[geos-commits] r2420 - in trunk/source: geom/prep headers/geos/geom/prep

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Apr 29 04:56:14 EDT 2009


Author: strk
Date: 2009-04-29 04:56:14 -0400 (Wed, 29 Apr 2009)
New Revision: 2420

Modified:
   trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp
   trunk/source/geom/prep/PreparedPolygonContainsProperly.cpp
   trunk/source/geom/prep/PreparedPolygonCovers.cpp
   trunk/source/geom/prep/PreparedPolygonIntersects.cpp
   trunk/source/geom/prep/PreparedPolygonPredicate.cpp
   trunk/source/headers/geos/geom/prep/AbstractPreparedPolygonContains.h
   trunk/source/headers/geos/geom/prep/PreparedPolygonContainsProperly.h
   trunk/source/headers/geos/geom/prep/PreparedPolygonCovers.h
   trunk/source/headers/geos/geom/prep/PreparedPolygonIntersects.h
   trunk/source/headers/geos/geom/prep/PreparedPolygonPredicate.h
Log:
Bring all geom::prep package in sync with JTS-1.10 


Modified: trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp
===================================================================
--- trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp	2009-04-29 08:56:14 UTC (rev 2420)
@@ -13,7 +13,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/AbstractPreparedPolygonContains.java rev. 1.6 (2007-12-12)
+ * Last port: geom/prep/AbstractPreparedPolygonContains.java rev 1.7 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -118,7 +119,7 @@
 	// 
 	// If a point of any test components does not lie in target,
 	// result is false
-	bool isAllInTargetArea = isAllTestComponentsInTargetArea( geom);
+	bool isAllInTargetArea = isAllTestComponentsInTarget( geom);
 	if ( !isAllInTargetArea ) 
 		return false;
 
@@ -181,7 +182,7 @@
 		||	geom->getGeometryTypeId() == geos::geom::GEOS_POLYGON )
 	{
 		// TODO: generalize this to handle GeometryCollections
-		bool isTargetInTestArea = isAnyTargetComponentInTestArea( geom, prepPoly->getRepresentativePoints());
+		bool isTargetInTestArea = isAnyTargetComponentInAreaTest( geom, prepPoly->getRepresentativePoints());
 	
 		if ( isTargetInTestArea ) 
 			return false;

Modified: trunk/source/geom/prep/PreparedPolygonContainsProperly.cpp
===================================================================
--- trunk/source/geom/prep/PreparedPolygonContainsProperly.cpp	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/geom/prep/PreparedPolygonContainsProperly.cpp	2009-04-29 08:56:14 UTC (rev 2420)
@@ -13,7 +13,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonContainsProperly.java rev 1.4 (2007-12-12)
+ * Last port: geom/prep/PreparedPolygonContainsProperly.java rev 1.5 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -75,7 +76,7 @@
 		||	geom->getGeometryTypeId() == geos::geom::GEOS_POLYGON )
 	{
 		// TODO: generalize this to handle GeometryCollections
-		bool isTargetGeomInTestArea = isAnyTargetComponentInTestArea( geom, prepPoly->getRepresentativePoints());
+		bool isTargetGeomInTestArea = isAnyTargetComponentInAreaTest( geom, prepPoly->getRepresentativePoints());
 		if (isTargetGeomInTestArea) 
 			return false;
 	}

Modified: trunk/source/geom/prep/PreparedPolygonCovers.cpp
===================================================================
--- trunk/source/geom/prep/PreparedPolygonCovers.cpp	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/geom/prep/PreparedPolygonCovers.cpp	2009-04-29 08:56:14 UTC (rev 2420)
@@ -13,7 +13,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonCovers.java rev 1.1 (2007-08-17)
+ * Last port: geom/prep/PreparedPolygonCovers.java rev 1.2 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 

