Class: ADIWG::Mdtranslator::Writers::Iso19115_2::MD_Georeferenceable

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ MD_Georeferenceable



19
20
21
22
23
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb', line 19

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Instance Method Details

#writeXML(hGeoRef) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb', line 25

def writeXML(hGeoRef)

   # classes used
   gridClass = Grid.new(@xml, @hResponseObj)
   citationClass = CI_Citation.new(@xml, @hResponseObj)

   @xml.tag!('gmd:MD_Georeferenceable') do

      # georeferenceable - add grid info (required)
      hGrid = hGeoRef[:gridRepresentation]
      gridClass.writeXML(hGrid, 'georeferenceable representation')

      # georeferenceable - control point availability (required)
      s = hGeoRef[:orientationParameterAvailable]
      @xml.tag!('gmd:controlPointAvailability') do
         @xml.tag!('gco:Boolean', s)
      end

      # georeferenceable - orientation parameter availability (required)
      s = hGeoRef[:orientationParameterAvailable]
      @xml.tag!('gmd:orientationParameterAvailability') do
         @xml.tag!('gco:Boolean', s)
      end

      # georeferenceable - orientation parameter description
      s = hGeoRef[:orientationParameterDescription]
      unless s.nil?
         @xml.tag!('gmd:orientationParameterDescription') do
            @xml.tag!('gco:CharacterString', s)
         end
      end
      if s.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:orientationParameterDescription')
      end

      # georeferenceable - georeferenced parameter (required)
      s = hGeoRef[:georeferencedParameter]
      unless s.nil?
         @xml.tag!('gmd:georeferencedParameters') do
            @xml.tag!('gco:Record', s)
         end
      end
      if s.nil?
         @NameSpace.issueWarning(180, 'gmd:georeferencedParameters', 'spatial representation')
      end

      # georeferenceable - parameter citation [{citation}]
      aCitation = hGeoRef[:parameterCitation]
      aCitation.each do |hCitation|
         @xml.tag!('gmd:parameterCitation') do
            citationClass.writeXML(hCitation, 'georeferenceable representation')
         end
      end
      if aCitation.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:parameterCitation')
      end

   end # gmd:MD_Georeferenceable tag
end