class AIXM::Feature::NavigationalAid::DesignatedPoint

Named geographical location used in defining an ATS route, aircraft flight paths or for other navigation purposes.

Cheat Sheet in Pseudo Code:

designated_point = AIXM.designated_point(
  source: String or nil
  region: String or nil
  id: String
  name: String or nil
  xy: AIXM.xy
  type: TYPES
)
designated_point.airport = AIXM.airport or nil
designated_point.remarks = String or nil

@see gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#dpn-designated-point

Constants

TYPES

Attributes

type[R]

@return [Symbol] type of designated point

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:, **arguments) click to toggle source
Calls superclass method AIXM::Feature::NavigationalAid::new
   # File lib/aixm/feature/navigational_aid/designated_point.rb
47 def initialize(type:, **arguments)
48   super(organisation: nil, z: nil, **arguments)
49   self.type = type
50 end

Public Instance Methods

to_uid() click to toggle source

@return [String] UID markup

   # File lib/aixm/feature/navigational_aid/designated_point.rb
57 def to_uid
58   builder = Builder::XmlMarkup.new(indent: 2)
59   builder.DpnUid({ region: (region if AIXM.ofmx?) }.compact) do |dpn_uid|
60     dpn_uid.codeId(id)
61     dpn_uid.geoLat(xy.lat(AIXM.schema))
62     dpn_uid.geoLong(xy.long(AIXM.schema))
63   end
64 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

   # File lib/aixm/feature/navigational_aid/designated_point.rb
68 def to_xml
69   builder = to_builder
70   builder.Dpn({ source: (source if AIXM.ofmx?) }.compact) do |dpn|
71     dpn << to_uid.indent(2)
72     dpn << airport.to_uid(as: :AhpUidAssoc).indent(2) if airport
73     dpn.codeDatum('WGE')
74     dpn.codeType(AIXM.aixm? && type_key =~ /^VFR/ ? 'OTHER' : type_key.to_s)
75     dpn.txtName(name) if name
76     dpn.txtRmk(remarks) if remarks
77     dpn.target!
78   end
79 end
type=(value) click to toggle source
   # File lib/aixm/feature/navigational_aid/designated_point.rb
52 def type=(value)
53   @type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type")
54 end

Private Instance Methods

type_key() click to toggle source
   # File lib/aixm/feature/navigational_aid/designated_point.rb
83 def type_key
84   TYPES.key(type)
85 end