rgeo 2.3.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/README.md +23 -14
  4. data/ext/geos_c_impl/analysis.c +30 -25
  5. data/ext/geos_c_impl/analysis.h +8 -7
  6. data/ext/geos_c_impl/coordinates.c +27 -21
  7. data/ext/geos_c_impl/coordinates.h +5 -2
  8. data/ext/geos_c_impl/errors.c +19 -10
  9. data/ext/geos_c_impl/errors.h +11 -4
  10. data/ext/geos_c_impl/extconf.rb +42 -28
  11. data/ext/geos_c_impl/factory.c +540 -451
  12. data/ext/geos_c_impl/factory.h +105 -95
  13. data/ext/geos_c_impl/geometry.c +593 -387
  14. data/ext/geos_c_impl/geometry.h +10 -5
  15. data/ext/geos_c_impl/geometry_collection.c +306 -339
  16. data/ext/geos_c_impl/geometry_collection.h +6 -20
  17. data/ext/geos_c_impl/globals.c +169 -0
  18. data/ext/geos_c_impl/globals.h +46 -0
  19. data/ext/geos_c_impl/line_string.c +271 -231
  20. data/ext/geos_c_impl/line_string.h +5 -8
  21. data/ext/geos_c_impl/main.c +16 -16
  22. data/ext/geos_c_impl/point.c +65 -67
  23. data/ext/geos_c_impl/point.h +4 -7
  24. data/ext/geos_c_impl/polygon.c +137 -135
  25. data/ext/geos_c_impl/polygon.h +11 -11
  26. data/ext/geos_c_impl/preface.h +16 -10
  27. data/ext/geos_c_impl/ruby_more.c +67 -0
  28. data/ext/geos_c_impl/ruby_more.h +25 -0
  29. data/lib/rgeo/cartesian/analysis.rb +5 -3
  30. data/lib/rgeo/cartesian/bounding_box.rb +74 -79
  31. data/lib/rgeo/cartesian/calculations.rb +64 -33
  32. data/lib/rgeo/cartesian/factory.rb +57 -102
  33. data/lib/rgeo/cartesian/feature_classes.rb +68 -46
  34. data/lib/rgeo/cartesian/feature_methods.rb +67 -25
  35. data/lib/rgeo/cartesian/interface.rb +6 -41
  36. data/lib/rgeo/cartesian/planar_graph.rb +373 -0
  37. data/lib/rgeo/cartesian/sweepline_intersector.rb +147 -0
  38. data/lib/rgeo/cartesian/valid_op.rb +69 -0
  39. data/lib/rgeo/cartesian.rb +3 -0
  40. data/lib/rgeo/coord_sys/cs/entities.rb +303 -99
  41. data/lib/rgeo/coord_sys/cs/factories.rb +0 -2
  42. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +90 -42
  43. data/lib/rgeo/coord_sys.rb +1 -20
  44. data/lib/rgeo/error.rb +15 -0
  45. data/lib/rgeo/feature/curve.rb +0 -11
  46. data/lib/rgeo/feature/factory.rb +26 -36
  47. data/lib/rgeo/feature/factory_generator.rb +6 -14
  48. data/lib/rgeo/feature/geometry.rb +146 -66
  49. data/lib/rgeo/feature/geometry_collection.rb +16 -9
  50. data/lib/rgeo/feature/line_string.rb +4 -5
  51. data/lib/rgeo/feature/linear_ring.rb +0 -1
  52. data/lib/rgeo/feature/multi_curve.rb +0 -6
  53. data/lib/rgeo/feature/multi_surface.rb +3 -4
  54. data/lib/rgeo/feature/point.rb +4 -5
  55. data/lib/rgeo/feature/polygon.rb +1 -2
  56. data/lib/rgeo/feature/surface.rb +3 -4
  57. data/lib/rgeo/feature/types.rb +69 -85
  58. data/lib/rgeo/geographic/factory.rb +98 -125
  59. data/lib/rgeo/geographic/interface.rb +69 -166
  60. data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
  61. data/lib/rgeo/geographic/projected_feature_methods.rb +67 -42
  62. data/lib/rgeo/geographic/projected_window.rb +36 -22
  63. data/lib/rgeo/geographic/{proj4_projector.rb → projector.rb} +3 -5
  64. data/lib/rgeo/geographic/simple_mercator_projector.rb +26 -25
  65. data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
  66. data/lib/rgeo/geographic/spherical_feature_methods.rb +86 -9
  67. data/lib/rgeo/geographic/spherical_math.rb +17 -20
  68. data/lib/rgeo/geographic.rb +1 -1
  69. data/lib/rgeo/geos/capi_factory.rb +87 -158
  70. data/lib/rgeo/geos/capi_feature_classes.rb +50 -36
  71. data/lib/rgeo/geos/ffi_factory.rb +105 -173
  72. data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
  73. data/lib/rgeo/geos/ffi_feature_methods.rb +105 -127
  74. data/lib/rgeo/geos/interface.rb +20 -59
  75. data/lib/rgeo/geos/utils.rb +5 -5
  76. data/lib/rgeo/geos/zm_factory.rb +53 -95
  77. data/lib/rgeo/geos/zm_feature_methods.rb +30 -33
  78. data/lib/rgeo/geos.rb +8 -8
  79. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +9 -22
  80. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -2
  81. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +28 -56
  82. data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -14
  83. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +17 -26
  84. data/lib/rgeo/impl_helper/utils.rb +21 -0
  85. data/lib/rgeo/impl_helper/valid_op.rb +350 -0
  86. data/lib/rgeo/impl_helper/validity_check.rb +139 -0
  87. data/lib/rgeo/impl_helper.rb +1 -0
  88. data/lib/rgeo/version.rb +1 -1
  89. data/lib/rgeo/wkrep/wkb_generator.rb +73 -63
  90. data/lib/rgeo/wkrep/wkb_parser.rb +33 -31
  91. data/lib/rgeo/wkrep/wkt_generator.rb +52 -45
  92. data/lib/rgeo/wkrep/wkt_parser.rb +48 -35
  93. data/lib/rgeo.rb +1 -3
  94. metadata +50 -13
  95. data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
  96. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
  97. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
