aixm 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +14 -0
  4. data/README.md +3 -1
  5. data/lib/aixm/a.rb +29 -15
  6. data/lib/aixm/association.rb +2 -1
  7. data/lib/aixm/classes.rb +4 -0
  8. data/lib/aixm/component/address.rb +15 -9
  9. data/lib/aixm/component/approach_lighting.rb +28 -25
  10. data/lib/aixm/component/fato.rb +38 -26
  11. data/lib/aixm/component/frequency.rb +32 -20
  12. data/lib/aixm/component/geometry/arc.rb +16 -3
  13. data/lib/aixm/component/geometry/border.rb +8 -1
  14. data/lib/aixm/component/geometry/circle.rb +14 -2
  15. data/lib/aixm/component/geometry/point.rb +8 -1
  16. data/lib/aixm/component/geometry/rhumb_line.rb +8 -1
  17. data/lib/aixm/component/geometry.rb +20 -10
  18. data/lib/aixm/component/helipad.rb +41 -20
  19. data/lib/aixm/component/layer.rb +31 -20
  20. data/lib/aixm/component/lighting.rb +22 -24
  21. data/lib/aixm/component/runway.rb +32 -25
  22. data/lib/aixm/component/service.rb +11 -17
  23. data/lib/aixm/component/surface.rb +47 -14
  24. data/lib/aixm/component/timesheet.rb +178 -0
  25. data/lib/aixm/component/timetable.rb +32 -13
  26. data/lib/aixm/component/vasis.rb +36 -6
  27. data/lib/aixm/component/vertical_limit.rb +26 -4
  28. data/lib/aixm/component.rb +4 -1
  29. data/lib/aixm/concerns/hash_equality.rb +21 -0
  30. data/lib/aixm/concerns/intensity.rb +30 -0
  31. data/lib/aixm/concerns/marking.rb +21 -0
  32. data/lib/aixm/concerns/remarks.rb +21 -0
  33. data/lib/aixm/concerns/timetable.rb +22 -0
  34. data/lib/aixm/d.rb +20 -14
  35. data/lib/aixm/document.rb +22 -5
  36. data/lib/aixm/f.rb +29 -17
  37. data/lib/aixm/feature/airport.rb +91 -45
  38. data/lib/aixm/feature/airspace.rb +28 -5
  39. data/lib/aixm/feature/navigational_aid/designated_point.rb +8 -1
  40. data/lib/aixm/feature/navigational_aid/dme.rb +12 -2
  41. data/lib/aixm/feature/navigational_aid/marker.rb +9 -2
  42. data/lib/aixm/feature/navigational_aid/ndb.rb +15 -3
  43. data/lib/aixm/feature/navigational_aid/vor.rb +20 -3
  44. data/lib/aixm/feature/navigational_aid.rb +29 -20
  45. data/lib/aixm/feature/obstacle.rb +105 -29
  46. data/lib/aixm/feature/obstacle_group.rb +3 -7
  47. data/lib/aixm/feature/organisation.rb +23 -14
  48. data/lib/aixm/feature/unit.rb +23 -11
  49. data/lib/aixm/feature.rb +23 -4
  50. data/lib/aixm/memoize.rb +3 -3
  51. data/lib/aixm/p.rb +20 -14
  52. data/lib/aixm/payload_hash.rb +5 -2
  53. data/lib/aixm/r.rb +15 -12
  54. data/lib/aixm/refinements.rb +42 -2
  55. data/lib/aixm/schedule/date.rb +181 -0
  56. data/lib/aixm/schedule/day.rb +114 -0
  57. data/lib/aixm/schedule/time.rb +255 -0
  58. data/lib/aixm/shortcuts.rb +3 -0
  59. data/lib/aixm/version.rb +1 -1
  60. data/lib/aixm/w.rb +20 -13
  61. data/lib/aixm/xy.rb +36 -25
  62. data/lib/aixm/z.rb +29 -17
  63. data/lib/aixm.rb +13 -0
  64. data.tar.gz.sig +0 -0
  65. metadata +22 -13
  66. metadata.gz.sig +0 -0
data/lib/aixm/xy.rb CHANGED
@@ -29,8 +29,11 @@ module AIXM
29
29
  #
30
30
  # @see https://gitlab.com/openflightmaps/ofmx/wikis/Coordinates
