[geos-commits] [SCM] geos branch svn-3.6 updated. a12a5ecc5c8ccd41c5e4952bcb58d994e4d709e2

git at osgeo.org git at osgeo.org
Wed Jul 19 15:12:36 PDT 2017


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, svn-3.6 has been updated
       via  a12a5ecc5c8ccd41c5e4952bcb58d994e4d709e2 (commit)
      from  397572542e1627df61d51cf1474da09536c93544 (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 a12a5ecc5c8ccd41c5e4952bcb58d994e4d709e2
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Jul 19 23:58:28 2017 +0200

    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

diff --git a/tests/xmltester/Makefile.am b/tests/xmltester/Makefile.am
index 588c364..37928b0 100644
--- a/tests/xmltester/Makefile.am
+++ b/tests/xmltester/Makefile.am
@@ -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 \
diff --git a/tests/xmltester/XMLTester.cpp b/tests/xmltester/XMLTester.cpp
index bdad20b..d4e7d75 100644
--- a/tests/xmltester/XMLTester.cpp
+++ b/tests/xmltester/XMLTester.cpp
@@ -1,4 +1,4 @@
-/**********************************************************************
+/**********************************************************************
  *
  * GEOS - Geometry Engine Open Source
  * http://geos.osgeo.org
@@ -8,7 +8,7 @@
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU Lesser General Public Licence as published
- * by the Free Software Foundation. 
+ * by the Free Software Foundation.
  * See the COPYING file for more information.
  *
  **********************************************************************/
@@ -32,6 +32,8 @@
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/IntersectionMatrix.h>
 #include <geos/geom/PrecisionModel.h>
+#include <geos/geom/prep/PreparedGeometry.h>
+#include <geos/geom/prep/PreparedGeometryFactory.h>
 #include <geos/geom/BinaryOp.h>
 #include <geos/operation/overlay/OverlayOp.h>
 #include <geos/operation/overlay/snap/GeometrySnapper.h>
@@ -84,10 +86,15 @@
 using namespace geos;
 using namespace geos::operation::polygonize;
 using namespace geos::operation::linemerge;
+using namespace geos::geom::prep;
 using std::runtime_error;
 
 namespace {
 
+std::auto_ptr<const PreparedGeometry> prepare( const geom::Geometry *g ) {
+    return std::auto_ptr<const PreparedGeometry> ( PreparedGeometryFactory::prepare(g) );
+}
+
 // Asymmetric Rounding Algorithm  - equivalent to Java Math.round()
 // Copy from geos/util/math.cpp
 double java_math_round(double val)
@@ -170,7 +177,7 @@ void dump_to_stdout( const TiXmlNode * pParent, unsigned int indent = 0 )
 
     const TiXmlNode * pChild;
 
-    for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) 
+    for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
     {
         dump_to_stdout( pChild, indent+2 );
     }
@@ -192,7 +199,7 @@ normalize_filename(const std::string& str)
     std::string::size_type last_slash = str.find_last_of('/', str.size());
     if ( last_slash == std::string::npos ) newstring = str;
     else newstring = str.substr(last_slash+1);
-    
+
     for (std::string::iterator i=newstring.begin(), e=newstring.end(); i!=e; ++i)
     {
         if ( *i == '.' ) *i = '_';
@@ -241,7 +248,7 @@ checkBufferSuccess(geom::Geometry const& gRes, geom::Geometry const& gRealRes, d
                 << "areal type."
                 << std::endl;
         }
-        
+
 
         geos::xmltester::BufferResultMatcher matcher;
         if ( ! matcher.isBufferResultMatch(gRealRes,
@@ -371,7 +378,7 @@ XMLTester::printTest(bool success, const std::string& expected_result, const std
         std::cout << *curr_file <<":";
         std::cout << " case" << caseCount << ":";
         std::cout << " test" << testCount << ": "
-            << opSignature; 
+            << opSignature;
         std::cout << ": " << (success?"ok.":"failed.");
         std::cout << " (" << std::setprecision(15) << java_math_round(prof.getTot()/1000) << " ms)" << std::endl;
 
@@ -403,8 +410,8 @@ XMLTester::run(const std::string &source)
 
     if ( sqlOutput )
     {
-        std::cout << "CREATE TABLE \"" << normalize_filename(*curr_file) << "\"" 
-                  << "( caseno integer, testno integer, " 
+        std::cout << "CREATE TABLE \"" << normalize_filename(*curr_file) << "\""
+                  << "( caseno integer, testno integer, "
               << " operation varchar, description varchar, "
               << " a geometry, b geometry, expected geometry, "
               << " obtained geometry, result bool )"
@@ -440,7 +447,7 @@ XMLTester::run(const std::string &source)
 
 }
 
-void 
+void
 XMLTester::resultSummary(std::ostream &os) const
 {
     os<<"Files: "<<testFileCount<<std::endl;
@@ -449,8 +456,8 @@ XMLTester::resultSummary(std::ostream &os) const
     os<<"Succeeded: "<<succeeded<<std::endl;
 }
 
-void 
-XMLTester::resetCounters() 
+void
+XMLTester::resetCounters()
 {
     testFileCount=totalTestCount=failed=succeeded=0;
 }
@@ -469,11 +476,31 @@ XMLTester::parseRun(const TiXmlNode* node)
     if ( el ) parsePrecisionModel(el);
     else pm.reset(new PrecisionModel());
 
+    // Look for geometryOperation, if any
+    usePrepared = false;
+    el = node->FirstChildElement("geometryOperation");
+    if ( el ) {
+        const TiXmlNode* txt = el->FirstChild();
+        if ( txt ) {
+            std::string op = trimBlanks(txt->Value());
+            if ( op.find("PreparedGeometryOperation") ) {
+                usePrepared = true;
+            } else {
+                std::cerr << *curr_file
+                          <<": WARNING: unknown geometryOperation: "
+                          << op << std::endl;
+            }
+        }
+    }
+
     if (verbose > 1)
     {
-        std::cerr << *curr_file <<": run: Precision Model: " << pm->toString() <<std::endl;
+        std::cerr << *curr_file <<": run: Precision Model: " << pm->toString();
+        if ( usePrepared ) std::cerr << " (prepared)";
+        std::cerr << std::endl;
     }
 
+
     factory = geom::GeometryFactory::create(pm.get());
     wktreader.reset(new io::WKTReader(factory.get()));
     wktwriter.reset(new io::WKTWriter());
@@ -536,7 +563,6 @@ XMLTester::parsePrecisionModel(const TiXmlElement* el)
     }
 }
 
-
 bool
 XMLTester::testValid(const geom::Geometry* g, const std::string& label)
 {
@@ -548,8 +574,8 @@ XMLTester::testValid(const geom::Geometry* g, const std::string& label)
         std::cerr << *curr_file << ":"
               << " case" << caseCount << ":"
               << " test" << testCount << ": "
-              << opSignature << ": " 
-              << " invalid geometry (" << label 
+              << opSignature << ": "
+              << " invalid geometry (" << label
               << "): " << err->toString() << std::endl;
     }
     return valid;
@@ -605,7 +631,7 @@ XMLTester::parseGeometry(const std::string &in, const char* label)
     return ret;
 }
 
-std::string 
+std::string
 XMLTester::trimBlanks(const std::string &in)
 {
     std::string out;
@@ -685,7 +711,7 @@ XMLTester::parseCase(const TiXmlNode* node)
     }
 
     totalTestCount+=testCount;
-        
+
     delete gA;
     delete gB;
 }
@@ -822,7 +848,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *gT=gA;
             if ( ( opArg1 == "B" || opArg1 == "b" ) && gB ) {
                 gT=gB;
-            } 
+            }
 
             if (gT->isValid()) actual_result="true";
             else actual_result="false";