@@ -78,7 +78,6 @@ module RGeo
78
78
  # Therefore, if an implementation cannot provide a suitable test for
79
79
  # their equivalence types, they must degrade to use a stronger form
80
80
  # of equivalence.
81
-
82
81
  module Geometry
83
82
  extend Type
84
83
 
@@ -90,7 +89,7 @@ module RGeo
90
89
  # operations on them.)
91
90
 
92
91
  def factory
93
- raise Error::UnsupportedOperation, "Method Geometry#factory not defined."
92
+ raise Error::UnsupportedOperation, "Method #{self.class}#factory not defined."
94
93
  end
95
94
 
96
95
  # === SFS 1.1 Description
@@ -105,7 +104,37 @@ module RGeo
105
104
  # point geometries, 1 for curves, and 2 for surfaces.
106
105
 
107
106
  def dimension
108
- raise Error::UnsupportedOperation, "Method Geometry#dimension not defined."
107
+ raise Error::UnsupportedOperation, "Method #{self.class}#dimension not defined."
108
+ end
109
+
110
+ # === SFS 1.2 Description
111
+ #
112
+ # The coordinate dimension is the dimension of direct positions (coordinate tuples) used in
113
+ # the definition of this geometric object
114
+ #
115
+ # === Notes
116
+ #
117
+ # Difference between this and dimension is that this is the dimension of the coordinate
118
+ # not the dimension of the geometry.
119
+ #
120
+ # @return [Integer]
121
+ def coordinate_dimension
122
+ raise Error::UnsupportedOperation, "Method #{self.class}#coordinate_dimension not defined."
123
+ end
124
+
125
+ # === SFS 1.2 Description
126
+ #
127
+ # The spatial dimension is the dimension of the spatial portion of the direct positions
128
+ # (coordinate tuples) used in the definition of this geometric object. If the direct positions
129
+ # do not carry a measure coordinate, this will be equal to the coordinate dimension.
130
+ #
131
+ # === Notes
132
+ #
133
+ # Similar to coordinate_dimension except it will ignore the M component always.
134
+ #
135
+ # @return [Integer]
136
+ def spatial_dimension
137
+ raise Error::UnsupportedOperation, "Method #{self.class}#spatial_dimension not defined."
109
138
  end
110
139
 
111
140
  # === SFS 1.1 Description
@@ -122,7 +151,7 @@ module RGeo
122
151
  # call the +type_name+ method of the returned module.
123
152
 
124
153
  def geometry_type
