Class: AIXM::Feature::Unit

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

Overview

Units providing all kind of services such as air traffic management, search and rescue, meteorological services and so forth.

Cheat Sheet in Pseudo Code:

unit = AIXM.unit(
  source: String or nil
  region: String or nil
  organisation: AIXM.organisation
  name: String
  type: TYPES
  class: :icao or :other
)
unit.airport = AIXM.airport or nil
unit.remarks = String or nil
unit.comment = Object or nil
unit.add_service(AIXM.service)

Constant Summary collapse

TYPES =
{
  ACC: :area_control_centre,
  ADSU: :automatic_dependent_surveillance_unit,
  ADVC: :advisory_centre,
  ALPS: :alerting_post,
  AOF: :aeronautical_information_services_office,
  APP: :approach_control_office,
  'APP-ARR': :arrivals_approach_control_office,
  'APP-DEP': :depatures_approach_control_office,
  ARO: :air_traffic_service_reporting_office,
  ARTCC: :air_route_traffic_control_centre,
  ATCC: :air_traffic_control_centre,
  ATFMU: :air_traffic_flow_management_unit,
  ATMU: :air_traffic_management_unit,
  ATSU: :air_traffic_services_unit,
  BOF: :briefing_office,
  BS: :commercial_broadcasting_station,
  COM: :communications_office,
  FCST: :forecasting_office,
  FIC: :flight_information_centre,
  FSS: :flight_service_station,
  GCA: :ground_controlled_approach_systems_office,
  MET: :meteorological_office,
  MIL: :military_station,
  MILOPS: :military_flight_operations_briefing_office,
  MWO: :meteorological_watch_office,
  NOF: :international_notam_office,
  OAC: :oceanic_control_centre,
  PAR: :precision_approach_radar_centre,
  RAD: :radar_office,
  RAFC: :regional_area_forecast_centre,
  RCC: :rescue_coordination_centre,
  RSC: :rescue_sub_centre,
  SAR: :search_and_rescue_centre,
  SMC: :surface_movement_control_office,
  SMR: :surface_movement_radar_office,
  SRA: :surveillance_radar_approach_centre,
  SSR: :secondary_surveillance_radar_centre,
  TAR: :terminal_area_surveillance_radar_centre,
  TRACON: :terminal_radar_approach_control,
  TWR: :aerodrome_control_tower,
  UAC: :upper_area_control_centre,
  UDF: :uhf_direction_finding_station,
  UIC: :upper_information_centre,
  VDF: :vdf_direction_finding_station,
  WAFC: :world_area_forecast_centre,
  OTHER: :other                       # specify in remarks
}.freeze
CLASSES =
{
  ICAO: :icao,
  OTHER: :other   # specify in remarks
}.freeze

Constants inherited from AIXM::Feature

REGION_RE

Instance Attribute Summary collapse

Attributes included from Concerns::Remarks

#remarks

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:, name:, type:, class:) ⇒ Unit

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



117
118
119
120
121
# File 'lib/aixm/feature/unit.rb', line 117

def initialize(source: nil, region: nil, organisation:, name:, type:, class:)
  super(source: source, region: region)
  self.organisation, self.name, self.type = organisation, name, type
  self.class = binding.local_variable_get(:class)
end

Instance Attribute Details

#classSymbol #class=(value) ⇒ Object

Note:

Use Object#__class__ alias to query the Ruby object class.

Class of unit.

Overloads:

  • #classSymbol

    Returns any of CLASSES.

    Returns:

  • #class=(value) ⇒ Object

    Parameters:

    • value (Symbol)

      any of CLASSES



146
147
148
# File 'lib/aixm/feature/unit.rb', line 146

def class
  @klass
end

#nameString #name=(value) ⇒ Object

Name of unit (e.g. “MARSEILLE ACS”)

Overloads:

  • #nameString

    Returns:

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

    Parameters:

    • value (String)


105
106
107
# File 'lib/aixm/feature/unit.rb', line 105

def name
  @name
end

#typeSymbol #type=(value) ⇒ Object

Type of unit

Overloads:

  • #typeSymbol

    Returns any of TYPES.

    Returns:

    • (Symbol)

      any of TYPES

  • #type=(value) ⇒ Object

    Parameters:

    • value (Symbol)

      any of TYPES



113
114
115
# File 'lib/aixm/feature/unit.rb', line 113

def type
  @type
end

Instance Method Details

#add_service(service) ⇒ Object

Parameters:



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

has_many :services

#airportAIXM::Feature::Airport?

Returns airport.

Returns:



97
# File 'lib/aixm/feature/unit.rb', line 97

belongs_to :airport

#inspectString

Returns:

  • (String)


124
125
126
# File 'lib/aixm/feature/unit.rb', line 124

def inspect
  %Q(#<#{__class__} name=#{name.inspect} type=#{type.inspect}>)
end

#organisationAIXM::Feature::Organisation

Returns superior organisation.

Returns:



93
# File 'lib/aixm/feature/unit.rb', line 93

belongs_to :organisation, as: :member

#servicesArray<AIXM::Component::Service>

Returns services provided by this unit.

Returns:



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

has_many :services