aixm 0.2.3 → 0.3.0
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/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.yardopts +3 -0
- data/CHANGELOG.md +34 -14
- data/Guardfile +1 -0
- data/README.md +64 -257
- data/lib/aixm.rb +16 -7
- data/lib/aixm/component.rb +6 -0
- data/lib/aixm/component/frequency.rb +135 -0
- data/lib/aixm/component/geometry.rb +34 -23
- data/lib/aixm/component/geometry/arc.rb +37 -22
- data/lib/aixm/component/geometry/border.rb +29 -20
- data/lib/aixm/component/geometry/circle.rb +39 -22
- data/lib/aixm/component/geometry/point.rb +29 -13
- data/lib/aixm/component/helipad.rb +154 -0
- data/lib/aixm/component/layer.rb +91 -0
- data/lib/aixm/component/runway.rb +294 -0
- data/lib/aixm/component/service.rb +170 -0
- data/lib/aixm/component/timetable.rb +65 -0
- data/lib/aixm/component/vertical_limits.rb +65 -29
- data/lib/aixm/config.rb +87 -0
- data/lib/aixm/document.rb +66 -42
- data/lib/aixm/errors.rb +11 -0
- data/lib/aixm/f.rb +34 -20
- data/lib/aixm/feature.rb +38 -0
- data/lib/aixm/feature/airport.rb +473 -0
- data/lib/aixm/feature/airspace.rb +145 -92
- data/lib/aixm/feature/navigational_aid.rb +94 -0
- data/lib/aixm/feature/navigational_aid/designated_point.rb +50 -54
- data/lib/aixm/feature/navigational_aid/dme.rb +48 -40
- data/lib/aixm/feature/navigational_aid/marker.rb +55 -45
- data/lib/aixm/feature/navigational_aid/ndb.rb +54 -50
- data/lib/aixm/feature/navigational_aid/tacan.rb +38 -31
- data/lib/aixm/feature/navigational_aid/vor.rb +84 -76
- data/lib/aixm/feature/organisation.rb +97 -0
- data/lib/aixm/feature/unit.rb +152 -0
- data/lib/aixm/refinements.rb +132 -47
- data/lib/aixm/shortcuts.rb +11 -6
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +64 -20
- data/lib/aixm/z.rb +51 -22
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-DataTypes.xsd +0 -0
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Features.xsd +0 -0
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Snapshot.xsd +0 -0
- data/schemas/ofmx/0/OFMX-DataTypes.xsd +5077 -0
- data/schemas/ofmx/0/OFMX-Features.xsd +9955 -0
- data/schemas/ofmx/0/OFMX-Snapshot.xsd +217 -0
- data/spec/factory.rb +209 -33
- data/spec/lib/aixm/component/frequency_spec.rb +75 -0
- data/spec/lib/aixm/component/geometry/arc_spec.rb +28 -22
- data/spec/lib/aixm/component/geometry/border_spec.rb +23 -20
- data/spec/lib/aixm/component/geometry/circle_spec.rb +31 -22
- data/spec/lib/aixm/component/geometry/point_spec.rb +11 -14
- data/spec/lib/aixm/component/geometry_spec.rb +150 -69
- data/spec/lib/aixm/component/helipad_spec.rb +136 -0
- data/spec/lib/aixm/component/layer_spec.rb +110 -0
- data/spec/lib/aixm/component/runway_spec.rb +402 -0
- data/spec/lib/aixm/component/service_spec.rb +61 -0
- data/spec/lib/aixm/component/timetable_spec.rb +49 -0
- data/spec/lib/aixm/component/vertical_limits_spec.rb +39 -20
- data/spec/lib/aixm/config_spec.rb +41 -0
- data/spec/lib/aixm/document_spec.rb +637 -147
- data/spec/lib/aixm/errors_spec.rb +14 -0
- data/spec/lib/aixm/f_spec.rb +17 -10
- data/spec/lib/aixm/feature/airport_spec.rb +546 -0
- data/spec/lib/aixm/feature/airspace_spec.rb +349 -226
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +47 -36
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +61 -36
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +61 -113
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +65 -79
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +57 -36
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +86 -112
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +52 -0
- data/spec/lib/aixm/feature/organisation_spec.rb +77 -0
- data/spec/lib/aixm/feature/unit_spec.rb +227 -0
- data/spec/lib/aixm/feature_spec.rb +58 -0
- data/spec/lib/aixm/refinements_spec.rb +187 -178
- data/spec/lib/aixm/xy_spec.rb +45 -34
- data/spec/lib/aixm/z_spec.rb +19 -21
- data/spec/macros/organisation.rb +11 -0
- data/spec/macros/remarks.rb +12 -0
- data/spec/macros/timetable.rb +11 -0
- data/spec/macros/xy.rb +11 -0
- data/spec/macros/z_qnh.rb +11 -0
- data/spec/spec_helper.rb +26 -0
- metadata +60 -19
- data/lib/aixm/base.rb +0 -10
- data/lib/aixm/component/base.rb +0 -6
- data/lib/aixm/component/class_layer.rb +0 -46
- data/lib/aixm/component/geometry/base.rb +0 -8
- data/lib/aixm/component/schedule.rb +0 -43
- data/lib/aixm/feature/base.rb +0 -6
- data/lib/aixm/feature/navigational_aid/base.rb +0 -79
- data/spec/lib/aixm/component/class_layer_spec.rb +0 -74
- data/spec/lib/aixm/component/schedule_spec.rb +0 -33
- data/spec/lib/aixm/feature/navigational_aid/base_spec.rb +0 -41
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
75
|
+
end
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
require_relative '../../../../spec_helper'
|
|
2
2
|
|
|
3
3
|
describe AIXM::Component::Geometry::Arc do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
xy
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
10
25
|
end
|
|
11
26
|
end
|
|
12
27
|
|
|
@@ -18,25 +33,15 @@ describe AIXM::Component::Geometry::Arc do
|
|
|
18
33
|
end
|
|
19
34
|
end
|
|
20
35
|
|
|
21
|
-
describe :
|
|
22
|
-
it "
|
|
23
|
-
subject = AIXM.arc(
|
|
24
|
-
xy: AIXM.xy(lat: 11.1, long: 33.3),
|
|
25
|
-
center_xy: AIXM.xy(lat: 22.2, long: 33.3),
|
|
26
|
-
clockwise: true
|
|
27
|
-
)
|
|
28
|
-
subject.to_digest.must_equal 712900173
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe :to_aixm do
|
|
33
|
-
it "must build correct XML for clockwise arcs" do
|
|
36
|
+
describe :to_xml do
|
|
37
|
+
it "builds correct AIXM for clockwise arcs" do
|
|
34
38
|
subject = AIXM.arc(
|
|
35
39
|
xy: AIXM.xy(lat: 11.1, long: 33.3),
|
|
36
40
|
center_xy: AIXM.xy(lat: 22.2, long: 33.3),
|
|
37
41
|
clockwise: true
|
|
38
42
|
)
|
|
39
|
-
|
|
43
|
+
AIXM.aixm!
|
|
44
|
+
subject.to_xml.must_equal <<~END
|
|
40
45
|
<Avx>
|
|
41
46
|
<codeType>CWA</codeType>
|
|
42
47
|
<geoLat>110600.00N</geoLat>
|
|
@@ -48,13 +53,14 @@ describe AIXM::Component::Geometry::Arc do
|
|
|
48
53
|
END
|
|
49
54
|
end
|
|
50
55
|
|
|
51
|
-
it "
|
|
56
|
+
it "builds correct AIXM for counter-clockwise arcs" do
|
|
52
57
|
subject = AIXM.arc(
|
|
53
58
|
xy: AIXM.xy(lat: 11.1, long: 33.3),
|
|
54
59
|
center_xy: AIXM.xy(lat: 22.2, long: 33.3),
|
|
55
60
|
clockwise: false
|
|
56
61
|
)
|
|
57
|
-
|
|
62
|
+
AIXM.aixm!
|
|
63
|
+
subject.to_xml.must_equal <<~END
|
|
58
64
|
<Avx>
|
|
59
65
|
<codeType>CCA</codeType>
|
|
60
66
|
<geoLat>110600.00N</geoLat>
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
require_relative '../../../../spec_helper'
|
|
2
2
|
|
|
3
3
|
describe AIXM::Component::Geometry::Border do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
11
14
|
end
|
|
12
15
|
end
|
|
13
16
|
|
|
14
|
-
describe :
|
|
15
|
-
it "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
describe :to_xml do
|
|
18
|
+
it "builds correct AIXM" do
|
|
19
|
+
AIXM.aixm!
|
|
20
|
+
subject.to_xml.must_equal <<~END
|
|
21
|
+
<Avx>
|
|
22
|
+
<GbrUid>
|
|
23
|
+
<txtName>FRANCE-SWITZERLAND</txtName>
|
|
24
|
+
</GbrUid>
|
|
25
|
+
<codeType>FNT</codeType>
|
|
26
|
+
<geoLat>110600.00N</geoLat>
|
|
27
|
+
<geoLong>0221200.00E</geoLong>
|
|
28
|
+
<codeDatum>WGE</codeDatum>
|
|
29
|
+
</Avx>
|
|
27
30
|
END
|
|
28
31
|
end
|
|
29
32
|
end
|
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
require_relative '../../../../spec_helper'
|
|
2
2
|
|
|
3
3
|
describe AIXM::Component::Geometry::Circle do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
subject do
|
|
5
|
+
AIXM.circle(
|
|
6
|
+
center_xy: AIXM.xy(lat: 12.12345678, long: -23.12345678),
|
|
7
|
+
radius: 15
|
|
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
|
|
7
18
|
end
|
|
8
19
|
end
|
|
9
20
|
|
|
10
|
-
describe :
|
|
11
|
-
it "
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
subject.
|
|
21
|
+
describe :radius= do
|
|
22
|
+
it "fails on invalid values" do
|
|
23
|
+
[nil, 0, -5].wont_be_written_to subject, :radius
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "converts Numeric to Float" do
|
|
27
|
+
subject.tap { |s| s.radius = 5 }.radius.must_equal 5.0
|
|
17
28
|
end
|
|
18
29
|
end
|
|
19
30
|
|
|
20
|
-
describe :
|
|
21
|
-
it "must
|
|
22
|
-
subject
|
|
23
|
-
center_xy: AIXM.xy(lat: 12.12345678, long: -23.12345678),
|
|
24
|
-
radius: 15
|
|
25
|
-
)
|
|
26
|
-
subject.to_digest.must_equal 386055945
|
|
31
|
+
describe :north_xy do
|
|
32
|
+
it "must calculate approximation of northmost point on the circumference" do
|
|
33
|
+
subject.send(:north_xy).must_equal AIXM.xy(lat: 12.25835483455868, long: -23.12345678)
|
|
27
34
|
end
|
|
28
35
|
end
|
|
29
36
|
|
|
30
|
-
describe :
|
|
31
|
-
it "
|
|
37
|
+
describe :to_xml do
|
|
38
|
+
it "builds correct AIXM for circles not near the equator" do
|
|
32
39
|
subject = AIXM.circle(
|
|
33
40
|
center_xy: AIXM.xy(lat: 11.1, long: 22.2),
|
|
34
41
|
radius: 25
|
|
35
42
|
)
|
|
36
|
-
|
|
43
|
+
AIXM.aixm!
|
|
44
|
+
subject.to_xml.must_equal <<~END
|
|
37
45
|
<Avx>
|
|
38
46
|
<codeType>CWA</codeType>
|
|
39
47
|
<geoLat>111929.39N</geoLat>
|
|
@@ -45,12 +53,13 @@ describe AIXM::Component::Geometry::Circle do
|
|
|
45
53
|
END
|
|
46
54
|
end
|
|
47
55
|
|
|
48
|
-
it "
|
|
56
|
+
it "builds correct AIXM for circles near the equator" do
|
|
49
57
|
subject = AIXM.circle(
|
|
50
58
|
center_xy: AIXM.xy(lat: -0.0005, long: -22.2),
|
|
51
59
|
radius: 50
|
|
52
60
|
)
|
|
53
|
-
|
|
61
|
+
AIXM.aixm!
|
|
62
|
+
subject.to_xml.must_equal <<~END
|
|
54
63
|
<Avx>
|
|
55
64
|
<codeType>CWA</codeType>
|
|
56
65
|
<geoLat>002656.98N</geoLat>
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
require_relative '../../../../spec_helper'
|
|
2
2
|
|
|
3
3
|
describe AIXM::Component::Geometry::Point do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-> { AIXM.point(xy: 0) }.must_raise ArgumentError
|
|
7
|
-
end
|
|
4
|
+
subject do
|
|
5
|
+
AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
|
|
8
6
|
end
|
|
9
7
|
|
|
10
|
-
describe :
|
|
11
|
-
|
|
12
|
-
subject = AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
|
|
13
|
-
subject.to_digest.must_equal 167706171
|
|
14
|
-
end
|
|
8
|
+
describe :xy= do
|
|
9
|
+
macro :xy
|
|
15
10
|
end
|
|
16
11
|
|
|
17
|
-
describe :
|
|
18
|
-
it "
|
|
12
|
+
describe :to_xml do
|
|
13
|
+
it "builds correct AIXM for N/E points" do
|
|
19
14
|
subject = AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
|
|
20
|
-
|
|
15
|
+
AIXM.aixm!
|
|
16
|
+
subject.to_xml.must_equal <<~END
|
|
21
17
|
<Avx>
|
|
22
18
|
<codeType>GRC</codeType>
|
|
23
19
|
<geoLat>110600.00N</geoLat>
|
|
@@ -27,9 +23,10 @@ describe AIXM::Component::Geometry::Point do
|
|
|
27
23
|
END
|
|
28
24
|
end
|
|
29
25
|
|
|
30
|
-
it "
|
|
26
|
+
it "builds correct AIXM for S/W points" do
|
|
31
27
|
subject = AIXM.point(xy: AIXM.xy(lat: -11.1, long: -22.2))
|
|
32
|
-
|
|
28
|
+
AIXM.aixm!
|
|
29
|
+
subject.to_xml.must_equal <<~END
|
|
33
30
|
<Avx>
|
|
34
31
|
<codeType>GRC</codeType>
|
|
35
32
|
<geoLat>110600.00S</geoLat>
|
|
@@ -6,10 +6,14 @@ describe AIXM::Component::Geometry do
|
|
|
6
6
|
AIXM.geometry
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
it "must fail
|
|
9
|
+
it "must fail checks" do
|
|
10
10
|
subject.wont_be :circle?
|
|
11
|
-
subject.wont_be :
|
|
12
|
-
subject.wont_be :
|
|
11
|
+
subject.wont_be :polygon?
|
|
12
|
+
subject.wont_be :closed?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "must fail to build AIXM" do
|
|
16
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
13
17
|
end
|
|
14
18
|
end
|
|
15
19
|
|
|
@@ -20,10 +24,14 @@ describe AIXM::Component::Geometry do
|
|
|
20
24
|
end
|
|
21
25
|
end
|
|
22
26
|
|
|
23
|
-
it "must fail
|
|
27
|
+
it "must fail checks" do
|
|
24
28
|
subject.wont_be :circle?
|
|
25
|
-
subject.wont_be :
|
|
26
|
-
subject.wont_be :
|
|
29
|
+
subject.wont_be :polygon?
|
|
30
|
+
subject.wont_be :closed?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "must fail to build AIXM" do
|
|
34
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
27
35
|
end
|
|
28
36
|
end
|
|
29
37
|
|
|
@@ -35,44 +43,40 @@ describe AIXM::Component::Geometry do
|
|
|
35
43
|
end
|
|
36
44
|
end
|
|
37
45
|
|
|
38
|
-
it "must fail
|
|
46
|
+
it "must fail checks" do
|
|
39
47
|
subject.wont_be :circle?
|
|
40
|
-
subject.wont_be :
|
|
41
|
-
subject.wont_be :
|
|
48
|
+
subject.wont_be :polygon?
|
|
49
|
+
subject.wont_be :closed?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "must fail to build AIXM" do
|
|
53
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
42
54
|
end
|
|
43
55
|
end
|
|
44
56
|
|
|
45
|
-
context "polygon" do
|
|
57
|
+
context "closed polygon" do
|
|
46
58
|
subject do
|
|
47
59
|
AIXM.geometry.tap do |geometry|
|
|
48
60
|
geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
49
61
|
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
62
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
|
|
63
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
50
64
|
end
|
|
51
65
|
end
|
|
52
66
|
|
|
53
|
-
it "must
|
|
67
|
+
it "must pass checks" do
|
|
54
68
|
subject.wont_be :circle?
|
|
55
|
-
subject.
|
|
56
|
-
subject.
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "must recognize closed" do
|
|
60
|
-
subject << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
61
|
-
subject.wont_be :circle?
|
|
62
|
-
subject.must_be :closed_shape?
|
|
63
|
-
subject.must_be :complete?
|
|
69
|
+
subject.must_be :polygon?
|
|
70
|
+
subject.must_be :closed?
|
|
64
71
|
end
|
|
65
72
|
|
|
66
73
|
it "must return elements" do
|
|
67
|
-
subject.segments.count.must_equal
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "must return digest of payload" do
|
|
71
|
-
subject.to_digest.must_equal 310635400
|
|
74
|
+
subject.segments.count.must_equal 4
|
|
72
75
|
end
|
|
73
76
|
|
|
74
|
-
it "
|
|
75
|
-
|
|
77
|
+
it "builds valid AIXM" do
|
|
78
|
+
AIXM.aixm!
|
|
79
|
+
subject.to_xml.must_equal <<~END
|
|
76
80
|
<Avx>
|
|
77
81
|
<codeType>GRC</codeType>
|
|
78
82
|
<geoLat>110000.00N</geoLat>
|
|
@@ -85,33 +89,60 @@ describe AIXM::Component::Geometry do
|
|
|
85
89
|
<geoLong>0330000.00E</geoLong>
|
|
86
90
|
<codeDatum>WGE</codeDatum>
|
|
87
91
|
</Avx>
|
|
92
|
+
<Avx>
|
|
93
|
+
<codeType>GRC</codeType>
|
|
94
|
+
<geoLat>330000.00N</geoLat>
|
|
95
|
+
<geoLong>0440000.00E</geoLong>
|
|
96
|
+
<codeDatum>WGE</codeDatum>
|
|
97
|
+
</Avx>
|
|
98
|
+
<Avx>
|
|
99
|
+
<codeType>GRC</codeType>
|
|
100
|
+
<geoLat>110000.00N</geoLat>
|
|
101
|
+
<geoLong>0220000.00E</geoLong>
|
|
102
|
+
<codeDatum>WGE</codeDatum>
|
|
103
|
+
</Avx>
|
|
88
104
|
END
|
|
89
105
|
end
|
|
90
106
|
end
|
|
91
107
|
|
|
92
|
-
context "
|
|
108
|
+
context "unclosed polygon" do
|
|
93
109
|
subject do
|
|
94
110
|
AIXM.geometry.tap do |geometry|
|
|
95
|
-
geometry << AIXM.
|
|
111
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
96
112
|
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
113
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
|
|
97
114
|
end
|
|
98
115
|
end
|
|
99
116
|
|
|
100
|
-
it "must
|
|
117
|
+
it "must fail checks" do
|
|
101
118
|
subject.wont_be :circle?
|
|
102
|
-
subject.wont_be :
|
|
103
|
-
subject.wont_be :
|
|
119
|
+
subject.wont_be :polygon?
|
|
120
|
+
subject.wont_be :closed?
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "must fail to build AIXM" do
|
|
124
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
context "closed arc" do
|
|
129
|
+
subject do
|
|
130
|
+
AIXM.geometry.tap do |geometry|
|
|
131
|
+
geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
|
|
132
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
133
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
134
|
+
end
|
|
104
135
|
end
|
|
105
136
|
|
|
106
|
-
it "must
|
|
107
|
-
subject << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
137
|
+
it "must pass checks" do
|
|
108
138
|
subject.wont_be :circle?
|
|
109
|
-
subject.must_be :
|
|
110
|
-
subject.must_be :
|
|
139
|
+
subject.must_be :polygon?
|
|
140
|
+
subject.must_be :closed?
|
|
111
141
|
end
|
|
112
142
|
|
|
113
|
-
it "
|
|
114
|
-
|
|
143
|
+
it "builds valid AIXM" do
|
|
144
|
+
AIXM.aixm!
|
|
145
|
+
subject.to_xml.must_equal <<~END
|
|
115
146
|
<Avx>
|
|
116
147
|
<codeType>CWA</codeType>
|
|
117
148
|
<geoLat>110000.00N</geoLat>
|
|
@@ -126,38 +157,57 @@ describe AIXM::Component::Geometry do
|
|
|
126
157
|
<geoLong>0330000.00E</geoLong>
|
|
127
158
|
<codeDatum>WGE</codeDatum>
|
|
128
159
|
</Avx>
|
|
160
|
+
<Avx>
|
|
161
|
+
<codeType>GRC</codeType>
|
|
162
|
+
<geoLat>110000.00N</geoLat>
|
|
163
|
+
<geoLong>0220000.00E</geoLong>
|
|
164
|
+
<codeDatum>WGE</codeDatum>
|
|
165
|
+
</Avx>
|
|
129
166
|
END
|
|
130
167
|
end
|
|
131
|
-
|
|
132
|
-
it "must return digest of payload" do
|
|
133
|
-
subject.to_digest.must_equal 8205396
|
|
134
|
-
end
|
|
135
168
|
end
|
|
136
169
|
|
|
137
|
-
context "
|
|
170
|
+
context "unclosed arc" do
|
|
138
171
|
subject do
|
|
139
172
|
AIXM.geometry.tap do |geometry|
|
|
140
|
-
geometry << AIXM.
|
|
173
|
+
geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
|
|
141
174
|
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
142
175
|
end
|
|
143
176
|
end
|
|
144
177
|
|
|
145
|
-
it "must
|
|
178
|
+
it "must fail checks" do
|
|
146
179
|
subject.wont_be :circle?
|
|
147
|
-
subject.wont_be :
|
|
148
|
-
subject.wont_be :
|
|
180
|
+
subject.wont_be :polygon?
|
|
181
|
+
subject.wont_be :closed?
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
it "must fail to build AIXM" do
|
|
185
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
context "closed border" do
|
|
190
|
+
subject do
|
|
191
|
+
AIXM.geometry.tap do |geometry|
|
|
192
|
+
geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
|
|
193
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
194
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
195
|
+
end
|
|
149
196
|
end
|
|
150
197
|
|
|
151
|
-
it "must
|
|
152
|
-
subject << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
|
|
198
|
+
it "must pass checks" do
|
|
153
199
|
subject.wont_be :circle?
|
|
154
|
-
subject.must_be :
|
|
155
|
-
subject.must_be :
|
|
200
|
+
subject.must_be :polygon?
|
|
201
|
+
subject.must_be :closed?
|
|
156
202
|
end
|
|
157
203
|
|
|
158
|
-
it "
|
|
159
|
-
|
|
204
|
+
it "builds valid AIXM" do
|
|
205
|
+
AIXM.aixm!
|
|
206
|
+
subject.to_xml.must_equal <<~END
|
|
160
207
|
<Avx>
|
|
208
|
+
<GbrUid>
|
|
209
|
+
<txtName>foobar</txtName>
|
|
210
|
+
</GbrUid>
|
|
161
211
|
<codeType>FNT</codeType>
|
|
162
212
|
<geoLat>110000.00N</geoLat>
|
|
163
213
|
<geoLong>0220000.00E</geoLong>
|
|
@@ -169,11 +219,32 @@ describe AIXM::Component::Geometry do
|
|
|
169
219
|
<geoLong>0330000.00E</geoLong>
|
|
170
220
|
<codeDatum>WGE</codeDatum>
|
|
171
221
|
</Avx>
|
|
222
|
+
<Avx>
|
|
223
|
+
<codeType>GRC</codeType>
|
|
224
|
+
<geoLat>110000.00N</geoLat>
|
|
225
|
+
<geoLong>0220000.00E</geoLong>
|
|
226
|
+
<codeDatum>WGE</codeDatum>
|
|
227
|
+
</Avx>
|
|
172
228
|
END
|
|
173
229
|
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
context "unclosed border" do
|
|
233
|
+
subject do
|
|
234
|
+
AIXM.geometry.tap do |geometry|
|
|
235
|
+
geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
|
|
236
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
237
|
+
end
|
|
238
|
+
end
|
|
174
239
|
|
|
175
|
-
it "must
|
|
176
|
-
subject.
|
|
240
|
+
it "must fail checks" do
|
|
241
|
+
subject.wont_be :circle?
|
|
242
|
+
subject.wont_be :polygon?
|
|
243
|
+
subject.wont_be :closed?
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
it "must fail to build AIXM" do
|
|
247
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
177
248
|
end
|
|
178
249
|
end
|
|
179
250
|
|
|
@@ -184,21 +255,15 @@ describe AIXM::Component::Geometry do
|
|
|
184
255
|
end
|
|
185
256
|
end
|
|
186
257
|
|
|
187
|
-
it "must pass
|
|
258
|
+
it "must pass checks" do
|
|
188
259
|
subject.must_be :circle?
|
|
189
|
-
subject.wont_be :
|
|
190
|
-
subject.must_be :
|
|
260
|
+
subject.wont_be :polygon?
|
|
261
|
+
subject.must_be :closed?
|
|
191
262
|
end
|
|
192
263
|
|
|
193
|
-
it "
|
|
194
|
-
|
|
195
|
-
subject.
|
|
196
|
-
subject.wont_be :closed_shape?
|
|
197
|
-
subject.wont_be :complete?
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
it "must build valid XML" do
|
|
201
|
-
subject.to_aixm.must_equal <<~END
|
|
264
|
+
it "builds valid AIXM" do
|
|
265
|
+
AIXM.aixm!
|
|
266
|
+
subject.to_xml.must_equal <<~END
|
|
202
267
|
<Avx>
|
|
203
268
|
<codeType>CWA</codeType>
|
|
204
269
|
<geoLat>110523.76N</geoLat>
|
|
@@ -209,9 +274,25 @@ describe AIXM::Component::Geometry do
|
|
|
209
274
|
</Avx>
|
|
210
275
|
END
|
|
211
276
|
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
context "circle with additional elements" do
|
|
280
|
+
subject do
|
|
281
|
+
AIXM.geometry.tap do |geometry|
|
|
282
|
+
geometry << AIXM.circle(center_xy: AIXM.xy(lat: 11, long: 22), radius: 10)
|
|
283
|
+
geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
|
|
284
|
+
end
|
|
285
|
+
end
|
|
212
286
|
|
|
213
|
-
it "must
|
|
214
|
-
subject.
|
|
287
|
+
it "must fail checks when additional elements are present" do
|
|
288
|
+
subject.wont_be :circle?
|
|
289
|
+
subject.wont_be :polygon?
|
|
290
|
+
subject.wont_be :closed?
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
it "must fail to build AIXM" do
|
|
294
|
+
-> { subject.to_xml }.must_raise AIXM::GeometryError
|
|
215
295
|
end
|
|
216
296
|
end
|
|
297
|
+
|
|
217
298
|
end
|