[geos-commits] [SCM] GEOS branch master updated. 1e66be587d92ac281d85598a2f6c79c22e912a20

git at osgeo.org git at osgeo.org
Mon Aug 13 04:20:13 PDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  1e66be587d92ac281d85598a2f6c79c22e912a20 (commit)
       via  ea7c7d80e70ed5719c3bf7a17df93f8053a0c744 (commit)
      from  1fc7f585ed822ebbb685ba848f9537691d864697 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1e66be587d92ac281d85598a2f6c79c22e912a20
Merge: 1fc7f58 ea7c7d8
Author: Daniel Baston <dbaston at gmail.com>
Date:   Mon Aug 13 07:19:25 2018 -0400

    Merge branch 'trac-782'


commit ea7c7d80e70ed5719c3bf7a17df93f8053a0c744
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Aug 7 20:24:25 2018 -0400

    Fix predicate crash with empty collection components
    
    Fixes #782
    Closes https://github.com/libgeos/geos/pull/114

diff --git a/include/geos/algorithm/PointLocator.h b/include/geos/algorithm/PointLocator.h
index 11fef98..9bbe0a4 100644
--- a/include/geos/algorithm/PointLocator.h
+++ b/include/geos/algorithm/PointLocator.h
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/PointLocator.java r320 (JTS-1.12)
+ * Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
  *
  **********************************************************************/
 
@@ -51,9 +51,8 @@ namespace algorithm { // geos::algorithm
  * Notes:
  *	- instances of this class are not reentrant.
  *	- LinearRing objects do not enclose any area
- *	  points inside the ring are still in the EXTERIOR of the ring.
+ *	  (points inside the ring are still in the EXTERIOR of the ring.)
  *
- * Last port: algorithm/PointLocator.java rev. 1.26 (JTS-1.7+)
  */
 class GEOS_DLL PointLocator {
 public:
@@ -62,11 +61,9 @@ public:
 
 	/**
 	 * Computes the topological relationship (Location) of a single point
-	 * to a Geometry.
-	 * It handles both single-element
-	 * and multi-element Geometries.
-	 * The algorithm for multi-part Geometries
-	 * takes into account the boundaryDetermination rule.
+	 * to a Geometry. It handles both single-element and multi-element Geometries.
+	 * The algorithm for multi-part Geometriestakes into account the SFS
+	 * Boundary Determination rule.
 	 *
 	 * @return the Location of the point relative to the input Geometry
 	 */
diff --git a/src/algorithm/PointLocator.cpp b/src/algorithm/PointLocator.cpp
index 1ee0c5f..2249280 100644
--- a/src/algorithm/PointLocator.cpp
+++ b/src/algorithm/PointLocator.cpp
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/PointLocator.java r320 (JTS-1.12)
+ * Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
  *
  **********************************************************************/
 
@@ -128,6 +128,9 @@ PointLocator::locate(const Coordinate& p, const Point *pt)
 int
 PointLocator::locate(const Coordinate& p, const LineString *l)
 {
+	if (!l->getEnvelopeInternal()->intersects(p))
+		return Location::EXTERIOR;
+
 	const CoordinateSequence* pt=l->getCoordinatesRO();
 	if (! l->isClosed()) {
 		if ((p==pt->getAt(0)) || (p==pt->getAt(pt->getSize()-1))) {
@@ -143,7 +146,9 @@ PointLocator::locate(const Coordinate& p, const LineString *l)
 int
 PointLocator::locateInPolygonRing(const Coordinate& p, const LinearRing *ring)
 {
-	// can this test be folded into isPointInRing ?
+	if (!ring->getEnvelopeInternal()->intersects(p)) {
+		return Location::EXTERIOR;
+	}
 
 	const CoordinateSequence *cl = ring->getCoordinatesRO();
 
diff --git a/tests/unit/capi/GEOSIntersectsTest.cpp b/tests/unit/capi/GEOSIntersectsTest.cpp
index 1bb8ab4..bda143a 100644
--- a/tests/unit/capi/GEOSIntersectsTest.cpp
+++ b/tests/unit/capi/GEOSIntersectsTest.cpp
@@ -158,5 +158,18 @@ namespace tut
 
     }
 
+    // Test for #782 (collection with empty components)
+    template<>
+    template<>
+    void object::test<6>()
+    {
+        geom1_ = GEOSGeomFromWKT("LINESTRING(10 0, 0 0, 0 10)");
+        geom2_ = GEOSGeomFromWKT("MULTILINESTRING((10 -1,-1 10),EMPTY)");
+
+        char r1 = GEOSIntersects(geom1_, geom2_);
+
+        ensure_equals(r1, 1);
+    }
+
 } // namespace tut
 

-----------------------------------------------------------------------

Summary of changes:
 include/geos/algorithm/PointLocator.h  | 13 +++++--------
 src/algorithm/PointLocator.cpp         |  9 +++++++--
 tests/unit/capi/GEOSIntersectsTest.cpp | 13 +++++++++++++
 3 files changed, 25 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list