125
- raise Error::UnsupportedOperation, "Method Geometry#geometry_type not defined."
154
+ raise Error::UnsupportedOperation, "Method #{self.class}#geometry_type not defined."
126
155
  end
127
156
 
128
157
  # === SFS 1.1 Description
@@ -137,7 +166,7 @@ module RGeo
137
166
  # stored in either the same or some other datastore.
138
167
 
139
168
  def srid
140
- raise Error::UnsupportedOperation, "Method Geometry#srid not defined."
169
+ raise Error::UnsupportedOperation, "Method #{self.class}#srid not defined."
141
170
  end
142
171
 
143
172
  # === SFS 1.1 Description
@@ -151,7 +180,7 @@ module RGeo
151
180
  # Returns an object that supports the Geometry interface.
152
181
 
153
182
  def envelope
154
- raise Error::UnsupportedOperation, "Method Geometry#envelope not defined."
183
+ raise Error::UnsupportedOperation, "Method #{self.class}#envelope not defined."
155
184
  end
156
185
 
157
186
  # === SFS 1.1 Description
@@ -164,7 +193,7 @@ module RGeo
164
193
  # Returns an ASCII string.
165
194
 
166
195
  def as_text
167
- raise Error::UnsupportedOperation, "Method Geometry#as_text not defined."
196
+ raise Error::UnsupportedOperation, "Method #{self.class}#as_text not defined."
168
197
  end
169
198
 
170
199
  # === SFS 1.1 Description
@@ -177,7 +206,7 @@ module RGeo
177
206
  # Returns a binary string.
178
207
 
179
208
  def as_binary
180
- raise Error::UnsupportedOperation, "Method Geometry#as_binary not defined."
209
+ raise Error::UnsupportedOperation, "Method #{self.class}#as_binary not defined."
181
210
  end
182
211
 
183
212
  # === SFS 1.1 Description
@@ -192,12 +221,7 @@ module RGeo
192
221
  # specification, which stipulates an integer return value.
193
222
 
194
223
  def empty?
195
- raise Error::UnsupportedOperation, "Method Geometry#empty? not defined."
196
- end
197
-
198
- def is_empty?
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?
224
+ raise Error::UnsupportedOperation, "Method #{self.class}#empty? not defined."
201
225
  end
202
226
 
203
227
  # === SFS 1.1 Description
@@ -214,12 +238,29 @@ module RGeo
214
238
  # specification, which stipulates an integer return value.
215
239
 
216
240
  def simple?
217
- raise Error::UnsupportedOperation, "Method Geometry#simple? not defined."
241
+ raise Error::UnsupportedOperation, "Method #{self.class}#simple? not defined."
218
242
  end
219
243
 
220
- def is_simple?
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?
244
+ # === SFS 1.2 Description
245
+ #
246
+ # Returns 1 (TRUE) if this geometric object has z coordinate values.
247
+ #
248
+ # === Notes
249
+ #
250
+ # @return [Boolean]
251
+ def is_3d?
252
+ raise Error::UnsupportedOperation, "Method #{self.class}#is_3d? not defined."
253
+ end
254
+
255
+ # === SFS 1.2 Description
256
+ #
257
+ # Returns 1 (TRUE) if this geometric object has m coordinate values.
258
+ #
259
+ # === Notes
260
+ #
261
+ # @return [Boolean]
262
+ def measured?
263
+ raise Error::UnsupportedOperation, "Method #{self.class}#measured? not defined."
223
264
  end
224
265
 
225
266
  # === SFS 1.1 Description
@@ -234,7 +275,7 @@ module RGeo
234
275
  # Returns an object that supports the Geometry interface.
235
276
 
236
277
  def boundary
237
- raise Error::UnsupportedOperation, "Method Geometry#boundary not defined."
278
+ raise Error::UnsupportedOperation, "Method #{self.class}#boundary not defined."
238
279
  end
239
280
 
240
281
  # === SFS 1.1 Description
@@ -252,8 +293,8 @@ module RGeo
252
293
  # this geometry, strictly speaking, the result of comparing objects
253
294
  # from different factories is undefined.
254
295
 
255
- def equals?(another_geometry)
256
- raise Error::UnsupportedOperation, "Method Geometry#equals? not defined."
296
+ def equals?(_another_geometry)
297
+ raise Error::UnsupportedOperation, "Method #{self.class}#equals? not defined."
257
298
  end
258
299
 
259
300
  # === SFS 1.1 Description
