rgeo 2.3.0 → 3.0.0.pre.rc.1
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/.yardopts +6 -0
- data/README.md +1 -0
- data/ext/geos_c_impl/analysis.c +8 -6
- data/ext/geos_c_impl/analysis.h +1 -3
- data/ext/geos_c_impl/errors.c +10 -8
- data/ext/geos_c_impl/errors.h +7 -3
- data/ext/geos_c_impl/extconf.rb +3 -0
- data/ext/geos_c_impl/factory.c +251 -182
- data/ext/geos_c_impl/factory.h +43 -62
- data/ext/geos_c_impl/geometry.c +56 -24
- data/ext/geos_c_impl/geometry.h +8 -3
- data/ext/geos_c_impl/geometry_collection.c +41 -148
- data/ext/geos_c_impl/geometry_collection.h +1 -14
- data/ext/geos_c_impl/globals.c +91 -0
- data/ext/geos_c_impl/globals.h +45 -0
- data/ext/geos_c_impl/line_string.c +28 -29
- data/ext/geos_c_impl/line_string.h +1 -3
- data/ext/geos_c_impl/main.c +10 -9
- data/ext/geos_c_impl/point.c +9 -8
- data/ext/geos_c_impl/point.h +1 -3
- data/ext/geos_c_impl/polygon.c +15 -51
- data/ext/geos_c_impl/polygon.h +1 -3
- data/ext/geos_c_impl/preface.h +8 -0
- data/lib/rgeo/cartesian/analysis.rb +2 -2
- data/lib/rgeo/cartesian/calculations.rb +54 -17
- data/lib/rgeo/cartesian/factory.rb +0 -7
- data/lib/rgeo/cartesian/feature_classes.rb +66 -46
- data/lib/rgeo/cartesian/feature_methods.rb +56 -20
- data/lib/rgeo/cartesian/interface.rb +0 -6
- data/lib/rgeo/cartesian/planar_graph.rb +379 -0
- data/lib/rgeo/cartesian/sweepline_intersector.rb +149 -0
- data/lib/rgeo/cartesian/valid_op.rb +71 -0
- data/lib/rgeo/cartesian.rb +3 -0
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +6 -6
- data/lib/rgeo/error.rb +15 -0
- data/lib/rgeo/feature/curve.rb +12 -2
- data/lib/rgeo/feature/geometry.rb +38 -28
- data/lib/rgeo/feature/geometry_collection.rb +13 -5
- data/lib/rgeo/feature/line_string.rb +3 -3
- data/lib/rgeo/feature/multi_curve.rb +6 -1
- data/lib/rgeo/feature/multi_surface.rb +3 -3
- data/lib/rgeo/feature/point.rb +4 -4
- data/lib/rgeo/feature/surface.rb +3 -3
- data/lib/rgeo/geographic/factory.rb +0 -7
- data/lib/rgeo/geographic/interface.rb +4 -18
- data/lib/rgeo/geographic/proj4_projector.rb +0 -2
- data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
- data/lib/rgeo/geographic/projected_feature_methods.rb +63 -30
- data/lib/rgeo/geographic/simple_mercator_projector.rb +0 -2
- data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
- data/lib/rgeo/geographic/spherical_feature_methods.rb +68 -2
- data/lib/rgeo/geos/capi_factory.rb +21 -31
- data/lib/rgeo/geos/capi_feature_classes.rb +64 -11
- data/lib/rgeo/geos/ffi_factory.rb +0 -28
- data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
- data/lib/rgeo/geos/ffi_feature_methods.rb +53 -10
- data/lib/rgeo/geos/interface.rb +18 -10
- data/lib/rgeo/geos/zm_factory.rb +0 -12
- data/lib/rgeo/geos/zm_feature_methods.rb +30 -5
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +18 -8
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -1
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +37 -26
- data/lib/rgeo/impl_helper/basic_point_methods.rb +13 -3
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +8 -3
- data/lib/rgeo/impl_helper/valid_op.rb +354 -0
- data/lib/rgeo/impl_helper/validity_check.rb +138 -0
- data/lib/rgeo/impl_helper.rb +1 -0
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep/wkb_generator.rb +1 -1
- data/lib/rgeo/wkrep/wkt_generator.rb +6 -6
- metadata +30 -7
@@ -65,8 +65,13 @@ module RGeo
|
|
65
65
|
# Returns a boolean value. Note that this is different from the SFS
|
66
66
|
# specification, which stipulates an integer return value.
|
67
67
|
|
68
|
+
def closed?
|
69
|
+
raise Error::UnsupportedOperation, "Method MultiCurve#closed? not defined."
|
70
|
+
end
|
71
|
+
|
68
72
|
def is_closed?
|
69
|
-
|
73
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
74
|
+
closed?
|
70
75
|
end
|
71
76
|
end
|
72
77
|
end
|
@@ -43,7 +43,7 @@ module RGeo
|
|
43
43
|
# Returns a floating-point scalar value.
|
44
44
|
|
45
45
|
def area
|
46
|
-
raise Error::UnsupportedOperation, "Method
|
46
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#area not defined."
|
47
47
|
end
|
48
48
|
|
49
49
|
# === SFS 1.1 Description
|
@@ -56,7 +56,7 @@ module RGeo
|
|
56
56
|
# Returns an object that supports the Point interface.
|
57
57
|
|
58
58
|
def centroid
|
59
|
-
raise Error::UnsupportedOperation, "Method
|
59
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#centroid not defined."
|
60
60
|
end
|
61
61
|
|
62
62
|
# === SFS 1.1 Description
|
@@ -68,7 +68,7 @@ module RGeo
|
|
68
68
|
# Returns an object that supports the Point interface.
|
69
69
|
|
70
70
|
def point_on_surface
|
71
|
-
raise Error::UnsupportedOperation, "Method
|
71
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#point_on_surface not defined."
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/rgeo/feature/point.rb
CHANGED
@@ -47,7 +47,7 @@ module RGeo
|
|
47
47
|
# Returns a floating-point scalar value.
|
48
48
|
|
49
49
|
def x
|
50
|
-
raise Error::UnsupportedOperation, "Method
|
50
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#x not defined."
|
51
51
|
end
|
52
52
|
|
53
53
|
# === SFS 1.1 Description
|
@@ -59,7 +59,7 @@ module RGeo
|
|
59
59
|
# Returns a floating-point scalar value.
|
60
60
|
|
61
61
|
def y
|
62
|
-
raise Error::UnsupportedOperation, "Method
|
62
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#y not defined."
|
63
63
|
end
|
64
64
|
|
65
65
|
# Returns the z-coordinate for this Point as a floating-point
|
@@ -69,7 +69,7 @@ module RGeo
|
|
69
69
|
# not support Z coordinates.
|
70
70
|
|
71
71
|
def z
|
72
|
-
raise Error::UnsupportedOperation, "Method
|
72
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#z not defined."
|
73
73
|
end
|
74
74
|
|
75
75
|
# Returns the m-coordinate for this Point as a floating-point
|
@@ -79,7 +79,7 @@ module RGeo
|
|
79
79
|
# not support M coordinates.
|
80
80
|
|
81
81
|
def m
|
82
|
-
raise Error::UnsupportedOperation, "Method
|
82
|
+
raise Error::UnsupportedOperation, "Method #{self.class}#m not defined."
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/lib/rgeo/feature/surface.rb
CHANGED
@@ -49,7 +49,7 @@ module RGeo
|
|
49
49
|
# Returns a floating-point scalar value.
|
50
50
|
|
51
51
|
def area
|
52
|
-
raise Error::UnsupportedOperation, "Method
|
52
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#area not defined."
|
53
53
|
end
|
54
54
|
|
55
55
|
# === SFS 1.1 Description
|
@@ -62,7 +62,7 @@ module RGeo
|
|
62
62
|
# Returns an object that supports the Point interface.
|
63
63
|
|
64
64
|
def centroid
|
65
|
-
raise Error::UnsupportedOperation, "Method
|
65
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#centroid not defined."
|
66
66
|
end
|
67
67
|
|
68
68
|
# === SFS 1.1 Description
|
@@ -74,7 +74,7 @@ module RGeo
|
|
74
74
|
# Returns an object that supports the Point interface.
|
75
75
|
|
76
76
|
def point_on_surface
|
77
|
-
raise Error::UnsupportedOperation, "Method
|
77
|
+
raise Error::UnsupportedOperation, "Method #{self.class.name}#point_on_surface not defined."
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -42,7 +42,6 @@ module RGeo
|
|
42
42
|
if @coord_sys.is_a?(String)
|
43
43
|
@coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
|
44
44
|
end
|
45
|
-
@lenient_assertions = opts[:uses_lenient_assertions] ? true : false
|
46
45
|
@buffer_resolution = opts[:buffer_resolution].to_i
|
47
46
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
48
47
|
|
@@ -106,7 +105,6 @@ module RGeo
|
|
106
105
|
"wkbg" => @wkb_generator.properties,
|
107
106
|
"wktp" => @wkt_parser.properties,
|
108
107
|
"wkbp" => @wkb_parser.properties,
|
109
|
-
"lena" => @lenient_assertions,
|
110
108
|
"bufr" => @buffer_resolution
|
111
109
|
}
|
112
110
|
hash_["proj4"] = @proj4.marshal_dump if @proj4
|
@@ -138,7 +136,6 @@ module RGeo
|
|
138
136
|
wkb_generator: symbolize_hash(data_["wkbg"]),
|
139
137
|
wkt_parser: symbolize_hash(data_["wktp"]),
|
140
138
|
wkb_parser: symbolize_hash(data_["wkbp"]),
|
141
|
-
uses_lenient_assertions: data_["lena"],
|
142
139
|
buffer_resolution: data_["bufr"],
|
143
140
|
proj4: proj4,
|
144
141
|
coord_sys: coord_sys
|
@@ -164,7 +161,6 @@ module RGeo
|
|
164
161
|
coder["wkb_generator"] = @wkb_generator.properties
|
165
162
|
coder["wkt_parser"] = @wkt_parser.properties
|
166
163
|
coder["wkb_parser"] = @wkb_parser.properties
|
167
|
-
coder["lenient_assertions"] = @lenient_assertions
|
168
164
|
coder["buffer_resolution"] = @buffer_resolution
|
169
165
|
if @proj4
|
170
166
|
str = @proj4.original_str || @proj4.canonical_str
|
@@ -201,7 +197,6 @@ module RGeo
|
|
201
197
|
wkb_generator: symbolize_hash(coder["wkb_generator"]),
|
202
198
|
wkt_parser: symbolize_hash(coder["wkt_parser"]),
|
203
199
|
wkb_parser: symbolize_hash(coder["wkb_parser"]),
|
204
|
-
uses_lenient_assertions: coder["lenient_assertions"],
|
205
200
|
buffer_resolution: coder["buffer_resolution"],
|
206
201
|
proj4: proj4,
|
207
202
|
coord_sys: coord_sys
|
@@ -293,8 +288,6 @@ module RGeo
|
|
293
288
|
@support_z
|
294
289
|
when :has_m_coordinate
|
295
290
|
@support_m
|
296
|
-
when :uses_lenient_assertions
|
297
|
-
@lenient_assertions
|
298
291
|
when :buffer_resolution
|
299
292
|
@buffer_resolution
|
300
293
|
when :is_geographic
|
@@ -54,12 +54,6 @@ module RGeo
|
|
54
54
|
# Support a Z coordinate. Default is false.
|
55
55
|
# [<tt>:has_m_coordinate</tt>]
|
56
56
|
# Support an M coordinate. Default is false.
|
57
|
-
# [<tt>:uses_lenient_assertions</tt>]
|
58
|
-
# If set to true, assertion checking is disabled. This includes
|
59
|
-
# simplicity checking on LinearRing, and validity checks on
|
60
|
-
# Polygon and MultiPolygon. This may speed up creation of certain
|
61
|
-
# objects, at the expense of not doing the proper checking for
|
62
|
-
# OGC compliance. Default is false.
|
63
57
|
# [<tt>:buffer_resolution</tt>]
|
64
58
|
# The resolution of buffers around geometries created by this
|
65
59
|
# factory. This controls the number of line segments used to
|
@@ -131,7 +125,6 @@ module RGeo
|
|
131
125
|
has_m_coordinate: opts[:has_m_coordinate],
|
132
126
|
proj4: proj4 || proj_4055,
|
133
127
|
coord_sys: coord_sys || coord_sys_4055,
|
134
|
-
uses_lenient_assertions: opts[:uses_lenient_assertions],
|
135
128
|
buffer_resolution: opts[:buffer_resolution],
|
136
129
|
wkt_parser: opts[:wkt_parser],
|
137
130
|
wkb_parser: opts[:wkb_parser],
|
@@ -207,10 +200,8 @@ module RGeo
|
|
207
200
|
#
|
208
201
|
# You may also provide options understood by the underlying
|
209
202
|
# projected Cartesian factory. For example, if GEOS is used for the
|
210
|
-
# projected factory, you may also set the
|
211
|
-
#
|
212
|
-
# <tt>:buffer_resolution</tt> options. See RGeo::Geos.factory for
|
213
|
-
# more details.
|
203
|
+
# projected factory, you may also set the <tt>:buffer_resolution</tt>
|
204
|
+
# options. See RGeo::Geos.factory for more details.
|
214
205
|
|
215
206
|
def simple_mercator_factory(opts = {})
|
216
207
|
factory = Geographic::Factory.new("Projected",
|
@@ -225,8 +216,6 @@ module RGeo
|
|
225
216
|
has_m_coordinate: opts[:has_m_coordinate])
|
226
217
|
projector = Geographic::SimpleMercatorProjector.new(factory,
|
227
218
|
buffer_resolution: opts[:buffer_resolution],
|
228
|
-
lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
|
229
|
-
uses_lenient_assertions: opts[:uses_lenient_assertions],
|
230
219
|
has_z_coordinate: opts[:has_z_coordinate],
|
231
220
|
has_m_coordinate: opts[:has_m_coordinate])
|
232
221
|
factory.projector = projector
|
@@ -341,9 +330,8 @@ module RGeo
|
|
341
330
|
# If a <tt>:projection_factory</tt> is _not_ provided, you may also
|
342
331
|
# provide options for configuring the projected Cartesian factory.
|
343
332
|
# For example, if GEOS is used for the projected factory, you may
|
344
|
-
# also set the <tt>:
|
345
|
-
#
|
346
|
-
# more details.
|
333
|
+
# also set the <tt>:buffer_resolution</tt> option. See RGeo::Geos.factory
|
334
|
+
# for more details.
|
347
335
|
|
348
336
|
def projected_factory(opts = {})
|
349
337
|
CoordSys.check!(:proj4)
|
@@ -446,8 +434,6 @@ module RGeo
|
|
446
434
|
srid: projection_srid,
|
447
435
|
coord_sys: projection_coord_sys,
|
448
436
|
buffer_resolution: opts[:buffer_resolution],
|
449
|
-
lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
|
450
|
-
uses_lenient_assertions: opts[:uses_lenient_assertions],
|
451
437
|
has_z_coordinate: opts[:has_z_coordinate],
|
452
438
|
has_m_coordinate: opts[:has_m_coordinate],
|
453
439
|
wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
|
@@ -48,8 +48,6 @@ module RGeo
|
|
48
48
|
proj4: proj4,
|
49
49
|
coord_sys: opts[:coord_sys], srid: opts[:srid],
|
50
50
|
buffer_resolution: opts[:buffer_resolution],
|
51
|
-
lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
|
52
|
-
uses_lenient_assertions: opts[:uses_lenient_assertions],
|
53
51
|
has_z_coordinate: opts[:has_z_coordinate],
|
54
52
|
has_m_coordinate: opts[:has_m_coordinate],
|
55
53
|
wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
|
@@ -8,16 +8,18 @@
|
|
8
8
|
|
9
9
|
module RGeo
|
10
10
|
module Geographic
|
11
|
-
class ProjectedPointImpl
|
11
|
+
class ProjectedPointImpl
|
12
12
|
include Feature::Point
|
13
|
+
include ImplHelper::ValidityCheck
|
13
14
|
include ImplHelper::BasicGeometryMethods
|
14
15
|
include ImplHelper::BasicPointMethods
|
15
16
|
include ProjectedGeometryMethods
|
16
17
|
include ProjectedPointMethods
|
17
18
|
end
|
18
19
|
|
19
|
-
class ProjectedLineStringImpl
|
20
|
+
class ProjectedLineStringImpl
|
20
21
|
include Feature::LineString
|
22
|
+
include ImplHelper::ValidityCheck
|
21
23
|
include ImplHelper::BasicGeometryMethods
|
22
24
|
include ImplHelper::BasicLineStringMethods
|
23
25
|
include ProjectedGeometryMethods
|
@@ -25,18 +27,21 @@ module RGeo
|
|
25
27
|
include ProjectedLineStringMethods
|
26
28
|
end
|
27
29
|
|
28
|
-
class ProjectedLinearRingImpl
|
30
|
+
class ProjectedLinearRingImpl
|
29
31
|
include Feature::LinearRing
|
32
|
+
include ImplHelper::ValidityCheck
|
30
33
|
include ImplHelper::BasicGeometryMethods
|
31
34
|
include ImplHelper::BasicLineStringMethods
|
32
35
|
include ImplHelper::BasicLinearRingMethods
|
33
36
|
include ProjectedGeometryMethods
|
34
37
|
include ProjectedNCurveMethods
|
35
38
|
include ProjectedLineStringMethods
|
39
|
+
include ProjectedLinearRingMethods
|
36
40
|
end
|
37
41
|
|
38
|
-
class ProjectedLineImpl
|
42
|
+
class ProjectedLineImpl
|
39
43
|
include Feature::Line
|
44
|
+
include ImplHelper::ValidityCheck
|
40
45
|
include ImplHelper::BasicGeometryMethods
|
41
46
|
include ImplHelper::BasicLineStringMethods
|
42
47
|
include ImplHelper::BasicLineMethods
|
@@ -45,8 +50,9 @@ module RGeo
|
|
45
50
|
include ProjectedLineStringMethods
|
46
51
|
end
|
47
52
|
|
48
|
-
class ProjectedPolygonImpl
|
53
|
+
class ProjectedPolygonImpl
|
49
54
|
include Feature::Polygon
|
55
|
+
include ImplHelper::ValidityCheck
|
50
56
|
include ImplHelper::BasicGeometryMethods
|
51
57
|
include ImplHelper::BasicPolygonMethods
|
52
58
|
include ProjectedGeometryMethods
|
@@ -54,23 +60,26 @@ module RGeo
|
|
54
60
|
include ProjectedPolygonMethods
|
55
61
|
end
|
56
62
|
|
57
|
-
class ProjectedGeometryCollectionImpl
|
63
|
+
class ProjectedGeometryCollectionImpl
|
58
64
|
include Feature::GeometryCollection
|
65
|
+
include ImplHelper::ValidityCheck
|
59
66
|
include ImplHelper::BasicGeometryMethods
|
60
67
|
include ImplHelper::BasicGeometryCollectionMethods
|
61
68
|
include ProjectedGeometryMethods
|
62
69
|
end
|
63
70
|
|
64
|
-
class ProjectedMultiPointImpl
|
71
|
+
class ProjectedMultiPointImpl
|
65
72
|
include Feature::MultiPoint
|
73
|
+
include ImplHelper::ValidityCheck
|
66
74
|
include ImplHelper::BasicGeometryMethods
|
67
75
|
include ImplHelper::BasicGeometryCollectionMethods
|
68
76
|
include ImplHelper::BasicMultiPointMethods
|
69
77
|
include ProjectedGeometryMethods
|
70
78
|
end
|
71
79
|
|
72
|
-
class ProjectedMultiLineStringImpl
|
80
|
+
class ProjectedMultiLineStringImpl
|
73
81
|
include Feature::MultiLineString
|
82
|
+
include ImplHelper::ValidityCheck
|
74
83
|
include ImplHelper::BasicGeometryMethods
|
75
84
|
include ImplHelper::BasicGeometryCollectionMethods
|
76
85
|
include ImplHelper::BasicMultiLineStringMethods
|
@@ -78,8 +87,9 @@ module RGeo
|
|
78
87
|
include ProjectedNCurveMethods
|
79
88
|
end
|
80
89
|
|
81
|
-
class ProjectedMultiPolygonImpl
|
90
|
+
class ProjectedMultiPolygonImpl
|
82
91
|
include Feature::MultiPolygon
|
92
|
+
include ImplHelper::ValidityCheck
|
83
93
|
include ImplHelper::BasicGeometryMethods
|
84
94
|
include ImplHelper::BasicGeometryCollectionMethods
|
85
95
|
include ImplHelper::BasicMultiPolygonMethods
|
@@ -87,5 +97,7 @@ module RGeo
|
|
87
97
|
include ProjectedNSurfaceMethods
|
88
98
|
include ProjectedMultiPolygonMethods
|
89
99
|
end
|
100
|
+
|
101
|
+
ImplHelper::ValidityCheck.override_classes
|
90
102
|
end
|
91
103
|
end
|
@@ -19,19 +19,42 @@ module RGeo
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def envelope
|
22
|
-
factory.unproject(projection.
|
22
|
+
factory.unproject(projection.unsafe_envelope)
|
23
|
+
end
|
24
|
+
|
25
|
+
def empty?
|
26
|
+
projection.empty?
|
23
27
|
end
|
24
28
|
|
25
29
|
def is_empty?
|
26
|
-
|
30
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
31
|
+
empty?
|
32
|
+
end
|
33
|
+
|
34
|
+
def simple?
|
35
|
+
projection.simple?
|
27
36
|
end
|
28
37
|
|
29
38
|
def is_simple?
|
30
|
-
|
39
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
40
|
+
simple?
|
41
|
+
end
|
42
|
+
|
43
|
+
def valid?
|
44
|
+
projection.valid?
|
45
|
+
end
|
46
|
+
|
47
|
+
def invalid_reason
|
48
|
+
projection.invalid_reason
|
49
|
+
end
|
50
|
+
|
51
|
+
# (see RGeo::ImplHelper::ValidityCheck#make_valid)
|
52
|
+
def make_valid
|
53
|
+
factory.unproject projection.make_valid
|
31
54
|
end
|
32
55
|
|
33
56
|
def boundary
|
34
|
-
boundary = projection.
|
57
|
+
boundary = projection.unsafe_boundary
|
35
58
|
boundary ? factory.unproject(boundary) : nil
|
36
59
|
end
|
37
60
|
|
@@ -40,79 +63,79 @@ module RGeo
|
|
40
63
|
end
|
41
64
|
|
42
65
|
def disjoint?(rhs)
|
43
|
-
projection.
|
66
|
+
projection.unsafe_disjoint?(Feature.cast(rhs, factory).projection)
|
44
67
|
end
|
45
68
|
|
46
69
|
def intersects?(rhs)
|
47
|
-
projection.
|
70
|
+
projection.unsafe_intersects?(Feature.cast(rhs, factory).projection)
|
48
71
|
end
|
49
72
|
|
50
73
|
def touches?(rhs)
|
51
|
-
projection.
|
74
|
+
projection.unsafe_touches?(Feature.cast(rhs, factory).projection)
|
52
75
|
end
|
53
76
|
|
54
77
|
def crosses?(rhs)
|
55
|
-
projection.
|
78
|
+
projection.unsafe_crosses?(Feature.cast(rhs, factory).projection)
|
56
79
|
end
|
57
80
|
|
58
81
|
def within?(rhs)
|
59
|
-
projection.
|
82
|
+
projection.unsafe_within?(Feature.cast(rhs, factory).projection)
|
60
83
|
end
|
61
84
|
|
62
85
|
def contains?(rhs)
|
63
|
-
projection.
|
86
|
+
projection.unsafe_contains?(Feature.cast(rhs, factory).projection)
|
64
87
|
end
|
65
88
|
|
66
89
|
def overlaps?(rhs)
|
67
|
-
projection.
|
90
|
+
projection.unsafe_overlaps?(Feature.cast(rhs, factory).projection)
|
68
91
|
end
|
69
92
|
|
70
93
|
def relate(rhs, pattern_)
|
71
|
-
projection.
|
94
|
+
projection.unsafe_relate(Feature.cast(rhs, factory).projection, pattern_)
|
72
95
|
end
|
73
96
|
|
74
97
|
def distance(rhs)
|
75
|
-
projection.
|
98
|
+
projection.unsafe_distance(Feature.cast(rhs, factory).projection)
|
76
99
|
end
|
77
100
|
|
78
101
|
def buffer(distance)
|
79
|
-
factory.unproject(projection.
|
102
|
+
factory.unproject(projection.unsafe_buffer(distance))
|
80
103
|
end
|
81
104
|
|
82
105
|
def buffer_with_style(distance, end_cap_style, join_style, mitre_limit)
|
83
|
-
factory.unproject(projection.
|
106
|
+
factory.unproject(projection.unsafe_buffer_with_style(distance, end_cap_style, join_style, mitre_limit))
|
84
107
|
end
|
85
108
|
|
86
109
|
def simplify(tolerance)
|
87
|
-
factory.unproject(projection.
|
110
|
+
factory.unproject(projection.unsafe_simplify(tolerance))
|
88
111
|
end
|
89
112
|
|
90
113
|
def simplify_preserve_topology(tolerance)
|
91
|
-
factory.unproject(projection.
|
114
|
+
factory.unproject(projection.unsafe_simplify_preserve_topology(tolerance))
|
92
115
|
end
|
93
116
|
|
94
117
|
def convex_hull
|
95
|
-
factory.unproject(projection.
|
118
|
+
factory.unproject(projection.unsafe_convex_hull)
|
96
119
|
end
|
97
120
|
|
98
121
|
def intersection(rhs)
|
99
|
-
factory.unproject(projection.
|
122
|
+
factory.unproject(projection.unsafe_intersection(Feature.cast(rhs, factory).projection))
|
100
123
|
end
|
101
124
|
|
102
125
|
def union(rhs)
|
103
|
-
factory.unproject(projection.
|
126
|
+
factory.unproject(projection.unsafe_union(Feature.cast(rhs, factory).projection))
|
104
127
|
end
|
105
128
|
|
106
129
|
def difference(rhs)
|
107
|
-
factory.unproject(projection.
|
130
|
+
factory.unproject(projection.unsafe_difference(Feature.cast(rhs, factory).projection))
|
108
131
|
end
|
109
132
|
|
110
133
|
def sym_difference(rhs)
|
111
|
-
factory.unproject(projection.
|
134
|
+
factory.unproject(projection.unsafe_sym_difference(Feature.cast(rhs, factory).projection))
|
112
135
|
end
|
113
136
|
|
114
137
|
def point_on_surface
|
115
|
-
factory.unproject(projection.
|
138
|
+
factory.unproject(projection.unsafe_point_on_surface)
|
116
139
|
end
|
117
140
|
end
|
118
141
|
|
@@ -144,7 +167,8 @@ module RGeo
|
|
144
167
|
|
145
168
|
private
|
146
169
|
|
147
|
-
|
170
|
+
# Ensure coordinates fall within a valid range.
|
171
|
+
def init_geometry
|
148
172
|
@y = 85.0511287 if @y > 85.0511287
|
149
173
|
@y = -85.0511287 if @y < -85.0511287
|
150
174
|
super
|
@@ -153,33 +177,41 @@ module RGeo
|
|
153
177
|
|
154
178
|
module ProjectedNCurveMethods # :nodoc:
|
155
179
|
def length
|
156
|
-
projection.
|
180
|
+
projection.unsafe_length
|
157
181
|
end
|
158
182
|
end
|
159
183
|
|
160
184
|
module ProjectedLineStringMethods # :nodoc:
|
161
185
|
private
|
162
186
|
|
163
|
-
|
187
|
+
# Ensure coordinates fall within a valid range.
|
188
|
+
def init_geometry
|
164
189
|
@points = @points.map(&:canonical_point)
|
165
190
|
super
|
166
191
|
end
|
167
192
|
end
|
168
193
|
|
194
|
+
module ProjectedLinearRingMethods # :nodoc:
|
195
|
+
def simple?
|
196
|
+
projection.valid?
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
169
200
|
module ProjectedNSurfaceMethods # :nodoc:
|
170
201
|
def area
|
171
|
-
projection.
|
202
|
+
projection.unsafe_area
|
172
203
|
end
|
173
204
|
|
174
205
|
def centroid
|
175
|
-
factory.unproject(projection.
|
206
|
+
factory.unproject(projection.unsafe_centroid)
|
176
207
|
end
|
177
208
|
end
|
178
209
|
|
179
210
|
module ProjectedPolygonMethods # :nodoc:
|
180
211
|
private
|
181
212
|
|
182
|
-
|
213
|
+
# Ensure projection is available.
|
214
|
+
def init_geometry
|
183
215
|
super
|
184
216
|
unless projection
|
185
217
|
raise Error::InvalidGeometry, "Polygon failed assertions"
|
@@ -190,7 +222,8 @@ module RGeo
|
|
190
222
|
module ProjectedMultiPolygonMethods # :nodoc:
|
191
223
|
private
|
192
224
|
|
193
|
-
|
225
|
+
# Ensure projection is available.
|
226
|
+
def init_geometry
|
194
227
|
super
|
195
228
|
unless projection
|
196
229
|
raise Error::InvalidGeometry, "MultiPolygon failed assertions"
|
@@ -17,8 +17,6 @@ module RGeo
|
|
17
17
|
proj4: SimpleMercatorProjector._proj4_3857,
|
18
18
|
coord_sys: SimpleMercatorProjector._coordsys_3857,
|
19
19
|
buffer_resolution: opts[:buffer_resolution],
|
20
|
-
lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
|
21
|
-
uses_lenient_assertions: opts[:uses_lenient_assertions],
|
22
20
|
has_z_coordinate: opts[:has_z_coordinate],
|
23
21
|
has_m_coordinate: opts[:has_m_coordinate])
|
24
22
|
end
|
@@ -8,78 +8,98 @@
|
|
8
8
|
|
9
9
|
module RGeo
|
10
10
|
module Geographic
|
11
|
-
class SphericalPointImpl
|
11
|
+
class SphericalPointImpl
|
12
12
|
include Feature::Point
|
13
|
+
include ImplHelper::ValidityCheck
|
13
14
|
include ImplHelper::BasicGeometryMethods
|
14
15
|
include ImplHelper::BasicPointMethods
|
16
|
+
include ImplHelper::ValidOp
|
15
17
|
include SphericalGeometryMethods
|
16
18
|
include SphericalPointMethods
|
17
19
|
end
|
18
20
|
|
19
|
-
class SphericalLineStringImpl
|
21
|
+
class SphericalLineStringImpl
|
20
22
|
include Feature::LineString
|
23
|
+
include ImplHelper::ValidityCheck
|
21
24
|
include ImplHelper::BasicGeometryMethods
|
22
25
|
include ImplHelper::BasicLineStringMethods
|
26
|
+
include ImplHelper::ValidOp
|
23
27
|
include SphericalGeometryMethods
|
24
28
|
include SphericalLineStringMethods
|
25
29
|
end
|
26
30
|
|
27
|
-
class SphericalLineImpl
|
31
|
+
class SphericalLineImpl
|
28
32
|
include Feature::Line
|
33
|
+
include ImplHelper::ValidityCheck
|
29
34
|
include ImplHelper::BasicGeometryMethods
|
30
35
|
include ImplHelper::BasicLineStringMethods
|
31
36
|
include ImplHelper::BasicLineMethods
|
37
|
+
include ImplHelper::ValidOp
|
32
38
|
include SphericalGeometryMethods
|
33
39
|
include SphericalLineStringMethods
|
34
40
|
end
|
35
41
|
|
36
|
-
class SphericalLinearRingImpl
|
42
|
+
class SphericalLinearRingImpl
|
37
43
|
include Feature::LinearRing
|
44
|
+
include ImplHelper::ValidityCheck
|
38
45
|
include ImplHelper::BasicGeometryMethods
|
39
46
|
include ImplHelper::BasicLineStringMethods
|
40
47
|
include ImplHelper::BasicLinearRingMethods
|
48
|
+
include ImplHelper::ValidOp
|
41
49
|
include SphericalGeometryMethods
|
42
50
|
include SphericalLineStringMethods
|
43
51
|
end
|
44
52
|
|
45
|
-
class SphericalPolygonImpl
|
53
|
+
class SphericalPolygonImpl
|
46
54
|
include Feature::Polygon
|
55
|
+
include ImplHelper::ValidityCheck
|
47
56
|
include ImplHelper::BasicGeometryMethods
|
48
57
|
include ImplHelper::BasicPolygonMethods
|
58
|
+
include ImplHelper::ValidOp
|
49
59
|
include SphericalGeometryMethods
|
50
60
|
include SphericalPolygonMethods
|
51
61
|
end
|
52
62
|
|
53
|
-
class SphericalGeometryCollectionImpl
|
63
|
+
class SphericalGeometryCollectionImpl
|
54
64
|
include Feature::GeometryCollection
|
65
|
+
include ImplHelper::ValidityCheck
|
55
66
|
include ImplHelper::BasicGeometryMethods
|
56
67
|
include ImplHelper::BasicGeometryCollectionMethods
|
68
|
+
include ImplHelper::ValidOp
|
57
69
|
include SphericalGeometryMethods
|
58
70
|
end
|
59
71
|
|
60
|
-
class SphericalMultiPointImpl
|
72
|
+
class SphericalMultiPointImpl
|
61
73
|
include Feature::MultiPoint
|
74
|
+
include ImplHelper::ValidityCheck
|
62
75
|
include ImplHelper::BasicGeometryMethods
|
63
76
|
include ImplHelper::BasicGeometryCollectionMethods
|
64
77
|
include ImplHelper::BasicMultiPointMethods
|
78
|
+
include ImplHelper::ValidOp
|
65
79
|
include SphericalGeometryMethods
|
66
80
|
end
|
67
81
|
|
68
|
-
class SphericalMultiLineStringImpl
|
82
|
+
class SphericalMultiLineStringImpl
|
69
83
|
include Feature::MultiLineString
|
84
|
+
include ImplHelper::ValidityCheck
|
70
85
|
include ImplHelper::BasicGeometryMethods
|
71
86
|
include ImplHelper::BasicGeometryCollectionMethods
|
72
87
|
include ImplHelper::BasicMultiLineStringMethods
|
88
|
+
include ImplHelper::ValidOp
|
73
89
|
include SphericalGeometryMethods
|
74
90
|
include SphericalMultiLineStringMethods
|
75
91
|
end
|
76
92
|
|
77
|
-
class SphericalMultiPolygonImpl
|
93
|
+
class SphericalMultiPolygonImpl
|
78
94
|
include Feature::MultiPolygon
|
95
|
+
include ImplHelper::ValidityCheck
|
79
96
|
include ImplHelper::BasicGeometryMethods
|
80
97
|
include ImplHelper::BasicGeometryCollectionMethods
|
81
98
|
include ImplHelper::BasicMultiPolygonMethods
|
99
|
+
include ImplHelper::ValidOp
|
82
100
|
include SphericalGeometryMethods
|
83
101
|
end
|
102
|
+
|
103
|
+
ImplHelper::ValidityCheck.override_classes
|
84
104
|
end
|
85
105
|
end
|