aixm 0.3.8 → 0.3.10

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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +33 -3
  5. data/README.md +166 -56
  6. data/exe/ckmid +14 -0
  7. data/exe/mkmid +14 -0
  8. data/lib/aixm.rb +16 -6
  9. data/lib/aixm/association.rb +369 -0
  10. data/lib/aixm/classes.rb +43 -0
  11. data/lib/aixm/component/fato.rb +45 -53
  12. data/lib/aixm/component/frequency.rb +11 -12
  13. data/lib/aixm/component/geometry.rb +36 -38
  14. data/lib/aixm/component/geometry/arc.rb +2 -2
  15. data/lib/aixm/component/geometry/border.rb +6 -3
  16. data/lib/aixm/component/geometry/circle.rb +8 -2
  17. data/lib/aixm/component/geometry/point.rb +8 -2
  18. data/lib/aixm/component/helipad.rb +30 -38
  19. data/lib/aixm/component/layer.rb +28 -19
  20. data/lib/aixm/component/lighting.rb +12 -13
  21. data/lib/aixm/component/runway.rb +44 -48
  22. data/lib/aixm/{feature → component}/service.rb +37 -36
  23. data/lib/aixm/component/surface.rb +3 -3
  24. data/lib/aixm/component/timetable.rb +2 -2
  25. data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
  26. data/lib/aixm/config.rb +2 -1
  27. data/lib/aixm/document.rb +27 -50
  28. data/lib/aixm/executables.rb +85 -0
  29. data/lib/aixm/feature.rb +13 -3
  30. data/lib/aixm/feature/address.rb +12 -13
  31. data/lib/aixm/feature/airport.rb +103 -128
  32. data/lib/aixm/feature/airspace.rb +44 -17
  33. data/lib/aixm/feature/navigational_aid.rb +7 -9
  34. data/lib/aixm/feature/navigational_aid/designated_point.rb +13 -15
  35. data/lib/aixm/feature/navigational_aid/dme.rb +11 -12
  36. data/lib/aixm/feature/navigational_aid/marker.rb +7 -3
  37. data/lib/aixm/feature/navigational_aid/ndb.rb +7 -3
  38. data/lib/aixm/feature/navigational_aid/tacan.rb +7 -3
  39. data/lib/aixm/feature/navigational_aid/vor.rb +23 -15
  40. data/lib/aixm/feature/obstacle.rb +29 -43
  41. data/lib/aixm/feature/obstacle_group.rb +37 -34
  42. data/lib/aixm/feature/organisation.rb +21 -5
  43. data/lib/aixm/feature/unit.rb +36 -46
  44. data/lib/aixm/memoize.rb +89 -0
  45. data/lib/aixm/object.rb +9 -0
  46. data/lib/aixm/payload_hash.rb +114 -0
  47. data/lib/aixm/refinements.rb +29 -76
  48. data/lib/aixm/shortcuts.rb +5 -42
  49. data/lib/aixm/version.rb +1 -1
  50. data/lib/aixm/xy.rb +1 -1
  51. data/schemas/ofmx/0/OFMX-Features.xsd +152 -20
  52. data/schemas/ofmx/0/OFMX-Snapshot.xsd +0 -5
  53. metadata +107 -156
  54. metadata.gz.sig +2 -0
  55. data/.github/workflows/test.yml +0 -26
  56. data/.gitignore +0 -6
  57. data/.ruby-version +0 -1
  58. data/.yardopts +0 -3
  59. data/Guardfile +0 -8
  60. data/aixm.gemspec +0 -35
  61. data/gems.rb +0 -3
  62. data/lib/aixm/component.rb +0 -6
  63. data/rakefile.rb +0 -36
  64. data/spec/factory.rb +0 -559
  65. data/spec/lib/aixm/a_spec.rb +0 -203
  66. data/spec/lib/aixm/component/fato_spec.rb +0 -267
  67. data/spec/lib/aixm/component/frequency_spec.rb +0 -74
  68. data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -73
  69. data/spec/lib/aixm/component/geometry/border_spec.rb +0 -38
  70. data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -68
  71. data/spec/lib/aixm/component/geometry/point_spec.rb +0 -37
  72. data/spec/lib/aixm/component/geometry_spec.rb +0 -316
  73. data/spec/lib/aixm/component/helipad_spec.rb +0 -193
  74. data/spec/lib/aixm/component/layer_spec.rb +0 -135
  75. data/spec/lib/aixm/component/lighting_spec.rb +0 -94
  76. data/spec/lib/aixm/component/runway_spec.rb +0 -479
  77. data/spec/lib/aixm/component/surface_spec.rb +0 -124
  78. data/spec/lib/aixm/component/timetable_spec.rb +0 -47
  79. data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -94
  80. data/spec/lib/aixm/config_spec.rb +0 -41
  81. data/spec/lib/aixm/d_spec.rb +0 -150
  82. data/spec/lib/aixm/document_spec.rb +0 -1884
  83. data/spec/lib/aixm/errors_spec.rb +0 -14
  84. data/spec/lib/aixm/f_spec.rb +0 -85
  85. data/spec/lib/aixm/feature/address_spec.rb +0 -60
  86. data/spec/lib/aixm/feature/airport_spec.rb +0 -776
  87. data/spec/lib/aixm/feature/airspace_spec.rb +0 -394
  88. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -103
  89. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -98
  90. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -85
  91. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -95
  92. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -94
  93. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -251
  94. data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
  95. data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -330
  96. data/spec/lib/aixm/feature/obstacle_spec.rb +0 -284
  97. data/spec/lib/aixm/feature/organisation_spec.rb +0 -83
  98. data/spec/lib/aixm/feature/service_spec.rb +0 -59
  99. data/spec/lib/aixm/feature/unit_spec.rb +0 -238
  100. data/spec/lib/aixm/feature_spec.rb +0 -38
  101. data/spec/lib/aixm/p_spec.rb +0 -189
  102. data/spec/lib/aixm/refinements_spec.rb +0 -430
  103. data/spec/lib/aixm/version_spec.rb +0 -7
  104. data/spec/lib/aixm/w_spec.rb +0 -150
  105. data/spec/lib/aixm/xy_spec.rb +0 -180
  106. data/spec/lib/aixm/z_spec.rb +0 -94
  107. data/spec/macros/marking.rb +0 -12
  108. data/spec/macros/organisation.rb +0 -11
  109. data/spec/macros/remarks.rb +0 -12
  110. data/spec/macros/timetable.rb +0 -11
  111. data/spec/macros/xy.rb +0 -11
  112. data/spec/macros/z_qnh.rb +0 -11
  113. data/spec/sounds/failure.mp3 +0 -0
  114. data/spec/sounds/success.mp3 +0 -0
  115. data/spec/spec_helper.rb +0 -62