@@ -271,8 +312,8 @@ module RGeo
271
312
  # this geometry, strictly speaking, the result of comparing objects
272
313
  # from different factories is undefined.
273
314
 
274
- def disjoint?(another_geometry)
275
- raise Error::UnsupportedOperation, "Method Geometry#disjoint? not defined."
315
+ def disjoint?(_another_geometry)
316
+ raise Error::UnsupportedOperation, "Method #{self.class}#disjoint? not defined."
276
317
  end
277
318
 
278
319
  # === SFS 1.1 Description
@@ -290,8 +331,8 @@ module RGeo
290
331
  # this geometry, strictly speaking, the result of comparing objects
291
332
  # from different factories is undefined.
292
333
 
293
- def intersects?(another_geometry)
294
- raise Error::UnsupportedOperation, "Method Geometry#intersects? not defined."
334
+ def intersects?(_another_geometry)
335
+ raise Error::UnsupportedOperation, "Method #{self.class}#intersects? not defined."
295
336
  end
296
337
 
297
338
  # === SFS 1.1 Description
@@ -309,8 +350,8 @@ module RGeo
309
350
  # this geometry, strictly speaking, the result of comparing objects
310
351
  # from different factories is undefined.
311
352
 
312
- def touches?(another_geometry)
313
- raise Error::UnsupportedOperation, "Method Geometry#touches? not defined."
353
+ def touches?(_another_geometry)
354
+ raise Error::UnsupportedOperation, "Method #{self.class}#touches? not defined."
314
355
  end
315
356
 
316
357
  # === SFS 1.1 Description
@@ -328,8 +369,8 @@ module RGeo
328
369
  # this geometry, strictly speaking, the result of comparing objects
329
370
  # from different factories is undefined.
330
371
 
331
- def crosses?(another_geometry)
332
- raise Error::UnsupportedOperation, "Method Geometry#crosses? not defined."
372
+ def crosses?(_another_geometry)
373
+ raise Error::UnsupportedOperation, "Method #{self.class}#crosses? not defined."
333
374
  end
334
375
 
335
376
  # === SFS 1.1 Description
@@ -347,8 +388,8 @@ module RGeo
347
388
  # this geometry, strictly speaking, the result of comparing objects
348
389
  # from different factories is undefined.
349
390
 
350
- def within?(another_geometry)
351
- raise Error::UnsupportedOperation, "Method Geometry#within? not defined."
391
+ def within?(_another_geometry)
392
+ raise Error::UnsupportedOperation, "Method #{self.class}#within? not defined."
352
393
  end
353
394
 
354
395
  # === SFS 1.1 Description
@@ -366,8 +407,8 @@ module RGeo
366
407
  # this geometry, strictly speaking, the result of comparing objects
367
408
  # from different factories is undefined.
368
409
 
369
- def contains?(another_geometry)
370
- raise Error::UnsupportedOperation, "Method Geometry#contains? not defined."
410
+ def contains?(_another_geometry)
411
+ raise Error::UnsupportedOperation, "Method #{self.class}#contains? not defined."
371
412
  end
372
413
 
373
414
  # === SFS 1.1 Description
@@ -385,8 +426,8 @@ module RGeo
385
426
  # this geometry, strictly speaking, the result of comparing objects
386
427
  # from different factories is undefined.
387
428
 
388
- def overlaps?(another_geometry)
389
- raise Error::UnsupportedOperation, "Method Geometry#overlaps? not defined."
429
+ def overlaps?(_another_geometry)
430
+ raise Error::UnsupportedOperation, "Method #{self.class}#overlaps? not defined."
390
431
  end
391
432
 
392
433
  # === SFS 1.1 Description
@@ -411,8 +452,35 @@ module RGeo
411
452
  # this geometry, strictly speaking, the result of comparing objects
412
453
  # from different factories is undefined.
413
454
 
