Module: AIXM

Defined in:
lib/aixm/a.rb,
lib/aixm/d.rb,
lib/aixm/f.rb,
lib/aixm/l.rb,
lib/aixm/p.rb,
lib/aixm/r.rb,
lib/aixm/w.rb,
lib/aixm/z.rb,
lib/aixm/xy.rb,
lib/aixm/config.rb,
lib/aixm/errors.rb,
lib/aixm/classes.rb,
lib/aixm/feature.rb,
lib/aixm/version.rb,
lib/aixm/document.rb,
lib/aixm/component.rb,
lib/aixm/constants.rb,
lib/aixm/shortcuts.rb,
lib/aixm/executables.rb,
lib/aixm/refinements.rb,
lib/aixm/feature/unit.rb,
lib/aixm/payload_hash.rb,
lib/aixm/schedule/day.rb,
lib/aixm/schedule/date.rb,
lib/aixm/schedule/time.rb,
lib/aixm/component/fato.rb,
lib/aixm/component/layer.rb,
lib/aixm/component/vasis.rb,
lib/aixm/feature/airport.rb,
lib/aixm/feature/generic.rb,
lib/aixm/component/runway.rb,
lib/aixm/concerns/marking.rb,
lib/aixm/concerns/memoize.rb,
lib/aixm/concerns/remarks.rb,
lib/aixm/feature/airspace.rb,
lib/aixm/feature/obstacle.rb,
lib/aixm/component/address.rb,
lib/aixm/component/helipad.rb,
lib/aixm/component/service.rb,
lib/aixm/component/surface.rb,
lib/aixm/component/geometry.rb,
lib/aixm/component/lighting.rb,
lib/aixm/concerns/intensity.rb,
lib/aixm/concerns/timetable.rb,
lib/aixm/schedule/date_time.rb,
lib/aixm/component/frequency.rb,
lib/aixm/component/timesheet.rb,
lib/aixm/component/timetable.rb,
lib/aixm/concerns/association.rb,
lib/aixm/concerns/xml_builder.rb,
lib/aixm/feature/organisation.rb,
lib/aixm/component/geometry/arc.rb,
lib/aixm/concerns/hash_equality.rb,
lib/aixm/feature/obstacle_group.rb,
lib/aixm/component/geometry/point.rb,
lib/aixm/component/vertical_limit.rb,
lib/aixm/feature/navigational_aid.rb,
lib/aixm/component/geometry/border.rb,
lib/aixm/component/geometry/circle.rb,
lib/aixm/component/approach_lighting.rb,
lib/aixm/feature/navigational_aid/dme.rb,
lib/aixm/feature/navigational_aid/ndb.rb,
lib/aixm/feature/navigational_aid/vor.rb,
lib/aixm/component/geometry/rhumb_line.rb,
lib/aixm/feature/navigational_aid/tacan.rb,
lib/aixm/feature/navigational_aid/marker.rb,
lib/aixm/feature/navigational_aid/designated_point.rb

Defined Under Namespace

Modules: Concerns, Executables, Refinements, Schedule Classes: A, Component, D, Document, Error, F, Feature, GeometryError, L, LayerError, P, PayloadHash, R, W, XY, Z

Constant Summary collapse

SCHEMAS =
{
  aixm: {
    version: '4.5',
    namespace: 'http://www.aixm.aero/schema/4.5/AIXM-Snapshot.xsd',
    xsd: Pathname(__dir__).join('..', '..', 'schemas', 'aixm', '4.5', 'AIXM-Snapshot.xsd'),
    root: 'AIXM-Snapshot'
  },
  ofmx: {
    version: '0',
    namespace: 'http://schema.openflightmaps.org/0.2/OFMX-Snapshot.xsd',
    xsd: Pathname(__dir__).join('..', '..', 'schemas', 'ofmx', '0.2', 'OFMX-Snapshot.xsd'),
    root: 'OFMX-Snapshot'
  }
}.freeze
CLASSES =

