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

Inherits:
AIXM::Feature::NavigationalAid show all
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
  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

Instance Attribute Summary collapse

Attributes inherited from AIXM::Feature::NavigationalAid

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

Attributes inherited from AIXM::Feature

#source

Instance Method Summary collapse

Methods inherited from AIXM::Feature::NavigationalAid

#inspect, #kind

Methods inherited from AIXM::Feature

#==

Constructor Details

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


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

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

Instance Attribute Details

#dmeAIXM::Feature::NavigationalAid::DME? (readonly)


55
56
57
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 55

def dme
  @dme
end

#fAIXM::F


49
50
51
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 49

def f
  @f
end

#northSymbol


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

def north
  @north
end

#tacanAIXM::Feature::NavigationalAid::TACAN? (readonly)


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

def tacan
  @tacan
end

#typeSymbol


46
47
48
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 46

def type
  @type
end

Instance Method Details

#associate_dme(channel:) ⇒ Object

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


79
80
81
82
83
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 79

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

#associate_tacan(channel:) ⇒ Object

Associate a TACAN which turns the VOR into a VORTAC


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

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

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


132
133
134
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 132

def north_key
  NORTHS.key(north)
end

#to_uidString


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

def to_uid
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.VorUid do |vor_uid|
    vor_uid.codeId(id)
    vor_uid.geoLat(xy.lat(AIXM.schema))
    vor_uid.geoLong(xy.long(AIXM.schema))
  end.insert_payload_hash(region: AIXM.config.mid_region)
end

#to_xmlString


103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 103

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.


127
128
129
# File 'lib/aixm/feature/navigational_aid/vor.rb', line 127

def type_key
  TYPES.key(type)
end