Class: AIXM::Feature::NavigationalAid::VOR

Inherits:
AIXM::Feature::NavigationalAid show all
Includes:
Memoize
Defined in:
lib/aixm/feature/navigational_aid/vor.rb

Overview

VHF omni directional radio range (VOR) is a type of radio navigation for aircraft to determine their position and course. They operate in the frequency band between 108.00 Mhz to 117.95 MHz.

Cheat Sheet in Pseudo Code:

vor = AIXM.vor(
  source: String or nil
  region: String or nil
  organisation: AIXM.organisation
  id: String
  name: String
  xy: AIXM.xy
  z: AIXM.z or nil
  type: TYPES
  f: AIXM.f
  north: NORTHS
)
vor.timetable = AIXM.timetable or nil
vor.remarks = String or nil
vor.associate_dme(channel: String)     # turns the VOR into a VOR/DME
vor.associate_tacan(channel: String)   # turns the VOR into a VORTAC

Constant Summary collapse

TYPES =
{
  VOR: :conventional,
  DVOR: :doppler,
  OTHER: :other         # specify in remarks
}.freeze
NORTHS =
{
  TRUE: :geographic,
  GRID: :grid,         # parallel to the north-south lines of the UTM grid
  MAG: :magnetic,
  OTHER: :other        # specify in remarks
}.freeze

Constants inherited from AIXM::Feature

REGION_RE

Instance Attribute Summary collapse

Attributes inherited from AIXM::Feature::NavigationalAid

#id, #name, #remarks, #timetable, #xy, #z

Attributes inherited from AIXM::Feature

#region, #source

Instance Method Summary collapse

Methods included from Memoize

cache, included, method

Methods inherited from AIXM::Feature::NavigationalAid

#inspect, #kind, #organisation

Methods included from Association

included

Methods inherited from AIXM::Feature

#==

Constructor Details

#initialize(type:, f:, north:, **arguments) ⇒ VOR

Returns a new instance of VOR.


69
70
71
72
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 69

def initialize(type:, f:, north:, **arguments)
  super(**arguments)
  self.type, self.f, self.north = type, f, north
end

Instance Attribute Details

#fAIXM::F

Returns radio requency.

Returns:


64
65
66
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 64

def f
  @f
end

#northSymbol

Returns north indication (see NORTHS).

Returns:

  • (Symbol)

    north indication (see NORTHS)


67
68
69
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 67

def north
  @north
end

#typeSymbol

Returns type of VOR (see TYPES).

Returns:

  • (Symbol)

    type of VOR (see TYPES)


61
62
63
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 61

def type
  @type
end

Instance Method Details

#associate_dme(channel:) ⇒ Object

Associate a DME which turns the VOR into a VOR/DME


88
89
90
91
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 88

def associate_dme(channel:)
  self.dme = AIXM.dme(region: region, organisation: organisation, id: id, name: name, xy: xy, z: z, channel: channel)
  dme.timetable, @dme.remarks = timetable, remarks
end

#associate_tacan(channel:) ⇒ Object

Associate a TACAN which turns the VOR into a VORTAC


94
95
96
97
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 94

def associate_tacan(channel:)
  self.tacan = AIXM.tacan(region: region, organisation: organisation, id: id, name: name, xy: xy, z: z, channel: channel)
  tacan.timetable, @tacan.remarks = timetable, remarks
end

#dmeAIXM::Feature::NavigationalAid::DME?

Returns associated DME.

Returns:


52
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 52

has_one :dme, allow_nil: true

#dme=(dme) ⇒ Object

Parameters:


52
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 52

has_one :dme, allow_nil: true

#north_keyObject

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.


140
141
142
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 140

def north_key
  NORTHS.key(north)
end

#tacanAIXM::Feature::NavigationalAid::TACAN?

Returns associated TACAN.

Returns:


58
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 58

has_one :tacan, allow_nil: true

#tacan=(tacan) ⇒ Object

Parameters:


58
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 58

has_one :tacan, allow_nil: true

#to_uidString

Returns UID markup.

Returns:

  • (String)

    UID markup


100
101
102
103
104
105
106
107
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 100

def to_uid
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.VorUid({ region: (region if AIXM.ofmx?) }.compact) do |vor_uid|
    vor_uid.codeId(id)
    vor_uid.geoLat(xy.lat(AIXM.schema))
    vor_uid.geoLong(xy.long(AIXM.schema))
  end
end

#to_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 111

def to_xml
  builder = to_builder
  builder.Vor({ source: (source if AIXM.ofmx?) }.compact) do |vor|
    vor << to_uid.indent(2)
    vor << organisation.to_uid.indent(2)
    vor.txtName(name) if name
    vor.codeType(type_key.to_s)
    vor.valFreq(f.freq.trim)
    vor.uomFreq(f.unit.upcase.to_s)
    vor.codeTypeNorth(north_key.to_s)
    vor.codeDatum('WGE')
    if z
      vor.valElev(z.alt)
      vor.uomDistVer(z.unit.upcase.to_s)
    end
    vor << timetable.to_xml(as: :Vtt).indent(2) if timetable
    vor.txtRmk(remarks) if remarks
  end
  builder << @dme.to_xml if @dme
  builder << @tacan.to_xml if @tacan
  builder.target!
end

#type_keyObject

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.


135
136
137
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 135

def type_key
  TYPES.key(type)
end