class ADIWG::Mdtranslator::Writers::Iso19115_2::MD_Georeferenceable

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb, line 19
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Public Instance Methods

writeXML(hGeoRef) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb, line 25
def writeXML(hGeoRef)

   # classes used
   gridClass = Grid.new(@xml, @hResponseObj)
   citationClass = CI_Citation.new(@xml, @hResponseObj)

   @xml.tag!('gmd:MD_Georeferenceable') do

      # georeferenceable - add grid info (required)
      hGrid = hGeoRef[:gridRepresentation]
      gridClass.writeXML(hGrid, 'georeferenceable representation')

      # georeferenceable - control point availability (required)
      s = hGeoRef[:orientationParameterAvailable]
      @xml.tag!('gmd:controlPointAvailability') do
         @xml.tag!('gco:Boolean', s)
      end

      # georeferenceable - orientation parameter availability (required)
      s = hGeoRef[:orientationParameterAvailable]
      @xml.tag!('gmd:orientationParameterAvailability') do
         @xml.tag!('gco:Boolean', s)
      end

      # georeferenceable - orientation parameter description
      s = hGeoRef[:orientationParameterDescription]
      unless s.nil?
         @xml.tag!('gmd:orientationParameterDescription') do
            @xml.tag!('gco:CharacterString', s)
         end
      end
      if s.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:orientationParameterDescription')
      end

      # georeferenceable - georeferenced parameter (required)
      s = hGeoRef[:georeferencedParameter]
      unless s.nil?
         @xml.tag!('gmd:georeferencedParameters') do
            @xml.tag!('gco:Record', s)
         end
      end
      if s.nil?
         @NameSpace.issueWarning(180, 'gmd:georeferencedParameters', 'spatial representation')
      end

      # georeferenceable - parameter citation [{citation}]
      aCitation = hGeoRef[:parameterCitation]
      aCitation.each do |hCitation|
         @xml.tag!('gmd:parameterCitation') do
            citationClass.writeXML(hCitation, 'georeferenceable representation')
         end
      end
      if aCitation.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:parameterCitation')
      end

   end # gmd:MD_Georeferenceable tag
end