aixm 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -2
- data/CHANGELOG.md +20 -0
- data/README.md +7 -2
- data/aixm.gemspec +2 -3
- data/lib/aixm.rb +6 -2
- data/lib/aixm/a.rb +151 -0
- data/lib/aixm/component/frequency.rb +2 -2
- data/lib/aixm/component/geometry.rb +4 -0
- data/lib/aixm/component/geometry/point.rb +0 -4
- data/lib/aixm/component/helipad.rb +8 -22
- data/lib/aixm/component/runway.rb +36 -36
- data/lib/aixm/component/surface.rb +121 -0
- data/lib/aixm/component/timetable.rb +1 -0
- data/lib/aixm/constants.rb +40 -0
- data/lib/aixm/d.rb +5 -0
- data/lib/aixm/document.rb +2 -2
- data/lib/aixm/f.rb +6 -0
- data/lib/aixm/feature/address.rb +100 -0
- data/lib/aixm/feature/airport.rb +26 -7
- data/lib/aixm/feature/airspace.rb +10 -1
- data/lib/aixm/feature/navigational_aid.rb +1 -1
- data/lib/aixm/feature/navigational_aid/designated_point.rb +20 -5
- data/lib/aixm/feature/navigational_aid/dme.rb +2 -2
- data/lib/aixm/{component → feature}/service.rb +67 -16
- data/lib/aixm/feature/unit.rb +40 -6
- data/lib/aixm/refinements.rb +63 -6
- data/lib/aixm/shortcuts.rb +12 -4
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +6 -1
- data/lib/aixm/z.rb +6 -0
- data/schemas/ofmx/0/OFMX-DataTypes.xsd +5 -2
- data/schemas/ofmx/0/OFMX-Features.xsd +2 -0
- data/spec/factory.rb +32 -10
- data/spec/lib/aixm/a_spec.rb +203 -0
- data/spec/lib/aixm/component/helipad_spec.rb +11 -17
- data/spec/lib/aixm/component/runway_spec.rb +46 -32
- data/spec/lib/aixm/component/surface_spec.rb +88 -0
- data/spec/lib/aixm/d_spec.rb +10 -0
- data/spec/lib/aixm/document_spec.rb +104 -32
- data/spec/lib/aixm/f_spec.rb +10 -0
- data/spec/lib/aixm/feature/address_spec.rb +55 -0
- data/spec/lib/aixm/feature/airport_spec.rb +73 -3
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +43 -6
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +2 -2
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +2 -2
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +2 -2
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +2 -2
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +6 -6
- data/spec/lib/aixm/{component → feature}/service_spec.rb +12 -14
- data/spec/lib/aixm/feature/unit_spec.rb +7 -4
- data/spec/lib/aixm/refinements_spec.rb +100 -15
- data/spec/lib/aixm/z_spec.rb +10 -0
- metadata +17 -25
- data/lib/aixm/h.rb +0 -87
- data/spec/lib/aixm/h_spec.rb +0 -113
@@ -26,7 +26,7 @@ module AIXM
|
|
26
26
|
class DME < NavigationalAid
|
27
27
|
public_class_method :new
|
28
28
|
|
29
|
-
|
29
|
+
CHANNEL_RE = /\A([1-9]|[1-9]\d|1[0-1]\d|12[0-6])[XY]\z/.freeze
|
30
30
|
|
31
31
|
# @return [String] radio channel
|
32
32
|
attr_reader :channel
|
@@ -40,7 +40,7 @@ module AIXM
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def channel=(value)
|
43
|
-
fail(ArgumentError, "invalid channel") unless value.is_a?(String) && value.match?(
|
43
|
+
fail(ArgumentError, "invalid channel") unless value.is_a?(String) && value.match?(CHANNEL_RE)
|
44
44
|
@channel = value
|
45
45
|
end
|
46
46
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
using AIXM::Refinements
|
2
2
|
|
3
3
|
module AIXM
|
4
|
-
class
|
4
|
+
class Feature
|
5
5
|
|
6
6
|
# Service provided by a unit.
|
7
7
|
#
|
8
8
|
# ===Cheat Sheet in Pseudo Code:
|
9
9
|
# service = AIXM.service(
|
10
|
-
#
|
10
|
+
# source: String or nil
|
11
11
|
# type: TYPES
|
12
12
|
# )
|
13
13
|
# service.timetable = AIXM.timetable or nil
|
@@ -15,7 +15,9 @@ module AIXM
|
|
15
15
|
# service.add_frequency(AIXM.frequency)
|
16
16
|
#
|
17
17
|
# @see https://github.com/openflightmaps/ofmx/wiki/Organisation#ser-service
|
18
|
-
class Service
|
18
|
+
class Service < Feature
|
19
|
+
public_class_method :new
|
20
|
+
|
19
21
|
TYPES = {
|
20
22
|
ACS: :area_control_service,
|
21
23
|
ADS: :automatic_dependent_surveillance_service,
|
@@ -77,12 +79,57 @@ module AIXM
|
|
77
79
|
OTHER: :other # specify in remarks
|
78
80
|
}.freeze
|
79
81
|
|
82
|
+
# Map service types to guessed unit types
|
83
|
+
GUESSED_UNIT_TYPES_MAP = {
|
84
|
+
:advisory_service => :advisory_centre,
|
85
|
+
:aerodrome_control_tower_service => :aerodrome_control_tower,
|
86
|
+
:aerodrome_flight_information_service => :aerodrome_control_tower,
|
87
|
+
:aeronautical_information_service => :aeronautical_information_services_office,
|
88
|
+
:air_route_traffic_control_centre_service => :air_route_traffic_control_centre,
|
89
|
+
:air_traffic_control_service => :air_traffic_control_centre,
|
90
|
+
:air_traffic_flow_management_service => :air_traffic_flow_management_unit,
|
91
|
+
:air_traffic_management_service => :air_traffic_management_unit,
|
92
|
+
:air_traffic_service => :air_traffic_services_unit,
|
93
|
+
:approach_control_service => :approach_control_office,
|
94
|
+
:approach_control_service_for_arrival => :arrivals_approach_control_office,
|
95
|
+
:approach_control_service_for_departure => :depatures_approach_control_office,
|
96
|
+
:area_control_service => :area_control_centre,
|
97
|
+
:automated_terminal_information_service => :aerodrome_control_tower,
|
98
|
+
:automated_terminal_information_service_for_arrival => :aerodrome_control_tower,
|
99
|
+
:automated_terminal_information_service_for_departure => :aerodrome_control_tower,
|
100
|
+
:automatic_dependent_surveillance_service => :automatic_dependent_surveillance_unit,
|
101
|
+
:briefing_service => :briefing_office,
|
102
|
+
:commercial_broadcasting_service => :commercial_broadcasting_station,
|
103
|
+
:communications_service => :communications_office,
|
104
|
+
:flight_information_service => :flight_information_centre,
|
105
|
+
:flight_service_station_service => :flight_service_station,
|
106
|
+
:forecasting_service => :forecasting_office,
|
107
|
+
:ground_controlled_approach_service => :ground_controlled_approach_systems_office,
|
108
|
+
:international_notam_service => :international_notam_office,
|
109
|
+
:meteorological_service => :meteorological_office,
|
110
|
+
:oceanic_area_control_service => :oceanic_control_centre,
|
111
|
+
:precision_approach_radar_service => :precision_approach_radar_centre,
|
112
|
+
:radar_service => :radar_office,
|
113
|
+
:regional_area_forecasting_service => :regional_area_forecast_centre,
|
114
|
+
:rescue_coordination_service => :rescue_coordination_centre,
|
115
|
+
:search_and_rescue_service => :search_and_rescue_centre,
|
116
|
+
:secondary_surveillance_radar_service => :secondary_surveillance_radar_centre,
|
117
|
+
:sigmet_service => :meteorological_office,
|
118
|
+
:surface_movement_control_service => :surface_movement_control_office,
|
119
|
+
:surface_movement_radar_service => :surface_movement_radar_office,
|
120
|
+
:surveillance_radar_approach_service => :surveillance_radar_approach_centre,
|
121
|
+
:terminal_area_radar_service => :terminal_area_surveillance_radar_centre,
|
122
|
+
:transcribed_weather_broadcast_service => :meteorological_office,
|
123
|
+
:uhf_direction_finding_service => :uhf_direction_finding_station,
|
124
|
+
:upper_area_control_service => :upper_area_control_centre,
|
125
|
+
:vhf_direction_finding_service => :vdf_direction_finding_station,
|
126
|
+
:volmet_service => :meteorological_office,
|
127
|
+
:other => :other
|
128
|
+
}
|
129
|
+
|
80
130
|
# @return [AIXM::Feature::Unit] unit providing this service
|
81
131
|
attr_reader :unit
|
82
132
|
|
83
|
-
# @return [String] full name
|
84
|
-
attr_reader :name
|
85
|
-
|
86
133
|
# @return [Symbol] type of service (see {TYPES})
|
87
134
|
attr_reader :type
|
88
135
|
|
@@ -95,8 +142,9 @@ module AIXM
|
|
95
142
|
# @return [Array<AIXM::Component::Frequency>] frequencies used by this service
|
96
143
|
attr_reader :frequencies
|
97
144
|
|
98
|
-
def initialize(
|
99
|
-
|
145
|
+
def initialize(source: nil, type:)
|
146
|
+
super(source: source)
|
147
|
+
self.type = type
|
100
148
|
@frequencies = []
|
101
149
|
end
|
102
150
|
|
@@ -111,11 +159,6 @@ module AIXM
|
|
111
159
|
end
|
112
160
|
private :unit=
|
113
161
|
|
114
|
-
def name=(value)
|
115
|
-
fail(ArgumentError, "invalid name") unless value.is_a? String
|
116
|
-
@name = value.uptrans
|
117
|
-
end
|
118
|
-
|
119
162
|
def type=(value)
|
120
163
|
@type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type")
|
121
164
|
end
|
@@ -129,7 +172,7 @@ module AIXM
|
|
129
172
|
@remarks = value&.to_s
|
130
173
|
end
|
131
174
|
|
132
|
-
# Add a frequency used by this service
|
175
|
+
# Add a frequency used by this service
|
133
176
|
#
|
134
177
|
# @param frequency [AIXM::Component::Frequency] frequency instance
|
135
178
|
# @return [self]
|
@@ -140,6 +183,13 @@ module AIXM
|
|
140
183
|
self
|
141
184
|
end
|
142
185
|
|
186
|
+
# Guess the unit type for this service
|
187
|
+
#
|
188
|
+
# @return [Symbol, nil] guessed unit type or +nil+ if unmappable
|
189
|
+
def guessed_unit_type
|
190
|
+
GUESSED_UNIT_TYPES_MAP[type]
|
191
|
+
end
|
192
|
+
|
143
193
|
# @return [String] UID markup
|
144
194
|
def to_uid
|
145
195
|
builder = Builder::XmlMarkup.new(indent: 2)
|
@@ -151,10 +201,11 @@ module AIXM
|
|
151
201
|
end
|
152
202
|
|
153
203
|
# @return [String] AIXM or OFMX markup
|
154
|
-
def to_xml(sequence
|
204
|
+
def to_xml(sequence:)
|
155
205
|
@sequence = sequence
|
156
206
|
builder = Builder::XmlMarkup.new(indent: 2)
|
157
|
-
builder.
|
207
|
+
builder.comment! ["Service: #{TYPES.key(type)}", unit&.name].compact.join(' by ')
|
208
|
+
builder.Ser({ source: (source if AIXM.ofmx?) }.compact) do |ser|
|
158
209
|
ser << to_uid.indent(2)
|
159
210
|
ser << timetable.to_xml(as: :Stt).indent(2) if timetable
|
160
211
|
ser.txtRmk(remarks) if remarks
|
data/lib/aixm/feature/unit.rb
CHANGED
@@ -24,16 +24,50 @@ module AIXM
|
|
24
24
|
|
25
25
|
TYPES = {
|
26
26
|
ACC: :area_control_centre,
|
27
|
+
ADSU: :automatic_dependent_surveillance_unit,
|
28
|
+
ADVC: :advisory_centre,
|
29
|
+
ALPS: :alerting_post,
|
30
|
+
AOF: :aeronautical_information_services_office,
|
27
31
|
APP: :approach_control_office,
|
28
|
-
|
32
|
+
'APP-ARR': :arrivals_approach_control_office,
|
33
|
+
'APP-DEP': :depatures_approach_control_office,
|
34
|
+
ARO: :air_traffic_service_reporting_office,
|
35
|
+
ARTCC: :air_route_traffic_control_centre,
|
36
|
+
ATCC: :air_traffic_control_centre,
|
37
|
+
ATFMU: :air_traffic_flow_management_unit,
|
38
|
+
ATMU: :air_traffic_management_unit,
|
29
39
|
ATSU: :air_traffic_services_unit,
|
40
|
+
BOF: :briefing_office,
|
41
|
+
BS: :commercial_broadcasting_station,
|
30
42
|
COM: :communications_office,
|
43
|
+
FCST: :forecasting_office,
|
31
44
|
FIC: :flight_information_centre,
|
32
45
|
FSS: :flight_service_station,
|
46
|
+
GCA: :ground_controlled_approach_systems_office,
|
33
47
|
MET: :meteorological_office,
|
48
|
+
MIL: :military_station,
|
49
|
+
MILOPS: :military_flight_operations_briefing_office,
|
50
|
+
MWO: :meteorological_watch_office,
|
34
51
|
NOF: :international_notam_office,
|
52
|
+
OAC: :oceanic_control_centre,
|
53
|
+
PAR: :precision_approach_radar_centre,
|
35
54
|
RAD: :radar_office,
|
55
|
+
RAFC: :regional_area_forecast_centre,
|
56
|
+
RCC: :rescue_coordination_centre,
|
57
|
+
RSC: :rescue_sub_centre,
|
58
|
+
SAR: :search_and_rescue_centre,
|
59
|
+
SMC: :surface_movement_control_office,
|
60
|
+
SMR: :surface_movement_radar_office,
|
61
|
+
SRA: :surveillance_radar_approach_centre,
|
62
|
+
SSR: :secondary_surveillance_radar_centre,
|
63
|
+
TAR: :terminal_area_surveillance_radar_centre,
|
64
|
+
TRACON: :terminal_radar_approach_control,
|
36
65
|
TWR: :aerodrome_control_tower,
|
66
|
+
UAC: :upper_area_control_centre,
|
67
|
+
UDF: :uhf_direction_finding_station,
|
68
|
+
UIC: :upper_information_centre,
|
69
|
+
VDF: :vdf_direction_finding_station,
|
70
|
+
WAFC: :world_area_forecast_centre,
|
37
71
|
OTHER: :other # specify in remarks
|
38
72
|
}.freeze
|
39
73
|
|
@@ -104,19 +138,19 @@ module AIXM
|
|
104
138
|
|
105
139
|
# Add a service provided by this unit.
|
106
140
|
#
|
107
|
-
# @param service [AIXM::
|
141
|
+
# @param service [AIXM::Feature::Service] service instance
|
108
142
|
# @return [self]
|
109
143
|
def add_service(service)
|
110
|
-
fail(ArgumentError, "invalid service") unless service.is_a? AIXM::
|
144
|
+
fail(ArgumentError, "invalid service") unless service.is_a? AIXM::Feature::Service
|
111
145
|
service.send(:unit=, self)
|
112
146
|
@services << service
|
113
147
|
self
|
114
148
|
end
|
115
149
|
|
116
150
|
# @!attribute [r] services
|
117
|
-
# @return [Array<AIXM::
|
151
|
+
# @return [Array<AIXM::Feature::Service>] services provided by this unit
|
118
152
|
def services
|
119
|
-
@services.sort { |a, b|
|
153
|
+
@services.sort { |a, b| a.type <=> b.type }
|
120
154
|
end
|
121
155
|
|
122
156
|
# @return [String] UID markup
|
@@ -141,7 +175,7 @@ module AIXM
|
|
141
175
|
end
|
142
176
|
services.each.with_object({}) do |service, sequences|
|
143
177
|
sequences[service.type] = (sequences[service.type] || 0) + 1
|
144
|
-
builder << service.to_xml(sequences[service.type])
|
178
|
+
builder << service.to_xml(sequence: sequences[service.type])
|
145
179
|
end
|
146
180
|
builder.target!
|
147
181
|
end
|
data/lib/aixm/refinements.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module AIXM
|
2
2
|
module Refinements
|
3
3
|
|
4
|
-
UPTRANS_FILTER = %r
|
4
|
+
UPTRANS_FILTER = %r(
|
5
|
+
[^A-Z0-9, !"&#$%'\(\)\*\+\-\./:;<=>\?@\[\\\]\^_\|\{\}]
|
6
|
+
)x.freeze
|
5
7
|
|
6
8
|
UPTRANS_MAP = {
|
7
9
|
'Ä' => 'AE',
|
@@ -132,6 +134,19 @@ module AIXM
|
|
132
134
|
end
|
133
135
|
end
|
134
136
|
|
137
|
+
# @!method decapture
|
138
|
+
# Replace all groups with non-caputuring groups
|
139
|
+
#
|
140
|
+
# @example
|
141
|
+
# /^(foo)(?<name>bar)/.decapture # => /^(?:foo)(?:bar)/
|
142
|
+
#
|
143
|
+
# @note This is a refinement for +Regexp+
|
144
|
+
refine Regexp do
|
145
|
+
def decapture
|
146
|
+
Regexp.new(to_s.gsub(/\(\?<\w+>|(?<![^\\]\\)\((?!\?)/, '(?:'))
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
135
150
|
# @!method indent(number)
|
136
151
|
# Indent every line of a string with +number+ spaces.
|
137
152
|
#
|
@@ -149,26 +164,68 @@ module AIXM
|
|
149
164
|
end
|
150
165
|
end
|
151
166
|
|
167
|
+
# @!method payload_hash(region:, element:)
|
168
|
+
# Calculate the UUIDv3 hash of an OFMX XML string.
|
169
|
+
#
|
170
|
+
# A word of warning: This is a minimalistic implementation for the AIXM
|
171
|
+
# gem and won't work unless the following conditions are met:
|
172
|
+
# * the XML string must be OFMX
|
173
|
+
# * the XML string must be valid
|
174
|
+
# * the XML string must be pretty-printed
|
175
|
+
#
|
176
|
+
# @example from https://github.com/openflightmaps/ofmx/wiki/Functions
|
177
|
+
# xml.payload_hash(region: 'LF', element: 'Ser')
|
178
|
+
# # => "269b1f18-cabe-3c9e-1d71-48a7414a4cb9"
|
179
|
+
#
|
180
|
+
# @note This is a refinement for +String+
|
181
|
+
# @param region [String] OFMX region (e.g. "LF")
|
182
|
+
# @param element [String] tag to calculate the payload hash for
|
183
|
+
# @return [String] UUID version 3
|
184
|
+
refine String do
|
185
|
+
def payload_hash(region:, element:)
|
186
|
+
gsub(%r(mid="[^"]*"), ''). # remove existing mid attributes
|
187
|
+
sub(%r(\A.*?(?=<#{element}))m, ''). # remove everything before first <element>
|
188
|
+
sub(%r(</#{element}>.*\z)m, ''). # remove everything after first </element>
|
189
|
+
scan(%r(<([\w-]+)([^>]*)>([^<]*))).each_with_object([region]) do |(e, a, t), m|
|
190
|
+
m << e << a.scan(%r(([\w-]+)="([^"]*)")).sort.flatten << t
|
191
|
+
end.
|
192
|
+
flatten.
|
193
|
+
keep_if { |s| s.match?(/[^[:space:]]/m) }.
|
194
|
+
compact.
|
195
|
+
to_uuid
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
152
199
|
# @!method to_dd
|
153
200
|
# Convert DMS angle to DD or +nil+ if the notation is not recognized.
|
154
201
|
#
|
155
202
|
# @example
|
156
203
|
# %q(43°12'77.92").to_dd
|
157
204
|
# # => 43.22164444444445
|
205
|
+
# "431277.92S".to_dd
|
206
|
+
# # => -43.22164444444445
|
158
207
|
# %q(-123).to_dd
|
159
208
|
# # => nil
|
160
209
|
#
|
161
210
|
# Supported notations:
|
162
|
-
# * +{-}{DD}D°MM'SS{.SS}"+
|
163
|
-
# * +{-}{DD}D MM SS{.SS}+
|
164
|
-
# * +{-}{DD}DMMSS{.SS}+
|
211
|
+
# * +{-}{DD}D°MM'SS{.SS}"{[NESW]}+
|
212
|
+
# * +{-}{DD}D MM SS{.SS} {[NESW]}+
|
213
|
+
# * +{-}{DD}DMMSS{.SS}[NESW]+
|
214
|
+
#
|
215
|
+
# Quite a number of typos are tolerated such as the wrong use of
|
216
|
+
# minute +'+ and second +"+ markers as well as the use of decimal
|
217
|
+
# comma +,+ instead of dot +.+.
|
165
218
|
#
|
166
219
|
# @note This is a refinement for +String+
|
167
220
|
# @return [Float] angle in DD notation
|
168
221
|
refine String do
|
169
222
|
def to_dd
|
170
|
-
if
|
171
|
-
|
223
|
+
if match = self.match(DMS_RE)
|
224
|
+
"#{match['sgn']}1".to_i * "#{:- if match['hem_sw']}1".to_i * (
|
225
|
+
match['deg'].to_f +
|
226
|
+
match['min'].to_f/60 +
|
227
|
+
match['sec'].tr(',', '.').to_f/3600
|
228
|
+
)
|
172
229
|
end
|
173
230
|
end
|
174
231
|
end
|
data/lib/aixm/shortcuts.rb
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
module AIXM
|
2
2
|
|
3
|
-
|
3
|
+
# List of shorthand names and their corresponding AIXM classes
|
4
|
+
CLASSES = {
|
4
5
|
document: Document,
|
5
6
|
xy: XY,
|
6
7
|
z: Z,
|
7
8
|
d: D,
|
8
9
|
f: F,
|
9
|
-
|
10
|
+
a: A,
|
11
|
+
address: Feature::Address,
|
10
12
|
organisation: Feature::Organisation,
|
11
13
|
unit: Feature::Unit,
|
12
|
-
service:
|
14
|
+
service: Feature::Service,
|
13
15
|
frequency: Component::Frequency,
|
14
16
|
airport: Feature::Airport,
|
15
17
|
runway: Component::Runway,
|
16
18
|
helipad: Component::Helipad,
|
19
|
+
surface: Component::Surface,
|
17
20
|
airspace: Feature::Airspace,
|
18
21
|
layer: Component::Layer,
|
19
22
|
geometry: Component::Geometry,
|
@@ -33,14 +36,19 @@ module AIXM
|
|
33
36
|
timetable: Component::Timetable
|
34
37
|
}.freeze
|
35
38
|
|
36
|
-
|
39
|
+
CLASSES.each do |element, klass|
|
37
40
|
define_singleton_method(element) do |*arguments|
|
38
41
|
klass.new(*arguments)
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
45
|
+
# Ground level
|
42
46
|
GROUND = z(0, :qfe).freeze
|
47
|
+
|
48
|
+
# Max flight level used to signal "no upper limit"
|
43
49
|
UNLIMITED = z(999, :qne).freeze
|
50
|
+
|
51
|
+
# Timetable used to signal "always active"
|
44
52
|
H24 = timetable(code: :H24).freeze
|
45
53
|
|
46
54
|
end
|
data/lib/aixm/version.rb
CHANGED
data/lib/aixm/xy.rb
CHANGED
@@ -14,6 +14,11 @@ module AIXM
|
|
14
14
|
# AIXM.xy(lat: %q(11°22'33.44N"), long: %q(111°22'33.44W"))
|
15
15
|
# AIXM.xy(lat: '112233.44N', long: '1112233.44W')
|
16
16
|
#
|
17
|
+
# ===Constants:
|
18
|
+
# * +AIXM::MIN+ - characters recognized as DMS minute symbols
|
19
|
+
# * +AIXM::SEC+ - characters recognized as DMS second symbols
|
20
|
+
# * +AIXM::DMS_RE+ - regular expression to match DMS coordinate notations
|
21
|
+
#
|
17
22
|
# @see https://github.com/openflightmaps/ofmx/wiki/Coordinates
|
18
23
|
class XY
|
19
24
|
EARTH_RADIUS = 6_371_008.8
|
@@ -98,7 +103,7 @@ module AIXM
|
|
98
103
|
def float_for(value)
|
99
104
|
case value
|
100
105
|
when Numeric then value.to_f
|
101
|
-
when String then value
|
106
|
+
when String then value.to_dd
|
102
107
|
else fail(ArgumentError, "invalid value class `#{value.class}'")
|
103
108
|
end
|
104
109
|
rescue
|
data/lib/aixm/z.rb
CHANGED
@@ -13,8 +13,14 @@ module AIXM
|
|
13
13
|
# * +AIXM::GROUND+ - surface expressed as "0 ft QFE"
|
14
14
|
# * +AIXM::UNLIMITED+ - no upper limit expressed as "FL 999"
|
15
15
|
class Z
|
16
|
+
extend Forwardable
|
17
|
+
|
16
18
|
CODES = %i(qfe qnh qne).freeze
|
17
19
|
|
20
|
+
# @!method zero?
|
21
|
+
# @return [Boolean] whether height, elevation or altitude is zero
|
22
|
+
def_delegator :@alt, :zero?
|
23
|
+
|
18
24
|
# @return [Integer] altitude or elevation value
|
19
25
|
attr_reader :alt
|
20
26
|
|
@@ -87,7 +87,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
87
87
|
<xsd:documentation>Reference to the source AIP document.</xsd:documentation>
|
88
88
|
</xsd:annotation>
|
89
89
|
<xsd:restriction base="xsd:string">
|
90
|
-
<xsd:pattern value="[A-Z]{2,4}\|(GEN|ENR|AD|AIRAC)
|
90
|
+
<xsd:pattern value="[A-Z]{2,4}\|(GEN|ENR|AD|AIRAC|VAC)\|.+\|[\d-]+\|\d+"/>
|
91
91
|
</xsd:restriction>
|
92
92
|
</xsd:simpleType>
|
93
93
|
<xsd:simpleType name="codeAcftEngineNoBase">
|
@@ -3398,6 +3398,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3398
3398
|
<xsd:enumeration value="ICAO"/>
|
3399
3399
|
<xsd:enumeration value="ADHP"/>
|
3400
3400
|
<xsd:enumeration value="COORD"/>
|
3401
|
+
<xsd:enumeration value="VFR-RP"/>
|
3402
|
+
<xsd:enumeration value="VFR-MRP"/>
|
3403
|
+
<xsd:enumeration value="VFR-ENR"/>
|
3404
|
+
<xsd:enumeration value="VFR-GLD"/>
|
3401
3405
|
<xsd:enumeration value="OTHER"/>
|
3402
3406
|
</xsd:restriction>
|
3403
3407
|
</xsd:simpleType>
|
@@ -4028,7 +4032,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4028
4032
|
</xsd:complexType>
|
4029
4033
|
<xsd:simpleType name="codeTypeSerAdBase">
|
4030
4034
|
<xsd:restriction base="xsd:string">
|
4031
|
-
<xsd:enumeration value="INFO"/>
|
4032
4035
|
<xsd:enumeration value="FIRE"/>
|
4033
4036
|
<xsd:enumeration value="CUST"/>
|
4034
4037
|
<xsd:enumeration value="SAN"/>
|