Class: AIXM::Component::Runway::Direction
- Inherits:
-
Object
- Object
- AIXM::Component::Runway::Direction
- Defined in:
- lib/aixm/component/runway.rb
Overview
Constant Summary collapse
- VFR_PATTERNS =
{ L: :left, R: :right, E: :left_or_right }
Instance Attribute Summary collapse
-
#displaced_threshold ⇒ AIXM::XY, ...
Displaced threshold point either as coordinates (AIXM::XY) or distance (AIXM::D) from the beginning point.
-
#geographic_orientation ⇒ AIXM::A?
Geographic orientation (true bearing) in degrees.
-
#lightings ⇒ Array<AIXM::Component::Lighting>
readonly
Installed lighting systems.
-
#name ⇒ AIXM::A
Partial name of runway (e.g. “12” or “16L”).
-
#remarks ⇒ String?
Free text remarks.
- #runway ⇒ Object writeonly
-
#vfr_pattern ⇒ Symbol?
Direction of the VFR flight pattern (see VFR_PATTERNS).
-
#xy ⇒ AIXM::XY
Beginning point (middle of the runway width).
-
#z ⇒ AIXM::Z?
Elevation of the touch down zone in
qnh.
Instance Method Summary collapse
-
#add_lighting(lighting) ⇒ self
Add a lighting system to the runway direction.
-
#initialize(runway:, name:) ⇒ Direction
constructor
A new instance of Direction.
- #inspect ⇒ String
-
#magnetic_orientation ⇒ AIXM::A
Magnetic orientation (magnetic bearing) in degrees.
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(runway:, name:) ⇒ Direction
Returns a new instance of Direction.
207 208 209 210 |
# File 'lib/aixm/component/runway.rb', line 207 def initialize(runway:, name:) self.runway, self.name = runway, name @lightings = [] end |
Instance Attribute Details
#displaced_threshold ⇒ AIXM::XY, ...
Returns displaced threshold point either as coordinates (AIXM::XY) or distance (AIXM::D) from the beginning point.
196 197 198 |
# File 'lib/aixm/component/runway.rb', line 196 def displaced_threshold @displaced_threshold end |
#geographic_orientation ⇒ AIXM::A?
Returns geographic orientation (true bearing) in degrees.
185 186 187 |
# File 'lib/aixm/component/runway.rb', line 185 def geographic_orientation @geographic_orientation end |
#lightings ⇒ Array<AIXM::Component::Lighting> (readonly)
Returns installed lighting systems.
205 206 207 |
# File 'lib/aixm/component/runway.rb', line 205 def lightings @lightings end |
#name ⇒ AIXM::A
Returns partial name of runway (e.g. “12” or “16L”).
182 183 184 |
# File 'lib/aixm/component/runway.rb', line 182 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
202 203 204 |
# File 'lib/aixm/component/runway.rb', line 202 def remarks @remarks end |
#runway=(value) ⇒ Object
217 218 219 220 |
# File 'lib/aixm/component/runway.rb', line 217 def runway=(value) fail(ArgumentError, "invalid runway") unless value.is_a? AIXM::Component::Runway @runway = value end |
#vfr_pattern ⇒ Symbol?
Returns direction of the VFR flight pattern (see VFR_PATTERNS).
199 200 201 |
# File 'lib/aixm/component/runway.rb', line 199 def vfr_pattern @vfr_pattern end |
#xy ⇒ AIXM::XY
Returns beginning point (middle of the runway width).
188 189 190 |
# File 'lib/aixm/component/runway.rb', line 188 def xy @xy end |
#z ⇒ AIXM::Z?
Returns elevation of the touch down zone in qnh.
191 192 193 |
# File 'lib/aixm/component/runway.rb', line 191 def z @z end |
Instance Method Details
#add_lighting(lighting) ⇒ self
Add a lighting system to the runway direction.
270 271 272 273 274 275 |
# File 'lib/aixm/component/runway.rb', line 270 def add_lighting(lighting) fail(ArgumentError, "invalid lighting") unless lighting.is_a? AIXM::Component::Lighting lighting.send(:lightable=, self) @lightings << lighting self end |
#inspect ⇒ String
213 214 215 |
# File 'lib/aixm/component/runway.rb', line 213 def inspect %Q(#<#{self.class} airport=#{runway&.airport&.id.inspect} name=#{name.inspect}>) end |
#magnetic_orientation ⇒ AIXM::A
Returns magnetic orientation (magnetic bearing) in degrees.
278 279 280 281 282 |
# File 'lib/aixm/component/runway.rb', line 278 def magnetic_orientation if geographic_orientation && runway.airport.declination geographic_orientation + runway.airport.declination end end |
#to_uid ⇒ String
Returns UID markup.
285 286 287 288 289 290 291 |
# File 'lib/aixm/component/runway.rb', line 285 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.RdnUid do |rdn_uid| rdn_uid << runway.to_uid.indent(2) rdn_uid.txtDesig(name) end end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/aixm/component/runway.rb', line 294 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.Rdn do |rdn| rdn << to_uid.indent(2) rdn.geoLat(xy.lat(AIXM.schema)) rdn.geoLong(xy.long(AIXM.schema)) rdn.valTrueBrg(geographic_orientation) if geographic_orientation rdn.valMagBrg(magnetic_orientation) if magnetic_orientation if z rdn.valElevTdz(z.alt) rdn.uomElevTdz(z.unit.upcase.to_s) end rdn.codeVfrPattern(VFR_PATTERNS.key(vfr_pattern).to_s) if vfr_pattern rdn.txtRmk(remarks) if remarks end if displaced_threshold builder.Rdd do |rdd| rdd.RddUid do |rdd_uid| rdd_uid.RdnUid do |rdn_uid| rdn_uid << runway.to_uid.indent(6) rdn_uid.txtDesig(name) end rdd_uid.codeType('DPLM') rdd_uid.codeDayPeriod('A') end rdd.valDist(displaced_threshold.dist.trim) rdd.uomDist(displaced_threshold.unit.to_s.upcase) rdd.txtRmk(remarks) if remarks end end lightings.each do |lighting| builder << lighting.to_xml(as: :Rls) end builder.target! end |