@@ -893,7 +919,7 @@ XMLTester::parseTest(const TiXmlNode* node)
 #else
             GeomAutoPtr gRealRes = BinaryOp(gA, gB, overlayOp(OverlayOp::opDIFFERENCE));
 #endif
-            
+
             gRealRes->normalize();
 
             if (gRes->compareTo(gRealRes.get())==0) success=1;
@@ -932,9 +958,13 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
 
-            if (g1->intersects(g2)) actual_result="true";
-            else actual_result="false";
-            
+            actual_result="false";
+            if ( usePrepared )
+            {
+                if ( prepare(g1)->intersects(g2) ) actual_result="true";
+            }
+            else if (g1->intersects(g2)) actual_result="true";
+
             if (actual_result==opRes) success=1;
         }
 
@@ -943,9 +973,13 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
 
-            if (g1->contains(g2)) actual_result="true";
-            else actual_result="false";
-            
+            actual_result="false";
+            if ( usePrepared )
+            {
+                if ( prepare(g1)->contains(g2) ) actual_result="true";
+            }
+            else if (g1->contains(g2)) actual_result="true";
+
             if (actual_result==opRes) success=1;
         }
 
@@ -954,9 +988,13 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
 
-            if (g1->within(g2)) actual_result="true";
-            else actual_result="false";
-            
+            actual_result="false";
+            if ( usePrepared )
+            {
+                if ( prepare(g1)->within(g2) ) actual_result="true";
+            }
+            else if (g1->within(g2)) actual_result="true";
+
             if (actual_result==opRes) success=1;
         }
 
