Class: AIXM::Feature::NavigationalAid::DesignatedPoint

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

Overview

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
  id: String
  name: String or nil
  xy: AIXM.xy
  type: TYPES
)
designated_point.airport = AIXM.airport or nil
designated_point.remarks = String or nil

Constant Summary collapse

TYPES =
{
  ICAO: :icao,                                 # five-letter ICAO id
  ADHP: :adhp,                                 # airport related id
  COORD: :coordinates,                         # derived from geographical coordinates
  'VFR-RP': :vfr_reporting_point,              # usually one or two letter id
  'VFR-MRP': :vfr_mandatory_reporting_point,   # usually one or two letter id
  'VFR-ENR': :vfr_en_route_point,
  'VFR-GLD': :vfr_glider_point,
  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:, **arguments) ⇒ DesignatedPoint


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

def initialize(type:, **arguments)
  super(organisation: false, z: nil, **arguments)
  self.type = type
end

Instance Attribute Details

#airportAIXM::Feature::Airport


43
44
45
# File 'lib/aixm/feature/navigational_aid/designated_point.rb', line 43

def airport
  @airport
end

#typeSymbol


39
40
41
# File 'lib/aixm/feature/navigational_aid/designated_point.rb', line 39

def type
  @type
end

Instance Method Details

#to_uidString


60
61
62
63
64
65
66
67
# File 'lib/aixm/feature/navigational_aid/designated_point.rb', line 60

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

#to_xmlString


70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/aixm/feature/navigational_aid/designated_point.rb', line 70

def to_xml
  builder = to_builder
  builder.Dpn({ source: (source if AIXM.ofmx?) }.compact) do |dpn|
    dpn << to_uid.indent(2)
    dpn << airport.to_uid(as: :AhpUidAssoc).indent(2) if airport
    dpn.codeDatum('WGE')
    dpn.codeType(AIXM.aixm? && type_key =~ /^VFR/ ? 'OTHER' : type_key.to_s)
    dpn.txtName(name) if name
    dpn.txtRmk(remarks) if remarks
    dpn.target!
  end
end