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/feature.rb,
lib/aixm/version.rb,
lib/aixm/document.rb,
lib/aixm/component.rb,
lib/aixm/constants.rb,
lib/aixm/shortcuts.rb,
lib/aixm/refinements.rb,
lib/aixm/feature/unit.rb,
lib/aixm/component/fato.rb,
lib/aixm/component/layer.rb,
lib/aixm/feature/address.rb,
lib/aixm/feature/airport.rb,
lib/aixm/feature/service.rb,
lib/aixm/component/runway.rb,
lib/aixm/feature/airspace.rb,
lib/aixm/feature/obstacle.rb,
lib/aixm/component/helipad.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/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: A, Component, D, Document, Error, F, Feature, GeometryError, LayerError, P, 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
VERSION =
"0.3.8".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
CLASSES =

List of shorthand names and their corresponding AIXM classes

{
  document: Document,
  xy: XY,
  z: Z,
  d: D,
  f: F,
  a: A,
  w: W,
  p: P,
  address: Feature::Address,
  organisation: Feature::Organisation,
  unit: Feature::Unit,
  service: Feature::Service,
  frequency: Component::Frequency,
  airport: Feature::Airport,
  runway: Component::Runway,
  fato: Component::FATO,
  helipad: Component::Helipad,
  surface: Component::Surface,
  lighting: Component::Lighting,
  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 =

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

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

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)


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).


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

def initialize_config
  @@config = OpenStruct.new(
    schema: :aixm,
    mid: false
  )
end

.ofmx!Symbol

Shortcuts to set the schema.

Examples:

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

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

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'

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

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