Class: TimeInstant

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ TimeInstant

Returns a new instance of TimeInstant.



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

def initialize(xml)
  @xml = xml
end

Instance Method Details

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

def writeXML(hTempI)

  timeID = hTempI[:timeID]
  if timeID.nil?
    $idCount = $idCount.succ
    timeID = 'timeInstant' + $idCount
  end

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

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

    # time instant - time position
    hDateTime = hTempI[:timePosition]
    timeInstant = hDateTime[:dateTime]
    timeResolution = hDateTime[:dateResolution]
    dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant,timeResolution)
    @xml.tag!('gml:timePosition',dateStr)

  end

end