rgeo 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e86885f1c2a19a3b89ea73784add4644f6cbfa6afb1cf73dc0f1dda22151923
4
- data.tar.gz: 83690993b988a200dc689750e31f8aabdb78fc7aade2af339a068f5adb41b9a1
3
+ metadata.gz: b93de3431a81612631cfa612d589bc0e1026f16276d3c1e848b71f1a3e682731
4
+ data.tar.gz: 992a46705454a1fe1c77405e9b6f753739af0c80b9e6f58d8e60da07b75eea93
5
5
  SHA512:
6
- metadata.gz: 733c109fc5858536ca56a18bac9d9ab78204365a1ea5cd2e4eb7f9d06eaf833cafb28907a547698954c5b5963be921b415b9e5cc881f7235d644be2619de482f
7
- data.tar.gz: 7ab29b70bcfb8f7a58832271245a6a125861c5298db870a3ecad3ff2869aa56045fb42213b44609b44edcf7531349a205ef0e688773bab1f652508c66925730d
6
+ metadata.gz: aca5ecae4e1c3ee2d022591ccf612aae3e4f8539543cc740ba3875b15ae156da6e1e13180a305e0c2a41a9bcf3a60e3eafb5c87eb737f95ef194e08fe66c39f9
7
+ data.tar.gz: 94ae519f52c0a6deada3e560722256e99fc482528be8ceea67496cf0dbc7488da9bf643ab2905a28294aaa68ac3f532e913c3afb7fea2877b438ecf282911153
@@ -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
- geom = NULL;
787
- if (!NIL_P(object)) {
788
- geom = RGEO_GEOMETRY_DATA_PTR(object)->geom;
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
 
@@ -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, "is_empty?", method_geometry_is_empty, 0);
1099
- rb_define_method(geos_geometry_methods, "is_simple?", method_geometry_is_simple, 0);
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, "is_closed?", method_multi_line_string_is_closed, 0);
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, "is_closed?", method_line_string_is_closed, 0);
667
- rb_define_method(geos_line_string_methods, "is_ring?", method_line_string_is_ring, 0);
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 `is_ring?`
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.is_capi_geos?(ring) && RGeo::Geos::Analysis.ccw_supported?
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 is_simple?
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
@@ -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
- raise Error::UnsupportedOperation, "Method Curve#is_closed? not defined."
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
- raise Error::UnsupportedOperation, "Method Curve#is_ring? not defined."
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
- raise Error::UnsupportedOperation, "Method Geometry#is_empty? not defined."
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
- raise Error::UnsupportedOperation, "Method Geometry#is_simple? not defined."
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
- raise Error::UnsupportedOperation, "Method MultiCurve#is_closed? not defined."
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
- projection.is_empty?
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
- projection.is_simple?
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 is_simple?
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 is_empty?
116
+ def empty?
117
117
  @fg_geom.empty?
118
118
  end
119
119
 
120
- def is_simple?
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 is_closed?
380
+ def closed?
371
381
  @fg_geom.closed?
372
382
  end
373
383
 
374
- def is_ring?
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 is_closed?
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
@@ -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 is_capi_geos?(object)
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 is_ffi_geos?(object)
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 is_geos?(object)
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
- @zgeometry.is_empty?
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
- @zgeometry.is_simple?
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
- @zgeometry.is_closed?
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
- @zgeometry.is_ring?
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
- @zgeometry.is_closed?
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 is_empty?
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
- all?(&:is_closed?)
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.is_empty? && !line.is_closed?
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.is_empty?
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 is_empty?
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 !is_empty? && !is_closed?
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 is_closed?
61
- unless defined?(@is_closed)
62
- @is_closed = @points.size > 2 && @points.first == @points.last
65
+ def closed?
66
+ unless defined?(@closed)
67
+ @closed = @points.size > 2 && @points.first == @points.last
63
68
  end
64
- @is_closed
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
- is_closed? && is_simple?
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) && !is_ring?
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 is_empty?
48
+ def empty?
49
49
  false
50
50
  end
51
51
 
52
- def is_simple?
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
- @exterior_ring.is_empty?
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.is_empty?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RGeo
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
@@ -178,7 +178,7 @@ module RGeo
178
178
  emit_line_string_coords(obj)
179
179
  elsif type == Feature::Polygon
180
180
  exterior_ring = obj.exterior_ring
181
- if exterior_ring.is_empty?
181
+ if exterior_ring.empty?
182
182
  emit_integer(0)
183
183
  else
184
184
  emit_integer(1 + obj.num_interior_rings)
@@ -160,7 +160,7 @@ module RGeo
160
160
  end
161
161
 
162
162
  def generate_line_string(obj)
163
- if obj.is_empty?
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.is_empty?
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.is_empty?
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.is_empty?
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.is_empty?
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.is_empty?
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.0
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-04-16 00:00:00.000000000 Z
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.2.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.