Modified: trunk/source/geom/prep/PreparedPolygonIntersects.cpp
===================================================================
--- trunk/source/geom/prep/PreparedPolygonIntersects.cpp	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/geom/prep/PreparedPolygonIntersects.cpp	2009-04-29 08:56:14 UTC (rev 2420)
@@ -13,7 +13,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonIntersects.java rev 1.5 (2007-08-17)
+ * Last port: geom/prep/PreparedPolygonIntersects.java rev 1.6 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -48,7 +49,7 @@
 	// Do point-in-poly tests first, since they are cheaper and may result
 	// in a quick positive result.
 	// If a point of any test components lie in target, result is true
-	bool isInPrepGeomArea = isAnyTestComponentInTargetArea( geom);
+	bool isInPrepGeomArea = isAnyTestComponentInTarget( geom);
 	if ( isInPrepGeomArea ) 
 		return true;
 	
@@ -72,7 +73,7 @@
 	if ( geom->getDimension() == 2) 
 	{
 		// TODO: generalize this to handle GeometryCollections
-		bool isPrepGeomInArea = isAnyTargetComponentInTestArea( geom, prepPoly->getRepresentativePoints());
+		bool isPrepGeomInArea = isAnyTargetComponentInAreaTest( geom, prepPoly->getRepresentativePoints());
 		if ( isPrepGeomInArea ) 
 			return true;
 	}

Modified: trunk/source/geom/prep/PreparedPolygonPredicate.cpp
===================================================================
--- trunk/source/geom/prep/PreparedPolygonPredicate.cpp	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/geom/prep/PreparedPolygonPredicate.cpp	2009-04-29 08:56:14 UTC (rev 2420)
@@ -13,7 +13,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonPredicate.java rev. 1.2 (2007-08-16)
+ * Last port: geom/prep/PreparedPolygonPredicate.java rev. 1.4 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -38,7 +39,7 @@
 // protected:
 //
 bool 
-PreparedPolygonPredicate::isAllTestComponentsInTargetArea(const geom::Geometry* testGeom)
+PreparedPolygonPredicate::isAllTestComponentsInTarget(const geom::Geometry* testGeom) const
 {
     geom::Coordinate::ConstVect pts;
     geom::util::ComponentCoordinateExtracter::getCoordinates(*testGeom, pts);
@@ -56,7 +57,8 @@
 }
 
 bool 
-PreparedPolygonPredicate::isAllTestComponentsInTargetInterior(const geom::Geometry* testGeom)
+PreparedPolygonPredicate::isAllTestComponentsInTargetInterior(
+		const geom::Geometry* testGeom) const
 {
     geom::Coordinate::ConstVect pts;
     geom::util::ComponentCoordinateExtracter::getCoordinates(*testGeom, pts);
@@ -74,7 +76,8 @@
 }
 
 bool 
-PreparedPolygonPredicate::isAnyTestComponentInTargetArea(const geom::Geometry* testGeom)
+PreparedPolygonPredicate::isAnyTestComponentInTarget(
+		const geom::Geometry* testGeom) const
 {
     geom::Coordinate::ConstVect pts;
     geom::util::ComponentCoordinateExtracter::getCoordinates(*testGeom, pts);
@@ -92,7 +95,8 @@
 }
 
 bool 
-PreparedPolygonPredicate::isAnyTestComponentInTargetInterior( const geom::Geometry * testGeom)
+PreparedPolygonPredicate::isAnyTestComponentInTargetInterior(
+	const geom::Geometry * testGeom) const
 {
     geom::Coordinate::ConstVect pts;
     geom::util::ComponentCoordinateExtracter::getCoordinates(*testGeom, pts);
@@ -110,25 +114,22 @@
 }
 
 bool