@@ -965,9 +1003,13 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
 
-            if (g1->covers(g2)) actual_result="true";
-            else actual_result="false";
-            
+            actual_result="false";
+            if ( usePrepared )
+            {
+                if ( prepare(g1)->covers(g2) ) actual_result="true";
+            }
+            else if (g1->covers(g2)) actual_result="true";
+
             if (actual_result==opRes) success=1;
         }
 
@@ -976,9 +1018,13 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
 
-            if (g1->coveredBy(g2)) actual_result="true";
-            else actual_result="false";
-            
+            actual_result="false";
+            if ( usePrepared )
+            {
+                if ( prepare(g1)->coveredBy(g2) ) actual_result="true";
+            }
+            else if (g1->coveredBy(g2)) actual_result="true";
+
             if (actual_result==opRes) success=1;
         }
 
@@ -1021,7 +1067,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             actual_result=printGeom(gRealRes.get());
             expected_result=printGeom(gRes.get());
 
-            if ( testValidOutput ) 
+            if ( testValidOutput )
                 success &= int(testValid(gRealRes.get(), "result"));
         }
 
@@ -1053,7 +1099,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             actual_result=printGeom(gRealRes.get());
             expected_result=printGeom(gRes.get());
 
-            if ( testValidOutput ) 
+            if ( testValidOutput )
                 success &= int(testValid(gRealRes.get(), "result"));
         }
 
@@ -1076,7 +1122,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             if ( opArg3 != "" ) {
         params.setQuadrantSegments(std::atoi(opArg3.c_str()));
             }
-            
+
 
             BufferOp op(gT, params);
             gRealRes.reset(op.getResultGeometry(dist));
@@ -1108,13 +1154,13 @@ XMLTester::parseTest(const TiXmlNode* node)
 
             GeomAutoPtr gRealRes;
             double dist = std::atof(opArg2.c_str());
-                
+
             BufferParameters params ;
             params.setJoinStyle( BufferParameters::JOIN_ROUND ) ;
             if ( opArg3 != "" ) {
         params.setQuadrantSegments( std::atoi(opArg3.c_str()));
             }
-            
+
             bool leftSide = true ;
             if ( opArg4 == "right" )
             {
@@ -1173,7 +1219,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             actual_result=printGeom(gRealRes.get());
             expected_result=printGeom(gRes.get());
 
-            if ( testValidOutput ) 
+            if ( testValidOutput )
                 success &= int(testValid(gRealRes.get(), "result"));
         }
 
@@ -1195,7 +1241,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             actual_result=printGeom(gRealRes.get());
             expected_result=printGeom(gRes.get());
 
-            if ( testValidOutput ) 
+            if ( testValidOutput )
                 success &= int(testValid(gRealRes.get(), "result"));
         }
 
@@ -1264,7 +1310,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             actual_result=printGeom(gRealRes.get());
             expected_result=printGeom(gRes.get());
 
-            if ( testValidOutput ) 
+            if ( testValidOutput )
                 success &= int(testValid(gRealRes.get(), "result"));
         }
 
@@ -1360,7 +1406,7 @@ XMLTester::parseTest(const TiXmlNode* node)
 
             double areaA = gA->getArea();
             double areaB = gB->getArea();
-            double areaI = gI->getArea(); 
+            double areaI = gI->getArea();
             double areaDab = gDab->getArea();
             double areaDba = gDba->getArea();
             double areaSD = gSD->getArea();
@@ -1373,7 +1419,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             // - : difference
             // + : union
             // ^ : intersection
