Skip to content

Commit

Permalink
Fix incorrect commented code, add RelatePA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jan 8, 2024
1 parent 5e806d6 commit 078a37e
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/geomgraph/GeometryGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,9 @@ GeometryGraph::addCollection(const GeometryCollection* gc)
{
for(std::size_t i = 0, n = gc->getNumGeometries(); i < n; ++i) {
const Geometry* g = gc->getGeometryN(i);
//if (! g->isEmpty()) {
if (! g->isEmpty()) {
add(g);
//}

}
}
}

Expand Down
77 changes: 76 additions & 1 deletion tests/xmltester/tests/general/TestRelatePA.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</case>

<case>
<desc>mPA - empty MultiPoint element</desc>
<desc>mPA - empty MultiPoint element for A</desc>
<a>
MULTIPOINT(EMPTY,(0 0))
</a>
Expand All @@ -181,6 +181,81 @@
<test><op name="within" arg1="A" arg2="B"> true </op></test>
</case>

<case>
<desc>mPA - empty MultiPoint element for A, on boundary of B</desc>
<a>
MULTIPOINT(EMPTY,(1 0))
</a>
<b>
POLYGON ((1 0,0 1,-1 0,0 -1, 1 0))
</b>
<test>
<op name="relate" arg3="F0FFFF212" 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"> true </op></test>
<test><op name="covers" arg1="A" arg2="B"> false </op></test>
<test><op name="crosses" arg1="A" arg2="B"> false </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"> true </op></test>
<test><op name="within" arg1="A" arg2="B"> false </op></test>
</case>

<case>
<desc>mPA - empty MultiPoint element for B</desc>
<a>
POLYGON ((1 0,0 1,-1 0,0 -1, 1 0))
</a>
<b>
MULTIPOINT(EMPTY,(0 0))
</b>
<test>
<op name="relate" arg3="0F2FF1FF2" arg1="A" arg2="B">
true
</op>
</test>
<test><op name="contains" arg1="A" arg2="B"> true </op></test>
<test><op name="coveredBy" arg1="A" arg2="B"> false </op></test>
<test><op name="covers" arg1="A" arg2="B"> true </op></test>
<test><op name="crosses" arg1="A" arg2="B"> false </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>mPA - empty MultiPoint element for B, on boundary of A</desc>
<a>
POLYGON ((1 0,0 1,-1 0,0 -1, 1 0))
</a>
<b>
MULTIPOINT(EMPTY,(1 0))
</b>
<test>
<op name="relate" arg3="FF20F1FF2" 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"> true </op></test>
<test><op name="crosses" arg1="A" arg2="B"> false </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"> true </op></test>
<test><op name="within" arg1="A" arg2="B"> false </op></test>
</case>

<case>
<desc>PmA - empty MultiPolygon element</desc>
<a>
Expand Down

0 comments on commit 078a37e

Please sign in to comment.