rgeo 2.3.0 → 2.3.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/ext/geos_c_impl/factory.c +5 -6
- data/ext/geos_c_impl/geometry.c +2 -2
- data/ext/geos_c_impl/geometry_collection.c +1 -1
- data/ext/geos_c_impl/line_string.c +2 -2
- data/lib/rgeo/cartesian/analysis.rb +2 -2
- data/lib/rgeo/cartesian/feature_methods.rb +6 -1
- data/lib/rgeo/feature/curve.rb +12 -2
- data/lib/rgeo/feature/geometry.rb +12 -2
- data/lib/rgeo/feature/multi_curve.rb +6 -1
- data/lib/rgeo/geographic/interface.rb +2 -1
- data/lib/rgeo/geographic/projected_feature_methods.rb +12 -2
- data/lib/rgeo/geographic/spherical_feature_methods.rb +6 -1
- data/lib/rgeo/geos/capi_feature_classes.rb +29 -0
- data/lib/rgeo/geos/ffi_feature_methods.rb +30 -5
- data/lib/rgeo/geos/interface.rb +18 -3
- data/lib/rgeo/geos/zm_feature_methods.rb +30 -5
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +14 -4
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +23 -8
- data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -2
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +7 -2
- 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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b93de3431a81612631cfa612d589bc0e1026f16276d3c1e848b71f1a3e682731
|
4
|
+
data.tar.gz: 992a46705454a1fe1c77405e9b6f753739af0c80b9e6f58d8e60da07b75eea93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aca5ecae4e1c3ee2d022591ccf612aae3e4f8539543cc740ba3875b15ae156da6e1e13180a305e0c2a41a9bcf3a60e3eafb5c87eb737f95ef194e08fe66c39f9
|
7
|
+
data.tar.gz: 94ae519f52c0a6deada3e560722256e99fc482528be8ceea67496cf0dbc7488da9bf643ab2905a28294aaa68ac3f532e913c3afb7fea2877b438ecf282911153
|
data/ext/geos_c_impl/factory.c
CHANGED
@@ -773,7 +773,6 @@ VALUE rgeo_wrap_geos_geometry_clone(VALUE factory, const GEOSGeometry* geom, VAL
|
|
773
773
|
const GEOSGeometry* rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type)
|
774
774
|
{
|
775
775
|
VALUE object;
|
776
|
-
const GEOSGeometry* geom;
|
777
776
|
RGeo_Globals* globals;
|
778
777
|
|
779
778
|
if (NIL_P(type) && TYPE(obj) == T_DATA && RDATA(obj)->dfree == (RUBY_DATA_FUNC)destroy_geometry_func && RGEO_GEOMETRY_DATA_PTR(obj)->factory == factory) {
|
@@ -783,11 +782,11 @@ const GEOSGeometry* rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALU
|
|
783
782
|
globals = RGEO_FACTORY_DATA_PTR(factory)->globals;
|
784
783
|
object = rb_funcall(globals->feature_module, globals->id_cast, 3, obj, factory, type);
|
785
784
|
}
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
return geom;
|
785
|
+
if (NIL_P(object))
|
786
|
+
return NULL;
|
787
|
+
|
788
|
+
Check_Type(object, T_DATA);
|
789
|
+
return RGEO_GEOMETRY_DATA_PTR(object)->geom;
|
791
790
|
}
|
792
791
|
|
793
792
|
|
data/ext/geos_c_impl/geometry.c
CHANGED
@@ -1095,8 +1095,8 @@ void rgeo_init_geos_geometry(RGeo_Globals* globals)
|
|
1095
1095
|
rb_define_method(geos_geometry_methods, "boundary", method_geometry_boundary, 0);
|
1096
1096
|
rb_define_method(geos_geometry_methods, "_as_text", method_geometry_as_text, 0);
|
1097
1097
|
rb_define_method(geos_geometry_methods, "as_binary", method_geometry_as_binary, 0);
|
1098
|
-
rb_define_method(geos_geometry_methods, "
|
1099
|
-
rb_define_method(geos_geometry_methods, "
|
1098
|
+
rb_define_method(geos_geometry_methods, "empty?", method_geometry_is_empty, 0);
|
1099
|
+
rb_define_method(geos_geometry_methods, "simple?", method_geometry_is_simple, 0);
|
1100
1100
|
rb_define_method(geos_geometry_methods, "equals?", method_geometry_equals, 1);
|
1101
1101
|
rb_define_method(geos_geometry_methods, "==", method_geometry_equals, 1);
|
1102
1102
|
rb_define_method(geos_geometry_methods, "rep_equals?", method_geometry_eql, 1);
|
@@ -623,7 +623,7 @@ void rgeo_init_geos_geometry_collection(RGeo_Globals* globals)
|
|
623
623
|
geos_multi_line_string_methods = rb_define_module_under(globals->geos_module, "CAPIMultiLineStringMethods");
|
624
624
|
rb_define_method(geos_multi_line_string_methods, "geometry_type", method_multi_line_string_geometry_type, 0);
|
625
625
|
rb_define_method(geos_multi_line_string_methods, "length", method_multi_line_string_length, 0);
|
626
|
-
rb_define_method(geos_multi_line_string_methods, "
|
626
|
+
rb_define_method(geos_multi_line_string_methods, "closed?", method_multi_line_string_is_closed, 0);
|
627
627
|
rb_define_method(geos_multi_line_string_methods, "hash", method_multi_line_string_hash, 0);
|
628
628
|
rb_define_method(geos_multi_line_string_methods, "coordinates", method_multi_line_string_coordinates, 0);
|
629
629
|
|
@@ -663,8 +663,8 @@ void rgeo_init_geos_line_string(RGeo_Globals* globals)
|
|
663
663
|
rb_define_method(geos_line_string_methods, "end_point", method_line_string_end_point, 0);
|
664
664
|
rb_define_method(geos_line_string_methods, "project_point", method_line_string_project_point, 1);
|
665
665
|
rb_define_method(geos_line_string_methods, "interpolate_point", method_line_string_interpolate_point, 1);
|
666
|
-
rb_define_method(geos_line_string_methods, "
|
667
|
-
rb_define_method(geos_line_string_methods, "
|
666
|
+
rb_define_method(geos_line_string_methods, "closed?", method_line_string_is_closed, 0);
|
667
|
+
rb_define_method(geos_line_string_methods, "ring?", method_line_string_is_ring, 0);
|
668
668
|
rb_define_method(geos_line_string_methods, "coordinates", method_line_string_coordinates, 0);
|
669
669
|
|
670
670
|
// CAPILinearRingMethods module
|
@@ -22,12 +22,12 @@ module RGeo
|
|
22
22
|
# == Note
|
23
23
|
#
|
24
24
|
# This method does not ensure a correct result for an invalid geometry.
|
25
|
-
# You should make sure your ring is valid beforehand using `
|
25
|
+
# You should make sure your ring is valid beforehand using `ring?`
|
26
26
|
# if you are using a LineString, or directly `valid?` for a
|
27
27
|
# `linear_ring?`.
|
28
28
|
# This will be subject to changes in v3.
|
29
29
|
def ccw?(ring)
|
30
|
-
if RGeo::Geos.
|
30
|
+
if RGeo::Geos.capi_geos?(ring) && RGeo::Geos::Analysis.ccw_supported?
|
31
31
|
RGeo::Geos::Analysis.ccw?(ring)
|
32
32
|
else
|
33
33
|
RGeo::Cartesian::Analysis.ring_direction(ring) == 1
|
@@ -49,7 +49,7 @@ module RGeo
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def simple?
|
53
53
|
len = segments.length
|
54
54
|
return false if segments.any?(&:degenerate?)
|
55
55
|
return true if len == 1
|
@@ -72,6 +72,11 @@ module RGeo
|
|
72
72
|
true
|
73
73
|
end
|
74
74
|
|
75
|
+
def is_simple?
|
76
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
77
|
+
simple?
|
78
|
+
end
|
79
|
+
|
75
80
|
def length
|
76
81
|
segments.inject(0.0) { |sum, seg| sum + seg.length }
|
77
82
|
end
|
data/lib/rgeo/feature/curve.rb
CHANGED
@@ -90,8 +90,13 @@ module RGeo
|
|
90
90
|
# Returns a boolean value. Note that this is different from the SFS
|
91
91
|
# specification, which stipulates an integer return value.
|
92
92
|
|
93
|
+
def closed?
|
94
|
+
raise Error::UnsupportedOperation, "Method Curve#closed? not defined."
|
95
|
+
end
|
96
|
+
|
93
97
|
def is_closed?
|
94
|
-
|
98
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
99
|
+
closed?
|
95
100
|
end
|
96
101
|
|
97
102
|
# === SFS 1.1 Description
|
@@ -105,8 +110,13 @@ module RGeo
|
|
105
110
|
# Returns a boolean value. Note that this is different from the SFS
|
106
111
|
# specification, which stipulates an integer return value.
|
107
112
|
|
113
|
+
def ring?
|
114
|
+
raise Error::UnsupportedOperation, "Method Curve#ring? not defined."
|
115
|
+
end
|
116
|
+
|
108
117
|
def is_ring?
|
109
|
-
|
118
|
+
warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
119
|
+
ring?
|
110
120
|
end
|
111
121
|
end
|
112
122
|
end
|
@@ -191,8 +191,13 @@ module RGeo
|
|
191
191
|
# Returns a boolean value. Note that this is different from the SFS
|
192
192
|
# specification, which stipulates an integer return value.
|
193
193
|
|
194
|
+
def empty?
|
195
|
+
raise Error::UnsupportedOperation, "Method Geometry#empty? not defined."
|
196
|
+
end
|
197
|
+
|
194
198
|
def is_empty?
|
195
|
-
|
199
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
200
|
+
empty?
|
196
201
|
end
|
197
202
|
|
198
203
|
# === SFS 1.1 Description
|
@@ -208,8 +213,13 @@ module RGeo
|
|
208
213
|
# Returns a boolean value. Note that this is different from the SFS
|
209
214
|
# specification, which stipulates an integer return value.
|
210
215
|
|
216
|
+
def simple?
|
217
|
+
raise Error::UnsupportedOperation, "Method Geometry#simple? not defined."
|
218
|
+
end
|
219
|
+
|
211
220
|
def is_simple?
|
212
|
-
|
221
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
222
|
+
simple?
|
213
223
|
end
|
214
224
|
|
215
225
|
# === SFS 1.1 Description
|
@@ -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
|
@@ -222,7 +222,8 @@ module RGeo
|
|
222
222
|
wkt_generator: opts[:wkt_generator],
|
223
223
|
wkb_generator: opts[:wkb_generator],
|
224
224
|
has_z_coordinate: opts[:has_z_coordinate],
|
225
|
-
has_m_coordinate: opts[:has_m_coordinate]
|
225
|
+
has_m_coordinate: opts[:has_m_coordinate],
|
226
|
+
uses_lenient_assertions: opts[:uses_lenient_assertions])
|
226
227
|
projector = Geographic::SimpleMercatorProjector.new(factory,
|
227
228
|
buffer_resolution: opts[:buffer_resolution],
|
228
229
|
lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
|
@@ -22,12 +22,22 @@ module RGeo
|
|
22
22
|
factory.unproject(projection.envelope)
|
23
23
|
end
|
24
24
|
|
25
|
+
def empty?
|
26
|
+
projection.empty?
|
27
|
+
end
|
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?
|
31
41
|
end
|
32
42
|
|
33
43
|
def boundary
|
@@ -97,7 +97,7 @@ module RGeo
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
def
|
100
|
+
def simple?
|
101
101
|
len = arcs.length
|
102
102
|
return false if arcs.any?(&:degenerate?)
|
103
103
|
return true if len == 1
|
@@ -120,6 +120,11 @@ module RGeo
|
|
120
120
|
true
|
121
121
|
end
|
122
122
|
|
123
|
+
def is_simple?
|
124
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
125
|
+
simple?
|
126
|
+
end
|
127
|
+
|
123
128
|
def length
|
124
129
|
arcs.inject(0.0) { |sum, arc| sum + arc.length } * SphericalMath::RADIUS
|
125
130
|
end
|
@@ -11,6 +11,16 @@ module RGeo
|
|
11
11
|
module CAPIGeometryMethods # :nodoc:
|
12
12
|
include Feature::Instance
|
13
13
|
|
14
|
+
def is_empty? # rubocop:disable Naming/PredicateName
|
15
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
16
|
+
empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_simple? # rubocop:disable Naming/PredicateName
|
20
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
21
|
+
simple?
|
22
|
+
end
|
23
|
+
|
14
24
|
def inspect
|
15
25
|
"#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
|
16
26
|
end
|
@@ -50,6 +60,25 @@ module RGeo
|
|
50
60
|
alias to_s as_text
|
51
61
|
end
|
52
62
|
|
63
|
+
module CAPIMultiLineStringMethods # :nodoc:
|
64
|
+
def is_closed? # rubocop:disable Naming/PredicateName
|
65
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
66
|
+
closed?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module CAPILineStringMethods # :nodoc:
|
71
|
+
def is_closed? # rubocop:disable Naming/PredicateName
|
72
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
73
|
+
closed?
|
74
|
+
end
|
75
|
+
|
76
|
+
def is_ring? # rubocop:disable Naming/PredicateName
|
77
|
+
warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
78
|
+
ring?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
53
82
|
module CAPIGeometryCollectionMethods # :nodoc:
|
54
83
|
include Enumerable
|
55
84
|
end
|
@@ -113,14 +113,24 @@ module RGeo
|
|
113
113
|
@factory.generate_wkb(self)
|
114
114
|
end
|
115
115
|
|
116
|
-
def
|
116
|
+
def empty?
|
117
117
|
@fg_geom.empty?
|
118
118
|
end
|
119
119
|
|
120
|
-
def
|
120
|
+
def is_empty?
|
121
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
122
|
+
empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
def simple?
|
121
126
|
@fg_geom.simple?
|
122
127
|
end
|
123
128
|
|
129
|
+
def is_simple?
|
130
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
131
|
+
simple?
|
132
|
+
end
|
133
|
+
|
124
134
|
def equals?(rhs)
|
125
135
|
return false unless rhs.is_a?(RGeo::Feature::Instance)
|
126
136
|
fg = factory.convert_to_fg_geometry(rhs)
|
@@ -367,14 +377,24 @@ module RGeo
|
|
367
377
|
end
|
368
378
|
end
|
369
379
|
|
370
|
-
def
|
380
|
+
def closed?
|
371
381
|
@fg_geom.closed?
|
372
382
|
end
|
373
383
|
|
374
|
-
def
|
384
|
+
def is_closed?
|
385
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
386
|
+
closed?
|
387
|
+
end
|
388
|
+
|
389
|
+
def ring?
|
375
390
|
@fg_geom.ring?
|
376
391
|
end
|
377
392
|
|
393
|
+
def is_ring?
|
394
|
+
warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
395
|
+
ring?
|
396
|
+
end
|
397
|
+
|
378
398
|
def rep_equals?(rhs)
|
379
399
|
rhs.class == self.class && rhs.factory.eql?(@factory) &&
|
380
400
|
Utils.ffi_coord_seqs_equal?(rhs.fg_geom.coord_seq, @fg_geom.coord_seq, @factory._has_3d)
|
@@ -553,7 +573,7 @@ module RGeo
|
|
553
573
|
@fg_geom.length
|
554
574
|
end
|
555
575
|
|
556
|
-
def
|
576
|
+
def closed?
|
557
577
|
size = num_geometries
|
558
578
|
size.times do |n|
|
559
579
|
return false unless @fg_geom.get_geometry_n(n).closed?
|
@@ -561,6 +581,11 @@ module RGeo
|
|
561
581
|
true
|
562
582
|
end
|
563
583
|
|
584
|
+
def is_closed?
|
585
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
586
|
+
closed?
|
587
|
+
end
|
588
|
+
|
564
589
|
def coordinates
|
565
590
|
each.map(&:coordinates)
|
566
591
|
end
|
data/lib/rgeo/geos/interface.rb
CHANGED
@@ -31,32 +31,47 @@ module RGeo
|
|
31
31
|
# Returns true if the given feature is a CAPI GEOS feature, or if
|
32
32
|
# the given factory is a CAPI GEOS factory.
|
33
33
|
|
34
|
-
def
|
34
|
+
def capi_geos?(object)
|
35
35
|
CAPI_SUPPORTED &&
|
36
36
|
(CAPIFactory === object || CAPIGeometryMethods === object ||
|
37
37
|
ZMFactory === object && CAPIFactory === object.z_factory ||
|
38
38
|
ZMGeometryMethods === object && CAPIGeometryMethods === object.z_geometry)
|
39
39
|
end
|
40
40
|
|
41
|
+
def is_capi_geos?(object)
|
42
|
+
warn "The is_capi_geos? method is deprecated, please use the capi_geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
43
|
+
capi_geos?(object)
|
44
|
+
end
|
45
|
+
|
41
46
|
# Returns true if the given feature is an FFI GEOS feature, or if
|
42
47
|
# the given factory is an FFI GEOS factory.
|
43
48
|
|
44
|
-
def
|
49
|
+
def ffi_geos?(object)
|
45
50
|
FFI_SUPPORTED &&
|
46
51
|
(FFIFactory === object || FFIGeometryMethods === object ||
|
47
52
|
ZMFactory === object && FFIFactory === object.z_factory ||
|
48
53
|
ZMGeometryMethods === object && FFIGeometryMethods === object.z_geometry)
|
49
54
|
end
|
50
55
|
|
56
|
+
def is_ffi_geos?(object)
|
57
|
+
warn "The is_ffi_geos? method is deprecated, please use the ffi_geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
58
|
+
ffi_geos?(object)
|
59
|
+
end
|
60
|
+
|
51
61
|
# Returns true if the given feature is a GEOS feature, or if the given
|
52
62
|
# factory is a GEOS factory. Does not distinguish between CAPI and FFI.
|
53
63
|
|
54
|
-
def
|
64
|
+
def geos?(object)
|
55
65
|
CAPI_SUPPORTED && (CAPIFactory === object || CAPIGeometryMethods === object) ||
|
56
66
|
FFI_SUPPORTED && (FFIFactory === object || FFIGeometryMethods === object) ||
|
57
67
|
ZMFactory === object || ZMGeometryMethods === object
|
58
68
|
end
|
59
69
|
|
70
|
+
def is_geos?(object)
|
71
|
+
warn "The is_geos? method is deprecated, please use the geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
72
|
+
geos?(object)
|
73
|
+
end
|
74
|
+
|
60
75
|
# Returns the GEOS library version as a string of the format "x.y.z".
|
61
76
|
# Returns nil if GEOS is not available.
|
62
77
|
|
@@ -65,12 +65,22 @@ module RGeo
|
|
65
65
|
@factory.instance_variable_get(:@wkb_generator).generate(self)
|
66
66
|
end
|
67
67
|
|
68
|
+
def empty?
|
69
|
+
@zgeometry.empty?
|
70
|
+
end
|
71
|
+
|
68
72
|
def is_empty?
|
69
|
-
|
73
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
74
|
+
empty?
|
75
|
+
end
|
76
|
+
|
77
|
+
def simple?
|
78
|
+
@zgeometry.simple?
|
70
79
|
end
|
71
80
|
|
72
81
|
def is_simple?
|
73
|
-
|
82
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
83
|
+
simple?
|
74
84
|
end
|
75
85
|
|
76
86
|
def boundary
|
@@ -222,12 +232,22 @@ module RGeo
|
|
222
232
|
point_n(num_points - 1)
|
223
233
|
end
|
224
234
|
|
235
|
+
def closed?
|
236
|
+
@zgeometry.closed?
|
237
|
+
end
|
238
|
+
|
225
239
|
def is_closed?
|
226
|
-
|
240
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
241
|
+
closed?
|
242
|
+
end
|
243
|
+
|
244
|
+
def ring?
|
245
|
+
@zgeometry.ring?
|
227
246
|
end
|
228
247
|
|
229
248
|
def is_ring?
|
230
|
-
|
249
|
+
warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
250
|
+
ring?
|
231
251
|
end
|
232
252
|
|
233
253
|
def num_points
|
@@ -323,8 +343,13 @@ module RGeo
|
|
323
343
|
@zgeometry.length
|
324
344
|
end
|
325
345
|
|
346
|
+
def closed?
|
347
|
+
@zgeometry.closed?
|
348
|
+
end
|
349
|
+
|
326
350
|
def is_closed?
|
327
|
-
|
351
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
352
|
+
closed?
|
328
353
|
end
|
329
354
|
|
330
355
|
def coordinates
|
@@ -51,10 +51,15 @@ module RGeo
|
|
51
51
|
Feature::GeometryCollection
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def empty?
|
55
55
|
@elements.size == 0
|
56
56
|
end
|
57
57
|
|
58
|
+
def is_empty?
|
59
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
60
|
+
empty?
|
61
|
+
end
|
62
|
+
|
58
63
|
def rep_equals?(rhs)
|
59
64
|
if rhs.is_a?(self.class) && rhs.factory.eql?(@factory) && @elements.size == rhs.num_geometries
|
60
65
|
rhs.each_with_index { |p, i| return false unless @elements[i].rep_equals?(p) }
|
@@ -93,8 +98,13 @@ module RGeo
|
|
93
98
|
Feature::MultiLineString
|
94
99
|
end
|
95
100
|
|
101
|
+
def closed?
|
102
|
+
all?(&:closed?)
|
103
|
+
end
|
104
|
+
|
96
105
|
def is_closed?
|
97
|
-
|
106
|
+
warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
107
|
+
closed?
|
98
108
|
end
|
99
109
|
|
100
110
|
def length
|
@@ -104,7 +114,7 @@ module RGeo
|
|
104
114
|
def boundary
|
105
115
|
hash = {}
|
106
116
|
@elements.each do |line|
|
107
|
-
if !line.
|
117
|
+
if !line.empty? && !line.closed?
|
108
118
|
add_boundary(hash, line.start_point)
|
109
119
|
add_boundary(hash, line.end_point)
|
110
120
|
end
|
@@ -180,7 +190,7 @@ module RGeo
|
|
180
190
|
def boundary
|
181
191
|
array = []
|
182
192
|
@elements.each do |poly|
|
183
|
-
array << poly.exterior_ring unless poly.
|
193
|
+
array << poly.exterior_ring unless poly.empty?
|
184
194
|
array.concat(poly.interior_rings)
|
185
195
|
end
|
186
196
|
factory.multi_line_string(array)
|
@@ -39,13 +39,18 @@ module RGeo
|
|
39
39
|
Feature::LineString
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def empty?
|
43
43
|
@points.size == 0
|
44
44
|
end
|
45
45
|
|
46
|
+
def is_empty?
|
47
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
48
|
+
empty?
|
49
|
+
end
|
50
|
+
|
46
51
|
def boundary
|
47
52
|
array = []
|
48
|
-
array << @points.first << @points.last if !
|
53
|
+
array << @points.first << @points.last if !empty? && !closed?
|
49
54
|
factory.multipoint([array])
|
50
55
|
end
|
51
56
|
|
@@ -57,15 +62,25 @@ module RGeo
|
|
57
62
|
@points.last
|
58
63
|
end
|
59
64
|
|
60
|
-
def
|
61
|
-
unless defined?(@
|
62
|
-
@
|
65
|
+
def closed?
|
66
|
+
unless defined?(@closed)
|
67
|
+
@closed = @points.size > 2 && @points.first == @points.last
|
63
68
|
end
|
64
|
-
@
|
69
|
+
@closed
|
70
|
+
end
|
71
|
+
|
72
|
+
def is_closed?
|
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?
|
75
|
+
end
|
76
|
+
|
77
|
+
def ring?
|
78
|
+
closed? && simple?
|
65
79
|
end
|
66
80
|
|
67
81
|
def is_ring?
|
68
|
-
|
82
|
+
warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
83
|
+
ring?
|
69
84
|
end
|
70
85
|
|
71
86
|
def rep_equals?(rhs)
|
@@ -183,7 +198,7 @@ module RGeo
|
|
183
198
|
if @points.size > 0
|
184
199
|
@points << @points.first if @points.first != @points.last
|
185
200
|
@points = @points.chunk { |x| x }.map(&:first)
|
186
|
-
if !@factory.property(:uses_lenient_assertions) && !
|
201
|
+
if !@factory.property(:uses_lenient_assertions) && !ring?
|
187
202
|
raise Error::InvalidGeometry, "LinearRing failed ring test"
|
188
203
|
end
|
189
204
|
end
|
@@ -45,14 +45,24 @@ module RGeo
|
|
45
45
|
Feature::Point
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def empty?
|
49
49
|
false
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def is_empty?
|
53
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
54
|
+
empty?
|
55
|
+
end
|
56
|
+
|
57
|
+
def simple?
|
53
58
|
true
|
54
59
|
end
|
55
60
|
|
61
|
+
def is_simple?
|
62
|
+
warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
63
|
+
simple?
|
64
|
+
end
|
65
|
+
|
56
66
|
def envelope
|
57
67
|
self
|
58
68
|
end
|
@@ -49,13 +49,18 @@ module RGeo
|
|
49
49
|
Feature::Polygon
|
50
50
|
end
|
51
51
|
|
52
|
+
def empty?
|
53
|
+
@exterior_ring.empty?
|
54
|
+
end
|
55
|
+
|
52
56
|
def is_empty?
|
53
|
-
|
57
|
+
warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
|
58
|
+
empty?
|
54
59
|
end
|
55
60
|
|
56
61
|
def boundary
|
57
62
|
array = []
|
58
|
-
array << @exterior_ring unless @exterior_ring.
|
63
|
+
array << @exterior_ring unless @exterior_ring.empty?
|
59
64
|
array.concat(@interior_rings)
|
60
65
|
factory.multi_line_string(array)
|
61
66
|
end
|
data/lib/rgeo/version.rb
CHANGED
@@ -160,7 +160,7 @@ module RGeo
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def generate_line_string(obj)
|
163
|
-
if obj.
|
163
|
+
if obj.empty?
|
164
164
|
"EMPTY"
|
165
165
|
else
|
166
166
|
"#{@begin_bracket}#{obj.points.map { |p| generate_coords(p) }.join(', ')}#{@end_bracket}"
|
@@ -168,7 +168,7 @@ module RGeo
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def generate_polygon(obj)
|
171
|
-
if obj.
|
171
|
+
if obj.empty?
|
172
172
|
"EMPTY"
|
173
173
|
else
|
174
174
|
"#{@begin_bracket}#{([generate_line_string(obj.exterior_ring)] + obj.interior_rings.map { |r| generate_line_string(r) }).join(', ')}#{@end_bracket}"
|
@@ -176,7 +176,7 @@ module RGeo
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def generate_geometry_collection(obj)
|
179
|
-
if obj.
|
179
|
+
if obj.empty?
|
180
180
|
"EMPTY"
|
181
181
|
else
|
182
182
|
"#{@begin_bracket}#{obj.map { |f| generate_feature(f) }.join(', ')}#{@end_bracket}"
|
@@ -184,7 +184,7 @@ module RGeo
|
|
184
184
|
end
|
185
185
|
|
186
186
|
def generate_multi_point(obj)
|
187
|
-
if obj.
|
187
|
+
if obj.empty?
|
188
188
|
"EMPTY"
|
189
189
|
else
|
190
190
|
"#{@begin_bracket}#{obj.map { |f| generate_point(f) }.join(', ')}#{@end_bracket}"
|
@@ -192,7 +192,7 @@ module RGeo
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def generate_multi_line_string(obj)
|
195
|
-
if obj.
|
195
|
+
if obj.empty?
|
196
196
|
"EMPTY"
|
197
197
|
else
|
198
198
|
"#{@begin_bracket}#{obj.map { |f| generate_line_string(f) }.join(', ')}#{@end_bracket}"
|
@@ -200,7 +200,7 @@ module RGeo
|
|
200
200
|
end
|
201
201
|
|
202
202
|
def generate_multi_polygon(obj)
|
203
|
-
if obj.
|
203
|
+
if obj.empty?
|
204
204
|
"EMPTY"
|
205
205
|
else
|
206
206
|
"#{@begin_bracket}#{obj.map { |f| generate_polygon(f) }.join(', ')}#{@end_bracket}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi-geos
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.1.4
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: RGeo is a geospatial data library for Ruby.
|