414
- def relate?(another_geometry, _intersection_pattern_matrix_)
415
- raise Error::UnsupportedOperation, "Method Geometry#relate not defined."
455
+ def relate?(_another_geometry, _intersection_pattern_matrix_)
456
+ raise Error::UnsupportedOperation, "Method #{self.class}#relate not defined."
457
+ end
458
+
459
+ # === SFS 1.2 Description
460
+ #
461
+ # Returns a derived geometry collection value that matches the
462
+ # specified m coordinate value.
463
+ #
464
+ # === Notes
465
+ #
466
+ # @param m_value [Float] value to find matches for
467
+ # @return [RGeo::Feature::GeometryCollection]
468
+ def locate_along
469
+ raise Error::UnsupportedOperation, "Method #{self.class}#locate_along not defined."
470
+ end
471
+
472
+ # === SFS 1.2 Description
473
+ #
474
+ # Returns a derived geometry collection value
475
+ # that matches the specified range of m coordinate values inclusively
476
+ #
477
+ # === Notes
478
+ #
479
+ # @param m_start [Float] lower bound of value range
480
+ # @param m_end [Float] upper bound of value range
481
+ # @return [RGeo::Feature::GeometryCollection]
482
+ def locate_between
483
+ raise Error::UnsupportedOperation, "Method #{self.class}#locate_between not defined."
416
484
  end
417
485
 
418
486
  # === SFS 1.1 Description
@@ -430,8 +498,8 @@ module RGeo
430
498
  # this geometry, strictly speaking, the result of measuring the
431
499
  # distance between objects from different factories is undefined.
432
500
 
433
- def distance(another_geometry)
434
- raise Error::UnsupportedOperation, "Method Geometry#distance not defined."
501
+ def distance(_another_geometry)
502
+ raise Error::UnsupportedOperation, "Method #{self.class}#distance not defined."
435
503
  end
436
504
 
437
505
  # === SFS 1.1 Description
@@ -446,7 +514,7 @@ module RGeo
446
514
  # Returns an object that supports the Geometry interface.
447
515
 
448
516
  def buffer(_distance_)
449
- raise Error::UnsupportedOperation, "Method Geometry#buffer not defined."
517
+ raise Error::UnsupportedOperation, "Method #{self.class}#buffer not defined."
450
518
  end
451
519
 
452
520
  # === SFS 1.1 Description
@@ -459,7 +527,7 @@ module RGeo
459
527
  # Returns an object that supports the Geometry interface.
460
528
 
461
529
  def convex_hull
462
- raise Error::UnsupportedOperation, "Method Geometry#convex_hull not defined."
530
+ raise Error::UnsupportedOperation, "Method #{self.class}#convex_hull not defined."
463
531
  end
464
532
 
465
533
  # === SFS 1.1 Description
@@ -476,8 +544,8 @@ module RGeo
476
544
  # this geometry, strictly speaking, the result of performing
477
545
  # operations on objects from different factories is undefined.
478
546
 
479
- def intersection(another_geometry)
480
- raise Error::UnsupportedOperation, "Method Geometry#intersection not defined."
547
+ def intersection(_another_geometry)
548
+ raise Error::UnsupportedOperation, "Method #{self.class}#intersection not defined."
481
549
  end
482
550
 
483
551
  # === SFS 1.1 Description
@@ -494,8 +562,8 @@ module RGeo
494
562
  # this geometry, strictly speaking, the result of performing
495
563
  # operations on objects from different factories is undefined.
496
564
 
497
- def union(another_geometry)
498
- raise Error::UnsupportedOperation, "Method Geometry#union not defined."
565
+ def union(_another_geometry)
566
+ raise Error::UnsupportedOperation, "Method #{self.class}#union not defined."
499
567
  end
500
568
 
501
569
  # === SFS 1.1 Description
@@ -512,8 +580,8 @@ module RGeo
512
580
  # this geometry, strictly speaking, the result of performing
513
581
  # operations on objects from different factories is undefined.
514
582
 
515
- def difference(another_geometry)
516
- raise Error::UnsupportedOperation, "Method Geometry#difference not defined."
583
+ def difference(_another_geometry)
584
+ raise Error::UnsupportedOperation, "Method #{self.class}#difference not defined."
517
585
  end
518
586
 
519
587
  # === SFS 1.1 Description
@@ -530,8 +598,8 @@ module RGeo
530
598
  # this geometry, strictly speaking, the result of performing
531
599
  # operations on objects from different factories is undefined.
532
600
 
533
- def sym_difference(another_geometry)
534
- raise Error::UnsupportedOperation, "Method Geometry#sym_difference not defined."
601
+ def sym_difference(_another_geometry)
602
+ raise Error::UnsupportedOperation, "Method #{self.class}#sym_difference not defined."
535
603
  end
536
604
 
537
605
  # Returns true if this geometric object is representationally
@@ -542,8 +610,8 @@ module RGeo
542
610
  # this geometry, strictly speaking, the result of comparing objects
