[geos-commits] r3352 - in trunk: include/geos/geom/prep src/geom/prep

svn_geos at osgeo.org svn_geos at osgeo.org
Thu May 12 02:10:20 EDT 2011


Author: strk
Date: 2011-05-11 23:10:20 -0700 (Wed, 11 May 2011)
New Revision: 3352

Modified:
   trunk/include/geos/geom/prep/AbstractPreparedPolygonContains.h
   trunk/src/geom/prep/AbstractPreparedPolygonContains.cpp
Log:
Reduce heap allocations in AbstractPreparedPolygonContains

Modified: trunk/include/geos/geom/prep/AbstractPreparedPolygonContains.h
===================================================================
--- trunk/include/geos/geom/prep/AbstractPreparedPolygonContains.h	2011-05-11 17:59:14 UTC (rev 3351)
+++ trunk/include/geos/geom/prep/AbstractPreparedPolygonContains.h	2011-05-12 06:10:20 UTC (rev 3352)
@@ -1,5 +1,4 @@
 /**********************************************************************
- * $Id$
  *
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
@@ -14,8 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/AbstractPreparedPolygonContains.java rev 1.7 (JTS-1.10)
- * (2007-12-12)
+ * Last port: geom/prep/AbstractPreparedPolygonContains.java r388 (JTS-1.12)
  *
  **********************************************************************/
 

Modified: trunk/src/geom/prep/AbstractPreparedPolygonContains.cpp
===================================================================
--- trunk/src/geom/prep/AbstractPreparedPolygonContains.cpp	2011-05-11 17:59:14 UTC (rev 3351)
+++ trunk/src/geom/prep/AbstractPreparedPolygonContains.cpp	2011-05-12 06:10:20 UTC (rev 3352)
@@ -1,5 +1,4 @@
 /**********************************************************************
- * $Id$
  *
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
@@ -13,8 +12,7 @@
  *
  **********************************************************************
  *
- * Last port: geom/prep/AbstractPreparedPolygonContains.java rev 1.7 (JTS-1.10)
- * (2007-12-12)
+ * Last port: geom/prep/AbstractPreparedPolygonContains.java r388 (JTS-1.12)
  *
  **********************************************************************/
 
@@ -85,22 +83,18 @@
 	noding::SegmentString::ConstVect lineSegStr; 
 	noding::SegmentStringUtil::extractSegmentStrings(geom, lineSegStr);
 
-	algorithm::LineIntersector* li = 0;
-	li = new algorithm::LineIntersector();
+	algorithm::LineIntersector li;
 
-	noding::SegmentIntersectionDetector* intDetector = 0;
-	intDetector = new noding::SegmentIntersectionDetector(li);
+	noding::SegmentIntersectionDetector intDetector(&li);
 
-	intDetector->setFindAllIntersectionTypes( true);
-	prepPoly->getIntersectionFinder()->intersects(&lineSegStr, intDetector);
+	intDetector.setFindAllIntersectionTypes(true);
+	prepPoly->getIntersectionFinder()->intersects(&lineSegStr, &intDetector);
 
-	hasSegmentIntersection = intDetector->hasIntersection();
-	hasProperIntersection = intDetector->hasProperIntersection();
-	hasNonProperIntersection = intDetector->hasNonProperIntersection();
+	hasSegmentIntersection = intDetector.hasIntersection();
+	hasProperIntersection = intDetector.hasProperIntersection();
+	hasNonProperIntersection = intDetector.hasNonProperIntersection();
 
-	delete intDetector;
-	delete li;
-    for (std::size_t i = 0, ni = lineSegStr.size(); i < ni; i++ )
+	for (std::size_t i = 0, ni = lineSegStr.size(); i < ni; i++ )
 	{
 		delete lineSegStr[i]->getCoordinates();
 		delete lineSegStr[i];



More information about the geos-commits mailing list