Skip to content

Commit

Permalink
Port JTS commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Aug 20, 2024
1 parent 97a079a commit f3d2096
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion include/geos/operation/relateng/RelateGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class GEOS_DLL RelateGeometry {
* Indicates whether the geometry requires self-noding
* for correct evaluation of specific spatial predicates.
* Self-noding is required for geometries which may self-cross
* - i.e. lines, and overlapping polygons in GeometryCollections.
* - i.e. lines, and overlapping elements in GeometryCollections.
* Self-noding is not required for polygonal geometries,
* since they can only touch at vertices.
* This ensures that the coordinates of nodes created by
Expand Down
13 changes: 5 additions & 8 deletions include/geos/operation/relateng/TopologyComputer.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,13 @@ class GEOS_DLL TopologyComputer {
/**
* Indicates whether the input geometries require self-noding
* for correct evaluation of specific spatial predicates.
* Self-noding is required for geometries which may self-cross
* - i.e. lines, and overlapping polygons in GeometryCollections.
* Self-noding is not required for polygonal geometries,
* since they can only touch at vertices.
* This ensures that the coordinates of nodes created by
* crossing segments are computed explicitly.
* Self-noding is required for geometries which may
* have self-crossing linework.
* This causes the coordinates of nodes created by
* crossing segments to be computed explicitly.
* This ensures that node locations match in situations
* where a self-crossing and mutual crossing occur at the same logical location.
* E.g. a self-crossing line tested against a single segment
* identical to one of the crossed segments.
* The canonical example is a self-crossing line tested against a single segment * identical to one of the crossed segments.
*
* @return true if self-noding is required
*/
Expand Down
2 changes: 1 addition & 1 deletion src/operation/relateng/RelateGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ RelateGeometry::isSelfNodingRequired() const
{
return false;
}
//-- GC with a single polygon does not need noding
//-- a GC with a single polygon does not need noding
if (hasAreas && geom->getNumGeometries() == 1)
return false;
return true;
Expand Down
9 changes: 6 additions & 3 deletions src/operation/relateng/TopologyComputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ TopologyComputer::getDimension(bool isA) const
bool
TopologyComputer::isSelfNodingRequired() const
{
if (geomA.isSelfNodingRequired()) return true;
if (geomB.isSelfNodingRequired()) return true;
return predicate.requireSelfNoding();
if (predicate.requireSelfNoding()) {
if (geomA.isSelfNodingRequired() ||
geomB.isSelfNodingRequired())
return true;
}
return false;
}


Expand Down
8 changes: 4 additions & 4 deletions tests/xmltester/tests/misc/InvalidRelates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
LINESTRING(40 180, 140 180)
</a>
<b>
MULTIPOLYGON(
((20 320, 180 320, 180 180, 20 180, 20 320)),
((60 180, 60 80, 180 80, 180 180, 60 180)))
GEOMETRYCOLLECTION(
POLYGON((20 320, 180 320, 180 180, 20 180, 20 320)),
POLYGON((60 180, 60 80, 180 80, 180 180, 60 180)))
</b>
<test>
<op arg1="A" arg2="B" arg3="111F0F212" name="relate">true</op>
<op arg1="A" arg2="B" arg3="11F00F212" name="relate">true</op>
</test>
</case>

Expand Down

0 comments on commit f3d2096

Please sign in to comment.