diff --git a/Spatial_Programming_With_RGeo.md b/Spatial_Programming_With_RGeo.md index 83474fa5..43763b63 100644 --- a/Spatial_Programming_With_RGeo.md +++ b/Spatial_Programming_With_RGeo.md @@ -390,19 +390,19 @@ defined functions. Most geometry types have a "degenerate" form representing no geometry. For example, a GeometryCollection may contain no items, or a LineString may -contain no points. This state is indicated by the `Geometry#is_empty?` method. +contain no points. This state is indicated by the `Geometry#empty?` method. In RGeo, any geometry type except Point may be empty. factory = RGeo::Cartesian.preferred_factory - factory.point(1, 2).is_empty? # returns false - factory.collection([]).is_empty? # returns true + factory.point(1, 2).empty? # returns false + factory.collection([]).empty? # returns true A second common property of geometry objects is "simplicity", which basically means the geometry doesn't intersect or repeat itself. For example, a LineString that intersects itself is not simple, nor is a MultiPoint that contains the same point more than once. Sometimes, a geometric analysis algorithm will have simplicity as a precondition. This property is indicated -by the `Geometry#is_simple?` method. +by the `Geometry#simple?` method. factory = RGeo::Cartesian.preferred_factory p00 = factory.point(0, 0) @@ -410,9 +410,9 @@ by the `Geometry#is_simple?` method. p11 = factory.point(1, 1) p10 = factory.point(1, 0) zigzag_line = factory.line_string([p00, p10, p01, p11]) - zigzag_line.is_simple? # returns true + zigzag_line.simple? # returns true self_crossing_line = factory.line_string([p00, p11, p01, p10]) - self_crossing_line.is_simple? # returns false + self_crossing_line.simple? # returns false All geometry objects also contain a "spatial reference ID", returned by the `Geometry#srid` method. This is an external ID reference indicating the @@ -485,7 +485,7 @@ interfaces, RGeo provides operators for some of these calculations. union.geometry_type # returns RGeo::Feature::MultiPoint union.num_geometries # returns 2 diff = p1.difference(p2) # or p1 - p2 - diff.is_empty? # returns true + diff.empty? # returns true ### 3.4. Unary Spatial Operations diff --git a/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md b/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md index 51bd9563..04e17921 100644 --- a/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md +++ b/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md @@ -390,19 +390,19 @@ defined functions. Most geometry types have a "degenerate" form representing no geometry. For example, a GeometryCollection may contain no items, or a LineString may -contain no points. This state is indicated by the `Geometry#is_empty?` method. +contain no points. This state is indicated by the `Geometry#empty?` method. In RGeo, any geometry type except Point may be empty. factory = RGeo::Cartesian.preferred_factory - factory.point(1, 2).is_empty? # returns false - factory.collection([]).is_empty? # returns true + factory.point(1, 2).empty? # returns false + factory.collection([]).empty? # returns true A second common property of geometry objects is "simplicity", which basically means the geometry doesn't intersect or repeat itself. For example, a LineString that intersects itself is not simple, nor is a MultiPoint that contains the same point more than once. Sometimes, a geometric analysis algorithm will have simplicity as a precondition. This property is indicated -by the `Geometry#is_simple?` method. +by the `Geometry#simple?` method. factory = RGeo::Cartesian.preferred_factory p00 = factory.point(0, 0) @@ -410,9 +410,9 @@ by the `Geometry#is_simple?` method. p11 = factory.point(1, 1) p10 = factory.point(1, 0) zigzag_line = factory.line_string([p00, p10, p01, p11]) - zigzag_line.is_simple? # returns true + zigzag_line.simple? # returns true self_crossing_line = factory.line_string([p00, p11, p01, p10]) - self_crossing_line.is_simple? # returns false + self_crossing_line.simple? # returns false All geometry objects also contain a "spatial reference ID", returned by the `Geometry#srid` method. This is an external ID reference indicating the @@ -485,7 +485,7 @@ interfaces, RGeo provides operators for some of these calculations. union.geometry_type # returns RGeo::Feature::MultiPoint union.num_geometries # returns 2 diff = p1.difference(p2) # or p1 - p2 - diff.is_empty? # returns true + diff.empty? # returns true ### 3.4. Unary Spatial Operations diff --git a/doc/Examples.md b/doc/Examples.md index 47ebc3e7..b56eb3c3 100644 --- a/doc/Examples.md +++ b/doc/Examples.md @@ -49,8 +49,8 @@ - [as_binary](#as_binary) - [Predicates and Relationships](#predicates-and-relationships) - [ccw?](#ccw) - - [is_simple?](#is_simple) - - [is_empty?](#is_empty) + - [simple?](#simple) + - [empty?](#empty) - [contains?](#contains) - [crosses?](#crosses) - [disjoint?](#disjoint) @@ -318,9 +318,9 @@ pt4 = factory.point(2, 6) linearring = factory.linear_ring([pt1, pt2, pt3, pt4, pt1]) p linearring # => # -p linearring.is_closed? +p linearring.closed? #=> true -p linearring.is_simple? +p linearring.simple? #=> true ``` @@ -689,7 +689,7 @@ p RGeo::Feature::Point.check_type(pt) p RGeo::Feature::Point.check_type(linestring) # => false -def is_point?(feature) +def point?(feature) case feature when RGeo::Feature::Point p "It's a Point!" @@ -700,10 +700,10 @@ def is_point?(feature) end end -is_point?(pt) +point?(pt) # => "It's a Point!" -is_point?(linestring) +point?(linestring) # => "It's not a Point" ``` @@ -767,7 +767,7 @@ p factory.linear_ring([pt1, pt2, pt3, pt4, pt1]).ccw? # => true ``` -### is_simple? +### simple? ```ruby factory = RGeo::Cartesian.factory @@ -777,11 +777,11 @@ pt2 = factory.point(1, 0) pt3 = factory.point(1, 1) pt4 = factory.point(0, 1) -p factory.linear_ring([pt1, pt2, pt3, pt4, pt1]).is_simple? +p factory.linear_ring([pt1, pt2, pt3, pt4, pt1]).simple? # => true ``` -### is_empty? +### empty? Returns `true` if the object is the empty set. @@ -793,10 +793,10 @@ pt2 = factory.point(1, 0) pt3 = factory.point(1, 1) pt4 = factory.point(0, 1) -p factory.linear_ring([pt1, pt2, pt3, pt4, pt1]).is_empty? +p factory.linear_ring([pt1, pt2, pt3, pt4, pt1]).empty? # => false -p factory.multi_point([]).is_empty? +p factory.multi_point([]).empty? # => true ``` diff --git a/doc/Factory-Compatibility.md b/doc/Factory-Compatibility.md index ba3a886e..b6db6841 100644 --- a/doc/Factory-Compatibility.md +++ b/doc/Factory-Compatibility.md @@ -37,8 +37,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `Point#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Point#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Point#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Point#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Point#is_simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `Point#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `Point#simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Point#boundary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Point#convex_hull` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Point#buffer` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | @@ -129,8 +129,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `LineString#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `LineString#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `LineString#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `LineString#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `LineString#is_simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `LineString#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `LineString#simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `LineString#boundary` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `LineString#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `LineString#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -221,8 +221,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `LinearRing#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `LinearRing#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `LinearRing#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `LinearRing#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `LinearRing#is_simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `LinearRing#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `LinearRing#simple?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `LinearRing#boundary` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `LinearRing#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `LinearRing#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -313,8 +313,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `Polygon#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `Polygon#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Polygon#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Polygon#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Polygon#is_simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| `Polygon#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `Polygon#simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `Polygon#boundary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Polygon#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `Polygon#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -405,8 +405,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `Collection#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `Collection#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `Collection#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Collection#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `Collection#is_simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| `Collection#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `Collection#simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `Collection#boundary` | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | | `Collection#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `Collection#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -497,8 +497,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `MultiPoint#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `MultiPoint#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `MultiPoint#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiPoint#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiPoint#is_simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| `MultiPoint#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `MultiPoint#simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiPoint#boundary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `MultiPoint#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiPoint#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -589,8 +589,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `MultiLineString#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `MultiLineString#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `MultiLineString#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiLineString#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiLineString#is_simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| `MultiLineString#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `MultiLineString#simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiLineString#boundary` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiLineString#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiLineString#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | @@ -681,8 +681,8 @@ _Note: This list is not exhaustive of all the methods defined by each factory. T | `MultiPolygon#envelope` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `MultiPolygon#as_text` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `MultiPolygon#as_binary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiPolygon#is_empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `MultiPolygon#is_simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| `MultiPolygon#empty?` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `MultiPolygon#simple?` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiPolygon#boundary` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `MultiPolygon#convex_hull` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | | `MultiPolygon#buffer` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | diff --git a/ext/geos_c_impl/geometry.c b/ext/geos_c_impl/geometry.c index 2eedad3c..26e33cb6 100644 --- a/ext/geos_c_impl/geometry.c +++ b/ext/geos_c_impl/geometry.c @@ -1095,8 +1095,8 @@ void rgeo_init_geos_geometry(RGeo_Globals* globals) rb_define_method(geos_geometry_methods, "boundary", method_geometry_boundary, 0); rb_define_method(geos_geometry_methods, "_as_text", method_geometry_as_text, 0); rb_define_method(geos_geometry_methods, "as_binary", method_geometry_as_binary, 0); - rb_define_method(geos_geometry_methods, "is_empty?", method_geometry_is_empty, 0); - rb_define_method(geos_geometry_methods, "is_simple?", method_geometry_is_simple, 0); + rb_define_method(geos_geometry_methods, "empty?", method_geometry_is_empty, 0); + rb_define_method(geos_geometry_methods, "simple?", method_geometry_is_simple, 0); rb_define_method(geos_geometry_methods, "equals?", method_geometry_equals, 1); rb_define_method(geos_geometry_methods, "==", method_geometry_equals, 1); rb_define_method(geos_geometry_methods, "rep_equals?", method_geometry_eql, 1); diff --git a/ext/geos_c_impl/geometry_collection.c b/ext/geos_c_impl/geometry_collection.c index a4950309..1f40d97f 100644 --- a/ext/geos_c_impl/geometry_collection.c +++ b/ext/geos_c_impl/geometry_collection.c @@ -623,7 +623,7 @@ void rgeo_init_geos_geometry_collection(RGeo_Globals* globals) geos_multi_line_string_methods = rb_define_module_under(globals->geos_module, "CAPIMultiLineStringMethods"); rb_define_method(geos_multi_line_string_methods, "geometry_type", method_multi_line_string_geometry_type, 0); rb_define_method(geos_multi_line_string_methods, "length", method_multi_line_string_length, 0); - rb_define_method(geos_multi_line_string_methods, "is_closed?", method_multi_line_string_is_closed, 0); + rb_define_method(geos_multi_line_string_methods, "closed?", method_multi_line_string_is_closed, 0); rb_define_method(geos_multi_line_string_methods, "hash", method_multi_line_string_hash, 0); rb_define_method(geos_multi_line_string_methods, "coordinates", method_multi_line_string_coordinates, 0); diff --git a/ext/geos_c_impl/line_string.c b/ext/geos_c_impl/line_string.c index 0f5bc642..9c070f32 100644 --- a/ext/geos_c_impl/line_string.c +++ b/ext/geos_c_impl/line_string.c @@ -663,8 +663,8 @@ void rgeo_init_geos_line_string(RGeo_Globals* globals) rb_define_method(geos_line_string_methods, "end_point", method_line_string_end_point, 0); rb_define_method(geos_line_string_methods, "project_point", method_line_string_project_point, 1); rb_define_method(geos_line_string_methods, "interpolate_point", method_line_string_interpolate_point, 1); - rb_define_method(geos_line_string_methods, "is_closed?", method_line_string_is_closed, 0); - rb_define_method(geos_line_string_methods, "is_ring?", method_line_string_is_ring, 0); + rb_define_method(geos_line_string_methods, "closed?", method_line_string_is_closed, 0); + rb_define_method(geos_line_string_methods, "ring?", method_line_string_is_ring, 0); rb_define_method(geos_line_string_methods, "coordinates", method_line_string_coordinates, 0); // CAPILinearRingMethods module diff --git a/lib/rgeo/cartesian/analysis.rb b/lib/rgeo/cartesian/analysis.rb index 40804c0b..b8708e31 100644 --- a/lib/rgeo/cartesian/analysis.rb +++ b/lib/rgeo/cartesian/analysis.rb @@ -22,12 +22,12 @@ class << self # == Note # # This method does not ensure a correct result for an invalid geometry. - # You should make sure your ring is valid beforehand using `is_ring?` + # You should make sure your ring is valid beforehand using `ring?` # if you are using a LineString, or directly `valid?` for a # `linear_ring?`. # This will be subject to changes in v3. def ccw?(ring) - if RGeo::Geos.is_capi_geos?(ring) && RGeo::Geos::Analysis.ccw_supported? + if RGeo::Geos.capi_geos?(ring) && RGeo::Geos::Analysis.ccw_supported? RGeo::Geos::Analysis.ccw?(ring) else RGeo::Cartesian::Analysis.ring_direction(ring) == 1 diff --git a/lib/rgeo/cartesian/feature_methods.rb b/lib/rgeo/cartesian/feature_methods.rb index fd847aac..cd0381aa 100644 --- a/lib/rgeo/cartesian/feature_methods.rb +++ b/lib/rgeo/cartesian/feature_methods.rb @@ -49,7 +49,7 @@ def segments end end - def is_simple? + def simple? len = segments.length return false if segments.any?(&:degenerate?) return true if len == 1 @@ -72,6 +72,11 @@ def is_simple? true end + def is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? + end + def length segments.inject(0.0) { |sum, seg| sum + seg.length } end diff --git a/lib/rgeo/feature/curve.rb b/lib/rgeo/feature/curve.rb index 1236764e..088ef7be 100644 --- a/lib/rgeo/feature/curve.rb +++ b/lib/rgeo/feature/curve.rb @@ -90,8 +90,13 @@ def end_point # Returns a boolean value. Note that this is different from the SFS # specification, which stipulates an integer return value. + def closed? + raise Error::UnsupportedOperation, "Method Curve#closed? not defined." + end + def is_closed? - raise Error::UnsupportedOperation, "Method Curve#is_closed? not defined." + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? end # === SFS 1.1 Description @@ -105,8 +110,13 @@ def is_closed? # Returns a boolean value. Note that this is different from the SFS # specification, which stipulates an integer return value. + def ring? + raise Error::UnsupportedOperation, "Method Curve#ring? not defined." + end + def is_ring? - raise Error::UnsupportedOperation, "Method Curve#is_ring? not defined." + warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ring? end end end diff --git a/lib/rgeo/feature/geometry.rb b/lib/rgeo/feature/geometry.rb index b9d45ff7..1cc11ffd 100644 --- a/lib/rgeo/feature/geometry.rb +++ b/lib/rgeo/feature/geometry.rb @@ -191,8 +191,13 @@ def as_binary # Returns a boolean value. Note that this is different from the SFS # specification, which stipulates an integer return value. + def empty? + raise Error::UnsupportedOperation, "Method Geometry#empty? not defined." + end + def is_empty? - raise Error::UnsupportedOperation, "Method Geometry#is_empty? not defined." + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? end # === SFS 1.1 Description @@ -208,8 +213,13 @@ def is_empty? # Returns a boolean value. Note that this is different from the SFS # specification, which stipulates an integer return value. + def simple? + raise Error::UnsupportedOperation, "Method Geometry#simple? not defined." + end + def is_simple? - raise Error::UnsupportedOperation, "Method Geometry#is_simple? not defined." + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? end # === SFS 1.1 Description diff --git a/lib/rgeo/feature/multi_curve.rb b/lib/rgeo/feature/multi_curve.rb index 50bf7ff2..72f3dcc8 100644 --- a/lib/rgeo/feature/multi_curve.rb +++ b/lib/rgeo/feature/multi_curve.rb @@ -65,8 +65,13 @@ def length # Returns a boolean value. Note that this is different from the SFS # specification, which stipulates an integer return value. + def closed? + raise Error::UnsupportedOperation, "Method MultiCurve#closed? not defined." + end + def is_closed? - raise Error::UnsupportedOperation, "Method MultiCurve#is_closed? not defined." + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? end end end diff --git a/lib/rgeo/geographic/projected_feature_methods.rb b/lib/rgeo/geographic/projected_feature_methods.rb index 1c70c418..7afc79aa 100644 --- a/lib/rgeo/geographic/projected_feature_methods.rb +++ b/lib/rgeo/geographic/projected_feature_methods.rb @@ -22,12 +22,22 @@ def envelope factory.unproject(projection.envelope) end + def empty? + projection.empty? + end + def is_empty? - projection.is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + + def simple? + projection.simple? end def is_simple? - projection.is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? end def boundary diff --git a/lib/rgeo/geographic/spherical_feature_methods.rb b/lib/rgeo/geographic/spherical_feature_methods.rb index 438dcf3f..a691e850 100644 --- a/lib/rgeo/geographic/spherical_feature_methods.rb +++ b/lib/rgeo/geographic/spherical_feature_methods.rb @@ -97,7 +97,7 @@ def arcs end end - def is_simple? + def simple? len = arcs.length return false if arcs.any?(&:degenerate?) return true if len == 1 @@ -120,6 +120,11 @@ def is_simple? true end + def is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? + end + def length arcs.inject(0.0) { |sum, arc| sum + arc.length } * SphericalMath::RADIUS end diff --git a/lib/rgeo/geos/capi_feature_classes.rb b/lib/rgeo/geos/capi_feature_classes.rb index 8290a2b4..cf563b3f 100644 --- a/lib/rgeo/geos/capi_feature_classes.rb +++ b/lib/rgeo/geos/capi_feature_classes.rb @@ -11,6 +11,16 @@ module Geos module CAPIGeometryMethods # :nodoc: include Feature::Instance + def is_empty? # rubocop:disable Naming/PredicateName + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + + def is_simple? # rubocop:disable Naming/PredicateName + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? + end + def inspect "#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>" end @@ -50,6 +60,25 @@ def as_text alias to_s as_text end + module CAPIMultiLineStringMethods # :nodoc: + def is_closed? # rubocop:disable Naming/PredicateName + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + end + + module CAPILineStringMethods # :nodoc: + def is_closed? # rubocop:disable Naming/PredicateName + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + + def is_ring? # rubocop:disable Naming/PredicateName + warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ring? + end + end + module CAPIGeometryCollectionMethods # :nodoc: include Enumerable end diff --git a/lib/rgeo/geos/ffi_feature_methods.rb b/lib/rgeo/geos/ffi_feature_methods.rb index a223a042..513d5cb5 100644 --- a/lib/rgeo/geos/ffi_feature_methods.rb +++ b/lib/rgeo/geos/ffi_feature_methods.rb @@ -113,14 +113,24 @@ def as_binary @factory.generate_wkb(self) end - def is_empty? + def empty? @fg_geom.empty? end - def is_simple? + def is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + + def simple? @fg_geom.simple? end + def is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? + end + def equals?(rhs) return false unless rhs.is_a?(RGeo::Feature::Instance) fg = factory.convert_to_fg_geometry(rhs) @@ -367,14 +377,24 @@ def points end end - def is_closed? + def closed? @fg_geom.closed? end - def is_ring? + def is_closed? + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + + def ring? @fg_geom.ring? end + def is_ring? + warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ring? + end + def rep_equals?(rhs) rhs.class == self.class && rhs.factory.eql?(@factory) && Utils.ffi_coord_seqs_equal?(rhs.fg_geom.coord_seq, @fg_geom.coord_seq, @factory._has_3d) @@ -553,7 +573,7 @@ def length @fg_geom.length end - def is_closed? + def closed? size = num_geometries size.times do |n| return false unless @fg_geom.get_geometry_n(n).closed? @@ -561,6 +581,11 @@ def is_closed? true end + def is_closed? + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + def coordinates each.map(&:coordinates) end diff --git a/lib/rgeo/geos/interface.rb b/lib/rgeo/geos/interface.rb index 97df791b..c5d41632 100644 --- a/lib/rgeo/geos/interface.rb +++ b/lib/rgeo/geos/interface.rb @@ -31,32 +31,47 @@ def supported? # Returns true if the given feature is a CAPI GEOS feature, or if # the given factory is a CAPI GEOS factory. - def is_capi_geos?(object) + def capi_geos?(object) CAPI_SUPPORTED && (CAPIFactory === object || CAPIGeometryMethods === object || ZMFactory === object && CAPIFactory === object.z_factory || ZMGeometryMethods === object && CAPIGeometryMethods === object.z_geometry) end + def is_capi_geos?(object) + warn "The is_capi_geos? method is deprecated, please use the capi_geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + capi_geos?(object) + end + # Returns true if the given feature is an FFI GEOS feature, or if # the given factory is an FFI GEOS factory. - def is_ffi_geos?(object) + def ffi_geos?(object) FFI_SUPPORTED && (FFIFactory === object || FFIGeometryMethods === object || ZMFactory === object && FFIFactory === object.z_factory || ZMGeometryMethods === object && FFIGeometryMethods === object.z_geometry) end + def is_ffi_geos?(object) + warn "The is_ffi_geos? method is deprecated, please use the ffi_geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ffi_geos?(object) + end + # Returns true if the given feature is a GEOS feature, or if the given # factory is a GEOS factory. Does not distinguish between CAPI and FFI. - def is_geos?(object) + def geos?(object) CAPI_SUPPORTED && (CAPIFactory === object || CAPIGeometryMethods === object) || FFI_SUPPORTED && (FFIFactory === object || FFIGeometryMethods === object) || ZMFactory === object || ZMGeometryMethods === object end + def is_geos?(object) + warn "The is_geos? method is deprecated, please use the geos? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + geos?(object) + end + # Returns the GEOS library version as a string of the format "x.y.z". # Returns nil if GEOS is not available. diff --git a/lib/rgeo/geos/zm_feature_methods.rb b/lib/rgeo/geos/zm_feature_methods.rb index 0a21ef47..d78d7bde 100644 --- a/lib/rgeo/geos/zm_feature_methods.rb +++ b/lib/rgeo/geos/zm_feature_methods.rb @@ -65,12 +65,22 @@ def as_binary @factory.instance_variable_get(:@wkb_generator).generate(self) end + def empty? + @zgeometry.empty? + end + def is_empty? - @zgeometry.is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + + def simple? + @zgeometry.simple? end def is_simple? - @zgeometry.is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? end def boundary @@ -222,12 +232,22 @@ def end_point point_n(num_points - 1) end + def closed? + @zgeometry.closed? + end + def is_closed? - @zgeometry.is_closed? + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + + def ring? + @zgeometry.ring? end def is_ring? - @zgeometry.is_ring? + warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ring? end def num_points @@ -323,8 +343,13 @@ def length @zgeometry.length end + def closed? + @zgeometry.closed? + end + def is_closed? - @zgeometry.is_closed? + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? end def coordinates diff --git a/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb b/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb index 0e7d8dc2..2baccf71 100644 --- a/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +++ b/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb @@ -51,10 +51,15 @@ def geometry_type Feature::GeometryCollection end - def is_empty? + def empty? @elements.size == 0 end + def is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + def rep_equals?(rhs) if rhs.is_a?(self.class) && rhs.factory.eql?(@factory) && @elements.size == rhs.num_geometries rhs.each_with_index { |p, i| return false unless @elements[i].rep_equals?(p) } @@ -93,8 +98,13 @@ def geometry_type Feature::MultiLineString end + def closed? + all?(&:closed?) + end + def is_closed? - all?(&:is_closed?) + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? end def length @@ -104,7 +114,7 @@ def length def boundary hash = {} @elements.each do |line| - if !line.is_empty? && !line.is_closed? + if !line.empty? && !line.closed? add_boundary(hash, line.start_point) add_boundary(hash, line.end_point) end @@ -180,7 +190,7 @@ def area def boundary array = [] @elements.each do |poly| - array << poly.exterior_ring unless poly.is_empty? + array << poly.exterior_ring unless poly.empty? array.concat(poly.interior_rings) end factory.multi_line_string(array) diff --git a/lib/rgeo/impl_helper/basic_line_string_methods.rb b/lib/rgeo/impl_helper/basic_line_string_methods.rb index 84233dee..281a73d5 100644 --- a/lib/rgeo/impl_helper/basic_line_string_methods.rb +++ b/lib/rgeo/impl_helper/basic_line_string_methods.rb @@ -39,13 +39,18 @@ def geometry_type Feature::LineString end - def is_empty? + def empty? @points.size == 0 end + def is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + def boundary array = [] - array << @points.first << @points.last if !is_empty? && !is_closed? + array << @points.first << @points.last if !empty? && !closed? factory.multipoint([array]) end @@ -57,15 +62,25 @@ def end_point @points.last end - def is_closed? - unless defined?(@is_closed) - @is_closed = @points.size > 2 && @points.first == @points.last + def closed? + unless defined?(@closed) + @closed = @points.size > 2 && @points.first == @points.last end - @is_closed + @closed + end + + def is_closed? + warn "The is_closed? method is deprecated, please use the closed? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + closed? + end + + def ring? + closed? && simple? end def is_ring? - is_closed? && is_simple? + warn "The is_ring? method is deprecated, please use the ring? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + ring? end def rep_equals?(rhs) @@ -183,7 +198,7 @@ def validate_geometry if @points.size > 0 @points << @points.first if @points.first != @points.last @points = @points.chunk { |x| x }.map(&:first) - if !@factory.property(:uses_lenient_assertions) && !is_ring? + if !@factory.property(:uses_lenient_assertions) && !ring? raise Error::InvalidGeometry, "LinearRing failed ring test" end end diff --git a/lib/rgeo/impl_helper/basic_point_methods.rb b/lib/rgeo/impl_helper/basic_point_methods.rb index fdbd1cc0..a674fc89 100644 --- a/lib/rgeo/impl_helper/basic_point_methods.rb +++ b/lib/rgeo/impl_helper/basic_point_methods.rb @@ -45,14 +45,24 @@ def geometry_type Feature::Point end - def is_empty? + def empty? false end - def is_simple? + def is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? + end + + def simple? true end + def is_simple? + warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + simple? + end + def envelope self end diff --git a/lib/rgeo/impl_helper/basic_polygon_methods.rb b/lib/rgeo/impl_helper/basic_polygon_methods.rb index 8c653f40..feda1ec7 100644 --- a/lib/rgeo/impl_helper/basic_polygon_methods.rb +++ b/lib/rgeo/impl_helper/basic_polygon_methods.rb @@ -49,13 +49,18 @@ def geometry_type Feature::Polygon end + def empty? + @exterior_ring.empty? + end + def is_empty? - @exterior_ring.is_empty? + warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"] + empty? end def boundary array = [] - array << @exterior_ring unless @exterior_ring.is_empty? + array << @exterior_ring unless @exterior_ring.empty? array.concat(@interior_rings) factory.multi_line_string(array) end diff --git a/lib/rgeo/wkrep/wkb_generator.rb b/lib/rgeo/wkrep/wkb_generator.rb index b171d0e5..dc629e63 100644 --- a/lib/rgeo/wkrep/wkb_generator.rb +++ b/lib/rgeo/wkrep/wkb_generator.rb @@ -178,7 +178,7 @@ def generate_feature(obj, toplevel = false) emit_line_string_coords(obj) elsif type == Feature::Polygon exterior_ring = obj.exterior_ring - if exterior_ring.is_empty? + if exterior_ring.empty? emit_integer(0) else emit_integer(1 + obj.num_interior_rings) diff --git a/lib/rgeo/wkrep/wkt_generator.rb b/lib/rgeo/wkrep/wkt_generator.rb index baedf84d..40ae5224 100644 --- a/lib/rgeo/wkrep/wkt_generator.rb +++ b/lib/rgeo/wkrep/wkt_generator.rb @@ -160,7 +160,7 @@ def generate_point(obj) end def generate_line_string(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{obj.points.map { |p| generate_coords(p) }.join(', ')}#{@end_bracket}" @@ -168,7 +168,7 @@ def generate_line_string(obj) end def generate_polygon(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{([generate_line_string(obj.exterior_ring)] + obj.interior_rings.map { |r| generate_line_string(r) }).join(', ')}#{@end_bracket}" @@ -176,7 +176,7 @@ def generate_polygon(obj) end def generate_geometry_collection(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{obj.map { |f| generate_feature(f) }.join(', ')}#{@end_bracket}" @@ -184,7 +184,7 @@ def generate_geometry_collection(obj) end def generate_multi_point(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{obj.map { |f| generate_point(f) }.join(', ')}#{@end_bracket}" @@ -192,7 +192,7 @@ def generate_multi_point(obj) end def generate_multi_line_string(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{obj.map { |f| generate_line_string(f) }.join(', ')}#{@end_bracket}" @@ -200,7 +200,7 @@ def generate_multi_line_string(obj) end def generate_multi_polygon(obj) - if obj.is_empty? + if obj.empty? "EMPTY" else "#{@begin_bracket}#{obj.map { |f| generate_polygon(f) }.join(', ')}#{@end_bracket}" diff --git a/test/cartesian_bbox_test.rb b/test/cartesian_bbox_test.rb index cfd832d3..9b3e0ad3 100644 --- a/test/cartesian_bbox_test.rb +++ b/test/cartesian_bbox_test.rb @@ -20,7 +20,7 @@ def test_empty_bbox assert_nil(bbox.min_x) assert_equal(@factory, bbox.factory) assert_nil(bbox.min_point) - assert_equal(true, bbox.to_geometry.is_empty?) + assert_equal(true, bbox.to_geometry.empty?) assert_equal(true, bbox.contains?(bbox)) assert_equal(false, bbox.contains?(@factory.point(1, 1))) assert_nil(bbox.center_x) diff --git a/test/common/geometry_collection_tests.rb b/test/common/geometry_collection_tests.rb index 7ee16c20..c75b5179 100644 --- a/test/common/geometry_collection_tests.rb +++ b/test/common/geometry_collection_tests.rb @@ -193,9 +193,9 @@ def test_dimension def test_is_empty geom1 = @factory.collection([@point1, @line1]) - assert(!geom1.is_empty?) + assert(!geom1.empty?) geom2 = @factory.collection([]) - assert(geom2.is_empty?) + assert(geom2.empty?) end def test_empty_collection_envelope diff --git a/test/common/line_string_tests.rb b/test/common/line_string_tests.rb index 701aa22c..41774817 100644 --- a/test/common/line_string_tests.rb +++ b/test/common/line_string_tests.rb @@ -74,12 +74,12 @@ def test_creation_linear_ring point2 = @factory.point(0, 1) point3 = @factory.point(1, 0) line1 = @factory.linear_ring([point1, point2, point3, point1]) - assert(line1.is_ring?) + assert(line1.ring?) assert(RGeo::Feature::LinearRing === line1) assert_equal(RGeo::Feature::LinearRing, line1.geometry_type) line2 = @factory.linear_ring([point1, point2, point3]) assert(line2) - assert(line2.is_ring?) + assert(line2.ring?) assert(RGeo::Feature::LinearRing === line2) assert_equal(4, line2.num_points) assert_equal(RGeo::Feature::LinearRing, line2.geometry_type) @@ -267,14 +267,14 @@ def test_empty_as_text_wkt_round_trip line1 = @factory.line_string([]) text = line1.as_text line2 = @factory.parse_wkt(text) - assert(line2.is_empty?) + assert(line2.empty?) end def test_empty_as_binary_wkb_round_trip line1 = @factory.line_string([]) binary = line1.as_binary line2 = @factory.parse_wkb(binary) - assert(line2.is_empty?) + assert(line2.empty?) end def test_dimension @@ -288,9 +288,9 @@ def test_is_empty point1 = @factory.point(-42, 0) point2 = @factory.point(0, 193) line1 = @factory.line_string([point1, point2]) - assert(!line1.is_empty?) + assert(!line1.empty?) line2 = @factory.line_string([]) - assert(line2.is_empty?) + assert(line2.empty?) end def test_marshal_roundtrip diff --git a/test/common/multi_line_string_tests.rb b/test/common/multi_line_string_tests.rb index 6351a573..9474ac64 100644 --- a/test/common/multi_line_string_tests.rb +++ b/test/common/multi_line_string_tests.rb @@ -157,9 +157,9 @@ def test_dimension def test_is_empty geom1 = @factory.multi_line_string([@linestring1, @linestring2]) - assert(!geom1.is_empty?) + assert(!geom1.empty?) geom2 = @factory.multi_line_string([]) - assert(geom2.is_empty?) + assert(geom2.empty?) end def test_length diff --git a/test/common/multi_point_tests.rb b/test/common/multi_point_tests.rb index 7c9df712..e05fba49 100644 --- a/test/common/multi_point_tests.rb +++ b/test/common/multi_point_tests.rb @@ -151,9 +151,9 @@ def test_dimension def test_is_empty geom1 = @factory.multi_point([@point1, @point2]) - assert(!geom1.is_empty?) + assert(!geom1.empty?) geom2 = @factory.multi_point([]) - assert(geom2.is_empty?) + assert(geom2.empty?) end def test_union diff --git a/test/common/multi_polygon_tests.rb b/test/common/multi_polygon_tests.rb index 07a30e7c..51f90a36 100644 --- a/test/common/multi_polygon_tests.rb +++ b/test/common/multi_polygon_tests.rb @@ -160,9 +160,9 @@ def test_dimension def test_is_empty geom1 = @factory.multi_polygon([@poly1, @poly2]) - assert(!geom1.is_empty?) + assert(!geom1.empty?) geom2 = @factory.multi_polygon([]) - assert(geom2.is_empty?) + assert(geom2.empty?) end def test_multi_polygon_coordinates diff --git a/test/common/point_tests.rb b/test/common/point_tests.rb index ffb79231..a86a5120 100644 --- a/test/common/point_tests.rb +++ b/test/common/point_tests.rb @@ -84,17 +84,17 @@ def test_as_binary_wkb_round_trip def test_is_empty point1 = @factory.point(0, 0) - assert(!point1.is_empty?) + assert(!point1.empty?) end def test_is_simple point1 = @factory.point(0, 0) - assert(point1.is_simple?) + assert(point1.simple?) end def test_boundary point = @factory.point(11, 12) - assert point.boundary.is_empty? + assert point.boundary.empty? end def test_equals @@ -197,7 +197,7 @@ def test_intersection point2 = @factory.point(11, 12) point3 = @factory.point(12, 12) assert_close_enough(point1, point1.intersection(point2)) - assert point1.intersection(point3).is_empty? + assert point1.intersection(point3).empty? end def test_union @@ -219,7 +219,7 @@ def test_difference diff12 = point1.difference(point2) diff13 = point1.difference(point3) assert_equal(RGeo::Feature::GeometryCollection, diff12.geometry_type) - assert(diff12.is_empty?) + assert(diff12.empty?) assert_close_enough(point1, diff13) end @@ -230,7 +230,7 @@ def test_sym_difference diff12 = point1.sym_difference(point2) diff13 = point1.sym_difference(point3) assert_equal(RGeo::Feature::GeometryCollection, diff12.geometry_type) - assert(diff12.is_empty?) + assert(diff12.empty?) assert_equal(RGeo::Feature::MultiPoint, diff13.geometry_type) assert_contains_approx(point1, diff13) assert_contains_approx(point3, diff13) diff --git a/test/common/polygon_tests.rb b/test/common/polygon_tests.rb index c15817dd..baa29e60 100644 --- a/test/common/polygon_tests.rb +++ b/test/common/polygon_tests.rb @@ -204,9 +204,9 @@ def test_is_empty point3 = @factory.point(1, 0) exterior = @factory.linear_ring([point1, point2, point3, point1]) poly1 = @factory.polygon(exterior) - assert(!poly1.is_empty?) + assert(!poly1.empty?) poly2 = @factory.polygon(@factory.linear_ring([])) - assert(poly2.is_empty?) + assert(poly2.empty?) end def test_boundary_simple diff --git a/test/docs/factory_compatibility_table_test.rb b/test/docs/factory_compatibility_table_test.rb index f0415ec3..ccb15116 100644 --- a/test/docs/factory_compatibility_table_test.rb +++ b/test/docs/factory_compatibility_table_test.rb @@ -58,8 +58,8 @@ def basic_methods :envelope, :as_text, :as_binary, - :is_empty?, - :is_simple?, + :empty?, + :simple?, :boundary, :convex_hull, :buffer diff --git a/test/geos_capi/factory_test.rb b/test/geos_capi/factory_test.rb index 97b3dace..0ef3ab90 100644 --- a/test/geos_capi/factory_test.rb +++ b/test/geos_capi/factory_test.rb @@ -17,8 +17,8 @@ def setup end def test_is_geos_factory - assert_equal(true, RGeo::Geos.is_geos?(@factory)) - assert_equal(true, RGeo::Geos.is_capi_geos?(@factory)) - assert_equal(false, RGeo::Geos.is_ffi_geos?(@factory)) + assert_equal(true, RGeo::Geos.geos?(@factory)) + assert_equal(true, RGeo::Geos.capi_geos?(@factory)) + assert_equal(false, RGeo::Geos.ffi_geos?(@factory)) end end if RGeo::Geos.capi_supported? diff --git a/test/geos_capi/point_test.rb b/test/geos_capi/point_test.rb index 4a35a586..23c56715 100644 --- a/test/geos_capi/point_test.rb +++ b/test/geos_capi/point_test.rb @@ -20,13 +20,13 @@ def setup def test_is_geos point = @factory.point(21, -22) - assert_equal(true, RGeo::Geos.is_geos?(point)) - assert_equal(true, RGeo::Geos.is_capi_geos?(point)) - assert_equal(false, RGeo::Geos.is_ffi_geos?(point)) + assert_equal(true, RGeo::Geos.geos?(point)) + assert_equal(true, RGeo::Geos.capi_geos?(point)) + assert_equal(false, RGeo::Geos.ffi_geos?(point)) point2 = @zmfactory.point(21, -22, 0, 0) - assert_equal(true, RGeo::Geos.is_geos?(point2)) - assert_equal(true, RGeo::Geos.is_capi_geos?(point2)) - assert_equal(false, RGeo::Geos.is_ffi_geos?(point2)) + assert_equal(true, RGeo::Geos.geos?(point2)) + assert_equal(true, RGeo::Geos.capi_geos?(point2)) + assert_equal(false, RGeo::Geos.ffi_geos?(point2)) end def test_has_no_projection diff --git a/test/geos_capi/zmfactory_test.rb b/test/geos_capi/zmfactory_test.rb index 4309ca69..a4a9ad55 100644 --- a/test/geos_capi/zmfactory_test.rb +++ b/test/geos_capi/zmfactory_test.rb @@ -17,9 +17,9 @@ def setup end def test_is_geos_factory - assert_equal(true, RGeo::Geos.is_geos?(@factory)) - assert_equal(true, RGeo::Geos.is_capi_geos?(@factory)) - assert_equal(false, RGeo::Geos.is_ffi_geos?(@factory)) + assert_equal(true, RGeo::Geos.geos?(@factory)) + assert_equal(true, RGeo::Geos.capi_geos?(@factory)) + assert_equal(false, RGeo::Geos.ffi_geos?(@factory)) end def test_factory_parts diff --git a/test/geos_ffi/factory_test.rb b/test/geos_ffi/factory_test.rb index afdb6e2e..cc043ae2 100644 --- a/test/geos_ffi/factory_test.rb +++ b/test/geos_ffi/factory_test.rb @@ -17,8 +17,8 @@ def setup end def test_is_geos_factory - assert_equal(true, RGeo::Geos.is_geos?(@factory)) - assert_equal(false, RGeo::Geos.is_capi_geos?(@factory)) - assert_equal(true, RGeo::Geos.is_ffi_geos?(@factory)) + assert_equal(true, RGeo::Geos.geos?(@factory)) + assert_equal(false, RGeo::Geos.capi_geos?(@factory)) + assert_equal(true, RGeo::Geos.ffi_geos?(@factory)) end end if RGeo::Geos.ffi_supported? diff --git a/test/geos_ffi/point_test.rb b/test/geos_ffi/point_test.rb index 81a34a51..640149b2 100644 --- a/test/geos_ffi/point_test.rb +++ b/test/geos_ffi/point_test.rb @@ -21,13 +21,13 @@ def setup def test_is_geos point = @factory.point(21, -22) - assert_equal(true, RGeo::Geos.is_geos?(point)) - assert_equal(false, RGeo::Geos.is_capi_geos?(point)) - assert_equal(true, RGeo::Geos.is_ffi_geos?(point)) + assert_equal(true, RGeo::Geos.geos?(point)) + assert_equal(false, RGeo::Geos.capi_geos?(point)) + assert_equal(true, RGeo::Geos.ffi_geos?(point)) point2 = @zmfactory.point(21, -22, 0, 0) - assert_equal(true, RGeo::Geos.is_geos?(point2)) - assert_equal(false, RGeo::Geos.is_capi_geos?(point2)) - assert_equal(true, RGeo::Geos.is_ffi_geos?(point2)) + assert_equal(true, RGeo::Geos.geos?(point2)) + assert_equal(false, RGeo::Geos.capi_geos?(point2)) + assert_equal(true, RGeo::Geos.ffi_geos?(point2)) end def test_has_no_projection diff --git a/test/geos_ffi/zmfactory_test.rb b/test/geos_ffi/zmfactory_test.rb index 83ac435a..6fb2c576 100644 --- a/test/geos_ffi/zmfactory_test.rb +++ b/test/geos_ffi/zmfactory_test.rb @@ -18,9 +18,9 @@ def setup end def test_is_geos_factory - assert_equal(true, RGeo::Geos.is_geos?(@factory)) - assert_equal(false, RGeo::Geos.is_capi_geos?(@factory)) - assert_equal(true, RGeo::Geos.is_ffi_geos?(@factory)) + assert_equal(true, RGeo::Geos.geos?(@factory)) + assert_equal(false, RGeo::Geos.capi_geos?(@factory)) + assert_equal(true, RGeo::Geos.ffi_geos?(@factory)) end def test_factory_parts