Class: EX_TemporalExtent

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ EX_TemporalExtent

Returns a new instance of EX_TemporalExtent.



14
15
16
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb', line 14

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hTempEle) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb', line 18

def writeXML(hTempEle)

  # classes used by MD_Metadata
  intMetadataClass = .new
  timeInstClass = TimeInstant.new(@xml)
  timePeriodClass = TimePeriod.new(@xml)

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

    # temporal extent - date - not supported by ISO
    # ... convert date to time instant
    hDate =  hTempEle[:date]
    unless hDate.empty?
      intTimeInst = intMetadataClass.newTimeInstant
      intTimeInst[:timePosition] = hDate
      @xml.tag!('gmd:extent') do
        timeInstClass.writeXML(intTimeInst)
      end
    end

    # temporal extent - time instant
    hTimeInst = hTempEle[:timeInstant]
    unless hTimeInst.empty?
      @xml.tag!('gmd:extent') do
        timeInstClass.writeXML(hTimeInst)
      end
    end

    # temporal extent - time period
    hTimePeriod = hTempEle[:timePeriod]
    unless hTimePeriod.empty?
      @xml.tag!('gmd:extent') do
        timePeriodClass.writeXML(hTimePeriod)
      end
    end

  end

end