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

Inherits:
Object
  • Object
show all
Includes:
Association, Memoize
Defined in:
lib/aixm/component/runway.rb

Overview

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

Constant Summary collapse

VFR_PATTERNS =
{
  L: :left,
  R: :right,
  E: :left_or_right
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Memoize

cache, included, method

Methods included from Association

included

Constructor Details

#initialize(name:) ⇒ Direction

Returns a new instance of Direction.


220
221
222
# File 'lib/aixm/component/runway.rb', line 220

def initialize(name:)
  self.name = 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


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

def displaced_threshold
  @displaced_threshold
end

#geographic_orientationAIXM::A?

Returns geographic orientation (true bearing) in degrees.

Returns:

  • (AIXM::A, nil)

    geographic orientation (true bearing) in degrees


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

def geographic_orientation
  @geographic_orientation
end

#nameAIXM::A

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

Returns:

  • (AIXM::A)

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


198
199
200
# File 'lib/aixm/component/runway.rb', line 198

def name
  @name
end

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    free text remarks


218
219
220
# File 'lib/aixm/component/runway.rb', line 218

def remarks
  @remarks
end

#vfr_patternSymbol?

Returns direction of the VFR flight pattern (see VFR_PATTERNS).

Returns:

  • (Symbol, nil)

    direction of the VFR flight pattern (see VFR_PATTERNS)


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

def vfr_pattern
  @vfr_pattern
end

#xyAIXM::XY

Returns beginning point (middle of the runway width).

Returns:

  • (AIXM::XY)

    beginning point (middle of the runway width)


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

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


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

def z
  @z
end

Instance Method Details

#add_lighting(lighting) ⇒ self

Parameters:

Returns:

  • (self)

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

has_many :lightings, as: :lightable

#inspectString

Returns:

  • (String)

225
226
227
# File 'lib/aixm/component/runway.rb', line 225

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

#lightingsArray<AIXM::Component::Lighting>

Returns installed lighting systems.

Returns:


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

has_many :lightings, as: :lightable

#magnetic_orientationAIXM::A

Returns magnetic orientation (magnetic bearing) in degrees.

Returns:

  • (AIXM::A)

    magnetic orientation (magnetic bearing) in degrees


273
274
275
276
277
# File 'lib/aixm/component/runway.rb', line 273

def magnetic_orientation
  if geographic_orientation && runway.airport.declination
    geographic_orientation - runway.airport.declination
  end
end

#runwayAIXM::Component::Runway

Returns runway the runway direction is further describing.

Returns:


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

belongs_to :runway, readonly: true

#to_uidString

Returns UID markup.

Returns:

  • (String)

    UID markup


280
281
282
283
284
285
286
# File 'lib/aixm/component/runway.rb', line 280

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_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


290
291
292
293
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
# File 'lib/aixm/component/runway.rb', line 290

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 << to_uid.indent(4)
        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