rgeo 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +9 -7
- data/README.rdoc +7 -5
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +12 -19
- data/ext/geos_c_impl/factory.h +15 -21
- data/ext/geos_c_impl/geometry.c +19 -36
- data/ext/geos_c_impl/geometry.h +2 -12
- data/ext/geos_c_impl/geometry_collection.c +38 -157
- data/ext/geos_c_impl/geometry_collection.h +2 -12
- data/ext/geos_c_impl/line_string.c +83 -80
- data/ext/geos_c_impl/line_string.h +2 -12
- data/ext/geos_c_impl/main.c +5 -0
- data/ext/geos_c_impl/point.c +2 -12
- data/ext/geos_c_impl/point.h +2 -12
- data/ext/geos_c_impl/polygon.c +5 -14
- data/ext/geos_c_impl/polygon.h +2 -12
- data/ext/geos_c_impl/preface.h +8 -0
- data/lib/rgeo.rb +34 -16
- data/lib/rgeo/{geography/simple_spherical/geometry_collection_impl.rb → cartesian.rb} +19 -26
- data/lib/rgeo/cartesian/calculations.rb +129 -0
- data/lib/rgeo/cartesian/interface.rb +85 -0
- data/lib/rgeo/cartesian/simple_factory.rb +159 -0
- data/lib/rgeo/cartesian/simple_feature_classes.rb +187 -0
- data/lib/rgeo/cartesian/simple_feature_methods.rb +97 -0
- data/lib/rgeo/features.rb +1 -0
- data/lib/rgeo/features/curve.rb +3 -2
- data/lib/rgeo/features/factory.rb +62 -37
- data/lib/rgeo/features/geometry.rb +10 -32
- data/lib/rgeo/features/geometry_collection.rb +3 -2
- data/lib/rgeo/features/line.rb +3 -2
- data/lib/rgeo/features/line_string.rb +3 -2
- data/lib/rgeo/features/linear_ring.rb +3 -2
- data/lib/rgeo/features/multi_curve.rb +3 -2
- data/lib/rgeo/features/multi_line_string.rb +3 -2
- data/lib/rgeo/features/multi_point.rb +3 -2
- data/lib/rgeo/features/multi_polygon.rb +3 -2
- data/lib/rgeo/features/multi_surface.rb +3 -2
- data/lib/rgeo/features/point.rb +3 -2
- data/lib/rgeo/features/polygon.rb +3 -2
- data/lib/rgeo/features/surface.rb +3 -2
- data/lib/rgeo/features/types.rb +198 -0
- data/lib/rgeo/geography.rb +4 -14
- data/lib/rgeo/geography/factory.rb +7 -64
- data/lib/rgeo/geography/{simple_spherical/geometry_methods.rb → helper.rb} +4 -13
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +35 -89
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +22 -31
- data/lib/rgeo/geography/simple_mercator/projector.rb +4 -8
- data/lib/rgeo/geography/simple_spherical/calculations.rb +11 -9
- data/lib/rgeo/geography/simple_spherical/feature_classes.rb +189 -0
- data/lib/rgeo/geography/simple_spherical/{line_string_impl.rb → feature_methods.rb} +16 -64
- data/lib/rgeo/geos/factory.rb +26 -40
- data/lib/rgeo/geos/impl_additions.rb +3 -5
- data/lib/rgeo/{geography/simple_spherical/polygon_impl.rb → impl_helpers.rb} +16 -26
- data/lib/rgeo/impl_helpers/basic_geometry_collection_methods.rb +186 -0
- data/lib/rgeo/impl_helpers/basic_geometry_methods.rb +90 -0
- data/lib/rgeo/impl_helpers/basic_line_string_methods.rb +188 -0
- data/lib/rgeo/impl_helpers/basic_point_methods.rb +149 -0
- data/lib/rgeo/{geography/common/helper.rb → impl_helpers/basic_polygon_methods.rb} +62 -53
- data/lib/rgeo/{geography/common/polygon_methods.rb → impl_helpers/serialization.rb} +50 -42
- data/tests/common/geometry_collection_tests.rb +9 -7
- data/tests/common/multi_line_string_tests.rb +16 -13
- data/tests/common/multi_point_tests.rb +16 -13
- data/tests/common/multi_polygon_tests.rb +8 -6
- data/tests/common/point_tests.rb +1 -2
- data/tests/common/polygon_tests.rb +9 -9
- data/tests/geos/tc_multi_line_string.rb +2 -2
- data/tests/simple_cartesian/tc_calculations.rb +138 -0
- data/tests/simple_cartesian/tc_geometry_collection.rb +68 -0
- data/tests/simple_cartesian/tc_line_string.rb +70 -0
- data/{lib/rgeo/geography/simple_spherical/multi_line_string_impl.rb → tests/simple_cartesian/tc_multi_line_string.rb} +19 -19
- data/{lib/rgeo/geography/simple_spherical/multi_polygon_impl.rb → tests/simple_cartesian/tc_multi_point.rb} +19 -19
- data/{lib/rgeo/geography/common/geometry_methods.rb → tests/simple_cartesian/tc_multi_polygon.rb} +19 -41
- data/{lib/rgeo/geography/simple_spherical/point_impl.rb → tests/simple_cartesian/tc_point.rb} +33 -35
- data/tests/simple_cartesian/tc_polygon.rb +67 -0
- data/tests/simple_spherical/tc_geometry_collection.rb +68 -0
- data/tests/simple_spherical/tc_line_string.rb +10 -171
- data/tests/simple_spherical/tc_multi_line_string.rb +67 -0
- data/{lib/rgeo/geography/simple_spherical/multi_point_impl.rb → tests/simple_spherical/tc_multi_point.rb} +19 -19
- data/tests/simple_spherical/tc_multi_polygon.rb +70 -0
- data/tests/simple_spherical/tc_point.rb +17 -115
- data/tests/simple_spherical/tc_polygon.rb +67 -0
- metadata +46 -18
- data/ext/geos_c_impl/globals.h +0 -58
- data/lib/rgeo/geography/common/geometry_collection_methods.rb +0 -217
- data/lib/rgeo/geography/common/line_string_methods.rb +0 -201
- data/lib/rgeo/geography/common/point_methods.rb +0 -153
@@ -1,6 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Basic methods used by geometry objects
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
# Copyright 2010 Daniel Azuma
|
@@ -36,87 +36,95 @@
|
|
36
36
|
|
37
37
|
module RGeo
|
38
38
|
|
39
|
-
module
|
39
|
+
module ImplHelpers # :nodoc:
|
40
40
|
|
41
|
-
|
41
|
+
|
42
|
+
module Serialization # :nodoc:
|
42
43
|
|
44
|
+
@helper_factory = false
|
43
45
|
|
44
|
-
|
46
|
+
class << self
|
45
47
|
|
46
48
|
|
47
|
-
def
|
48
|
-
@
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
@interior_rings.each do |ring_|
|
54
|
-
unless Features::LinearRing.check_type(ring_)
|
55
|
-
raise Errors::InvalidGeometry, 'Interior ring must be a LinearRing'
|
49
|
+
def _helper_factory
|
50
|
+
if @helper_factory == false
|
51
|
+
if Geos.supported?
|
52
|
+
@helper_factory = Geos.factory(:srid => 0)
|
53
|
+
else
|
54
|
+
@helper_factory = nil
|
56
55
|
end
|
57
56
|
end
|
58
|
-
|
57
|
+
@helper_factory
|
59
58
|
end
|
60
59
|
|
61
60
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@exterior_ring
|
68
|
-
when Features::LineString
|
69
|
-
@exterior_ring.cast(type_)
|
70
|
-
when Features::GeometryCollection
|
71
|
-
factory.collection([self]) rescue nil
|
72
|
-
when Features::MultiPolygon
|
73
|
-
factory.multi_polygon([self]) rescue nil
|
61
|
+
def parse_wkt(str_, factory_)
|
62
|
+
helper_factory_ = _helper_factory
|
63
|
+
if helper_factory_
|
64
|
+
obj_ = helper_factory_.parse_wkt(str_)
|
65
|
+
obj_ ? Features.cast(obj_, factory_) : nil
|
74
66
|
else
|
75
|
-
|
67
|
+
default_parse_wkt(str_, factory_)
|
76
68
|
end
|
77
69
|
end
|
78
70
|
|
79
71
|
|
80
|
-
def
|
81
|
-
|
72
|
+
def parse_wkb(str_, factory_)
|
73
|
+
helper_factory_ = _helper_factory
|
74
|
+
if helper_factory_
|
75
|
+
obj_ = helper_factory_.parse_wkb(str_)
|
76
|
+
obj_ ? Features.cast(obj_, factory_) : nil
|
77
|
+
else
|
78
|
+
default_parse_wkb(str_, factory_)
|
79
|
+
end
|
82
80
|
end
|
83
81
|
|
84
82
|
|
85
|
-
def
|
86
|
-
|
83
|
+
def unparse_wkt(obj_)
|
84
|
+
helper_factory_ = _helper_factory
|
85
|
+
if helper_factory_
|
86
|
+
Features.cast(obj_, helper_factory_).as_text
|
87
|
+
else
|
88
|
+
default_unparse_wkt(obj_)
|
89
|
+
end
|
87
90
|
end
|
88
91
|
|
89
92
|
|
90
|
-
def
|
91
|
-
|
93
|
+
def unparse_wkb(obj_)
|
94
|
+
helper_factory_ = _helper_factory
|
95
|
+
if helper_factory_
|
96
|
+
Features.cast(obj_, helper_factory_).as_binary
|
97
|
+
else
|
98
|
+
default_unparse_wkb(obj_)
|
99
|
+
end
|
92
100
|
end
|
93
101
|
|
94
102
|
|
95
|
-
def
|
96
|
-
|
103
|
+
def default_parse_wkt(str_, factory_)
|
104
|
+
nil # TODO
|
97
105
|
end
|
98
106
|
|
99
107
|
|
100
|
-
def
|
101
|
-
|
108
|
+
def default_parse_wkb(str_, factory_)
|
109
|
+
nil # TODO
|
102
110
|
end
|
103
111
|
|
104
112
|
|
105
|
-
def
|
106
|
-
|
113
|
+
def default_unparse_wkt(obj_)
|
114
|
+
nil # TODO
|
107
115
|
end
|
108
116
|
|
109
117
|
|
110
|
-
def
|
111
|
-
|
118
|
+
def default_unparse_wkb(obj_)
|
119
|
+
nil # TODO
|
112
120
|
end
|
113
121
|
|
114
122
|
|
115
123
|
end
|
116
124
|
|
117
|
-
|
118
125
|
end
|
119
126
|
|
127
|
+
|
120
128
|
end
|
121
129
|
|
122
130
|
end
|
@@ -62,7 +62,8 @@ module RGeo
|
|
62
62
|
assert(::RGeo::Features::GeometryCollection === geom_)
|
63
63
|
assert_equal(::RGeo::Features::GeometryCollection, geom_.geometry_type)
|
64
64
|
assert_equal(2, geom_.num_geometries)
|
65
|
-
|
65
|
+
assert(@point1.eql?(geom_[0]))
|
66
|
+
assert(@line1.eql?(geom_[1]))
|
66
67
|
end
|
67
68
|
|
68
69
|
|
@@ -105,7 +106,7 @@ module RGeo
|
|
105
106
|
assert(::RGeo::Features::GeometryCollection === geom2_)
|
106
107
|
assert_equal(::RGeo::Features::GeometryCollection, geom2_.geometry_type)
|
107
108
|
assert_equal(2, geom2_.num_geometries)
|
108
|
-
|
109
|
+
assert_equal(::RGeo::Features::Line, geom2_[1][1].geometry_type)
|
109
110
|
end
|
110
111
|
|
111
112
|
|
@@ -144,7 +145,7 @@ module RGeo
|
|
144
145
|
def test_wkt_creation_simple
|
145
146
|
parsed_geom_ = @factory.parse_wkt('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(-4 2, -5 3))')
|
146
147
|
built_geom_ = @factory.collection([@point1, @line1])
|
147
|
-
|
148
|
+
assert(built_geom_.eql?(parsed_geom_))
|
148
149
|
end
|
149
150
|
|
150
151
|
|
@@ -158,10 +159,11 @@ module RGeo
|
|
158
159
|
def test_clone
|
159
160
|
geom1_ = @factory.collection([@point1, @line1])
|
160
161
|
geom2_ = geom1_.clone
|
161
|
-
|
162
|
+
assert(geom1_.eql?(geom2_))
|
162
163
|
assert_equal(::RGeo::Features::GeometryCollection, geom2_.geometry_type)
|
163
164
|
assert_equal(2, geom2_.num_geometries)
|
164
|
-
|
165
|
+
assert(@point1.eql?(geom2_[0]))
|
166
|
+
assert(@line1.eql?(geom2_[1]))
|
165
167
|
end
|
166
168
|
|
167
169
|
|
@@ -183,7 +185,7 @@ module RGeo
|
|
183
185
|
geom1_ = @factory.collection([@point1, @line1])
|
184
186
|
text_ = geom1_.as_text
|
185
187
|
geom2_ = @factory.parse_wkt(text_)
|
186
|
-
|
188
|
+
assert(geom1_.eql?(geom2_))
|
187
189
|
end
|
188
190
|
|
189
191
|
|
@@ -191,7 +193,7 @@ module RGeo
|
|
191
193
|
geom1_ = @factory.collection([@point1, @line1])
|
192
194
|
binary_ = geom1_.as_binary
|
193
195
|
geom2_ = @factory.parse_wkb(binary_)
|
194
|
-
|
196
|
+
assert(geom1_.eql?(geom2_))
|
195
197
|
end
|
196
198
|
|
197
199
|
|
@@ -64,7 +64,8 @@ module RGeo
|
|
64
64
|
assert(::RGeo::Features::MultiLineString === geom_)
|
65
65
|
assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
|
66
66
|
assert_equal(2, geom_.num_geometries)
|
67
|
-
|
67
|
+
assert(@linestring1.eql?(geom_[0]))
|
68
|
+
assert(@linestring2.eql?(geom_[1]))
|
68
69
|
end
|
69
70
|
|
70
71
|
|
@@ -89,16 +90,17 @@ module RGeo
|
|
89
90
|
end
|
90
91
|
|
91
92
|
|
92
|
-
def
|
93
|
-
mls1_ = @factory.
|
94
|
-
mls2_ = @factory.
|
95
|
-
|
96
|
-
geom_ = @factory.multi_line_string([mls3_, mls2_, @linearring1])
|
93
|
+
def test_creation_casting
|
94
|
+
mls1_ = @factory.collection([@line1])
|
95
|
+
mls2_ = @factory.multi_line_string([@linearring1])
|
96
|
+
geom_ = @factory.multi_line_string([@linestring1, @linestring2, mls1_, mls2_])
|
97
97
|
assert_not_nil(geom_)
|
98
|
-
assert(::RGeo::Features::MultiLineString === geom_)
|
99
98
|
assert_equal(::RGeo::Features::MultiLineString, geom_.geometry_type)
|
100
99
|
assert_equal(4, geom_.num_geometries)
|
101
|
-
assert(
|
100
|
+
assert(@linestring1.eql?(geom_[0]))
|
101
|
+
assert(@linestring2.eql?(geom_[1]))
|
102
|
+
assert(@line1.eql?(geom_[2]))
|
103
|
+
assert(@linearring1.eql?(geom_[3]))
|
102
104
|
end
|
103
105
|
|
104
106
|
|
@@ -129,7 +131,7 @@ module RGeo
|
|
129
131
|
def test_wkt_creation_simple
|
130
132
|
parsed_geom_ = @factory.parse_wkt('MULTILINESTRING((0 0, 1 0), (-4 2, -5 3, -3 5))')
|
131
133
|
built_geom_ = @factory.multi_line_string([@linestring1, @linestring2])
|
132
|
-
|
134
|
+
assert(built_geom_.eql?(parsed_geom_))
|
133
135
|
end
|
134
136
|
|
135
137
|
|
@@ -144,10 +146,11 @@ module RGeo
|
|
144
146
|
def test_clone
|
145
147
|
geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
|
146
148
|
geom2_ = geom1_.clone
|
147
|
-
|
149
|
+
assert(geom1_.eql?(geom2_))
|
148
150
|
assert_equal(::RGeo::Features::MultiLineString, geom2_.geometry_type)
|
149
151
|
assert_equal(2, geom2_.num_geometries)
|
150
|
-
|
152
|
+
assert(@linestring1.eql?(geom2_[0]))
|
153
|
+
assert(@linestring2.eql?(geom2_[1]))
|
151
154
|
end
|
152
155
|
|
153
156
|
|
@@ -171,7 +174,7 @@ module RGeo
|
|
171
174
|
geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
|
172
175
|
text_ = geom1_.as_text
|
173
176
|
geom2_ = @factory.parse_wkt(text_)
|
174
|
-
|
177
|
+
assert(geom1_.eql?(geom2_))
|
175
178
|
end
|
176
179
|
|
177
180
|
|
@@ -179,7 +182,7 @@ module RGeo
|
|
179
182
|
geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
|
180
183
|
binary_ = geom1_.as_binary
|
181
184
|
geom2_ = @factory.parse_wkb(binary_)
|
182
|
-
|
185
|
+
assert(geom1_.eql?(geom2_))
|
183
186
|
end
|
184
187
|
|
185
188
|
|
@@ -60,7 +60,8 @@ module RGeo
|
|
60
60
|
assert(::RGeo::Features::MultiPoint === geom_)
|
61
61
|
assert_equal(::RGeo::Features::MultiPoint, geom_.geometry_type)
|
62
62
|
assert_equal(2, geom_.num_geometries)
|
63
|
-
|
63
|
+
assert(@point1.eql?(geom_[0]))
|
64
|
+
assert(@point2.eql?(geom_[1]))
|
64
65
|
end
|
65
66
|
|
66
67
|
|
@@ -74,16 +75,17 @@ module RGeo
|
|
74
75
|
end
|
75
76
|
|
76
77
|
|
77
|
-
def
|
78
|
-
mp1_ = @factory.
|
79
|
-
mp2_ = @factory.
|
80
|
-
|
81
|
-
geom_ = @factory.multi_point([mp3_, mp2_, @point4])
|
78
|
+
def test_creation_casting
|
79
|
+
mp1_ = @factory.collection([@point3])
|
80
|
+
mp2_ = @factory.multi_point([@point4])
|
81
|
+
geom_ = @factory.multi_point([@point1, @point2, mp1_, mp2_])
|
82
82
|
assert_not_nil(geom_)
|
83
|
-
assert(::RGeo::Features::MultiPoint === geom_)
|
84
83
|
assert_equal(::RGeo::Features::MultiPoint, geom_.geometry_type)
|
85
84
|
assert_equal(4, geom_.num_geometries)
|
86
|
-
|
85
|
+
assert(@point1.eql?(geom_[0]))
|
86
|
+
assert(@point2.eql?(geom_[1]))
|
87
|
+
assert(@point3.eql?(geom_[2]))
|
88
|
+
assert(@point4.eql?(geom_[3]))
|
87
89
|
end
|
88
90
|
|
89
91
|
|
@@ -121,7 +123,7 @@ module RGeo
|
|
121
123
|
def test_wkt_creation_simple
|
122
124
|
parsed_geom_ = @factory.parse_wkt('MULTIPOINT((0 0), (-4 2), (-5 3))')
|
123
125
|
built_geom_ = @factory.multi_point([@point1, @point3, @point4])
|
124
|
-
|
126
|
+
assert(built_geom_.eql?(parsed_geom_))
|
125
127
|
end
|
126
128
|
|
127
129
|
|
@@ -136,10 +138,11 @@ module RGeo
|
|
136
138
|
def test_clone
|
137
139
|
geom1_ = @factory.multi_point([@point1, @point2])
|
138
140
|
geom2_ = geom1_.clone
|
139
|
-
|
141
|
+
assert(geom1_.eql?(geom2_))
|
140
142
|
assert_equal(::RGeo::Features::MultiPoint, geom2_.geometry_type)
|
141
143
|
assert_equal(2, geom2_.num_geometries)
|
142
|
-
|
144
|
+
assert(@point1.eql?(geom2_[0]))
|
145
|
+
assert(@point2.eql?(geom2_[1]))
|
143
146
|
end
|
144
147
|
|
145
148
|
|
@@ -163,7 +166,7 @@ module RGeo
|
|
163
166
|
geom1_ = @factory.multi_point([@point1, @point2])
|
164
167
|
text_ = geom1_.as_text
|
165
168
|
geom2_ = @factory.parse_wkt(text_)
|
166
|
-
|
169
|
+
assert(geom1_.eql?(geom2_))
|
167
170
|
end
|
168
171
|
|
169
172
|
|
@@ -171,7 +174,7 @@ module RGeo
|
|
171
174
|
geom1_ = @factory.multi_point([@point1, @point2])
|
172
175
|
binary_ = geom1_.as_binary
|
173
176
|
geom2_ = @factory.parse_wkb(binary_)
|
174
|
-
|
177
|
+
assert(geom1_.eql?(geom2_))
|
175
178
|
end
|
176
179
|
|
177
180
|
|
@@ -74,7 +74,8 @@ module RGeo
|
|
74
74
|
assert(::RGeo::Features::MultiPolygon === geom_)
|
75
75
|
assert_equal(::RGeo::Features::MultiPolygon, geom_.geometry_type)
|
76
76
|
assert_equal(2, geom_.num_geometries)
|
77
|
-
|
77
|
+
assert(@poly1.eql?(geom_[0]))
|
78
|
+
assert(@poly2.eql?(geom_[1]))
|
78
79
|
end
|
79
80
|
|
80
81
|
|
@@ -129,7 +130,7 @@ module RGeo
|
|
129
130
|
def test_wkt_creation_simple
|
130
131
|
parsed_geom_ = @factory.parse_wkt('MULTIPOLYGON(((0 0, 0 -10, -10 0, 0 0)), ((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 5 6, 6 4, 4 4)))')
|
131
132
|
built_geom_ = @factory.multi_polygon([@poly1, @poly2])
|
132
|
-
|
133
|
+
assert(built_geom_.eql?(parsed_geom_))
|
133
134
|
end
|
134
135
|
|
135
136
|
|
@@ -144,10 +145,11 @@ module RGeo
|
|
144
145
|
def test_clone
|
145
146
|
geom1_ = @factory.multi_polygon([@poly1, @poly2])
|
146
147
|
geom2_ = geom1_.clone
|
147
|
-
|
148
|
+
assert(geom1_.eql?(geom2_))
|
148
149
|
assert_equal(::RGeo::Features::MultiPolygon, geom2_.geometry_type)
|
149
150
|
assert_equal(2, geom2_.num_geometries)
|
150
|
-
|
151
|
+
assert(@poly1.eql?(geom2_[0]))
|
152
|
+
assert(@poly2.eql?(geom2_[1]))
|
151
153
|
end
|
152
154
|
|
153
155
|
|
@@ -171,7 +173,7 @@ module RGeo
|
|
171
173
|
geom1_ = @factory.multi_polygon([@poly1, @poly2])
|
172
174
|
text_ = geom1_.as_text
|
173
175
|
geom2_ = @factory.parse_wkt(text_)
|
174
|
-
|
176
|
+
assert(geom1_.eql?(geom2_))
|
175
177
|
end
|
176
178
|
|
177
179
|
|
@@ -179,7 +181,7 @@ module RGeo
|
|
179
181
|
geom1_ = @factory.multi_polygon([@poly1, @poly2])
|
180
182
|
binary_ = geom1_.as_binary
|
181
183
|
geom2_ = @factory.parse_wkb(binary_)
|
182
|
-
|
184
|
+
assert(geom1_.eql?(geom2_))
|
183
185
|
end
|
184
186
|
|
185
187
|
|
data/tests/common/point_tests.rb
CHANGED
@@ -53,7 +53,7 @@ module RGeo
|
|
53
53
|
assert_not_nil(polygon_)
|
54
54
|
assert(::RGeo::Features::Polygon === polygon_)
|
55
55
|
assert_equal(::RGeo::Features::Polygon, polygon_.geometry_type)
|
56
|
-
|
56
|
+
assert(exterior_.eql?(polygon_.exterior_ring))
|
57
57
|
assert_equal(0, polygon_.num_interior_rings)
|
58
58
|
end
|
59
59
|
|
@@ -72,9 +72,9 @@ module RGeo
|
|
72
72
|
assert_not_nil(polygon_)
|
73
73
|
assert(::RGeo::Features::Polygon === polygon_)
|
74
74
|
assert_equal(::RGeo::Features::Polygon, polygon_.geometry_type)
|
75
|
-
|
75
|
+
assert(exterior_.eql?(polygon_.exterior_ring))
|
76
76
|
assert_equal(1, polygon_.num_interior_rings)
|
77
|
-
|
77
|
+
assert(interior_.eql?(polygon_.interior_ring_n(0)))
|
78
78
|
end
|
79
79
|
|
80
80
|
|
@@ -127,7 +127,7 @@ module RGeo
|
|
127
127
|
point3_ = @factory.point(1, 0)
|
128
128
|
exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
|
129
129
|
built_poly_ = @factory.polygon(exterior_)
|
130
|
-
|
130
|
+
assert(built_poly_.eql?(parsed_poly_))
|
131
131
|
end
|
132
132
|
|
133
133
|
|
@@ -143,7 +143,7 @@ module RGeo
|
|
143
143
|
exterior_ = @factory.linear_ring([point1_, point2_, point3_, point4_, point1_])
|
144
144
|
interior_ = @factory.linear_ring([point5_, point6_, point7_, point5_])
|
145
145
|
built_poly_ = @factory.polygon(exterior_, [interior_])
|
146
|
-
|
146
|
+
assert(built_poly_.eql?(parsed_poly_))
|
147
147
|
end
|
148
148
|
|
149
149
|
|
@@ -154,8 +154,8 @@ module RGeo
|
|
154
154
|
exterior_ = @factory.linear_ring([point1_, point2_, point3_, point1_])
|
155
155
|
poly1_ = @factory.polygon(exterior_)
|
156
156
|
poly2_ = poly1_.clone
|
157
|
-
|
158
|
-
|
157
|
+
assert(poly1_.eql?(poly2_))
|
158
|
+
assert(exterior_.eql?(poly2_.exterior_ring))
|
159
159
|
assert_equal(0, poly2_.num_interior_rings)
|
160
160
|
end
|
161
161
|
|
@@ -182,7 +182,7 @@ module RGeo
|
|
182
182
|
poly1_ = @factory.polygon(exterior_)
|
183
183
|
text_ = poly1_.as_text
|
184
184
|
poly2_ = @factory.parse_wkt(text_)
|
185
|
-
|
185
|
+
assert(poly1_.eql?(poly2_))
|
186
186
|
end
|
187
187
|
|
188
188
|
|
@@ -194,7 +194,7 @@ module RGeo
|
|
194
194
|
poly1_ = @factory.polygon(exterior_)
|
195
195
|
binary_ = poly1_.as_binary
|
196
196
|
poly2_ = @factory.parse_wkb(binary_)
|
197
|
-
|
197
|
+
assert(poly1_.eql?(poly2_))
|
198
198
|
end
|
199
199
|
|
200
200
|
|