Manifest of shorthand names and their corresponding AIXM class names

{
  document: 'AIXM::Document',
  xy: 'AIXM::XY',
  z: 'AIXM::Z',
  d: 'AIXM::D',
  l: 'AIXM::L',
  r: 'AIXM::R',
  f: 'AIXM::F',
  a: 'AIXM::A',
  w: 'AIXM::W',
  p: 'AIXM::P',
  date: 'AIXM::Schedule::Date',
  day: 'AIXM::Schedule::Day',
  time: 'AIXM::Schedule::Time',
  datetime: 'AIXM::Schedule::DateTime',
  address: 'AIXM::Component::Address',
  approach_lighting: 'AIXM::Component::ApproachLighting',
  organisation: 'AIXM::Feature::Organisation',
  unit: 'AIXM::Feature::Unit',
  service: 'AIXM::Component::Service',
  frequency: 'AIXM::Component::Frequency',
  airport: 'AIXM::Feature::Airport',
  runway: 'AIXM::Component::Runway',
  fato: 'AIXM::Component::FATO',
  helipad: 'AIXM::Component::Helipad',
  surface: 'AIXM::Component::Surface',
  lighting: 'AIXM::Component::Lighting',
  airspace: 'AIXM::Feature::Airspace',
  layer: 'AIXM::Component::Layer',
  geometry: 'AIXM::Component::Geometry',
  vertical_limit: 'AIXM::Component::VerticalLimit',
  point: 'AIXM::Component::Geometry::Point',
  rhumb_line: 'AIXM::Component::Geometry::RhumbLine',
  arc: 'AIXM::Component::Geometry::Arc',
  circle: 'AIXM::Component::Geometry::Circle',
  border: 'AIXM::Component::Geometry::Border',
  dme: 'AIXM::Feature::NavigationalAid::DME',
  designated_point: 'AIXM::Feature::NavigationalAid::DesignatedPoint',
  marker: 'AIXM::Feature::NavigationalAid::Marker',
  tacan: 'AIXM::Feature::NavigationalAid::TACAN',
  ndb: 'AIXM::Feature::NavigationalAid::NDB',
  vor: 'AIXM::Feature::NavigationalAid::VOR',
  obstacle: 'AIXM::Feature::Obstacle',
  obstacle_group: 'AIXM::Feature::ObstacleGroup',
  timetable: 'AIXM::Component::Timetable',
  timesheet: 'AIXM::Component::Timesheet',
  vasis: 'AIXM::Component::VASIS',
  generic: 'AIXM::Feature::Generic'
}.freeze
VERSION =
"1.5.3".freeze
MIN =

Characters recognized as symbols for “minute” in DMS notations