31
31
  class XY
32
+ include AIXM::Concerns::HashEquality
33
+
32
34
  EARTH_RADIUS = 6_371_008.8
33
35
 
36
+ # See the {overview}[AIXM::XY] for examples.
34
37
  def initialize(lat:, long:)
35
38
  self.lat, self.long = lat, long
36
39
  end
@@ -45,14 +48,14 @@ module AIXM
45
48
  [lat(:ofmx), long(:ofmx)].join(' '.freeze)
46
49
  end
47
50
 
51
+ # Latitude
52
+ #
48
53
  # @!attribute lat
49
- def lat=(value)
50
- @lat = float_for value
51
- fail(ArgumentError, "invalid lat") unless (-90..90).include? @lat
52
- end
53
-
54
- # @param schema [Symbol, nil] either nil, +:aixm+ or +:ofmx+
55
- # @return [String, Float] latitude
54
+ # @overload lat
55
+ # @param schema [Symbol, nil] either +:aixm+ or +:ofmx+ or +nil+
56
+ # @return [String, Float]
57
+ # @overload lat=(value)
58
+ # @param value [String, Numeric]
56
59
  def lat(schema=nil)
57
60
  case schema
58
61
  when :ofmx then ("%011.8f" % @lat.abs.round(8)) + (@lat.negative? ? 'S' : 'N')
@@ -61,14 +64,19 @@ module AIXM
61
64
  end
62
65
  end
63
66
 
64
- # @!attribute long
65
- def long=(value)
66
- @long = float_for value
67
- fail(ArgumentError, "invalid long") unless (-180..180).include? @long
67
+ def lat=(value)
68
+ @lat = float_for value
69
+ fail(ArgumentError, "invalid lat") unless (-90..90).include? @lat
68
70
  end
69
71
 
70
- # @param schema [Symbol, nil] either nil, +:aixm+ or +:ofmx+
71
- # @return [Float, String] longitude
72
+ # Longitude
73
+ #
74
+ # @!attribute long
75
+ # @overload long
76
+ # @param schema [Symbol, nil] either +:aixm+ or +:ofmx+ or +nil+
77
+ # @return [String, Float]
78
+ # @overload long=(value)
79
+ # @param value [String, Numeric]
72
80
  def long(schema=nil)
73
81
  case schema
74
82
  when :ofmx then ("%012.8f" % @long.abs.round(8)) + (@long.negative? ? 'W' : 'E')
@@ -77,18 +85,29 @@ module AIXM
77
85
  end
78
86
  end
79
87
 
80
- # @return [Boolean] +false+ if both longitude and latitude have zero DMS
81
- # seconds which may indicate rounded or estimated coordinates
88
+ def long=(value)
89
+ @long = float_for value
90
+ fail(ArgumentError, "invalid long") unless (-180..180).include? @long
91
+ end
92
+
93
+ # Whether both longitude and latitude have zero DMS seconds (which may
94
+ # indicate rounded or estimated coordinates).
95
+ #
96
+ # @return [Boolean]
82
97
  def seconds?
83
98
  !(long.to_dms[-6,5].to_f.zero? && lat.to_dms[-6,5].to_f.zero?)
84
99
  end
85
100
 
86
- # @return [AIXM::Component::Geometry::Point] convert to point
101
+ # Convert to point
102
+ #
103
+ # @return [AIXM::Component::Geometry::Point]
87
104
  def to_point
88
105
  AIXM.point(xy: self)
89
106
  end
90
107
 
91
- # @return [AIXM::D] distance as calculated by use of the Haversine formula
108
+ # Distance as calculated by the Haversine formula
109
+ #
110
+ # @return [AIXM::D]
92
111
  def distance(other)
93
112
  if self == other
94
113
  AIXM.d(0, :m)
@@ -105,17 +124,9 @@ module AIXM
105
124
  end
106
125
 
107
126
  # @see Object#==
108
- # @return [Boolean]
109
127
  def ==(other)
110
128
  self.class === other && lat == other.lat && long == other.long
111
129
  end
112
- alias_method :eql?, :==
113
-
114
- # @see Object#hash
115
- # @return [Integer]
116
- def hash
117
- to_s.hash
118
- end
119
130
 
