Commit a12a5ecc authored by Sandro Santilli's avatar Sandro Santilli

Add support for testing prepared geometries operations in XMLTester

Add 3 more tests from JTS testsuite now that they can be run
See #694 for 3.6 branch
parent 39757254
......@@ -62,6 +62,9 @@ SAFE_XMLTESTS=$(srcdir)/tests/testLeaksBig.xml \
$(srcdir)/tests/general/TestFunctionPL.xml \
$(srcdir)/tests/general/TestFunctionPP.xml \
$(srcdir)/tests/general/TestInteriorPoint.xml \
$(srcdir)/tests/general/TestPreparedPointPredicate.xml \
$(srcdir)/tests/general/TestPreparedPolygonPredicate.xml \
$(srcdir)/tests/general/TestPreparedPredicatesWithGeometryCollection.xml \
$(srcdir)/tests/general/TestRectanglePredicate.xml \
$(srcdir)/tests/general/TestRelateAA.xml \
$(srcdir)/tests/general/TestRelateLA.xml \
......
This diff is collapsed.
......@@ -50,6 +50,7 @@ private:
geom::Geometry *gB;
geom::Geometry *gT;
bool usePrepared;
std::auto_ptr<geom::PrecisionModel> pm;
geom::GeometryFactory::unique_ptr factory;
std::auto_ptr<io::WKTReader> wktreader;
......
......@@ -4,11 +4,3 @@ Tests found in JTS/testxml/general and not ported as of rev 3991 (Jun 30 2014)
TestDensify.xml
- requires densify::Densifier still unported
TestPreparedPointPredicate.xml
- requires using custom operation (PreparedGeometryOperation)
TestPreparedPolygonPredicate.xml
- requires using custom operation (PreparedGeometryOperation)
TestPreparedPredicatesWithGeometryCollection.xml
- requires using custom operation (PreparedGeometryOperation)
<run>
<desc>Test cases for PreparedPoint predicates</desc>
<precisionModel type="FLOATING"/>
<geometryOperation>org.locationtech.jtstest.geomop.PreparedGeometryOperation</geometryOperation>
<case>
<desc> P/A - point in interior of poly</desc>
<a> POINT (100 100)
</a>
<b> POLYGON ((50 130, 150 130, 100 50, 50 130))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc> P/A - point on boundary of poly</desc>
<a> POINT (100 50)
</a>
<b> POLYGON ((50 130, 150 130, 100 50, 50 130))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc> P/A - point outside poly</desc>
<a> POINT (200 200)
</a>
<b> POLYGON ((50 130, 150 130, 100 50, 50 130))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> false </op> </test>
</case>
</run>
<run>
<desc>Test cases for PreparedGeometry predicates using polygons as input</desc>
<precisionModel type="FLOATING"/>
<geometryOperation>org.locationtech.jtstest.geomop.PreparedGeometryOperation</geometryOperation>
<case>
<desc>A/P - point equal to start point of polygon
</desc>
<a>
POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b>
POINT (10 10)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/P - point equal to start point of polygon
</desc>
<a>
POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b>
POINT (10 20)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> false </op> </test>
</case>
<case>
<desc>mA/L
A has 2 shells touching at one vertex and one non-vertex.
B passes between the shells, but is wholely contained
</desc>
<a>
MULTIPOLYGON (((100 30, 30 110, 150 110, 100 30)),
((90 110, 30 170, 140 170, 90 110)))
</a>
<b>
LINESTRING (90 80, 90 150)
</b>
<test> <op name="contains" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>mA/L
A has 2 shells touching at one vertex and one non-vertex
B passes between the shells, but is NOT contained (since it is slightly offset)
</desc>
<a>
MULTIPOLYGON (((100 30, 30 110, 150 110, 100 30)),
((90 110, 30 170, 140 170, 90 110)))
</a>
<b>
LINESTRING (90.1 80, 90 150)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>mA/L - 2 disjoint shells with line crossing between them </desc>
<a>
MULTIPOLYGON (((50 20, 10 70, 80 70, 50 20)),
((10 90, 80 90, 50 140, 10 90)))
</a>
<b>
LINESTRING (50 110, 50 60)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - proper intersection crossing bdy
</desc>
<a>
POLYGON ((10 10, 10 100, 120 110, 120 30, 10 10))
</a>
<b>
LINESTRING (60 60, 70 140)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - non-proper intersection crossing bdy
</desc>
<a>
POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b>
LINESTRING (60 60, 60 140)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - wholely contained
</desc>
<a> POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b> LINESTRING (50 30, 70 60)
</b>
<test> <op name="contains" arg1="A" arg2="B"> true </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - contained but touching bdy at interior point
</desc>
<a>
POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b>
LINESTRING (60 10, 70 60)
</b>
<test> <op name="contains" arg1="A" arg2="B"> true </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - line in bdy - covered but not contained
</desc>
<a>
POLYGON ((10 10, 60 100, 110 10, 10 10))
</a>
<b>
LINESTRING (30 10, 90 10)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/A - two equal polygons
</desc>
<a>
POLYGON((20 20, 20 100, 120 100, 140 20, 20 20))
</a>
<b>
POLYGON((20 20, 20 100, 120 100, 140 20, 20 20))
</b>
<test> <op name="contains" arg1="A" arg2="B"> true </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - line with repeated points
</desc>
<a>
POLYGON((20 20, 20 100, 120 100, 140 20, 20 20))
</a>
<b>
LINESTRING (10 60, 50 60, 60 30, 60 30, 90 80, 90 80, 160 70)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>A/L - polygon and line with repeated points
</desc>
<a>
POLYGON((20 20, 20 100, 120 100, 120 100, 120 100, 140 20, 140 20, 140 20, 20 20))
</a>
<b>
LINESTRING (10 60, 50 60, 60 30, 60 30, 90 80, 90 80, 160 70)
</b>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
</run>
<run>
<desc>Test cases for PreparedGeometry predicates using GeometryCollections as test geometry.
This tests the various combinations of target geometry and predicate which support
GCs as the test geometry.
</desc>
<precisionModel type="FLOATING"/>
<geometryOperation>org.locationtech.jtstest.geomop.PreparedGeometryOperation</geometryOperation>
<case>
<desc>Box against GC
</desc>
<a>
POLYGON ((0 0, 0 100, 200 100, 200 0, 0 0))
</a>
<b>
GEOMETRYCOLLECTION (POLYGON ((50 160, 110 60, 150 160, 50 160)),
LINESTRING (50 40, 170 120))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> false </op> </test>
</case>
<case>
<desc>Box against GC, with containment
</desc>
<a>
POLYGON ((0 0, 0 200, 200 200, 200 0, 0 0))
</a>
<b>
GEOMETRYCOLLECTION (POLYGON ((50 160, 110 60, 150 160, 50 160)),
LINESTRING (50 40, 170 120))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
<test> <op name="contains" arg1="A" arg2="B"> true </op> </test>
<test> <op name="covers" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>Polygon-with-hole against GC
</desc>
<a>
POLYGON ((0 0, 0 270, 200 270, 200 0, 0 0),
(30 210, 170 210, 60 20, 30 210))
</a>
<b>
GEOMETRYCOLLECTION (POLYGON ((50 160, 110 60, 150 160, 50 160)),
LINESTRING (50 40, 170 120))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
<test> <op name="contains" arg1="A" arg2="B"> false </op> </test>
</case>
<case>
<desc>Linestring against GC
</desc>
<a>
LINESTRING (20 90, 90 190, 170 50)
</a>
<b>
GEOMETRYCOLLECTION (POLYGON ((50 160, 110 60, 150 160, 50 160)),
LINESTRING (50 40, 170 120))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
<case>
<desc>Linestring against GC, with containment
</desc>
<a>
LINESTRING (20 20, 100 100, 180 20)
</a>
<b>
GEOMETRYCOLLECTION (LINESTRING (40 40, 80 80), POINT (120 80))
</b>
<test> <op name="intersects" arg1="A" arg2="B"> true </op> </test>
</case>
</run>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment