Class: EX_Extent

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ EX_Extent

Returns a new instance of EX_Extent.



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

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hExtent) ⇒ Object



23
24
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
84
85
86
87
88
89
90
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb', line 23

def writeXML(hExtent)

  # classes used by MD_Metadata
  tempExtClass = EX_TemporalExtent.new(@xml)
  vertExtClass = EX_VerticalExtent.new(@xml)
  geoEleClass = GeographicElement.new(@xml)
  geoEleIdClass = EX_GeographicDescription.new(@xml)

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

    # extent - description
    s = hExtent[:extDesc]
    if !s.nil?
      @xml.tag!('gmd:description') do
        @xml.tag!('gco:CharacterString',s)
      end
    elsif $showAllTags
      @xml.tag!('gmd:description')
    end

    # extent - geographic element - for geometry
    aGeoElements = hExtent[:extGeoElements]
    if !aGeoElements.empty?
      aGeoElements.each do |hGeoElement|
        @xml.tag!('gmd:geographicElement') do
          geoEleClass.writeXML(hGeoElement)
        end
      end
    elsif $showAllTags
      @xml.tag!('gmd:geographicElement')
    end

    # extent - geographic element - for identifier
    aGeoElements = hExtent[:extIdElements]
    if !aGeoElements.empty?
      aGeoElements.each do |hGeoElement|
        @xml.tag!('gmd:geographicElement') do
          geoEleIdClass.writeXML(hGeoElement)
        end
      end
    end

    # extent - temporal element
    aTempElements = hExtent[:extTempElements]
    if !aTempElements.empty?
      aTempElements.each do |hTempElement|
        @xml.tag!('gmd:temporalElement') do
          tempExtClass.writeXML(hTempElement)
        end
      end
    elsif $showAllTags
      @xml.tag!('gmd:temporalElement')
    end

    # extent - vertical element
    aVertElements = hExtent[:extVertElements]
    if !aVertElements.empty?
      aVertElements.each do |hVertElement|
        @xml.tag!('gmd:verticalElement') do
          vertExtClass.writeXML(hVertElement)
        end
      end
    elsif $showAllTags
      @xml.tag!('gmd:verticalElement')
    end
  end

end