[geos-commits] r4119 - in trunk: include/geos/triangulate/quadedge src/triangulate/quadedge

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Nov 21 04:59:28 PST 2015


Author: strk
Date: 2015-11-21 04:59:28 -0800 (Sat, 21 Nov 2015)
New Revision: 4119

Modified:
   trunk/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h
   trunk/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
Log:
use std::vector instead of std::list to avoid size() bottleneck

Patch by Daniel Baston via
https://github.com/libgeos/libgeos/pull/55

Modified: trunk/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h
===================================================================
--- trunk/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h	2015-11-16 10:53:09 UTC (rev 4118)
+++ trunk/include/geos/triangulate/quadedge/QuadEdgeSubdivision.h	2015-11-21 12:59:28 UTC (rev 4119)
@@ -78,7 +78,7 @@
  */
 class GEOS_DLL QuadEdgeSubdivision {
 public:
-	typedef std::list<QuadEdge*> QuadEdgeList;
+	typedef std::vector<QuadEdge*> QuadEdgeList;
 
 	/**
 	 * Gets the edges for the triangle to the left of the given {@link QuadEdge}.

Modified: trunk/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
===================================================================
--- trunk/src/triangulate/quadedge/QuadEdgeSubdivision.cpp	2015-11-16 10:53:09 UTC (rev 4118)
+++ trunk/src/triangulate/quadedge/QuadEdgeSubdivision.cpp	2015-11-21 12:59:28 UTC (rev 4119)
@@ -17,6 +17,7 @@
  **********************************************************************/
 #include <geos/triangulate/quadedge/QuadEdgeSubdivision.h>
 
+#include <algorithm>
 #include <vector>
 #include <set>
 #include <iostream>
@@ -159,8 +160,8 @@
     QuadEdge::splice(e, e.oPrev());
     QuadEdge::splice(e.sym(), e.sym().oPrev());
 
-    // this is inefficient on an ArrayList, but this method should be called infrequently
-    quadEdges.remove(&e);
+    // this is inefficient on a std::vector, but this method should be called infrequently
+    quadEdges.erase(std::remove(quadEdges.begin(), quadEdges.end(), &e), quadEdges.end());
 
     //mark these edges as removed
     e.remove();



More information about the geos-commits mailing list