rgeo 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rgeo/cartesian/bounding_box.rb +1 -1
- data/lib/rgeo/cartesian/calculations.rb +1 -1
- data/lib/rgeo/cartesian/factory.rb +20 -20
- data/lib/rgeo/cartesian/feature_classes.rb +46 -46
- data/lib/rgeo/cartesian/feature_methods.rb +1 -1
- data/lib/rgeo/cartesian/interface.rb +4 -4
- data/lib/rgeo/coord_sys.rb +1 -1
- data/lib/rgeo/coord_sys/cs/entities.rb +1 -1
- data/lib/rgeo/feature/factory_generator.rb +1 -1
- data/lib/rgeo/feature/geometry.rb +2 -2
- data/lib/rgeo/feature/mixins.rb +1 -1
- data/lib/rgeo/feature/types.rb +11 -11
- data/lib/rgeo/geographic/factory.rb +21 -21
- data/lib/rgeo/geographic/projected_feature_methods.rb +2 -2
- data/lib/rgeo/geographic/projected_window.rb +4 -4
- data/lib/rgeo/geographic/spherical_math.rb +2 -2
- data/lib/rgeo/geos.rb +2 -2
- data/lib/rgeo/geos/capi_factory.rb +19 -19
- data/lib/rgeo/geos/capi_feature_classes.rb +1 -1
- data/lib/rgeo/geos/ffi_factory.rb +28 -28
- data/lib/rgeo/geos/ffi_feature_methods.rb +8 -8
- data/lib/rgeo/geos/interface.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +20 -20
- data/lib/rgeo/geos/zm_feature_methods.rb +23 -23
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep/wkb_parser.rb +1 -1
- data/lib/rgeo/wkrep/wkt_generator.rb +1 -1
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60f96ff950b9d39762392b471cd0be70fce1510daa17958da531f76d14c7f34
|
4
|
+
data.tar.gz: b30460450e679b6a46599a68171b6b8de69134913dfbc7d6c6f5a47c209207d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 638a465a19dbf4352b1ad4977a7193b228f62824ffaf93686f045383e8315bee5334ab978b5690f4d035fb1f091e6c905f9fbe941d50c2570c97c70215f94666
|
7
|
+
data.tar.gz: 5cbcb7893970f4b6819ca66112e09a3f3222bb7fdc529b6cf8af134cac4ee1018b66995b41a2227df45b2be7339c713ba7b59835eef833f686269eb97a1717b6
|
@@ -14,7 +14,7 @@ module RGeo
|
|
14
14
|
|
15
15
|
# Create a new simple cartesian factory.
|
16
16
|
#
|
17
|
-
# See
|
17
|
+
# See RGeo::Cartesian.simple_factory for a list of supported options.
|
18
18
|
|
19
19
|
def initialize(opts_ = {})
|
20
20
|
@has_z = opts_[:has_z_coordinate] ? true : false
|
@@ -85,7 +85,7 @@ module RGeo
|
|
85
85
|
@has_m == rhs_.property(:has_m_coordinate) &&
|
86
86
|
@proj4.eql?(rhs_.proj4)
|
87
87
|
end
|
88
|
-
|
88
|
+
alias == eql?
|
89
89
|
|
90
90
|
# Standard hash code
|
91
91
|
|
@@ -192,7 +192,7 @@ module RGeo
|
|
192
192
|
|
193
193
|
attr_reader :srid
|
194
194
|
|
195
|
-
# See
|
195
|
+
# See RGeo::Feature::Factory#property
|
196
196
|
|
197
197
|
def property(name_)
|
198
198
|
case name_
|
@@ -209,19 +209,19 @@ module RGeo
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
# See
|
212
|
+
# See RGeo::Feature::Factory#parse_wkt
|
213
213
|
|
214
214
|
def parse_wkt(str_)
|
215
215
|
@wkt_parser.parse(str_)
|
216
216
|
end
|
217
217
|
|
218
|
-
# See
|
218
|
+
# See RGeo::Feature::Factory#parse_wkb
|
219
219
|
|
220
220
|
def parse_wkb(str_)
|
221
221
|
@wkb_parser.parse(str_)
|
222
222
|
end
|
223
223
|
|
224
|
-
# See
|
224
|
+
# See RGeo::Feature::Factory#point
|
225
225
|
|
226
226
|
def point(x_, y_, *extra_)
|
227
227
|
PointImpl.new(self, x_, y_, *extra_)
|
@@ -229,7 +229,7 @@ module RGeo
|
|
229
229
|
nil
|
230
230
|
end
|
231
231
|
|
232
|
-
# See
|
232
|
+
# See RGeo::Feature::Factory#line_string
|
233
233
|
|
234
234
|
def line_string(points_)
|
235
235
|
LineStringImpl.new(self, points_)
|
@@ -237,7 +237,7 @@ module RGeo
|
|
237
237
|
nil
|
238
238
|
end
|
239
239
|
|
240
|
-
# See
|
240
|
+
# See RGeo::Feature::Factory#line
|
241
241
|
|
242
242
|
def line(start_, end_)
|
243
243
|
LineImpl.new(self, start_, end_)
|
@@ -245,7 +245,7 @@ module RGeo
|
|
245
245
|
nil
|
246
246
|
end
|
247
247
|
|
248
|
-
# See
|
248
|
+
# See RGeo::Feature::Factory#linear_ring
|
249
249
|
|
250
250
|
def linear_ring(points_)
|
251
251
|
LinearRingImpl.new(self, points_)
|
@@ -253,7 +253,7 @@ module RGeo
|
|
253
253
|
nil
|
254
254
|
end
|
255
255
|
|
256
|
-
# See
|
256
|
+
# See RGeo::Feature::Factory#polygon
|
257
257
|
|
258
258
|
def polygon(outer_ring_, inner_rings_ = nil)
|
259
259
|
PolygonImpl.new(self, outer_ring_, inner_rings_)
|
@@ -261,7 +261,7 @@ module RGeo
|
|
261
261
|
nil
|
262
262
|
end
|
263
263
|
|
264
|
-
# See
|
264
|
+
# See RGeo::Feature::Factory#collection
|
265
265
|
|
266
266
|
def collection(elems_)
|
267
267
|
GeometryCollectionImpl.new(self, elems_)
|
@@ -269,7 +269,7 @@ module RGeo
|
|
269
269
|
nil
|
270
270
|
end
|
271
271
|
|
272
|
-
# See
|
272
|
+
# See RGeo::Feature::Factory#multi_point
|
273
273
|
|
274
274
|
def multi_point(elems_)
|
275
275
|
MultiPointImpl.new(self, elems_)
|
@@ -277,7 +277,7 @@ module RGeo
|
|
277
277
|
nil
|
278
278
|
end
|
279
279
|
|
280
|
-
# See
|
280
|
+
# See RGeo::Feature::Factory#multi_line_string
|
281
281
|
|
282
282
|
def multi_line_string(elems_)
|
283
283
|
MultiLineStringImpl.new(self, elems_)
|
@@ -285,7 +285,7 @@ module RGeo
|
|
285
285
|
nil
|
286
286
|
end
|
287
287
|
|
288
|
-
# See
|
288
|
+
# See RGeo::Feature::Factory#multi_polygon
|
289
289
|
|
290
290
|
def multi_polygon(elems_)
|
291
291
|
MultiPolygonImpl.new(self, elems_)
|
@@ -293,11 +293,11 @@ module RGeo
|
|
293
293
|
nil
|
294
294
|
end
|
295
295
|
|
296
|
-
# See
|
296
|
+
# See RGeo::Feature::Factory#proj4
|
297
297
|
|
298
298
|
attr_reader :proj4
|
299
299
|
|
300
|
-
# See
|
300
|
+
# See RGeo::Feature::Factory#coord_sys
|
301
301
|
|
302
302
|
attr_reader :coord_sys
|
303
303
|
|
@@ -311,7 +311,7 @@ module RGeo
|
|
311
311
|
|
312
312
|
def _marshal_wkb_generator # :nodoc:
|
313
313
|
unless defined?(@marshal_wkb_generator)
|
314
|
-
@marshal_wkb_generator =
|
314
|
+
@marshal_wkb_generator = RGeo::WKRep::WKBGenerator.new(
|
315
315
|
type_format: :wkb12)
|
316
316
|
end
|
317
317
|
@marshal_wkb_generator
|
@@ -319,7 +319,7 @@ module RGeo
|
|
319
319
|
|
320
320
|
def _marshal_wkb_parser # :nodoc:
|
321
321
|
unless defined?(@marshal_wkb_parser)
|
322
|
-
@marshal_wkb_parser =
|
322
|
+
@marshal_wkb_parser = RGeo::WKRep::WKBParser.new(self,
|
323
323
|
support_wkb12: true)
|
324
324
|
end
|
325
325
|
@marshal_wkb_parser
|
@@ -327,7 +327,7 @@ module RGeo
|
|
327
327
|
|
328
328
|
def _psych_wkt_generator # :nodoc:
|
329
329
|
unless defined?(@psych_wkt_generator)
|
330
|
-
@psych_wkt_generator =
|
330
|
+
@psych_wkt_generator = RGeo::WKRep::WKTGenerator.new(
|
331
331
|
tag_format: :wkt12)
|
332
332
|
end
|
333
333
|
@psych_wkt_generator
|
@@ -335,7 +335,7 @@ module RGeo
|
|
335
335
|
|
336
336
|
def _psych_wkt_parser # :nodoc:
|
337
337
|
unless defined?(@psych_wkt_parser)
|
338
|
-
@psych_wkt_parser =
|
338
|
+
@psych_wkt_parser = RGeo::WKRep::WKTParser.new(self,
|
339
339
|
support_wkt12: true, support_ewkt: true)
|
340
340
|
end
|
341
341
|
@psych_wkt_parser
|
@@ -7,92 +7,92 @@
|
|
7
7
|
module RGeo
|
8
8
|
module Cartesian
|
9
9
|
class PointImpl # :nodoc:
|
10
|
-
include
|
11
|
-
include
|
12
|
-
include
|
13
|
-
include
|
14
|
-
include
|
10
|
+
include RGeo::Feature::Point
|
11
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
12
|
+
include RGeo::ImplHelper::BasicPointMethods
|
13
|
+
include RGeo::Cartesian::GeometryMethods
|
14
|
+
include RGeo::Cartesian::PointMethods
|
15
15
|
|
16
16
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Point).include_in_class(self, true)
|
17
17
|
end
|
18
18
|
|
19
19
|
class LineStringImpl # :nodoc:
|
20
|
-
include
|
21
|
-
include
|
22
|
-
include
|
23
|
-
include
|
24
|
-
include
|
20
|
+
include RGeo::Feature::LineString
|
21
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
22
|
+
include RGeo::ImplHelper::BasicLineStringMethods
|
23
|
+
include RGeo::Cartesian::GeometryMethods
|
24
|
+
include RGeo::Cartesian::LineStringMethods
|
25
25
|
|
26
26
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LineString).include_in_class(self, true)
|
27
27
|
end
|
28
28
|
|
29
29
|
class LineImpl # :nodoc:
|
30
|
-
include
|
31
|
-
include
|
32
|
-
include
|
33
|
-
include
|
34
|
-
include
|
35
|
-
include
|
30
|
+
include RGeo::Feature::Line
|
31
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
32
|
+
include RGeo::ImplHelper::BasicLineStringMethods
|
33
|
+
include RGeo::ImplHelper::BasicLineMethods
|
34
|
+
include RGeo::Cartesian::GeometryMethods
|
35
|
+
include RGeo::Cartesian::LineStringMethods
|
36
36
|
|
37
37
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Line).include_in_class(self, true)
|
38
38
|
end
|
39
39
|
|
40
40
|
class LinearRingImpl # :nodoc:
|
41
|
-
include
|
42
|
-
include
|
43
|
-
include
|
44
|
-
include
|
45
|
-
include
|
46
|
-
include
|
41
|
+
include RGeo::Feature::LinearRing
|
42
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
43
|
+
include RGeo::ImplHelper::BasicLineStringMethods
|
44
|
+
include RGeo::ImplHelper::BasicLinearRingMethods
|
45
|
+
include RGeo::Cartesian::GeometryMethods
|
46
|
+
include RGeo::Cartesian::LineStringMethods
|
47
47
|
|
48
48
|
Feature::MixinCollection::GLOBAL.for_type(Feature::LinearRing).include_in_class(self, true)
|
49
49
|
end
|
50
50
|
|
51
51
|
class PolygonImpl # :nodoc:
|
52
|
-
include
|
53
|
-
include
|
54
|
-
include
|
55
|
-
include
|
52
|
+
include RGeo::Feature::Polygon
|
53
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
54
|
+
include RGeo::ImplHelper::BasicPolygonMethods
|
55
|
+
include RGeo::Cartesian::GeometryMethods
|
56
56
|
|
57
57
|
Feature::MixinCollection::GLOBAL.for_type(Feature::Polygon).include_in_class(self, true)
|
58
58
|
end
|
59
59
|
|
60
60
|
class GeometryCollectionImpl # :nodoc:
|
61
|
-
include
|
62
|
-
include
|
63
|
-
include
|
64
|
-
include
|
61
|
+
include RGeo::Feature::GeometryCollection
|
62
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
63
|
+
include RGeo::ImplHelper::BasicGeometryCollectionMethods
|
64
|
+
include RGeo::Cartesian::GeometryMethods
|
65
65
|
|
66
66
|
Feature::MixinCollection::GLOBAL.for_type(Feature::GeometryCollection).include_in_class(self, true)
|
67
67
|
end
|
68
68
|
|
69
69
|
class MultiPointImpl # :nodoc:
|
70
|
-
include
|
71
|
-
include
|
72
|
-
include
|
73
|
-
include
|
74
|
-
include
|
70
|
+
include RGeo::Feature::MultiPoint
|
71
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
72
|
+
include RGeo::ImplHelper::BasicGeometryCollectionMethods
|
73
|
+
include RGeo::ImplHelper::BasicMultiPointMethods
|
74
|
+
include RGeo::Cartesian::GeometryMethods
|
75
75
|
|
76
76
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPoint).include_in_class(self, true)
|
77
77
|
end
|
78
78
|
|
79
79
|
class MultiLineStringImpl # :nodoc:
|
80
|
-
include
|
81
|
-
include
|
82
|
-
include
|
83
|
-
include
|
84
|
-
include
|
85
|
-
include
|
80
|
+
include RGeo::Feature::MultiLineString
|
81
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
82
|
+
include RGeo::ImplHelper::BasicGeometryCollectionMethods
|
83
|
+
include RGeo::ImplHelper::BasicMultiLineStringMethods
|
84
|
+
include RGeo::Cartesian::GeometryMethods
|
85
|
+
include RGeo::Cartesian::MultiLineStringMethods
|
86
86
|
|
87
87
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiLineString).include_in_class(self, true)
|
88
88
|
end
|
89
89
|
|
90
90
|
class MultiPolygonImpl # :nodoc:
|
91
|
-
include
|
92
|
-
include
|
93
|
-
include
|
94
|
-
include
|
95
|
-
include
|
91
|
+
include RGeo::Feature::MultiPolygon
|
92
|
+
include RGeo::ImplHelper::BasicGeometryMethods
|
93
|
+
include RGeo::ImplHelper::BasicGeometryCollectionMethods
|
94
|
+
include RGeo::ImplHelper::BasicMultiPolygonMethods
|
95
|
+
include RGeo::Cartesian::GeometryMethods
|
96
96
|
|
97
97
|
Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPolygon).include_in_class(self, true)
|
98
98
|
end
|
@@ -25,13 +25,13 @@ module RGeo
|
|
25
25
|
# are ignored.
|
26
26
|
|
27
27
|
def preferred_factory(opts_ = {})
|
28
|
-
if
|
29
|
-
|
28
|
+
if RGeo::Geos.supported?
|
29
|
+
RGeo::Geos.factory(opts_)
|
30
30
|
else
|
31
31
|
simple_factory(opts_)
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
alias factory preferred_factory
|
35
35
|
|
36
36
|
# Returns a factory for the simple Cartesian implementation. This
|
37
37
|
# implementation provides all SFS 1.1 types, and also allows Z and
|
@@ -117,7 +117,7 @@ module RGeo
|
|
117
117
|
def preferred_factory_generator(defaults_ = {})
|
118
118
|
::Proc.new { |c_| preferred_factory(defaults_.merge(c_)) }
|
119
119
|
end
|
120
|
-
|
120
|
+
alias factory_generator preferred_factory_generator
|
121
121
|
|
122
122
|
# Returns a Feature::FactoryGenerator that creates simple factories.
|
123
123
|
# The given options are used as the default options.
|
data/lib/rgeo/coord_sys.rb
CHANGED
@@ -29,7 +29,7 @@ module RGeo
|
|
29
29
|
# The only valid key is :proj4
|
30
30
|
def self.supported?(key)
|
31
31
|
raise(Error::UnsupportedOperation, "Invalid key. The only valid key is :proj4.") unless key == :proj4
|
32
|
-
defined?(Proj4) && Proj4.supported?
|
32
|
+
defined?(RGeo::CoordSys::Proj4) && RGeo::CoordSys::Proj4.supported?
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.check!(key)
|
@@ -22,7 +22,7 @@ module RGeo
|
|
22
22
|
# implementation. Thus, to get a corresponding factory generator,
|
23
23
|
# you can use the <tt>method</tt> method. e.g.
|
24
24
|
#
|
25
|
-
# factory_generator =
|
25
|
+
# factory_generator = RGeo::Cartesian.method(:preferred_factory)
|
26
26
|
#
|
27
27
|
# FactoryGenerator is defined as a module and is provided
|
28
28
|
# primarily for the sake of documentation. Implementations need not
|
@@ -567,7 +567,7 @@ module RGeo
|
|
567
567
|
# objective equivalence.
|
568
568
|
|
569
569
|
def eql?(rhs_)
|
570
|
-
if rhs_.is_a?(
|
570
|
+
if rhs_.is_a?(RGeo::Feature::Instance)
|
571
571
|
begin
|
572
572
|
rep_equals?(rhs_)
|
573
573
|
rescue Error::UnsupportedOperation
|
@@ -593,7 +593,7 @@ module RGeo
|
|
593
593
|
# objective equivalence.
|
594
594
|
|
595
595
|
def ==(rhs_)
|
596
|
-
if rhs_.is_a?(
|
596
|
+
if rhs_.is_a?(RGeo::Feature::Instance)
|
597
597
|
begin
|
598
598
|
equals?(rhs_)
|
599
599
|
rescue Error::UnsupportedOperation
|
data/lib/rgeo/feature/mixins.rb
CHANGED
@@ -99,7 +99,7 @@ module RGeo
|
|
99
99
|
# Returns a TypeData for the given type.
|
100
100
|
#
|
101
101
|
# e.g. to add a module for point types, you can call:
|
102
|
-
# for_type(
|
102
|
+
# for_type(RGeo::Feature::Point).add(module)
|
103
103
|
|
104
104
|
def for_type(type_)
|
105
105
|
(@types[type_] ||= TypeData.new(self, type_))
|
data/lib/rgeo/feature/types.rb
CHANGED
@@ -14,39 +14,39 @@ module RGeo
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# This module provides the API for geometry type objects. Technically
|
17
|
-
# these objects are modules (such as
|
17
|
+
# these objects are modules (such as RGeo::Feature::Point), but as
|
18
18
|
# objects they respond to the methods documented here.
|
19
19
|
#
|
20
20
|
# For example, you may determine whether a feature object is a
|
21
21
|
# point by calling:
|
22
22
|
#
|
23
|
-
#
|
23
|
+
# RGeo::Feature::Point.check_type(object)
|
24
24
|
#
|
25
25
|
# A corresponding === operator is provided so you can use the type
|
26
26
|
# modules in a case-when clause:
|
27
27
|
#
|
28
28
|
# case object
|
29
|
-
# when
|
29
|
+
# when RGeo::Feature::Point
|
30
30
|
# # do stuff here...
|
31
31
|
#
|
32
32
|
# However, a feature object may not actually include the point module
|
33
33
|
# itself; hence, the following will *not* work:
|
34
34
|
#
|
35
|
-
# object.is_a?(
|
35
|
+
# object.is_a?(RGeo::Feature::Point) # DON'T DO THIS-- DOES NOT WORK
|
36
36
|
#
|
37
37
|
# You may obtain the type of a feature object by calling its
|
38
38
|
# geometry_type method. You may then use the methods in this module to
|
39
39
|
# interrogate that type.
|
40
40
|
#
|
41
41
|
# # supppose object is a Point
|
42
|
-
# type = object.geometry_type #
|
42
|
+
# type = object.geometry_type # RGeo::Feature::Point
|
43
43
|
# type.type_name # "Point"
|
44
|
-
# type.supertype #
|
44
|
+
# type.supertype # RGeo::Feature::Geometry
|
45
45
|
#
|
46
46
|
# You may also use the presence of this module to determine whether
|
47
47
|
# a particular object is a feature type:
|
48
48
|
#
|
49
|
-
#
|
49
|
+
# RGeo::Feature::Type === object.geometry_type # true
|
50
50
|
|
51
51
|
module Type
|
52
52
|
# Returns true if the given object is this type or a subtype
|
@@ -60,7 +60,7 @@ module RGeo
|
|
60
60
|
rhs_ = rhs_.geometry_type if rhs_.is_a?(Feature::Instance)
|
61
61
|
rhs_.is_a?(Type) && (rhs_ == self || rhs_.include?(self))
|
62
62
|
end
|
63
|
-
|
63
|
+
alias === check_type
|
64
64
|
|
65
65
|
# Returns true if this type is the same type or a subtype of the
|
66
66
|
# given type.
|
@@ -84,12 +84,12 @@ module RGeo
|
|
84
84
|
|
85
85
|
# Returns the OpenGIS type name of this type. For example:
|
86
86
|
#
|
87
|
-
#
|
87
|
+
# RGeo::Feature::Point.type_name # "Point"
|
88
88
|
|
89
89
|
def type_name
|
90
90
|
name.sub("RGeo::Feature::", "")
|
91
91
|
end
|
92
|
-
|
92
|
+
alias to_s type_name
|
93
93
|
|
94
94
|
def _add_subtype(type_) # :nodoc:
|
95
95
|
(@subtypes ||= []) << type_
|
@@ -153,7 +153,7 @@ module RGeo
|
|
153
153
|
# RGeo provides a default casting algorithm. Individual feature
|
154
154
|
# implementation factories may override this and customize the
|
155
155
|
# casting behavior by defining the override_cast method. See
|
156
|
-
#
|
156
|
+
# RGeo::Feature::Factory#override_cast for more details.
|
157
157
|
|
158
158
|
def cast(obj_, *params_)
|
159
159
|
# Interpret params
|