-PreparedPolygonPredicate::isAnyTargetComponentInTestArea(const geom::Geometry* testGeom,
-                                                         const geom::Coordinate::ConstVect* targetRepPts)
+PreparedPolygonPredicate::isAnyTargetComponentInAreaTest(
+	const geom::Geometry* testGeom,
+	const geom::Coordinate::ConstVect* targetRepPts) const
 {
-    // TODO - mloskot: Replace manual delete with scoped_ptr
-    algorithm::locate::PointOnGeometryLocator* piaLoc = 0;
-    piaLoc = new algorithm::locate::SimplePointInAreaLocator(testGeom);
+    algorithm::locate::SimplePointInAreaLocator piaLoc(testGeom);
 
     for (std::size_t i = 0, ni = targetRepPts->size(); i < ni; i++)
     {
         const geom::Coordinate * pt = (*targetRepPts)[i];
-        const int loc = piaLoc->locate(pt);
+        const int loc = piaLoc.locate(pt);
         if (geom::Location::EXTERIOR != loc)
         {
-            delete piaLoc;
             return true;
         }
     }
 
-    delete piaLoc;
     return false;
 }
 

Modified: trunk/source/headers/geos/geom/prep/AbstractPreparedPolygonContains.h
===================================================================
--- trunk/source/headers/geos/geom/prep/AbstractPreparedPolygonContains.h	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/headers/geos/geom/prep/AbstractPreparedPolygonContains.h	2009-04-29 08:56:14 UTC (rev 2420)
@@ -14,7 +14,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/AbstractPreparedPolygonContains.java rev. 1.6 (2007-12-12)
+ * Last port: geom/prep/AbstractPreparedPolygonContains.java rev 1.7 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 

Modified: trunk/source/headers/geos/geom/prep/PreparedPolygonContainsProperly.h
===================================================================
--- trunk/source/headers/geos/geom/prep/PreparedPolygonContainsProperly.h	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/headers/geos/geom/prep/PreparedPolygonContainsProperly.h	2009-04-29 08:56:14 UTC (rev 2420)
@@ -14,7 +14,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonContainsProperly.java rev 1.4 (2007-12-12)
+ * Last port: geom/prep/PreparedPolygonContainsProperly.java rev 1.5 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 

Modified: trunk/source/headers/geos/geom/prep/PreparedPolygonCovers.h
===================================================================
--- trunk/source/headers/geos/geom/prep/PreparedPolygonCovers.h	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/headers/geos/geom/prep/PreparedPolygonCovers.h	2009-04-29 08:56:14 UTC (rev 2420)
@@ -14,7 +14,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonCovers.java rev 1.1 (2007-08-17)
+ * Last port: geom/prep/PreparedPolygonCovers.java rev 1.2 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -61,7 +62,7 @@
 	 * Used when short-circuit tests are not conclusive.
 	 * 
 	 * @param geom the test geometry
-	 * @return true if this prepared polygon contains the test geometry
+	 * @return true if this prepared polygon covers the test geometry
 	 */
 	bool fullTopologicalPredicate( const geom::Geometry * geom);
 
@@ -93,7 +94,7 @@
 	 * Tests whether this PreparedPolygon <tt>covers</tt> a given geometry.
 	 * 
 	 * @param geom the test geometry
