Module: AIXM

Defined in:
lib/aixm/a.rb,
lib/aixm/d.rb,
lib/aixm/f.rb,
lib/aixm/p.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/memoize.rb,
lib/aixm/version.rb,
lib/aixm/document.rb,
lib/aixm/constants.rb,
lib/aixm/shortcuts.rb,
lib/aixm/association.rb,
lib/aixm/executables.rb,
lib/aixm/refinements.rb,
lib/aixm/feature/unit.rb,
lib/aixm/payload_hash.rb,
lib/aixm/component/fato.rb,
lib/aixm/component/layer.rb,
lib/aixm/feature/address.rb,
lib/aixm/feature/airport.rb,
lib/aixm/component/runway.rb,
lib/aixm/feature/airspace.rb,
lib/aixm/feature/obstacle.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/component/frequency.rb,
lib/aixm/component/timetable.rb,
lib/aixm/feature/organisation.rb,
lib/aixm/component/geometry/arc.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/feature/navigational_aid/dme.rb,
lib/aixm/feature/navigational_aid/ndb.rb,
lib/aixm/feature/navigational_aid/vor.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: Association, Component, Executables, Memoize, Refinements Classes: A, D, Document, Error, F, Feature, GeometryError, LayerError, P, PayloadHash, 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/OFMX-Snapshot.xsd',
    xsd: Pathname(__dir__).join('..', '..', 'schemas', 'ofmx', '0', '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',
  f: 'AIXM::F',
  a: 'AIXM::A',
  w: 'AIXM::W',
  p: 'AIXM::P',
  address: 'AIXM::Feature::Address',
  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',
  arc: 'AIXM::Component::Geometry::Arc',
  border: 'AIXM::Component::Geometry::Border',
  circle: 'AIXM::Component::Geometry::Circle',
  point: 'AIXM::Component::Geometry::Point',
  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'
}.freeze
VERSION =
"0.3.10".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
H24 =

Timetable used to signal “always active”

timetable(code: :H24).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


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

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)

67
68
69
# File 'lib/aixm/config.rb', line 67

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)

78
79
80
81
82
83
84
# File 'lib/aixm/config.rb', line 78

def initialize_config
  @@config = OpenStruct.new(
    schema: :aixm,
    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


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

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)

67
68
69
# File 'lib/aixm/config.rb', line 67

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