Class: EX_GeographicBoundingBox

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

Overview

History: Stan Smith 2013-11-01 original script

Stan Smith 2014-05-30 hElement attributes changed for version 0.5.0

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ EX_GeographicBoundingBox

Returns a new instance of EX_GeographicBoundingBox.



10
11
12
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicBoundingBox.rb', line 10

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hElement) ⇒ Object



14
15
16
17
18
19
20
21
22
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
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicBoundingBox.rb', line 14

def writeXML(hElement)

  extentType = hElement[:elementIncludeData]
  hBBox = hElement[:elementGeometry][:geometry]

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

    # bounding box - extent type - required
    if extentType.nil?
      @xml.tag!('gmd:extentTypeCode',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:extentTypeCode') do
        @xml.tag!('gco:Boolean',extentType)
      end
    end

    # bounding box - west longitude - required
    s = hBBox[:westLong]
    if s.nil?
      @xml.tag!('gmd:westBoundLongitude',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:westBoundLongitude') do
        @xml.tag!('gco:Decimal',s)
      end
    end

    # bounding box - east longitude - required
    s = hBBox[:eastLong]
    if s.nil?
      @xml.tag!('gmd:eastBoundLongitude',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:eastBoundLongitude') do
        @xml.tag!('gco:Decimal',s)
      end
    end

    # bounding box - south latitude - required
    s = hBBox[:southLat]
    if s.nil?
      @xml.tag!('gmd:southBoundLatitude',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:southBoundLatitude') do
        @xml.tag!('gco:Decimal',s)
      end
    end

    # bounding box - north latitude - required
    s = hBBox[:northLat]
    if s.nil?
      @xml.tag!('gmd:northBoundLatitude',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:northBoundLatitude') do
        @xml.tag!('gco:Decimal',s)
      end
    end

  end

end