class ADIWG::Mdtranslator::Writers::Iso19115_1::MD_VectorSpatialRepresentation

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb, line 18
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Public Instance Methods

writeXML(hVector, inContext = nil) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb, line 23
def writeXML(hVector, inContext = nil)

   # classes used
   codelistClass = MD_Codelist.new(@xml, @hResponseObj)
   geoObjClass = MD_GeometricObjects.new(@xml, @hResponseObj)
   scopeClass = MD_Scope.new(@xml, @hResponseObj)

   outContext = 'vector representation'
   outContext = inContext + ' vector representation' unless inContext.nil?

   @xml.tag!('msr:MD_VectorSpatialRepresentation') do

      # vector representation - scope
      hVector[:scope].each do |scope|
         @xml.tag!('msr:scope') do
            scopeClass.writeXML(scope, inContext)
         end
      end

      # vector representation - topology level
      unless hVector[:topologyLevel].nil?
         @xml.tag!('msr:topologyLevel') do
            codelistClass.writeXML('msr', 'iso_topologyLevel', hVector[:topologyLevel])
         end
      end
      if hVector[:topologyLevel].nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('msr:topologyLevel')
      end

      # vector representation - geometric objects [{MD_GeometricObjects}]
      aGeoObjs = hVector[:vectorObject]
      aGeoObjs.each do |hGeoObj|
         @xml.tag!('msr:geometricObjects') do
            geoObjClass.writeXML(hGeoObj, outContext)
         end
      end
      if aGeoObjs.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('msr:geometricObjects')
      end

   end # msr:MD_VectorSpatialRepresentation tag
end