543
611
  # from different factories is undefined.
544
612
 
545
- def rep_equals?(another_geometry)
546
- raise Error::UnsupportedOperation, "Method Geometry#rep_equals? not defined."
613
+ def rep_equals?(_another_geometry)
614
+ raise Error::UnsupportedOperation, "Method #{self.class}#rep_equals? not defined."
547
615
  end
548
616
 
549
617
  # Unions a collection of Geometry or a single Geometry
@@ -560,7 +628,7 @@ module RGeo
560
628
  # returns nil.
561
629
  #
562
630
  def unary_union
563
- raise Error::UnsupportedOperation, "Method Geometry#unary_union not defined."
631
+ raise Error::UnsupportedOperation, "Method #{self.class}#unary_union not defined."
564
632
  end
565
633
 
566
634
  # This method should behave almost the same as the rep_equals?
@@ -578,12 +646,12 @@ module RGeo
578
646
  # representational equivalence test, this method must fall back on
579
647
  # objective equivalence.
580
648
 
581
- def eql?(rhs)
582
- if rhs.is_a?(RGeo::Feature::Instance)
649
+ def eql?(other)
650
+ if other.is_a?(RGeo::Feature::Instance)
583
651
  begin
584
- rep_equals?(rhs)
652
+ rep_equals?(other)
585
653
  rescue Error::UnsupportedOperation
586
- equal?(rhs)
654
+ equal?(other)
587
655
  end
588
656
  else
589
657
  false
@@ -604,12 +672,12 @@ module RGeo
604
672
  # test, the == operator must fall back on representational or
605
673
  # objective equivalence.
606
674
 
607
- def ==(rhs)
608
- if rhs.is_a?(RGeo::Feature::Instance)
675
+ def ==(other)
676
+ if other.is_a?(RGeo::Feature::Instance)
609
677
  begin
610
- equals?(rhs)
678
+ equals?(other)
611
679
  rescue Error::UnsupportedOperation
612
- eql?(rhs)
680
+ eql?(other)
613
681
  end
614
682
  else
615
683
  false
@@ -621,8 +689,8 @@ module RGeo
621
689
  # types is not specified; an implementation may choose to provide
622
690
  # additional capabilities as appropriate.
623
691
 
624
- def -(rhs)
625
- difference(rhs)
692
+ def -(other)
693
+ difference(other)
626
694
  end
627
695
 
628
696
  # If the given rhs is a geometry object, this operator must behave
@@ -630,8 +698,8 @@ module RGeo
630
698
  # is not specified; an implementation may choose to provide
631
699
  # additional capabilities as appropriate.
632
700
 
633
- def +(rhs)
634
- union(rhs)
701
+ def +(other)
702
+ union(other)
635
703
  end
636
704
 
637
705
  # If the given rhs is a geometry object, this operator must behave
@@ -639,8 +707,20 @@ module RGeo
639
707
  # types is not specified; an implementation may choose to provide
640
708
  # additional capabilities as appropriate.
641
709
 
642
- def *(rhs)
643
- intersection(rhs)
710
+ def *(other)
711
+ intersection(other)
712
+ end
713
+
714
+ # Convenience method to transform/project a geometry
715
+ # to a different coordinate system from the geometry itself
716
+ # instead of the cast method.
717
+ #
718
+ # @note: Not an OGC SFS method
719
+ #
720
+ # @param [RGeo::Feature::Factory] other_factory
721
+ # @return [RGeo::Feature::Geometry]
722
+ def transform(other_factory)
723
+ Feature.cast(self, factory: other_factory, project: true)
644
724
  end
645
725
  end
646
726
  end
@@ -28,7 +28,6 @@ module RGeo
28
28
  # include this module itself. Therefore, you should not depend on the
29
29
  # kind_of? method to check type. Instead, use the provided check_type
30
30
  # class method (or === operator) defined in the Type module.
31
-
32
31
  module GeometryCollection
33
32
  include Geometry
34
33
  extend Type
@@ -44,7 +43,7 @@ module RGeo
44
43
  # Returns an integer.
45
44
 
46
45
  def num_geometries
47
- raise Error::UnsupportedOperation, "Method GeometryCollection#num_geometries not defined."
46
+ raise Error::UnsupportedOperation, "Method #{self.class}#num_geometries not defined."
48
47
  end
49
48
 
50
49
  # === SFS 1.1 Description
