class ADIWG::Mdtranslator::Writers::Fgdc::LocalSystem

Public Class Methods

new(xml, hResponseObj, inContext = nil) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb, line 18
def initialize(xml, hResponseObj, inContext = nil)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end

Public Instance Methods

writeXML(hProjection, inContext = nil) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb, line 24
def writeXML(hProjection, inContext = nil)

   # localSYSTEM is not the same as localPLANAR in fgdc
   # however they use the same 'local' object
   # local system sets projectionIdentifier.identifier = 'localSystem'
   # local planar sets projectionIdentifier.identifier = 'localPlanar'

   hProjectionId = hProjection[:projectionIdentifier]
   hLocal = hProjection[:local]

   outContext = 'local system'
   outContext = inContext + ' '  + outContext unless inContext.nil?

   if hLocal.empty?
      @NameSpace.issueError(250, outContext)
      return
   end

   if hProjectionId[:identifier] == 'localSystem'
      hProjectionId[:name] = nil unless hProjectionId.has_key?(:name)
      if hProjectionId[:name].nil?
         hProjectionId[:name] = 'Local Coordinate System'
      end
   end

   # local system 4.1.3.1 (localdes) - local coordinate system description (required)
   unless hLocal[:description].nil?
      @xml.tag!('localdes', hLocal[:description])
   end
   if hLocal[:description].nil?
      @NameSpace.issueError(251, outContext)
   end

   # local system 4.1.3.2 (localgeo) - local coordinate system georeference information (required)
   unless hLocal[:georeference].nil?
      @xml.tag!('localgeo', hLocal[:georeference])
   end
   if hLocal[:georeference].nil?
      @NameSpace.issueError(252, outContext)
   end

end