%Q('\u2018\u2019\u00b4).freeze
SEC =

Characters recognized as symbols for “second” in DMS notations

%Q("\u201c\u201d\u201f).freeze
DMS_RE =

Pattern matching geographical coordinates in various DMS notations

%r(
  (?<dms>
    (?<sgn>-)?
    (?<deg>\d{1,3})[° ]{1,2}
    (?<min>\d{2})[#{MIN}#{SEC} ]{1,2}
    (?<sec>\d{2}(?:[\.,]\d{0,2})?)[#{SEC}#{MIN} ]{0,2}
    (?<hem_ne>[NE])?(?<hem_sw>[SW])?
  |
    (?<sgn>-)?
    (?<deg>\d{1,3})
    (?<min>\d{2})
    (?<sec>\d{2}(?:[\.,]\d{0,2})?)
    (?:(?<hem_ne>[NE])|(?<hem_sw>[SW]))
  )
)xi.freeze
PCN_RE =

Pattern matching PCN surface strength notations

%r(
  (?<pcn>
    (?<capacity>\d+)\W+
    (?<type>[RF])\W+
    (?<subgrade>[A-D])\W+
    (?<tire_pressure>[W-Z])\W+
    (?<evaluation_method>[TU])
  )
)x.freeze
H_RE =

Pattern matching timetable working hour codes

/(?<code>H24|HJ|HN|HX|HO)/.freeze
GROUND =

Ground level

z(0, :qfe).freeze
UNLIMITED =

Max flight level used to signal “no upper limit”

z(999, :qne).freeze
ANY_DAY =

Day to signal “whatever date or day”

AIXM.day(:any).freeze
H24 =

Timetable used to signal “always active”

timetable(code: :H24).freeze
BEGINNING_OF_DAY =

Time which marks midnight at beginning of the day

AIXM.time('00:00').freeze
END_OF_DAY =

Time which marks midnight at end of the day

AIXM.time('24:00').freeze
EMERGENCY =

Emergency frequency

AIXM.f(121.5, :mhz).freeze

Class Method Summary collapse

Class Method Details

.aixm!Symbol

Shortcuts to set the schema.

Examples:

AIXM.aixm!   # => :aixm
AIXM.ofmx?   # => false
AIXM.ofmx!   # => :ofmx
AIXM.ofmx?   # => true

Returns:

  • (Symbol)

    schema key



53
54
55
# File 'lib/aixm/config.rb', line 53

SCHEMAS.each_key do |schema|
  define_method("#{schema}!") { @@config.schema = schema }
end

.aixm?Boolean

Shortcuts to query the schema.

Examples:

AIXM.aixm!   # => :aixm
AIXM.ofmx?   # => false
AIXM.ofmx!   # => :ofmx
AIXM.ofmx?   # => true

Returns:

  • (Boolean)


69
70
71
# File 'lib/aixm/config.rb', line 69

SCHEMAS.each_key do |schema|
  define_method("#{schema}?") { @@config.schema == schema }
end

.configOpenStruct

Access the configuration (e.g. AIXM.config.schema)

Returns:

  • (OpenStruct)

    configuration struct



22
23
24
# File 'lib/aixm/config.rb', line 22

def config
  @@config
end

.initialize_configOpenStruct

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Configuration defaults (view source for more).

Returns:

  • (OpenStruct)


80
81
82
83
84
85
86
87
# File 'lib/aixm/config.rb', line 80

def initialize_config
  @@config = OpenStruct.new(
    schema: :aixm,
    voice_channel_separation: :any,
    mid: false,
    inflector: Dry::Inflector.new
  )
end

.ofmx!Symbol

Shortcuts to set the schema.

Examples:

AIXM.aixm!   # => :aixm
AIXM.ofmx?   # => false
AIXM.ofmx!   # => :ofmx
AIXM.ofmx?   # => true

Returns:

  • (Symbol)

    schema key



53
54
55
# File 'lib/aixm/config.rb', line 53

SCHEMAS.each_key do |schema|
  define_method("#{schema}!") { @@config.schema = schema }
end

.ofmx?Boolean

Shortcuts to query the schema.

Examples:

AIXM.aixm!   # => :aixm
AIXM.ofmx?   # => false
AIXM.ofmx!   # => :ofmx
AIXM.ofmx?   # => true

Returns:

  • (Boolean)


69
70
71
# File 'lib/aixm/config.rb', line 69

SCHEMAS.each_key do |schema|
  define_method("#{schema}?") { @@config.schema == schema }
end

.schema(key = nil) ⇒ Object

Currently active schema

Examples:

Get the schema identifyer

AIXM.schema   # => :aixm

Get schema details

AIXM.schema(:version)   # => '4.5'
AIXM.schema(:root)      # => 'AIXM-Snapshot'

Parameters:

  • key (Symbol, nil) (defaults to: nil)

    schema detail key (see SCHEMAS)

Returns:

  • (Object)

    schema detail value



37
38
39
# File 'lib/aixm/config.rb', line 37

def schema(key = nil)
  key ? SCHEMAS.dig(@@config.schema, key) : @@config.schema
end