[geos-commits] r3643 - in trunk/src/operation: buffer overlay

svn_geos at osgeo.org svn_geos at osgeo.org
Fri May 25 06:54:49 EDT 2012


Author: strk
Date: 2012-05-25 03:54:49 -0700 (Fri, 25 May 2012)
New Revision: 3643

Modified:
   trunk/src/operation/buffer/BufferBuilder.cpp
   trunk/src/operation/overlay/OverlayOp.cpp
Log:
Check for interruption in OverlayOp and BufferBuilder

These are just two operations known to take a lot of time.
It'll take a better analisys to find appropriate check point.

The checks could as well be put within graph operation loops or
Coordinate constructors...

Modified: trunk/src/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/src/operation/buffer/BufferBuilder.cpp	2012-05-25 10:54:37 UTC (rev 3642)
+++ trunk/src/operation/buffer/BufferBuilder.cpp	2012-05-25 10:54:49 UTC (rev 3643)
@@ -50,6 +50,7 @@
 #include <geos/io/WKTWriter.h> // for debugging
 #include <geos/util/IllegalArgumentException.h>
 #include <geos/profiler.h>
+#include <geos/util/Interrupt.h>
 
 #include <cassert>
 #include <vector>
@@ -380,6 +381,8 @@
 	OffsetCurveBuilder curveBuilder(precisionModel, bufParams);
 	OffsetCurveSetBuilder curveSetBuilder(*g, distance, curveBuilder);
 
+  GEOS_CHECK_FOR_INTERRUPTS();
+
 	std::vector<SegmentString*>& bufferSegStrList=curveSetBuilder.getCurves();
 
 #if GEOS_DEBUG
@@ -397,6 +400,8 @@
 
 	computeNodedEdges(bufferSegStrList, precisionModel);
 
+  GEOS_CHECK_FOR_INTERRUPTS();
+
   } // bufferSegStrList and contents are released here
 
 #if GEOS_DEBUG > 1
@@ -411,6 +416,8 @@
 		PlanarGraph graph(OverlayNodeFactory::instance());
 		graph.addEdges(edgeList.getEdges());
 
+    GEOS_CHECK_FOR_INTERRUPTS();
+
 		createSubgraphs(&graph, subgraphList);
 
 #if GEOS_DEBUG
@@ -421,6 +428,8 @@
 #endif
 #endif
 
+    GEOS_CHECK_FOR_INTERRUPTS();
+
 		{ // scope for earlier PolygonBuilder cleanupt
 		  PolygonBuilder polyBuilder(geomFact);
 		  buildSubgraphs(subgraphList, polyBuilder);

Modified: trunk/src/operation/overlay/OverlayOp.cpp
===================================================================
--- trunk/src/operation/overlay/OverlayOp.cpp	2012-05-25 10:54:37 UTC (rev 3642)
+++ trunk/src/operation/overlay/OverlayOp.cpp	2012-05-25 10:54:49 UTC (rev 3643)
@@ -43,6 +43,7 @@
 #include <geos/geomgraph/DirectedEdge.h>
 #include <geos/geomgraph/Position.h>
 #include <geos/geomgraph/index/SegmentIntersector.h>
+#include <geos/util/Interrupt.h>
 #include <geos/util/TopologyException.h>
 #include <geos/geomgraph/EdgeNodingValidator.h>
 
@@ -655,6 +656,8 @@
 	copyPoints(0);
 	copyPoints(1);
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	// node the input Geometries
 	delete arg[0]->computeSelfNodes(li,false);
 	delete arg[1]->computeSelfNodes(li,false);
@@ -663,6 +666,8 @@
 	cerr<<"OverlayOp::computeOverlay: computed SelfNodes"<<endl;
 #endif
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	// compute intersections between edges of the two input geometries
 	delete arg[0]->computeEdgeIntersections(arg[1], &li,true);
 
@@ -672,16 +677,22 @@
 #endif
 
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	vector<Edge*> baseSplitEdges;
 	arg[0]->computeSplitEdges(&baseSplitEdges);
 	arg[1]->computeSplitEdges(&baseSplitEdges);
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	// add the noded edges to this result graph
 	insertUniqueEdges(&baseSplitEdges);
 	computeLabelsFromDepths();
 	replaceCollapsedEdges();
 	//Debug.println(edgeList);
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 #ifdef ENABLE_EDGE_NODING_VALIDATOR // {
 	/**
 	 * Check that the noding completed correctly.
@@ -730,8 +741,12 @@
 #endif // GEOS_DEBUG_VALIDATION }
 #endif // ENABLE_EDGE_NODING_VALIDATOR }
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	graph.addEdges(edgeList.getEdges());
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	// this can throw TopologyException *
 	computeLabelling();
 
@@ -740,6 +755,7 @@
 	//Debug.printWatch();
 	//nodeMap.print(System.out);
 
+	GEOS_CHECK_FOR_INTERRUPTS();
 
 	/*
 	 * The ordering of building the result Geometries is important.
@@ -751,6 +767,8 @@
 	findResultAreaEdges(opCode);
 	cancelDuplicateResultEdges();
 
+	GEOS_CHECK_FOR_INTERRUPTS();
+
 	PolygonBuilder polyBuilder(geomFact);
 	
 	// might throw a TopologyException *



More information about the geos-commits mailing list