-	 * @return true if the test geometry is contained
+	 * @return true if the test geometry is covered
 	 */
 	bool covers( const Geometry * geom)
 	{

Modified: trunk/source/headers/geos/geom/prep/PreparedPolygonIntersects.h
===================================================================
--- trunk/source/headers/geos/geom/prep/PreparedPolygonIntersects.h	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/headers/geos/geom/prep/PreparedPolygonIntersects.h	2009-04-29 08:56:14 UTC (rev 2420)
@@ -14,7 +14,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonIntersects.java rev 1.5 (2007-08-17)
+ * Last port: geom/prep/PreparedPolygonIntersects.java rev 1.6 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 

Modified: trunk/source/headers/geos/geom/prep/PreparedPolygonPredicate.h
===================================================================
--- trunk/source/headers/geos/geom/prep/PreparedPolygonPredicate.h	2009-04-29 08:22:16 UTC (rev 2419)
+++ trunk/source/headers/geos/geom/prep/PreparedPolygonPredicate.h	2009-04-29 08:56:14 UTC (rev 2420)
@@ -14,7 +14,8 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/PreparedPolygonPredicate.java rev. 1.2 (2007-08-16)
+ * Last port: geom/prep/PreparedPolygonPredicate.java rev. 1.4 (JTS-1.10)
+ * (2007-12-12)
  *
  **********************************************************************/
 
@@ -60,55 +61,63 @@
 protected:
 	const PreparedPolygon * const prepPoly;
 
-	/**
+	/** \brief
 	 * Tests whether all components of the test Geometry 
 	 * are contained in the target geometry.
+	 *
 	 * Handles both linear and point components.
 	 * 
 	 * @param geom a geometry to test
-	 * @return true if all componenta of the argument are contained in the target geometry
+	 * @return true if all components of the argument are contained
+	 *              in the target geometry
 	 */
-	bool isAllTestComponentsInTargetArea( const geom::Geometry * testGeom);
+	bool isAllTestComponentsInTarget(const geom::Geometry * testGeom) const;
 
-	/**
+	/** \brief
 	 * Tests whether all components of the test Geometry 
 	 * are contained in the interior of the target geometry.
+	 *
 	 * Handles both linear and point components.
 	 * 
 	 * @param geom a geometry to test
-	 * @return true if all componenta of the argument are contained in the target geometry interior
+	 * @return true if all componenta of the argument are contained in
+	 *              the target geometry interior
 	 */
-	bool isAllTestComponentsInTargetInterior( const geom::Geometry * testGeom);
+	bool isAllTestComponentsInTargetInterior( const geom::Geometry * testGeom) const;
 
-	/**
+	/** \brief
 	 * Tests whether any component of the test Geometry intersects
 	 * the area of the target geometry.
+	 *
 	 * Handles test geometries with both linear and point components.
 	 * 
 	 * @param geom a geometry to test
-	 * @return true if any component of the argument intersects the prepared geometry
+	 * @return true if any component of the argument intersects the
+	 *              prepared geometry
 	 */
-	bool isAnyTestComponentInTargetArea( const geom::Geometry * testGeom);
+	bool isAnyTestComponentInTarget( const geom::Geometry * testGeom) const;
 
-	/**
+	/** \brief
 	 * Tests whether any component of the test Geometry intersects
 	 * the interior of the target geometry.
+	 *
 	 * Handles test geometries with both linear and point components.
 	 * 
 	 * @param geom a geometry to test
-	 * @return true if any component of the argument intersects the prepared area geometry interior
+	 * @return true if any component of the argument intersects the
+	 *              prepared area geometry interior
 	 */
-	bool isAnyTestComponentInTargetInterior( const geom::Geometry * testGeom);
+	bool isAnyTestComponentInTargetInterior( const geom::Geometry * testGeom) const;
 
 	/**
 	 * Tests whether any component of the target geometry 
-	 * intersects the area of the test geometry 
+	 * intersects the test geometry (which must be an areal geometry)
 	 * 
 	 * @param geom the test geometry
 	 * @param repPts the representative points of the target geometry
 	 * @return true if any component intersects the areal test geometry
 	 */
-	bool isAnyTargetComponentInTestArea( const geom::Geometry * testGeom, const geom::Coordinate::ConstVect * targetRepPts);
+	bool isAnyTargetComponentInAreaTest( const geom::Geometry * testGeom, const geom::Coordinate::ConstVect * targetRepPts) const;
 
 public:
 	/**
@@ -120,7 +129,7 @@
 	:	prepPoly( prepPoly)
 	{ }
 
-	~PreparedPolygonPredicate()
+	virtual ~PreparedPolygonPredicate()
 	{ }
 
 };



More information about the geos-commits mailing list