@@ -58,8 +57,8 @@ module RGeo
58
57
  # Also note that this method is different from GeometryCollection#[]
59
58
  # in that it does not support negative indexes.
60
59
 
61
- def geometry_n(n)
62
- raise Error::UnsupportedOperation, "Method GeometryCollection#geometry_n not defined."
60
+ def geometry_n(_idx)
61
+ raise Error::UnsupportedOperation, "Method #{self.class}#geometry_n not defined."
63
62
  end
64
63
 
65
64
  # Alias of the num_geometries method.
@@ -78,14 +77,14 @@ module RGeo
78
77
  # the same way Ruby's array indexing works. Hence, geometry_n(-1)
79
78
  # returns nil, where [-1] returns the last element of the collection.
80
79
 
81
- def [](n)
82
- raise Error::UnsupportedOperation, "Method GeometryCollection#[] not defined."
80
+ def [](_idx)
81
+ raise Error::UnsupportedOperation, "Method #{self.class}#[] not defined."
83
82
  end
84
83
 
85
84
  # Nodes the linework in a list of Geometries
86
85
  #
87
86
  def node
88
- raise Error::UnsupportedOperation, "Method GeometryCollection#node not defined."
87
+ raise Error::UnsupportedOperation, "Method #{self.class}#node not defined."
89
88
  end
90
89
 
91
90
  # Iterates over the geometries of this GeometryCollection.
@@ -95,8 +94,16 @@ module RGeo
95
94
  # Note that all GeometryCollection implementations must also
96
95
  # include the Enumerable mixin.
97
96
 
98
- def each(&block)
99
- raise Error::UnsupportedOperation, "Method GeometryCollection#each not defined."
97
+ def each(&_block)
98
+ raise Error::UnsupportedOperation, "Method #{self.class}#each not defined."
99
+ end
100
+
101
+ # Gives a point that is guaranteed to be within the geometry.
102
+ #
103
+ # Extends OGC SFS 1.1 and follows PostGIS standards.
104
+ # @see https://postgis.net/docs/ST_PointOnSurface.html
105
+ def point_on_surface
106
+ raise Error::UnsupportedOperation, "Method #{self.class}#each not defined."
100
107
  end
101
108
  end
102
109
  end
@@ -20,7 +20,6 @@ module RGeo
20
20
  # include this module itself. Therefore, you should not depend on the
21
21
  # kind_of? method to check type. Instead, use the provided check_type
22
22
  # class method (or === operator) defined in the Type module.
23
-
24
23
  module LineString
25
24
  include Curve
26
25
  extend Type
@@ -34,7 +33,7 @@ module RGeo
34
33
  # Returns an integer.
35
34
 
36
35
  def num_points
37
- raise Error::UnsupportedOperation, "Method LineString#num_points not defined."
36
+ raise Error::UnsupportedOperation, "Method #{self.class}#num_points not defined."
38
37
  end
39
38
 
40
39
  # === SFS 1.1 Description
@@ -47,15 +46,15 @@ module RGeo
47
46
  # if the given N is out of range. N is zero-based.
48
47
  # Does not support negative indexes.
49
48
 
50
- def point_n(n)
51
- raise Error::UnsupportedOperation, "Method LineString#point_n not defined."
49
+ def point_n(_idx)
50
+ raise Error::UnsupportedOperation, "Method #{self.class}#point_n not defined."
52
51
  end
53
52
 
54
53
  # Returns the constituent points as an array of objects that
55
54
  # support the Point interface.
56
55
 
57
56
  def points
58
- raise Error::UnsupportedOperation, "Method LineString#points not defined."
57
+ raise Error::UnsupportedOperation, "Method #{self.class}#points not defined."
59
58
  end
60
59
  end
61
60
  end
@@ -19,7 +19,6 @@ module RGeo
19
19
  # include this module itself. Therefore, you should not depend on the
20
20
  # kind_of? method to check type. Instead, use the provided check_type
21
21
  # class method (or === operator) defined in the Type module.
22
-
23
22
  module LinearRing
24
23
  include LineString
25
24
  extend Type
@@ -37,7 +37,6 @@ module RGeo
37
37
  # include this module itself. Therefore, you should not depend on the
38
38
  # kind_of? method to check type. Instead, use the provided check_type
39
39
  # class method (or === operator) defined in the Type module.
40
-
41
40
  module MultiCurve
42
41
  include GeometryCollection
