class AIXM::Feature::NavigationalAid::NDB
A
non-directional radio beacon (NDB
) is a radio transmitter at a known location operating in the frequency band between 190 kHz and 1750 kHz.
Cheat Sheet in Pseudo Code:¶ ↑
ndb = AIXM.ndb( 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 ) ndb.timetable = AIXM.timetable or nil ndb.remarks = String or nil
@see gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#ndb-ndb
Constants
- TYPES
Attributes
f[R]
@return [AIXM::F] radio frequency
type[R]
@return [Symbol, nil] type of NDB
(see {TYPES})
Public Class Methods
new(source: nil, region: nil)
click to toggle source
# File lib/aixm/feature.rb 15 def initialize(source: nil, region: nil) 16 self.source = source 17 self.region = region || AIXM.config.region 18 end
new(type:, f:, **arguments)
click to toggle source
Calls superclass method
AIXM::Feature::NavigationalAid::new
# File lib/aixm/feature/navigational_aid/ndb.rb 44 def initialize(type:, f:, **arguments) 45 super(**arguments) 46 self.type, self.f = type, f 47 end
Public Instance Methods
f=(value)
click to toggle source
# File lib/aixm/feature/navigational_aid/ndb.rb 53 def f=(value) 54 fail(ArgumentError, "invalid f") unless value.is_a?(F) && value.between?(190, 1750, :khz) 55 @f = value 56 end
to_uid()
click to toggle source
@return [String] UID markup
# File lib/aixm/feature/navigational_aid/ndb.rb 59 def to_uid 60 builder = Builder::XmlMarkup.new(indent: 2) 61 builder.NdbUid({ region: (region if AIXM.ofmx?) }.compact) do |ndb_uid| 62 ndb_uid.codeId(id) 63 ndb_uid.geoLat(xy.lat(AIXM.schema)) 64 ndb_uid.geoLong(xy.long(AIXM.schema)) 65 end 66 end
to_xml()
click to toggle source
@return [String] AIXM
or OFMX markup
# File lib/aixm/feature/navigational_aid/ndb.rb 70 def to_xml 71 builder = to_builder 72 builder.Ndb({ source: (source if AIXM.ofmx?) }.compact) do |ndb| 73 ndb << to_uid.indent(2) 74 ndb << organisation.to_uid.indent(2) 75 ndb.txtName(name) if name 76 ndb.valFreq(f.freq.trim) 77 ndb.uomFreq(f.unit.upcase.to_s) 78 ndb.codeClass(type_key.to_s) if type 79 ndb.codeDatum('WGE') 80 if z 81 ndb.valElev(z.alt) 82 ndb.uomDistVer(z.unit.upcase.to_s) 83 end 84 ndb << timetable.to_xml(as: :Ntt).indent(2) if timetable 85 ndb.txtRmk(remarks) if remarks 86 ndb.target! 87 end 88 end
type=(value)
click to toggle source
# File lib/aixm/feature/navigational_aid/ndb.rb 49 def type=(value) 50 @type = value.nil? ? nil : TYPES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid type") 51 end
Private Instance Methods
type_key()
click to toggle source
# File lib/aixm/feature/navigational_aid/ndb.rb 92 def type_key 93 TYPES.key(type) 94 end