Class: ADIWG::Mdtranslator::Writers::Iso19115_2::LI_ProcessStep
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_2::LI_ProcessStep
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ LI_ProcessStep
constructor
A new instance of LI_ProcessStep.
- #writeXML(hStep, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ LI_ProcessStep
Returns a new instance of LI_ProcessStep.
26 27 28 29 30 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb', line 26 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2 end |
Instance Method Details
#writeXML(hStep, inContext = nil) ⇒ Object
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb', line 32 def writeXML(hStep, inContext = nil) # classes used partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj) sourceClass = Source.new(@xml, @hResponseObj) outContext = 'process step' outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil? outContext = inContext + ' ' + outContext unless inContext.nil? # process step - id attributes = {} s = hStep[:stepId] unless s.nil? attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') } end @xml.tag!('gmd:LI_ProcessStep', attributes) do # process step - description (required) s = hStep[:description] unless s.nil? @xml.tag!('gmd:description') do @xml.tag!('gco:CharacterString', s) end end if s.nil? @NameSpace.issueWarning(260, 'gmd:description', outContext) end # process step - rationale s = hStep[:rationale] unless s.nil? @xml.tag!('gmd:rationale') do @xml.tag!('gco:CharacterString', s) end end if s.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:rationale') end # process step - datetime hPeriod = hStep[:timePeriod] unless hPeriod.empty? hDate = hPeriod[:startDateTime] if hDate.empty? hDate = hPeriod[:endDateTime] end date = hDate[:dateTime] dateResolution = hDate[:dateResolution] s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution) if s != 'ERROR' @xml.tag!('gmd:dateTime') do @xml.tag!('gco:DateTime', s) end end end if hPeriod.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:dateTime') end # process step - processor [] {CI_ResponsibleParty} aParties = hStep[:processors] aParties.each do |hRParty| role = hRParty[:roleName] aParties = hRParty[:parties] aParties.each do |hParty| @xml.tag!('gmd:processor') do partyClass.writeXML(role, hParty, outContext) end end end if aParties.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:processor') end # process step - source [] {Source} aSources = hStep[:stepSources] aSources.each do |hSource| @xml.tag!('gmd:source') do sourceClass.writeXML(hSource) end end if aSources.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:source') end end # gmd:LI_ProcessStep tag end |