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/fgdc/classes/class_spatialReference.rb', line 27
def writeXML(hResourceInfo)
aRepTypes = hResourceInfo[:spatialRepresentationTypes]
aResolutions = hResourceInfo[:spatialResolutions]
aSpaceRefs = hResourceInfo[:spatialReferenceSystems]
geoResClass = GeographicResolution.new(@xml, @hResponseObj)
planarClass = PlanarReference.new(@xml, @hResponseObj)
localClass = LocalSystem.new(@xml, @hResponseObj)
geodeticClass = GeodeticReference.new(@xml, @hResponseObj)
vDatumClass = VerticalDatum.new(@xml, @hResponseObj)
outContext = 'spatial reference'
@xml.tag!('horizsys') do
aResolutions.each do |hSpaceRes|
unless hSpaceRes.empty?
if hSpaceRes[:geographicResolution]
unless hSpaceRes[:geographicResolution].empty?
@xml.tag!('geograph') do
geoResClass.writeXML(hSpaceRes[:geographicResolution], outContext)
end
break
end
end
end
end
havePlanar = false
havePlanar = true unless aRepTypes.empty?
aSpaceRefs.each do |hSpaceRef|
unless hSpaceRef[:systemParameterSet].empty?
unless hSpaceRef[:systemParameterSet][:projection].empty?
hProjection = hSpaceRef[:systemParameterSet][:projection]
unless hProjection[:projectionIdentifier][:identifier] == 'localSystem'
havePlanar = true
end
end
end
end
aResolutions.each do |hResolution|
havePlanar = true if hResolution[:coordinateResolution]
havePlanar = true if hResolution[:bearingDistanceResolution]
end
if havePlanar
@xml.tag!('planar') do
planarClass.writeXML(aSpaceRefs, aRepTypes, aResolutions, outContext)
end
end
aSpaceRefs.each do |hSpaceRef|
unless hSpaceRef[:systemParameterSet].empty?
if hSpaceRef[:systemParameterSet][:projection]
hProjection = hSpaceRef[:systemParameterSet][:projection]
unless hProjection.empty?
if hProjection[:projectionIdentifier][:identifier] == 'localSystem'
@xml.tag!('local') do
localClass.writeXML(hProjection, outContext)
end
end
end
end
end
end
aSpaceRefs.each do |hSpaceRef|
unless hSpaceRef[:systemParameterSet].empty?
if hSpaceRef[:systemParameterSet][:geodetic]
hGeodetic = hSpaceRef[:systemParameterSet][:geodetic]
unless hGeodetic.empty?
@xml.tag!('geodetic') do
geodeticClass.writeXML(hGeodetic, outContext)
end
end
end
end
end
end
haveVertical = false
aSpaceRefs.each do |hSpaceRef|
unless hSpaceRef[:systemParameterSet].empty?
unless hSpaceRef[:systemParameterSet][:verticalDatum].empty?
haveVertical = true
end
end
end
if haveVertical
@xml.tag!('vertdef') do
vDatumClass.writeXML(aSpaceRefs, outContext)
end
end
end
|