43
42
  extend Type
@@ -68,11 +67,6 @@ module RGeo
68
67
  def closed?
69
68
  raise Error::UnsupportedOperation, "Method MultiCurve#closed? not defined."
70
69
  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
70
  end
77
71
  end
78
72
  end
@@ -28,7 +28,6 @@ module RGeo
28
28
  # include this module itself. Therefore, you should not depend on the
29
29
  # kind_of? method to check type. Instead, use the provided check_type
30
30
  # class method (or === operator) defined in the Type module.
31
-
32
31
  module MultiSurface
33
32
  include GeometryCollection
34
33
  extend Type
@@ -43,7 +42,7 @@ module RGeo
43
42
  # Returns a floating-point scalar value.
44
43
 
45
44
  def area
46
- raise Error::UnsupportedOperation, "Method MultiSurface#area not defined."
45
+ raise Error::UnsupportedOperation, "Method #{self.class}#area not defined."
47
46
  end
48
47
 
49
48
  # === SFS 1.1 Description
@@ -56,7 +55,7 @@ module RGeo
56
55
  # Returns an object that supports the Point interface.
57
56
 
58
57
  def centroid
59
- raise Error::UnsupportedOperation, "Method MultiSurface#centroid not defined."
58
+ raise Error::UnsupportedOperation, "Method #{self.class}#centroid not defined."
60
59
  end
61
60
 
62
61
  # === SFS 1.1 Description
@@ -68,7 +67,7 @@ module RGeo
68
67
  # Returns an object that supports the Point interface.
69
68
 
70
69
  def point_on_surface
71
- raise Error::UnsupportedOperation, "Method MultiSurface#point_on_surface not defined."
70
+ raise Error::UnsupportedOperation, "Method #{self.class}#point_on_surface not defined."
72
71
  end
73
72
  end
74
73
  end
@@ -33,7 +33,6 @@ module RGeo
33
33
  # replace them with empty GeometryCollection objects. Therefore,
34
34
  # currently, every RGeo Point object represents an actual location
35
35
  # with real coordinates.
36
-
37
36
  module Point
38
37
  include Geometry
39
38
  extend Type
@@ -47,7 +46,7 @@ module RGeo
47
46
  # Returns a floating-point scalar value.
48
47
 
49
48
  def x
50
- raise Error::UnsupportedOperation, "Method Point#x not defined."
49
+ raise Error::UnsupportedOperation, "Method #{self.class}#x not defined."
51
50
  end
52
51
 
53
52
  # === SFS 1.1 Description
@@ -59,7 +58,7 @@ module RGeo
59
58
  # Returns a floating-point scalar value.
60
59
 
61
60
  def y
62
- raise Error::UnsupportedOperation, "Method Point#y not defined."
61
+ raise Error::UnsupportedOperation, "Method #{self.class}#y not defined."
63
62
  end
64
63
 
65
64
  # Returns the z-coordinate for this Point as a floating-point
@@ -69,7 +68,7 @@ module RGeo
69
68
  # not support Z coordinates.
70
69
 
71
70
  def z
72
- raise Error::UnsupportedOperation, "Method Point#z not defined."
71
+ raise Error::UnsupportedOperation, "Method #{self.class}#z not defined."
73
72
  end
74
73
 
75
74
  # Returns the m-coordinate for this Point as a floating-point
@@ -79,7 +78,7 @@ module RGeo
79
78
  # not support M coordinates.
80
79
 
81
80
  def m
82
- raise Error::UnsupportedOperation, "Method Point#m not defined."
81
+ raise Error::UnsupportedOperation, "Method #{self.class}#m not defined."
83
82
  end
84
83
  end
85
84
  end
@@ -45,7 +45,6 @@ module RGeo
45
45
  # include this module itself. Therefore, you should not depend on the
46
46
  # kind_of? method to check type. Instead, use the provided check_type
47
47
  # class method (or === operator) defined in the Type module.
48
-
49
48
  module Polygon
50
49
  include Surface
51
50
  extend Type
@@ -84,7 +83,7 @@ module RGeo
84
83
  # if the given N is out of range. N is zero-based.
85
84
  # Does not support negative indexes.
86
85
 
87
- def interior_ring_n(n)
86
+ def interior_ring_n(_idx)
88
87
  raise Error::UnsupportedOperation, "Method Polygon#interior_ring_n not defined."
89
88
  end
90
89