Class: ADIWG::Mdtranslator::Writers::Iso19115_3::LE_Source
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_3::LE_Source
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_leSource.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ LE_Source
constructor
A new instance of LE_Source.
- #writeXML(hSource, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ LE_Source
Returns a new instance of LE_Source.
22 23 24 25 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_leSource.rb', line 22 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj end |
Instance Method Details
#writeXML(hSource, inContext = nil) ⇒ Object
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 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_leSource.rb', line 27 def writeXML(hSource, inContext = nil) # classes used resolutionClass = MD_Resolution.new(@xml, @hResponseObj) referenceClass = MD_ReferenceSystem.new(@xml, @hResponseObj) citationClass = CI_Citation.new(@xml, @hResponseObj) scopeClass = MD_Scope.new(@xml, @hResponseObj) stepClass = ProcessStep.new(@xml, @hResponseObj) identifierClass = MD_Identifier.new(@xml, @hResponseObj) nominalClass = LE_NominalResolution.new(@xml, @hResponseObj) outContext = 'source' outContext = outContext + ' ' + hSource[:sourceId].to_s unless hSource[:sourceId].nil? outContext = inContext + ' source' unless inContext.nil? # source - id (tag attribute id="") attributes = {} s = hSource[:sourceId] unless s.nil? attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') } end @xml.tag!('mrl:LE_Source', attributes) do # source - description unless hSource[:description].nil? @xml.tag!('mrl:description') do @xml.tag!('gco:CharacterString', hSource[:description]) end end if hSource[:description].nil? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:description') end # source - spatial resolution {MD_Resolution} unless hSource[:spatialResolution].empty? @xml.tag!('mrl:sourceSpatialResolution') do resolutionClass.writeXML(hSource[:spatialResolution], outContext) end end if hSource[:spatialResolution].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:sourceSpatialResolution') end # source - reference system {MD_ReferenceSystem} unless hSource[:referenceSystem].empty? @xml.tag!('mrl:sourceReferenceSystem') do referenceClass.writeXML(hSource[:referenceSystem]) end end if hSource[:referenceSystem].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:sourceReferenceSystem') end # source - citation {CI_Citation} unless hSource[:sourceCitation].empty? @xml.tag!('mrl:sourceCitation') do citationClass.writeXML(hSource[:sourceCitation], outContext) end end if hSource[:sourceCitation].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:sourceCitation') end # source - metadata [] {CI_Citation} aCitations = hSource[:metadataCitations] aCitations.each do |hCitation| @xml.tag!('mrl:sourceMetadata') do citationClass.writeXML(hCitation, outContext) end end if aCitations.empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:sourceMetadata') end # source - scope {MD_Scope} unless hSource[:scope].empty? @xml.tag!('mrl:scope') do scopeClass.writeXML(hSource[:scope], outContext) end end if hSource[:scope].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:scope') end # source - process step [] {ProcessStep} aSteps = hSource[:sourceSteps] aSteps.each do |hStep| @xml.tag!('mrl:sourceStep') do stepClass.writeXML(hStep) end end if aSteps.empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:sourceStep') end # source - processed level {MD_Identifier} unless hSource[:processedLevel].empty? @xml.tag!('mrl:processedLevel') do identifierClass.writeXML(hSource[:processedLevel], outContext) end end if hSource[:processedLevel].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:processedLevel') end # source - resolution {LE_NominalResolution} unless hSource[:resolution].empty? @xml.tag!('mrl:resolution') do nominalClass.writeXML(hSource[:resolution], outContext) end end if hSource[:resolution].empty? && @hResponseObj[:writerShowTags] @xml.tag!('mrl:resolution') end end # mrl:LI_Source tag end |