Class: AIXM::Component::Runway::Direction

Inherits:
Object
  • Object
show all
Defined in:
lib/aixm/component/runway.rb

Overview

Runway directions further describe each direction #forth and #back of a runway.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runway:, name:) ⇒ Direction

Returns a new instance of Direction


206
207
208
# File 'lib/aixm/component/runway.rb', line 206

def initialize(runway:, name:)
  self.runway, self.name = runway, name
end

Instance Attribute Details

#displaced_thresholdAIXM::XY, ...

Returns displaced threshold point either as coordinates (AIXM::XY) or distance (AIXM::D) from the beginning point

Returns:

  • (AIXM::XY, AIXM::D, nil)

    displaced threshold point either as coordinates (AIXM::XY) or distance (AIXM::D) from the beginning point


201
202
203
# File 'lib/aixm/component/runway.rb', line 201

def displaced_threshold
  @displaced_threshold
end

#geographic_orientationInteger?

Returns geographic orientation (true bearing) in degrees

Returns:

  • (Integer, nil)

    geographic orientation (true bearing) in degrees


190
191
192
# File 'lib/aixm/component/runway.rb', line 190

def geographic_orientation
  @geographic_orientation
end

#nameString

Returns partial name of runway (e.g. “12” or “16L”)

Returns:

  • (String)

    partial name of runway (e.g. “12” or “16L”)


187
188
189
# File 'lib/aixm/component/runway.rb', line 187

def name
  @name
end

#remarksString?

Returns free text remarks

Returns:

  • (String, nil)

    free text remarks


204
205
206
# File 'lib/aixm/component/runway.rb', line 204

def remarks
  @remarks
end

#runway=(value) ⇒ Object


215
216
217
218
# File 'lib/aixm/component/runway.rb', line 215

def runway=(value)
  fail(ArgumentError, "invalid runway") unless value.is_a? AIXM::Component::Runway
  @runway = value
end

#xyAIXM::XY

Returns beginning point (middle of the runway width)

Returns:

  • (AIXM::XY)

    beginning point (middle of the runway width)


193
194
195
# File 'lib/aixm/component/runway.rb', line 193

def xy
  @xy
end

#zAIXM::Z?

Returns elevation of the touch down zone in qnh

Returns:

  • (AIXM::Z, nil)

    elevation of the touch down zone in qnh


196
197
198
# File 'lib/aixm/component/runway.rb', line 196

def z
  @z
end

Instance Method Details

#inspectString

Returns:

  • (String)

211
212
213
# File 'lib/aixm/component/runway.rb', line 211

def inspect
  %Q(#<#{self.class} name=#{name.inspect}>)
end

#magnetic_orientationInteger

Returns magnetic orientation (magnetic bearing) in degrees

Returns:

  • (Integer)

    magnetic orientation (magnetic bearing) in degrees


262
263
264
265
266
# File 'lib/aixm/component/runway.rb', line 262

def magnetic_orientation
  if geographic_orientation && runway.airport.declination
    (geographic_orientation + runway.airport.declination).round
  end
end

#to_xmlString

Returns AIXM or OFMX markup

Returns:

  • (String)

    AIXM or OFMX markup


269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/aixm/component/runway.rb', line 269

def to_xml
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.Rdn do |rdn|
    rdn.RdnUid do |rdn_uid|
      rdn_uid << runway.to_uid.indent(4)
      rdn_uid.txtDesig(name)
    end
    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.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
  builder.target!
end