Class: TimePeriod

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ TimePeriod

Returns a new instance of TimePeriod.



12
13
14
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb', line 12

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hTempP) ⇒ Object



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

def writeXML(hTempP)

  timeID = hTempP[:timeID]
  if timeID.nil?
    $idCount = $idCount.succ
    timeID = 'timePeriod' + $idCount
  end

  @xml.tag!('gml:TimePeriod',{'gml:id'=>timeID}) do

    # time period - description
    s = hTempP[:description]
    if !s.nil?
      @xml.tag!('gml:description',s)
    elsif $showAllTags
      @xml.tag!('gml:description')
    end

    # time period - begin position
    hDateTime = hTempP[:beginTime]
    timeInstant = hDateTime[:dateTime]
    timeResolution = hDateTime[:dateResolution]
    dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant,timeResolution)
    @xml.tag!('gml:beginPosition',dateStr)

    # time period - begin position
    hDateTime = hTempP[:endTime]
    timeInstant = hDateTime[:dateTime]
    timeResolution = hDateTime[:dateResolution]
    dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant,timeResolution)
    @xml.tag!('gml:endPosition',dateStr)

  end

end