[geos-commits] [SCM] GEOS branch main-relate-ng updated. 01c8fbc2b782f94e800e77805d72fa79ec672b7b

git at osgeo.org git at osgeo.org
Thu Aug 8 07:57:07 PDT 2024


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, main-relate-ng has been updated
       via  01c8fbc2b782f94e800e77805d72fa79ec672b7b (commit)
      from  43ac48e54737af05cedf380765ea5b68534464ce (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 01c8fbc2b782f94e800e77805d72fa79ec672b7b
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Thu Aug 8 07:56:41 2024 -0700

    Fix handling of LinearRings

diff --git a/include/geos/operation/relateng/DimensionLocation.h b/include/geos/operation/relateng/DimensionLocation.h
index e0e77b52b..6d3d87050 100644
--- a/include/geos/operation/relateng/DimensionLocation.h
+++ b/include/geos/operation/relateng/DimensionLocation.h
@@ -32,7 +32,7 @@ class GEOS_DLL DimensionLocation {
 public:
 
     enum DimensionLocationType {
-        EXTERIOR = -3,
+        EXTERIOR = 2,           // == Location.EXTERIOR
         POINT_INTERIOR = 103,
         LINE_INTERIOR = 110,
         LINE_BOUNDARY = 111,
diff --git a/src/operation/relateng/RelateGeometry.cpp b/src/operation/relateng/RelateGeometry.cpp
index e07c3f602..6c5cb6c78 100644
--- a/src/operation/relateng/RelateGeometry.cpp
+++ b/src/operation/relateng/RelateGeometry.cpp
@@ -84,7 +84,7 @@ RelateGeometry::analyzeDimensions()
         geomDim = Dimension::P;
         return;
     }
-    if (typeId == GEOS_LINESTRING || typeId == GEOS_MULTILINESTRING) {
+    if (typeId == GEOS_LINESTRING || typeId == GEOS_LINEARRING || typeId == GEOS_MULTILINESTRING) {
         hasLines = true;
         geomDim = Dimension::L;
         return;
@@ -105,7 +105,8 @@ RelateGeometry::analyzeDimensions()
             hasPoints = true;
             if (geomDim < Dimension::P) geomDim = Dimension::P;
         }
-        if (elem->getGeometryTypeId() == GEOS_LINESTRING) {
+        if (elem->getGeometryTypeId() == GEOS_LINESTRING ||
+            elem->getGeometryTypeId() == GEOS_LINEARRING) {
             hasLines = true;
             if (geomDim < Dimension::L) geomDim = Dimension::L;
         }
@@ -124,7 +125,8 @@ RelateGeometry::isZeroLength(const Geometry* geom)
     std::vector<const Geometry*> elems;
     GeometryLister::list(geom, elems);
     for (const Geometry* elem : elems) {
-        if (elem->getGeometryTypeId() == GEOS_LINESTRING) {
+        if (elem->getGeometryTypeId() == GEOS_LINESTRING ||
+            elem->getGeometryTypeId() == GEOS_LINEARRING ) {
             if (! isZeroLength(static_cast<const LineString*>(elem))) {
                 return false;
             }
@@ -408,7 +410,8 @@ RelateGeometry::extractSegmentStringsFromAtomic(bool isA,
         return;
 
     elementId++;
-    if (p_geom->getGeometryTypeId() == GEOS_LINESTRING) {
+    if (p_geom->getGeometryTypeId() == GEOS_LINESTRING ||
+        p_geom->getGeometryTypeId() == GEOS_LINEARRING) {
         const LineString* line = static_cast<const LineString*>(p_geom);
         /*
          * Condition the input Coordinate sequence so that it has no repeated points.
diff --git a/src/operation/relateng/RelateNG.cpp b/src/operation/relateng/RelateNG.cpp
index 90eacd40e..681c58ee3 100644
--- a/src/operation/relateng/RelateNG.cpp
+++ b/src/operation/relateng/RelateNG.cpp
@@ -430,7 +430,8 @@ RelateNG::computeLineEnds(
         if (elem->isEmpty())
             continue;
 
-        if (elem->getGeometryTypeId() == GEOS_LINESTRING) {
+        if (elem->getGeometryTypeId() == GEOS_LINESTRING ||
+            elem->getGeometryTypeId() == GEOS_LINEARRING) {
             //-- once an intersection with target exterior is recorded, skip further known-exterior points
             if (hasExteriorIntersection
                 && elem->getEnvelopeInternal()->disjoint(geomTarget.getEnvelope()))
diff --git a/src/operation/relateng/RelatePointLocator.cpp b/src/operation/relateng/RelatePointLocator.cpp
index aa29b374e..cca69d8ec 100644
--- a/src/operation/relateng/RelatePointLocator.cpp
+++ b/src/operation/relateng/RelatePointLocator.cpp
@@ -81,7 +81,8 @@ RelatePointLocator::extractElements(const Geometry* p_geom)
     if (p_geom->getGeometryTypeId() == GEOS_POINT) {
         addPoint(static_cast<const Point*>(p_geom));
     }
-    else if (p_geom->getGeometryTypeId() == GEOS_LINESTRING) {
+    else if (p_geom->getGeometryTypeId() == GEOS_LINESTRING ||
+             p_geom->getGeometryTypeId() == GEOS_LINEARRING) {
         addLine(static_cast<const LineString*>(p_geom));
     }
     else if (p_geom->getGeometryTypeId() == GEOS_POLYGON ||
diff --git a/src/operation/relateng/TopologyComputer.cpp b/src/operation/relateng/TopologyComputer.cpp
index 78dd304ea..af6ce0550 100644
--- a/src/operation/relateng/TopologyComputer.cpp
+++ b/src/operation/relateng/TopologyComputer.cpp
@@ -154,15 +154,23 @@ TopologyComputer::isExteriorCheckRequired(bool isA) const
     return predicate.requireExteriorCheck(isA);
 }
 
+char toSymbol(Location loc) {
+        switch (loc) {
+        case Location::NONE: return '-';
+        case Location::INTERIOR: return 'I';
+        case Location::BOUNDARY: return 'B';
+        case Location::EXTERIOR: return 'E';
+        }
+}
 
 /* private */
 void
 TopologyComputer::updateDim(Location locA, Location locB, int dimension)
 {
+//std::cout << toSymbol(locA) << toSymbol(locB) << " <- " << dimension << std::endl;
     predicate.updateDimension(locA, locB, dimension);
 }
 
-
 /* private */
 void
 TopologyComputer::updateDim(bool isAB, Location loc1, Location loc2, int dimension)

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

Summary of changes:
 include/geos/operation/relateng/DimensionLocation.h |  2 +-
 src/operation/relateng/RelateGeometry.cpp           | 11 +++++++----
 src/operation/relateng/RelateNG.cpp                 |  3 ++-
 src/operation/relateng/RelatePointLocator.cpp       |  3 ++-
 src/operation/relateng/TopologyComputer.cpp         | 10 +++++++++-
 5 files changed, 21 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list