Class: ADIWG::Mdtranslator::Writers::Iso19115_2::GeographicExtent

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

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ GeographicExtent

Returns a new instance of GeographicExtent.



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

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Instance Method Details

#writeXML(hGeoExtent) ⇒ 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
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb', line 23

def writeXML(hGeoExtent)

   # classes used
   bBoxClass = EX_GeographicBoundingBox.new(@xml, @hResponseObj)
   idClass = MD_Identifier.new(@xml, @hResponseObj)
   geoEleClass = GeographicElement.new(@xml, @hResponseObj)

   extType = hGeoExtent[:containsData]

   # geographic element - geographic bounding box
   # test for user provided bounding box
   # if empty, take computedBbox
   hBbox = hGeoExtent[:boundingBox]
   if hBbox.empty?
      hBbox = hGeoExtent[:computedBbox]
   end
   unless hBbox.empty?
      @xml.tag!('gmd:geographicElement') do
         @xml.tag!('gmd:EX_GeographicBoundingBox') do
            @xml.tag!('gmd:extentTypeCode') do
               @xml.tag!('gco:Boolean', extType)
            end
            bBoxClass.writeXML(hBbox)
         end
      end
   end

   # geographic element - geographic description
   unless hGeoExtent[:identifier].empty?
      @xml.tag!('gmd:geographicElement') do
         @xml.tag!('gmd:EX_GeographicDescription') do
            @xml.tag!('gmd:extentTypeCode') do
               @xml.tag!('gco:Boolean', extType)
            end
            @xml.tag!('gmd:geographicIdentifier') do
               idClass.writeXML(hGeoExtent[:identifier], 'geographic extent')
            end
         end
      end
   end

   # geographic element - geographic bounding polygon
   unless hGeoExtent[:geographicElements].empty?
      @xml.tag!('gmd:geographicElement') do
         @xml.tag!('gmd:EX_BoundingPolygon') do
            @xml.tag!('gmd:extentTypeCode') do
               @xml.tag!('gco:Boolean', extType)
            end
            geoEleClass.writeXML(hGeoExtent[:geographicElements])
         end
      end
   end

end