120
131
  private
121
132
 
data/lib/aixm/z.rb CHANGED
@@ -13,20 +13,36 @@ 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
+ include AIXM::Concerns::HashEquality
16
17
  extend Forwardable
17
18
 
18
19
  CODES = %i(qfe qnh qne).freeze
19
20
 
21
+ # Whether height, elevation or altitude is zero.
22
+
20
23
  # @!method zero?
21
- # @return [Boolean] whether height, elevation or altitude is zero
24
+ # @return [Boolean]
22
25
  def_delegator :@alt, :zero?
23
26
 
24
- # @return [Integer] altitude or elevation value
27
+ # Altitude or elevation value.
28
+ #
29
+ # @overload alt
30
+ # @return [Integer]
31
+ # @overload alt=(value)
32
+ # @param value [Integer]
25
33
  attr_reader :alt
26
34
 
27
- # @return [Symbol] Q code - either +:qfe+ (height in feet), +:qnh+ (altitude in feet or +:qne+ (altitude as flight level)
35
+ # Q code
36
+ #
37
+ # @overload code
38
+ # @return [Symbol] either +:qfe+ (height in feet), +:qnh+ (altitude in
39
+ # feet or +:qne+ (altitude as flight level)
40
+ # @overload code=(value)
41
+ # @param value [Symbol] either +:qfe+ (height in feet), +:qnh+ (altitude
42
+ # in feet or +:qne+ (altitude as flight level)
28
43
  attr_reader :code
29
44
 
45
+ # See the {overview}[AIXM::Z] for examples.
30
46
  def initialize(alt, code)
31
47
  self.alt, self.code = alt, code
32
48
  end
@@ -52,43 +68,39 @@ module AIXM
52
68
  fail(ArgumentError, "invalid code") unless CODES.include? @code
53
69
  end
54
70
 
55
- # @!method qfe?
56
- # @!method qnh?
57
- # @!method qne?
71
+ # Whether QFE, QNH or QNE.
58
72
  #
59
73
  # @example
60
74
  # z = AIXM.z(123, :qnh)
61
75
  # z.qnh? # => true
62
76
  # z.qfe? # => false
63
77
  #
78
+ # @!method qfe?
79
+ # @!method qnh?
80
+ # @!method qne?
64
81
  # @return [Boolean]
65
82
  CODES.each do |code|
66
83
  define_method(:"#{code}?") { @code == code }
67
84
  end
68
85
 
69
- # @return [Boolean] whether ground level or not
86
+ # Whether ground level
87
+ #
88
+ # @return [Boolean]
70
89
  def ground?
71
90
  qfe? && @alt == 0
72
91
  end
73
92
 
74
- # @return [Symbol] unit - either +:fl+ (flight level) or +:ft+ (feet)
93
+ # Unit
94
+ #
95
+ # @return [Symbol] either +:fl+ (flight level) or +:ft+ (feet)
75
96
  def unit
76
97
  qne? ? :fl : :ft
77
98
  end
78
99
 
79
100
  # @see Object#==
80
- # @return [Boolean]
81
101
  def ==(other)
82
102
  self.class === other && alt == other.alt && code == other.code
83
103
  end
84
- alias_method :eql?, :==
85
-
86
- # @see Object#hash
87
- # @return [Integer]
88
- def hash
89
- to_s.hash
90
- end
91
104
 
92
105
  end
93
-
94
106
  end
data/lib/aixm.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bigdecimal'
2
2
  require 'ostruct'
3
+ require 'date'
3
4
  require 'time'
4
5
  require 'pathname'
5
6
  require 'securerandom'
@@ -10,6 +11,7 @@ require 'optparse'
10
11
  require 'builder'
11
12
  require 'nokogiri'
12
13
  require 'dry/inflector'
14
+ require 'sun'
13
15
 
14
16
  require_relative 'aixm/object'
15
17
 
@@ -24,6 +26,12 @@ require_relative 'aixm/memoize'
24
26
  require_relative 'aixm/association'
25
27
  require_relative 'aixm/payload_hash'
26
28
 
29
+ require_relative 'aixm/concerns/hash_equality'
30
+ require_relative 'aixm/concerns/timetable'
31
+ require_relative 'aixm/concerns/intensity'
32
+ require_relative 'aixm/concerns/marking'
33
+ require_relative 'aixm/concerns/remarks'
34
+
27
35
  require_relative 'aixm/document'
