Class: ADIWG::Mdtranslator::Writers::Iso19115_2::MD_ProjectionParameters

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

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ MD_ProjectionParameters

Returns a new instance of MD_ProjectionParameters.



17
18
19
20
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb', line 17

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Instance Method Details

#writeXML(hProjection) ⇒ Object



22
23
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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb', line 22

def writeXML(hProjection)

   # classes used
   linePointClass = MD_ObliqueLinePoint.new(@xml, @hResponseObj)

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

      # projection parameters - zone {integer}
      i = hProjection[:gridZone]
      unless i.nil?
         @xml.tag!('gmd:zone') do
            @xml.tag!('gco:integer', i.to_s)
         end
      end
      if i.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:zone')
      end
      # projection parameters - standard parallel {real}
      r = hProjection[:standardParallel1]
      unless r.nil?
         @xml.tag!('gmd:standardParallel') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:standardParallel')
      end

      # projection parameters - standard parallel {real}
      r = hProjection[:standardParallel2]
      unless r.nil?
         @xml.tag!('gmd:standardParallel') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:standardParallel')
      end

      # projection parameters - longitude of central meridian {real}
      r = hProjection[:longitudeOfCentralMeridian]
      unless r.nil?
         @xml.tag!('gmd:longitudeOfCentralMeridian') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:longitudeOfCentralMeridian')
      end

      # projection parameters - latitude of projection origin {real}
      r = hProjection[:latitudeOfProjectionOrigin]
      unless r.nil?
         @xml.tag!('gmd:latitudeOfProjectionOrigin') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:latitudeOfProjectionOrigin')
      end

      # projection parameters - false easting {real}
      r = hProjection[:falseEasting]
      unless r.nil?
         @xml.tag!('gmd:falseEasting') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:falseEasting')
      end

      # projection parameters - false northing {real}
      r = hProjection[:falseNorthing]
      unless r.nil?
         @xml.tag!('gmd:falseNorthing') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:falseNorthing')
      end

      # projection parameters - false northing units
      s = hProjection[:falseEastingNorthingUnits]
      unless s.nil?
         @xml.tag!('gmd:falseEastingNorthingUnits') do
            @xml.tag!('gco:unit', s)
         end
      end
      if s.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:falseEastingNorthingUnits')
      end

      # projection parameters - scale factor at equator {real}
      r = hProjection[:scaleFactorAtEquator]
      unless r.nil?
         @xml.tag!('gmd:scaleFactorAtEquator') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:scaleFactorAtEquator')
      end

      # projection parameters - height of prospective point above surface {real}
      r = hProjection[:heightOfProspectivePointAboveSurface]
      unless r.nil?
         @xml.tag!('gmd:heightOfProspectivePointAboveSurface') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:heightOfProspectivePointAboveSurface')
      end

      # projection parameters - longitude of projection center {real}
      r = hProjection[:longitudeOfProjectionCenter]
      unless r.nil?
         @xml.tag!('gmd:longitudeOfProjectionCenter') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:longitudeOfProjectionCenter')
      end

      # projection parameters - scale factor at center line {real}
      r = hProjection[:scaleFactorAtCenterLine]
      unless r.nil?
         @xml.tag!('gmd:scaleFactorAtCenterLine') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:scaleFactorAtCenterLine')
      end

      # projection parameters - straight vertical longitude from pole {real}
      r = hProjection[:straightVerticalLongitudeFromPole]
      unless r.nil?
         @xml.tag!('gmd:straightVerticalLongitudeFromPole') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:straightVerticalLongitudeFromPole')
      end

      # projection parameters - scale factor at projection origin {real}
      r = hProjection[:scaleFactorAtProjectionOrigin]
      unless r.nil?
         @xml.tag!('gmd:scaleFactorAtProjectionOrigin') do
            @xml.tag!('gco:real', r.to_s)
         end
      end
      if r.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:scaleFactorAtProjectionOrigin')
      end

      # projection parameters - oblique line azimuth parameter
      r1 = hProjection[:azimuthAngle]
      r2 = hProjection[:azimuthMeasurePointLongitude]
      unless r1.nil? && r2.nil?
         @xml.tag!('gmd:obliqueLineAzimuthParameter') do
            @xml.tag!('gmd:MD_ObliqueLineAzimuth') do
               unless r1.nil?
                  @xml.tag!('gmd:azimuthAngle') do
                     @xml.tag!('gco:real', r1.to_s)
                  end
               end
               if r1.nil? && @hResponseObj[:writerShowTags]
                  @xml.tag!('gmd:azimuthAngle')
               end
               unless r2.nil?
                  @xml.tag!('gmd:azimuthMeasurePointLongitude') do
                     @xml.tag!('gco:real', r2.to_s)
                  end
               end
               if r2.nil? && @hResponseObj[:writerShowTags]
                  @xml.tag!('gmd:azimuthMeasurePointLongitude')
               end
            end
         end
      end
      if r1.nil? && r2.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:obliqueLineAzimuthParameter')
      end

      # projection parameters - oblique line point parameter
      aLinePoints = hProjection[:obliqueLinePoints]
      aLinePoints.each do |hLinePoint|
         @xml.tag!('gmd:obliqueLinePointParameter') do
            linePointClass.writeXML(hLinePoint)
         end
      end
      if aLinePoints.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:obliqueLinePointParameter')
      end

   end # gmd:MD_ProjectionParameters
end