@@ -1,74 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Frequency do
4
- subject do
5
- AIXM::Factory.frequency
6
- end
7
-
8
- describe :initialize do
9
- it "sets defaults" do
10
- subject = AIXM::Component::Frequency.new(
11
- transmission_f: AIXM.f(123.35, :mhz),
12
- callsigns: { en: "PUJAUT CONTROL", fr: "PUJAUT CONTROLE" }
13
- )
14
- _(subject.reception_f).must_equal subject.transmission_f
15
- end
16
- end
17
-
18
- describe :transmission_f= do
19
- it "fails on invalid values" do
20
- _([nil, :foobar, 123]).wont_be_written_to subject, :transmission_f
21
- end
22
-
23
- it "accepts valid values" do
24
- _([AIXM::Factory.f]).must_be_written_to subject, :transmission_f
25
- end
26
- end
27
-
28
- describe :callsigns= do
29
- it "fails on invalid values" do
30
- _([nil, :foobar, 123]).wont_be_written_to subject, :callsigns
31
- end
32
-
33
- it "downcases language codes" do
34
- _(subject.tap { |s| s.callsigns = { EN: "FOOBAR" } }.callsigns).must_equal(en: "FOOBAR")
35
- end
36
-
37
- it "upcases and transcodes callsigns" do
38
- _(subject.tap { |s| s.callsigns = { fr: "Nîmes-Alès" } }.callsigns).must_equal(fr: "NIMES-ALES")
39
- end
40
- end
41
-
42
- describe :reception_f= do
43
- it "fails on invalid values" do
44
- _([:foobar, 123]).wont_be_written_to subject, :reception_f
45
- end
46
-
47
- it "accepts valid values" do
48
- _([nil, AIXM::Factory.f]).must_be_written_to subject, :reception_f
49
- end
50
- end
51
-
52
- describe :type= do
53
- it "fails on invalid values" do
54
- _{ subject.type = :foobar }.must_raise ArgumentError
55
- end
56
-
57
- it "accepts nil value" do
58
- _([nil]).must_be_written_to subject, :type
59
- end
60
-
61
- it "looks up valid values" do
62
- _(subject.tap { |s| s.type = :standard }.type).must_equal :standard
63
- _(subject.tap { |s| s.type = :ALT }.type).must_equal :alternative
64
- end
65
- end
66
-
67
- describe :timetable= do
68
- macro :timetable
69
- end
70
-
71
- describe :remarks= do
72
- macro :remarks
73
- end
74
- end
@@ -1,73 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Arc do
4
- subject do
5
- AIXM.arc(
6
- xy: AIXM.xy(lat: 11.1, long: 33.3),
7
- center_xy: AIXM.xy(lat: 22.2, long: 33.3),
8
- clockwise: true
9
- )
10
- end
11
-
12
- describe :center_xy= do
13
- it "fails on invalid values" do
14
- _([nil, 123]).wont_be_written_to subject, :xy
15
- end
16
-
17
- it "accepts valid values" do
18
- _([AIXM::Factory.xy]).must_be_written_to subject, :xy
19
- end
20
- end
21
-
22
- describe :clockwise= do
23
- it "fails on invalid values" do
24
- _([nil, 0]).wont_be_written_to subject, :clockwise
25
- end
26
- end
27
-
28
- describe :clockwise? do
29
- it "must return true or false" do
30
- xy = AIXM.xy(lat: 11.1, long: 22.2)
31
- _(AIXM.arc(xy: xy, center_xy: xy, clockwise: true)).must_be :clockwise?
32
- _(AIXM.arc(xy: xy, center_xy: xy, clockwise: false)).wont_be :clockwise?
33
- end
34
- end
35
-
36
- describe :to_xml do
37
- it "builds correct AIXM for clockwise arcs" do
38
- subject = AIXM.arc(
39
- xy: AIXM.xy(lat: 11.1, long: 33.3),
40
- center_xy: AIXM.xy(lat: 22.2, long: 33.3),
41
- clockwise: true
42
- )
43
- _(subject.to_xml).must_equal <<~END
44
- <Avx>
45
- <codeType>CWA</codeType>
46
- <geoLat>110600.00N</geoLat>
47
- <geoLong>0331800.00E</geoLong>
48
- <codeDatum>WGE</codeDatum>
49
- <geoLatArc>221200.00N</geoLatArc>
50
- <geoLongArc>0331800.00E</geoLongArc>
51
- </Avx>
52
- END
53
- end
54
-
55
- it "builds correct AIXM for counter-clockwise arcs" do
56
- subject = AIXM.arc(
57
- xy: AIXM.xy(lat: 11.1, long: 33.3),
58
- center_xy: AIXM.xy(lat: 22.2, long: 33.3),
59
- clockwise: false
60
- )
61
- _(subject.to_xml).must_equal <<~END
62
- <Avx>
63
- <codeType>CCA</codeType>
64
- <geoLat>110600.00N</geoLat>
65
- <geoLong>0331800.00E</geoLong>
66
- <codeDatum>WGE</codeDatum>
67
- <geoLatArc>221200.00N</geoLatArc>
68
- <geoLongArc>0331800.00E</geoLongArc>
69
- </Avx>
70
- END
71
- end
72
- end
73
- end
@@ -1,38 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Border do
4
- subject do
5
- AIXM.border(
6
- xy: AIXM.xy(lat: 11.1, long: 22.2),
7
- name: 'FRANCE-SWITZERLAND'
8
- )
9
- end
10
-
11
- describe :name= do
12
- it "fails on invalid values" do
13
- _([nil, :foobar, 123]).wont_be_written_to subject, :name
14
- end
15
- end
16
-
17
- describe :to_xml do
18
- it "builds correct AIXM" do
19
- _(subject.to_xml).must_equal <<~END
20
- <Avx>
21
- <GbrUid>
22
- <txtName>FRANCE-SWITZERLAND</txtName>
23
- </GbrUid>
24
- <codeType>FNT</codeType>
25
- <geoLat>110600.00N</geoLat>
26
- <geoLong>0221200.00E</geoLong>
27
- <codeDatum>WGE</codeDatum>
28
- </Avx>
29
- END
30
- end
31
- end
32
-
33
- it "builds OFMX with mid" do
34
- AIXM.ofmx!
35
- AIXM.config.mid_region = 'LF'
36
- _(subject.to_xml).must_match /<GbrUid mid="6be76b9b-567e-50f1-5c98-80a76163eebe">/
37
- end
38
- end
@@ -1,68 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Circle do
4
- subject do
5
- AIXM.circle(
6
- center_xy: AIXM.xy(lat: 12.12345678, long: -23.12345678),
7
- radius: AIXM.d(15, :km)
8
- )
9
- end
10
-
11
- describe :center_xy= do
12
- it "fails on invalid values" do
13
- _([nil, 123]).wont_be_written_to subject, :center_xy
14
- end
15
-
16
- it "accepts valid values" do
17
- _([AIXM::Factory.xy]).must_be_written_to subject, :center_xy
18
- end
19
- end
20
-
21
- describe :radius= do
22
- it "fails on invalid values" do
23
- _([nil, 0, 2, AIXM.d(0, :m)]).wont_be_written_to subject, :radius
24
- end
25
- end
26
-
27
- describe :north_xy do
28
- it "must calculate approximation of northmost point on the circumference" do
29
- _(subject.send(:north_xy)).must_equal AIXM.xy(lat: 12.25835483455868, long: -23.12345678)
30
- end
31
- end
32
-
33
- describe :to_xml do
34
- it "builds correct AIXM for circles not near the equator" do
35
- subject = AIXM.circle(
36
- center_xy: AIXM.xy(lat: 11.1, long: 22.2),
37
- radius: AIXM.d(25, :km)
38
- )
39
- _(subject.to_xml).must_equal <<~END
40
- <Avx>
41
- <codeType>CWA</codeType>
42
- <geoLat>111929.39N</geoLat>
43
- <geoLong>0221200.00E</geoLong>
44
- <codeDatum>WGE</codeDatum>
45
- <geoLatArc>110600.00N</geoLatArc>
46
- <geoLongArc>0221200.00E</geoLongArc>
47
- </Avx>
48
- END
49
- end
50
-
51
- it "builds correct AIXM for circles near the equator" do
52
- subject = AIXM.circle(
53
- center_xy: AIXM.xy(lat: -0.0005, long: -22.2),
54
- radius: AIXM.d(50, :km)
55
- )
56
- _(subject.to_xml).must_equal <<~END
57
- <Avx>
58
- <codeType>CWA</codeType>
59
- <geoLat>002656.98N</geoLat>
60
- <geoLong>0221200.00W</geoLong>
61
- <codeDatum>WGE</codeDatum>
62
- <geoLatArc>000001.80S</geoLatArc>
63
- <geoLongArc>0221200.00W</geoLongArc>
64
- </Avx>
65
- END
66
- end
67
- end
68
- end
@@ -1,37 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Point do
4
- subject do
5
- AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
6
- end
7
-
8
- describe :xy= do
9
- macro :xy
10
- end
11
-
12
- describe :to_xml do
13
- it "builds correct AIXM for N/E points" do
14
- subject = AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
15
- _(subject.to_xml).must_equal <<~END
16
- <Avx>
17
- <codeType>GRC</codeType>
18
- <geoLat>110600.00N</geoLat>
19
- <geoLong>0221200.00E</geoLong>
20
- <codeDatum>WGE</codeDatum>
21
- </Avx>
22
- END
23
- end
24
-
25
- it "builds correct AIXM for S/W points" do
26
- subject = AIXM.point(xy: AIXM.xy(lat: -11.1, long: -22.2))
27
- _(subject.to_xml).must_equal <<~END
28
- <Avx>
29
- <codeType>GRC</codeType>
30
- <geoLat>110600.00S</geoLat>
31
- <geoLong>0221200.00W</geoLong>
32
- <codeDatum>WGE</codeDatum>
33
- </Avx>
34
- END
35
- end
36
- end
37
- end
@@ -1,316 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry do
4
- context "singularity" do
5
- subject do
6
- AIXM.geometry
7
- end
8
-
9
- it "must fail checks" do
10
- _(subject).wont_be :point?
11
- _(subject).wont_be :circle?
12
- _(subject).wont_be :polygon?
13
- _(subject).wont_be :closed?
14
- end
15
-
16
- it "must fail to build AIXM" do
17
- _{ subject.to_xml }.must_raise AIXM::GeometryError
18
- end
19
- end
20
-
21
- context "point" do
22
- subject do
23
- AIXM.geometry.tap do |geometry|
24
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
25
- end
26
- end
27
-
28
- it "must pass checks" do
29
- _(subject).must_be :point?
30
- _(subject).wont_be :circle?
31
- _(subject).wont_be :polygon?
32
- _(subject).must_be :closed?
33
- end
34
-
35
- it "must return elements" do
36
- _(subject.segments.count).must_equal 1
37
- end
38
-
39
- it "builds valid AIXM" do
40
- _(subject.to_xml).must_equal <<~END
41
- <Avx>
42
- <codeType>GRC</codeType>
43
- <geoLat>110000.00N</geoLat>
44
- <geoLong>0220000.00E</geoLong>
45
- <codeDatum>WGE</codeDatum>
46
- </Avx>
47
- END
48
- end
49
- end
50
-
51
- context "line" do
52
- subject do
53
- AIXM.geometry.tap do |geometry|
54
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
55
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
56
- end
57
- end
58
-
59
- it "must fail checks" do
60
- _(subject).wont_be :point?
61
- _(subject).wont_be :circle?
62
- _(subject).wont_be :polygon?
63
- _(subject).wont_be :closed?
64
- end
65
-
66
- it "must fail to build AIXM" do
67
- _{ subject.to_xml }.must_raise AIXM::GeometryError
68
- end
69
- end
70
-
71
- context "closed polygon" do
72
- subject do
73
- AIXM.geometry.tap do |geometry|
74
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
75
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
76
- geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
77
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
78
- end
79
- end
80
-
81
- it "must pass checks" do
82
- _(subject).wont_be :point?
83
- _(subject).wont_be :circle?
84
- _(subject).must_be :polygon?
85
- _(subject).must_be :closed?
86
- end
87
-
88
- it "must return elements" do
89
- _(subject.segments.count).must_equal 4
90
- end
91
-
92
- it "builds valid AIXM" do
93
- _(subject.to_xml).must_equal <<~END
94
- <Avx>
95
- <codeType>GRC</codeType>
96
- <geoLat>110000.00N</geoLat>
97
- <geoLong>0220000.00E</geoLong>
98
- <codeDatum>WGE</codeDatum>
99
- </Avx>
100
- <Avx>
101
- <codeType>GRC</codeType>
102
- <geoLat>220000.00N</geoLat>
103
- <geoLong>0330000.00E</geoLong>
104
- <codeDatum>WGE</codeDatum>
105
- </Avx>
106
- <Avx>
107
- <codeType>GRC</codeType>
108
- <geoLat>330000.00N</geoLat>
109
- <geoLong>0440000.00E</geoLong>
110
- <codeDatum>WGE</codeDatum>
111
- </Avx>
112
- <Avx>
113
- <codeType>GRC</codeType>
114
- <geoLat>110000.00N</geoLat>
115
- <geoLong>0220000.00E</geoLong>
116
- <codeDatum>WGE</codeDatum>
117
- </Avx>
118
- END
119
- end
120
- end
121
-
122
- context "unclosed polygon" do
123
- subject do
124
- AIXM.geometry.tap do |geometry|
125
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
126
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
127
- geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
128
- end
129
- end
130
-
131
- it "must fail checks" do
132
- _(subject).wont_be :point?
133
- _(subject).wont_be :circle?
134
- _(subject).wont_be :polygon?
135
- _(subject).wont_be :closed?
136
- end
137
-
138
- it "must fail to build AIXM" do
139
- _{ subject.to_xml }.must_raise AIXM::GeometryError
140
- end
141
- end
142
-
143
- context "closed arc" do
144
- subject do
145
- AIXM.geometry.tap do |geometry|
146
- geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
147
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
148
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
149
- end
150
- end
151
-
152
- it "must pass checks" do
153
- _(subject).wont_be :point?
154
- _(subject).wont_be :circle?
155
- _(subject).must_be :polygon?
156
- _(subject).must_be :closed?
157
- end
158
-
159
- it "builds valid AIXM" do
160
- _(subject.to_xml).must_equal <<~END
161
- <Avx>
162
- <codeType>CWA</codeType>
163
- <geoLat>110000.00N</geoLat>
164
- <geoLong>0220000.00E</geoLong>
165
- <codeDatum>WGE</codeDatum>
166
- <geoLatArc>100000.00N</geoLatArc>
167
- <geoLongArc>0200000.00E</geoLongArc>
168
- </Avx>
169
- <Avx>
170
- <codeType>GRC</codeType>
171
- <geoLat>220000.00N</geoLat>
172
- <geoLong>0330000.00E</geoLong>
173
- <codeDatum>WGE</codeDatum>
174
- </Avx>
175
- <Avx>
176
- <codeType>GRC</codeType>
177
- <geoLat>110000.00N</geoLat>
178
- <geoLong>0220000.00E</geoLong>
179
- <codeDatum>WGE</codeDatum>
180
- </Avx>
181
- END
182
- end
183
- end
184
-
185
- context "unclosed arc" do
186
- subject do
187
- AIXM.geometry.tap do |geometry|
188
- geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
189
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
190
- end
191
- end
192
-
193
- it "must fail checks" do
194
- _(subject).wont_be :point?
195
- _(subject).wont_be :circle?
196
- _(subject).wont_be :polygon?
197
- _(subject).wont_be :closed?
198
- end
199
-
200
- it "must fail to build AIXM" do
201
- _{ subject.to_xml }.must_raise AIXM::GeometryError
202
- end
203
- end
204
-
205
- context "closed border" do
206
- subject do
207
- AIXM.geometry.tap do |geometry|
208
- geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
209
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
210
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
211
- end
212
- end
213
-
214
- it "must pass checks" do
215
- _(subject).wont_be :point?
216
- _(subject).wont_be :circle?
217
- _(subject).must_be :polygon?
218
- _(subject).must_be :closed?
219
- end
220
-
221
- it "builds valid AIXM" do
222
- _(subject.to_xml).must_equal <<~END
223
- <Avx>
224
- <GbrUid>
225
- <txtName>foobar</txtName>
226
- </GbrUid>
227
- <codeType>FNT</codeType>
228
- <geoLat>110000.00N</geoLat>
229
- <geoLong>0220000.00E</geoLong>
230
- <codeDatum>WGE</codeDatum>
231
- </Avx>
232
- <Avx>
233
- <codeType>GRC</codeType>
234
- <geoLat>220000.00N</geoLat>
235
- <geoLong>0330000.00E</geoLong>
236
- <codeDatum>WGE</codeDatum>
237
- </Avx>
238
- <Avx>
239
- <codeType>GRC</codeType>
240
- <geoLat>110000.00N</geoLat>
241
- <geoLong>0220000.00E</geoLong>
242
- <codeDatum>WGE</codeDatum>
243
- </Avx>
244
- END
245
- end
246
- end
247
-
248
- context "unclosed border" do
249
- subject do
250
- AIXM.geometry.tap do |geometry|
251
- geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
252
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
253
- end
254
- end
255
-
256
- it "must fail checks" do
257
- _(subject).wont_be :point?
258
- _(subject).wont_be :circle?
259
- _(subject).wont_be :polygon?
260
- _(subject).wont_be :closed?
261
- end
262
-
263
- it "must fail to build AIXM" do
264
- _{ subject.to_xml }.must_raise AIXM::GeometryError
265
- end
266
- end
267
-
268
- context "circle" do
269
- subject do
270
- AIXM.geometry.tap do |geometry|
271
- geometry << AIXM.circle(center_xy: AIXM.xy(lat: 11, long: 22), radius: AIXM.d(10, :km))
272
- end
273
- end
274
-
275
- it "must pass checks" do
276
- _(subject).wont_be :point?
277
- _(subject).must_be :circle?
278
- _(subject).wont_be :polygon?
279
- _(subject).must_be :closed?
280
- end
281
-
282
- it "builds valid AIXM" do
283
- _(subject.to_xml).must_equal <<~END
284
- <Avx>
285
- <codeType>CWA</codeType>
286
- <geoLat>110523.76N</geoLat>
287
- <geoLong>0220000.00E</geoLong>
288
- <codeDatum>WGE</codeDatum>
289
- <geoLatArc>110000.00N</geoLatArc>
290
- <geoLongArc>0220000.00E</geoLongArc>
291
- </Avx>
292
- END
293
- end
294
- end
295
-
296
- context "circle with additional elements" do
297
- subject do
298
- AIXM.geometry.tap do |geometry|
299
- geometry << AIXM.circle(center_xy: AIXM.xy(lat: 11, long: 22), radius: AIXM.d(10, :km))
300
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
301
- end
302
- end
303
-
304
- it "must fail checks when additional elements are present" do
305
- _(subject).wont_be :point?
306
- _(subject).wont_be :circle?
307
- _(subject).wont_be :polygon?
308
- _(subject).wont_be :closed?
309
- end
310
-
311
- it "must fail to build AIXM" do
312
- _{ subject.to_xml }.must_raise AIXM::GeometryError
313
- end
314
- end
315
-
316
- end