28
36
  require_relative 'aixm/xy'
29
37
  require_relative 'aixm/z'
@@ -34,6 +42,10 @@ require_relative 'aixm/a'
34
42
  require_relative 'aixm/w'
35
43
  require_relative 'aixm/p'
36
44
 
45
+ require_relative 'aixm/schedule/date'
46
+ require_relative 'aixm/schedule/day'
47
+ require_relative 'aixm/schedule/time'
48
+
37
49
  require_relative 'aixm/component'
38
50
  require_relative 'aixm/component/address'
39
51
  require_relative 'aixm/component/service'
@@ -47,6 +59,7 @@ require_relative 'aixm/component/geometry/border'
47
59
  require_relative 'aixm/component/layer'
48
60
  require_relative 'aixm/component/vertical_limit'
49
61
  require_relative 'aixm/component/timetable'
62
+ require_relative 'aixm/component/timesheet'
50
63
  require_relative 'aixm/component/runway'
51
64
  require_relative 'aixm/component/fato'
52
65
  require_relative 'aixm/component/helipad'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aixm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -30,7 +30,7 @@ cert_chain:
30
30
  1+2Y1+i+4jd1B7qxIgOLxQTNIJiwE0sqU1itFfuesfgUACS7M0IV9u9Bp4hBGNEw
31
31
  5JcY2h7owdMxXIvgk1oakgldFJc=
32
32
  -----END CERTIFICATE-----
33
- date: 2022-03-05 00:00:00.000000000 Z
33
+ date: 2022-04-21 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: builder
@@ -75,21 +75,21 @@ dependencies:
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  - !ruby/object:Gem::Dependency
78
- name: rake
78
+ name: sun
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
84
- type: :development
83
+ version: '1'
84
+ type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: '1'
91
91
  - !ruby/object:Gem::Dependency
92
- name: minitest
92
+ name: debug
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
@@ -103,7 +103,7 @@ dependencies:
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  - !ruby/object:Gem::Dependency
106
- name: minitest-reporters
106
+ name: rake
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
@@ -117,7 +117,7 @@ dependencies:
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  - !ruby/object:Gem::Dependency
120
- name: minitest-sound
120
+ name: minitest
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ">="
@@ -131,7 +131,7 @@ dependencies:
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  - !ruby/object:Gem::Dependency
134
- name: minitest-matchers
134
+ name: minitest-sound
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
@@ -241,9 +241,15 @@ files:
241
241
  - lib/aixm/component/runway.rb
242
242
  - lib/aixm/component/service.rb
243
243
  - lib/aixm/component/surface.rb
244
+ - lib/aixm/component/timesheet.rb
244
245
  - lib/aixm/component/timetable.rb
245
246
  - lib/aixm/component/vasis.rb
246
247
  - lib/aixm/component/vertical_limit.rb
248
+ - lib/aixm/concerns/hash_equality.rb
249
+ - lib/aixm/concerns/intensity.rb
250
+ - lib/aixm/concerns/marking.rb
251
+ - lib/aixm/concerns/remarks.rb
252
+ - lib/aixm/concerns/timetable.rb
247
253
  - lib/aixm/config.rb
248
254
  - lib/aixm/constants.rb
249
255
  - lib/aixm/d.rb
@@ -271,6 +277,9 @@ files:
271
277
  - lib/aixm/payload_hash.rb
272
278
  - lib/aixm/r.rb
273
279
  - lib/aixm/refinements.rb
280
+ - lib/aixm/schedule/date.rb
281
+ - lib/aixm/schedule/day.rb
282
+ - lib/aixm/schedule/time.rb
274
283
  - lib/aixm/shortcuts.rb
275
284
  - lib/aixm/version.rb
276
285
  - lib/aixm/w.rb
@@ -315,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
324
  - !ruby/object:Gem::Version
316
325
  version: '0'
317
326
  requirements: []
318
- rubygems_version: 3.3.8
327
+ rubygems_version: 3.3.12
319
328
  signing_key:
320
329
  specification_version: 4
321
330
  summary: Builder for AIXM/OFMX aeronautical information
metadata.gz.sig CHANGED
Binary file