Skip to content

Commit

Permalink
Fix RelateNG handling of empty point elements
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jul 29, 2024
1 parent 0d5eac9 commit bf71d66
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ public List<Point> getEffectivePoints() {
//-- only return Points not covered by another element
List<Point> ptList = new ArrayList<Point>();
for (Point p : ptListAll) {
if (p.isEmpty())
continue;
int locDim = locateWithDim(p.getCoordinate());
if (DimensionLocation.dimension(locDim) == Dimension.P) {
ptList.add(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,11 @@ public void testAdjPolygonsContainingLineAndPoint() {
checkCoversCoveredBy(a, b, true);
}

public void testEmptyMultiPointElements() {
String a = "POLYGON ((3 7, 7 7, 7 3, 3 3, 3 7))";
String b = "GEOMETRYCOLLECTION (MULTIPOINT (EMPTY, (5 5)), LINESTRING (1 9, 4 9))";
checkIntersectsDisjoint(a, b, true);
}


}
21 changes: 21 additions & 0 deletions modules/tests/src/test/resources/testxml/misc/TestRelateGC.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,27 @@
<test><op name="within" arg1="A" arg2="B"> false </op></test>
</case>

<case>
<desc>A/GC:mP with empty MultiPoint elements</desc>
<a>
POLYGON ((3 7, 7 7, 7 3, 3 3, 3 7))
</a>
<b>
GEOMETRYCOLLECTION (MULTIPOINT (EMPTY, (5 5)), LINESTRING (1 9, 4 9))
</b>
<test><op name="relate" arg3="0F2FF1102" arg1="A" arg2="B"> true </op></test>
<test><op name="contains" arg1="A" arg2="B"> false </op></test>
<test><op name="coveredBy" arg1="A" arg2="B"> false </op></test>
<test><op name="covers" arg1="A" arg2="B"> false </op></test>
<test><op name="crosses" arg1="A" arg2="B"> true </op></test>
<test><op name="disjoint" arg1="A" arg2="B"> false </op></test>
<test><op name="equalsTopo" arg1="A" arg2="B"> false </op></test>
<test><op name="intersects" arg1="A" arg2="B"> true </op></test>
<test><op name="overlaps" arg1="A" arg2="B"> false </op></test>
<test><op name="touches" arg1="A" arg2="B"> false </op></test>
<test><op name="within" arg1="A" arg2="B"> false </op></test>
</case>

<case>
<desc>mA/GC:PL</desc>
<a>
Expand Down

0 comments on commit bf71d66

Please sign in to comment.