-        
+
             // A == ( A ^ B ) + ( A - B )
             double diff = std::fabs ( areaA - areaI - areaDab );
             if ( diff > maxdiff ) {
@@ -1425,7 +1471,7 @@ XMLTester::parseTest(const TiXmlNode* node)
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
             geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
             double distO = g1->distance(g2);
-            std::stringstream ss; ss << distO; 
+            std::stringstream ss; ss << distO;
             actual_result = ss.str();
 
             // TODO: Use a tolerance ?
@@ -1483,6 +1529,14 @@ XMLTester::runPredicates(const geom::Geometry *gA, const geom::Geometry *gB)
     std::cout << "\t    Within:\tAB=" << (gA->within(gB)?"T":"F") << ", BA=" << (gB->within(gA)?"T":"F") << std::endl;
     std::cout << "\t  Contains:\tAB=" << (gA->contains(gB)?"T":"F") << ", BA=" << (gB->contains(gA)?"T":"F") << std::endl;
     std::cout << "\t  Overlaps:\tAB=" << (gA->overlaps(gB)?"T":"F") << ", BA=" << (gB->overlaps(gA)?"T":"F") << std::endl;
+
+    std::cout << "\t  Prepared Disjoint:\tAB=" << (prepare(gA)->disjoint(gB)?"T":"F") << ", BA=" << (prepare(gB)->disjoint(gA)?"T":"F") << std::endl;
+    std::cout << "\tPrepared Intersects:\tAB=" << (prepare(gA)->intersects(gB)?"T":"F") << ", BA=" << (prepare(gB)->intersects(gA)?"T":"F") << std::endl;
+    std::cout << "\t   Prepared Touches:\tAB=" << (prepare(gA)->touches(gB)?"T":"F") << ", BA=" << (prepare(gB)->touches(gA)?"T":"F") << std::endl;
+    std::cout << "\t   Prepared Crosses:\tAB=" << (prepare(gA)->crosses(gB)?"T":"F") << ", BA=" << (prepare(gB)->crosses(gA)?"T":"F") << std::endl;
+    std::cout << "\t    Prepared Within:\tAB=" << (prepare(gA)->within(gB)?"T":"F") << ", BA=" << (prepare(gB)->within(gA)?"T":"F") << std::endl;
+    std::cout << "\t  Prepared Contains:\tAB=" << (prepare(gA)->contains(gB)?"T":"F") << ", BA=" << (prepare(gB)->contains(gA)?"T":"F") << std::endl;
+    std::cout << "\t Prepared Overlaps:\tAB=" << (prepare(gA)->overlaps(gB)?"T":"F") << ", BA=" << (prepare(gB)->overlaps(gA)?"T":"F") << std::endl;
 }
 
 XMLTester::~XMLTester()
diff --git a/tests/xmltester/XMLTester.h b/tests/xmltester/XMLTester.h
index f43d0c7..4bda540 100644
--- a/tests/xmltester/XMLTester.h
+++ b/tests/xmltester/XMLTester.h
@@ -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;
diff --git a/tests/xmltester/tests/general/MISSING b/tests/xmltester/tests/general/MISSING
index 9bdbb96..3928e7a 100644
--- a/tests/xmltester/tests/general/MISSING
+++ b/tests/xmltester/tests/general/MISSING
@@ -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)
diff --git a/tests/xmltester/tests/general/TestPreparedPointPredicate.xml b/tests/xmltester/tests/general/TestPreparedPointPredicate.xml
new file mode 100644
index 0000000..5c353df
--- /dev/null
+++ b/tests/xmltester/tests/general/TestPreparedPointPredicate.xml
@@ -0,0 +1,34 @@
+<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>
diff --git a/tests/xmltester/tests/general/TestPreparedPolygonPredicate.xml b/tests/xmltester/tests/general/TestPreparedPolygonPredicate.xml
new file mode 100644
index 0000000..04ca2e6
--- /dev/null
+++ b/tests/xmltester/tests/general/TestPreparedPolygonPredicate.xml
@@ -0,0 +1,191 @@
+<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>
diff --git a/tests/xmltester/tests/general/TestPreparedPredicatesWithGeometryCollection.xml b/tests/xmltester/tests/general/TestPreparedPredicatesWithGeometryCollection.xml
new file mode 100644
index 0000000..9ea3821
--- /dev/null
+++ b/tests/xmltester/tests/general/TestPreparedPredicatesWithGeometryCollection.xml
@@ -0,0 +1,81 @@
+<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>

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

Summary of changes:
 tests/xmltester/Makefile.am                        |    3 +
 tests/xmltester/XMLTester.cpp                      |  144 ++++++++++-----
 tests/xmltester/XMLTester.h                        |    1 +
 tests/xmltester/tests/general/MISSING              |    8 -
 .../tests/general/TestPreparedPointPredicate.xml   |   34 ++++
 .../tests/general/TestPreparedPolygonPredicate.xml |  191 ++++++++++++++++++++
 ...estPreparedPredicatesWithGeometryCollection.xml |   81 +++++++++
 7 files changed, 409 insertions(+), 53 deletions(-)
 create mode 100644 tests/xmltester/tests/general/TestPreparedPointPredicate.xml
 create mode 100644 tests/xmltester/tests/general/TestPreparedPolygonPredicate.xml
 create mode 100644 tests/xmltester/tests/general/TestPreparedPredicatesWithGeometryCollection.xml


hooks/post-receive
-- 
geos


More information about the geos-commits mailing list