Class: AIXM::Feature::Airport

Inherits:
AIXM::Feature show all
Includes:
Concerns::Association, Concerns::Remarks, Concerns::Timetable
Defined in:
lib/aixm/feature/airport.rb

Overview

Defined area on land or water to be used for the arrival, departure and surface movement of aircraft.

Cheat Sheet in Pseudo Code:

airport = AIXM.airport(
  source: String or nil
  region: String or nil
  organisation: AIXM.organisation
  id: String
  name: String
  xy: AIXM.xy
)
airport.gps = String or nil
airport.type = TYPES (other than AD, HP and AH only)
airport.z = AIXM.z or nil
airport.declination = Float or nil
airport.transition_z = AIXM.z or nil
airport.timetable = AIXM.timetable or nil
airport.operator = String or nil
airport.remarks = String or nil
airport.comment = Object or nil
airport.add_runway(AIXM.runway)
airport.add_fato(AIXM.fato)
airport.add_helipad(AIXM.helipad)
airport.add_usage_limitation(UsageLimitation::TYPES)
airport.add_unit(AIXM.unit)
airport.add_service(AIXM.service)
airport.add_address(AIXM.address)

For airports without an id, you may assign the two character region (e.g. “LF”) which will be combined with an 8 character digest of name.

Defined Under Namespace

Classes: UsageLimitation

Constant Summary collapse

ID_RE =
/^([A-Z]{3,4}|[A-Z]{2}[A-Z\d]{4,})$/.freeze
TYPES =
{
  AD: :aerodrome,
  HP: :heliport,
  AH: :aerodrome_and_heliport,
  LS: :landing_site
}.freeze

Constants inherited from AIXM::Feature

REGION_RE

Instance Attribute Summary collapse

Attributes included from Concerns::Remarks

#remarks

Attributes included from Concerns::Timetable

#timetable

Attributes inherited from AIXM::Feature

#comment, #region, #source

Attributes inherited from Component

#meta

Instance Method Summary collapse

Methods included from Concerns::Association

included

Methods inherited from AIXM::Feature

#==, #hash

Methods included from Concerns::HashEquality

#eql?, #hash

Methods included from Concerns::XMLBuilder

#build_fragment, #to_uid, #to_xml

Methods included from Concerns::Memoize

included, method

Constructor Details

#initialize(source: nil, region: nil, organisation:, id: nil, name:, xy:) ⇒ Airport

See the cheat sheet for examples on how to create instances of this class.



192
193
194
195
# File 'lib/aixm/feature/airport.rb', line 192

def initialize(source: nil, region: nil, organisation:, id: nil, name:, xy:)
  super(source: source, region: region)
  self.organisation, self.name, self.id, self.xy = organisation, name, id, xy   # name must be set before id
end

Instance Attribute Details

#declinationFloat?

When looking towards the geographic (aka: true) north, a positive declination represents the magnetic north is to the right (aka: east) by this angle.

To convert a magnetic bearing to the corresponding geographic (aka: true) bearing, the declination has to be added.

Returns:

  • (Float, nil)

    magnetic declination in degrees

See Also:



172
173
174
# File 'lib/aixm/feature/airport.rb', line 172

def declination
  @declination
end

#gpsString? #gps=(value) ⇒ Object

GPS code

Overloads:

  • #gpsString?

    Returns:

    • (String, nil)
  • #gps=(value) ⇒ Object

    Parameters:

    • value (String, nil)


153
154
155
# File 'lib/aixm/feature/airport.rb', line 153

def gps
  @gps
end

#idString #id=(value) ⇒ Object

ICAO, IATA or generated airport indicator.

  • four letter ICAO indicator (e.g. “LFMV”)

  • three letter IATA indicator (e.g. “AVN”)

  • two letter ICAO country code + four digit number (e.g. “LF1234”)

  • two letter ICAO country code + at least four letters/digits (e.g. “LFFOOBAR123” or “LF” + GPS code)

Overloads:

  • #idString

    Returns:

    • (String)
  • #id=(value) ⇒ Object

    Parameters:

    • value (String)


129
130
131
# File 'lib/aixm/feature/airport.rb', line 129

def id
  @id
end

#nameString #name=(value) ⇒ Object

Full name

Overloads:

  • #nameString

    Returns:

    • (String)
  • #name=(value) ⇒ Object

    Parameters:

    • value (String)


137
138
139
# File 'lib/aixm/feature/airport.rb', line 137

def name
  @name
end

#operatorString? #operator=(value) ⇒ Object

Operator of the airport

Overloads:

  • #operatorString?

    Returns:

    • (String, nil)
  • #operator=(value) ⇒ Object

    Parameters:

    • value (String, nil)


188
189
190
# File 'lib/aixm/feature/airport.rb', line 188

