Module: AIXM

Defined in:
lib/aixm/d.rb,
lib/aixm/f.rb,
lib/aixm/z.rb,
lib/aixm/xy.rb,
lib/aixm/config.rb,
lib/aixm/errors.rb,
lib/aixm/feature.rb,
lib/aixm/version.rb,
lib/aixm/document.rb,
lib/aixm/component.rb,
lib/aixm/shortcuts.rb,
lib/aixm/refinements.rb,
lib/aixm/feature/unit.rb,
lib/aixm/component/layer.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/geometry.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/feature/navigational_aid.rb,
lib/aixm/component/geometry/border.rb,
lib/aixm/component/geometry/circle.rb,
lib/aixm/component/vertical_limits.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: Refinements Classes: Component, D, Document, Error, F, Feature, GeometryError, LayerError, 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
VERSION =
"0.3.3".freeze
ELEMENTS =
{
  document: Document,
  xy: XY,
  z: Z,
  d: D,
  f: F,
  organisation: Feature::Organisation,
  unit: Feature::Unit,
  service: Component::Service,
  frequency: Component::Frequency,
  airport: Feature::Airport,
  runway: Component::Runway,
  helipad: Component::Helipad,
  airspace: Feature::Airspace,
  layer: Component::Layer,
  geometry: Component::Geometry,
  vertical_limits: Component::VerticalLimits,
  arc: Component::Geometry::Arc,
  border: Component::Geometry::Border,
  circle: Component::Geometry::Circle,
  point: Component::Geometry::Point,
  dme: Feature::NavigationalAid::DME,
  designated_point: Feature::NavigationalAid::DesignatedPoint,
  marker: Feature::NavigationalAid::Marker,
  tacan: Feature::NavigationalAid::TACAN,
  ndb: Feature::NavigationalAid::NDB,
  vor: Feature::NavigationalAid::VOR,
  obstacle: Feature::Obstacle,
  obstacle_group: Feature::ObstacleGroup,
  timetable: Component::Timetable
}.freeze
GROUND =
z(0, :qfe).freeze
UNLIMITED =
z(999, :qne).freeze
H24 =
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
# File 'lib/aixm/config.rb', line 78

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