Class: ADIWG::Mdtranslator::Writers::Fgdc::LocalSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj, inContext = nil) ⇒ LocalSystem

Returns a new instance of LocalSystem.



18
19
20
21
22
# 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

Instance Method Details

#writeXML(hProjection, inContext = nil) ⇒ Object



24
25
26
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
# 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