def operator
  @operator
end

#transition_zAIXM::Z? #transition_z=(value) ⇒ Object

Transition altitude in :qnh

Overloads:



180
181
182
# File 'lib/aixm/feature/airport.rb', line 180

def transition_z
  @transition_z
end

#typeSymbol #type=(value) ⇒ Object

Type of airport.

The type is usually derived from the presence of runways and helipads, however, this may be overridden by setting an alternative value, most notably :landing_site.

Overloads:

  • #typeSymbol

    Returns any of TYPES.

    Returns:

    • (Symbol)

      any of TYPES

  • #type=(value) ⇒ Object

    Parameters:

    • value (Symbol)

      any of TYPES



231
232
233
234
235
236
237
238
# File 'lib/aixm/feature/airport.rb', line 231

def type
  @type = case
    when @type then @type
    when runways.any? && (helipads.any? || fatos.any?) then :aerodrome_and_heliport
    when runways.any? then :aerodrome
    when helipads.any? || fatos.any? then :heliport
  end
end

#xyAIXM::XY #xy=(value) ⇒ Object

Reference point

Overloads:



145
146
147
# File 'lib/aixm/feature/airport.rb', line 145

def xy
  @xy
end

#zAIXM::Z? #z=(value) ⇒ Object

Elevation in :qnh

Overloads:



161
162
163
# File 'lib/aixm/feature/airport.rb', line 161

def z
  @z
end

Instance Method Details

#add_address(address) ⇒ self

Parameters:

Returns:

  • (self)


111
# File 'lib/aixm/feature/airport.rb', line 111

has_many :addresses, as: :addressable

#add_designated_point(designated_point) ⇒ Object

Parameters:



89
# File 'lib/aixm/feature/airport.rb', line 89

has_many :designated_points

#add_fato(fato) ⇒ Object

Parameters:



60
# File 'lib/aixm/feature/airport.rb', line 60

has_many :fatos

#add_helipad(helipad) ⇒ Object

Parameters:



67
# File 'lib/aixm/feature/airport.rb', line 67

has_many :helipads

#add_runway(runway) ⇒ Object

Parameters:



74
# File 'lib/aixm/feature/airport.rb', line 74

has_many :runways

#add_service(service) ⇒ Object

Parameters:



103
# File 'lib/aixm/feature/airport.rb', line 103

has_many :services

#add_unit(unit) ⇒ Object

Parameters:



96
# File 'lib/aixm/feature/airport.rb', line 96

has_many :units

#add_usage_limitation {|AIXM::Feature::Airport::UsageLimitation| ... } ⇒ self

Yields:

Returns:

  • (self)


82
# File 'lib/aixm/feature/airport.rb', line 82

has_many :usage_limitations, accept: 'AIXM::Feature::Airport::UsageLimitation' do |usage_limitation, type:| end

#addressesArray<AIXM::Feature::Address>

Returns postal address, url, A/A or A/G frequency etc.

Returns:



111
# File 'lib/aixm/feature/airport.rb', line 111

has_many :addresses, as: :addressable

#designated_pointsArray<AIXM::Feature::NavigationalAid::DesignatedPoint>

Returns designated points.

Returns:



89
# File 'lib/aixm/feature/airport.rb', line 89

has_many :designated_points

#fatosArray<AIXM::Component::FATO>

Returns FATOs present at this airport.

Returns:



60
# File 'lib/aixm/feature/airport.rb', line 60

has_many :fatos

#helipadsArray<AIXM::Component::Helipad>

Returns helipads present at this airport.

Returns:



67
# File 'lib/aixm/feature/airport.rb', line 67

has_many :helipads

#inspectString

Returns:

  • (String)


198
199
200
# File 'lib/aixm/feature/airport.rb', line 198

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

#organisationAIXM::Feature::Organisation

Returns superior organisation.

Returns:



115
# File 'lib/aixm/feature/airport.rb', line 115

belongs_to :organisation, as: :member

#runwaysArray<AIXM::Component::Runway>

Returns runways present at this airport.

Returns:



74
# File 'lib/aixm/feature/airport.rb', line 74

has_many :runways

#servicesArray<AIXM::Component::Service>

Returns services.

Returns:



103
# File 'lib/aixm/feature/airport.rb', line 103

has_many :services

#unitsArray<AIXM::Feature::Unit>

Returns units.

Returns:



96
# File 'lib/aixm/feature/airport.rb', line 96

has_many :units

#usage_limitationsArray<AIXM::Feature::Airport::UsageLimitation>

Returns usage limitations.

Returns:



82
# File 'lib/aixm/feature/airport.rb', line 82

has_many :usage_limitations, accept: 'AIXM::Feature::Airport::UsageLimitation' do |usage_limitation, type:| end