[geos-commits] r4018 - in trunk: include/geos/operation/overlay src/operation/overlay

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Sep 23 01:17:24 PDT 2014


Author: strk
Date: 2014-09-23 01:17:24 -0700 (Tue, 23 Sep 2014)
New Revision: 4018

Modified:
   trunk/include/geos/operation/overlay/OverlayOp.h
   trunk/src/operation/overlay/OverlayOp.cpp
Log:
Further speedup difference/intersection at the validating phase

This avoids to insert to the output graph edges which do not intersect
the target envelope.

Modified: trunk/include/geos/operation/overlay/OverlayOp.h
===================================================================
--- trunk/include/geos/operation/overlay/OverlayOp.h	2014-09-23 07:55:54 UTC (rev 4017)
+++ trunk/include/geos/operation/overlay/OverlayOp.h	2014-09-23 08:17:24 UTC (rev 4018)
@@ -201,7 +201,7 @@
 
 	void computeOverlay(OpCode opCode); // throw(TopologyException *);
 
-	void insertUniqueEdges(std::vector<geomgraph::Edge*> *edges);
+	void insertUniqueEdges(std::vector<geomgraph::Edge*> *edges, const geom::Envelope *env=0);
 
 	/*
 	 * If either of the GeometryLocations for the existing label is

Modified: trunk/src/operation/overlay/OverlayOp.cpp
===================================================================
--- trunk/src/operation/overlay/OverlayOp.cpp	2014-09-23 07:55:54 UTC (rev 4017)
+++ trunk/src/operation/overlay/OverlayOp.cpp	2014-09-23 08:17:24 UTC (rev 4018)
@@ -190,20 +190,20 @@
 
 /*private*/
 void
-OverlayOp::insertUniqueEdges(vector<Edge*> *edges)
+OverlayOp::insertUniqueEdges(vector<Edge*> *edges, const Envelope *env)
 {
+  for(size_t i=0, n=edges->size(); i<n; ++i) {
+    Edge *e = (*edges)[i];
+		if ( env && ! env->intersects(e->getEnvelope()) ) continue;
+#if GEOS_DEBUG
+		cerr <<" "<< e->print() << endl;
+#endif 
+    insertUniqueEdge(e);
+  }
+/*
 	for_each(edges->begin(), edges->end(),
 			bind1st(mem_fun(&OverlayOp::insertUniqueEdge), this));
-
-#if GEOS_DEBUG
-	cerr<<"OverlayOp::insertUniqueEdges("<<edges->size()<<"): "<<endl;
-	for(size_t i=0;i<edges->size();i++) {
-		Edge *e=(*edges)[i];
-		if ( ! e ) cerr <<" NULL"<<endl;
-		cerr <<" "<< e->print() << endl;
-	}
-#endif // GEOS_DEBUG
-
+*/
 }
 
 /*private*/
@@ -729,7 +729,7 @@
 	GEOS_CHECK_FOR_INTERRUPTS();
 
 	// add the noded edges to this result graph
-	insertUniqueEdges(&baseSplitEdges);
+	insertUniqueEdges(&baseSplitEdges, env);
 	computeLabelsFromDepths();
 	replaceCollapsedEdges();
 	//Debug.println(edgeList);
@@ -750,6 +750,9 @@
 	 */
   try
   {
+#ifdef GEOS_DEBUG_VALIDATION 
+		cout << "EdgeNodingValidator about to evaluate " << edgeList.getEdges().size() << " edges" << endl;
+#endif
     // Will throw TopologyException if noding is
     // found to be invalid
     EdgeNodingValidator::checkValid(edgeList.getEdges());



More information about the geos-commits mailing list