[geos-commits] r4032 - in branches/3.4/src: geomgraph operation/relate
svn_geos at osgeo.org
svn_geos at osgeo.org
Tue Nov 11 02:19:47 PST 2014
Author: strk
Date: 2014-11-11 02:19:47 -0800 (Tue, 11 Nov 2014)
New Revision: 4032
Modified:
branches/3.4/src/geomgraph/GeometryGraph.cpp
branches/3.4/src/geomgraph/PlanarGraph.cpp
branches/3.4/src/operation/relate/RelateComputer.cpp
Log:
Further enhance RelateOp interruptibility (#711)
Adds interruptibility calls in GeometryGraph and RelateComputer
Funded by CartoDB
Modified: branches/3.4/src/geomgraph/GeometryGraph.cpp
===================================================================
--- branches/3.4/src/geomgraph/GeometryGraph.cpp 2014-11-11 10:19:27 UTC (rev 4031)
+++ branches/3.4/src/geomgraph/GeometryGraph.cpp 2014-11-11 10:19:47 UTC (rev 4032)
@@ -44,6 +44,7 @@
#include <geos/geom/MultiLineString.h>
#include <geos/geom/MultiPolygon.h>
#include <geos/geom/GeometryCollection.h>
+#include <geos/util/Interrupt.h>
#include <geos/inline.h>
@@ -393,7 +394,7 @@
GeometryGraph::insertPoint(int argIndex, const Coordinate& coord,
int onLocation)
{
-#if GEOS_DEBUG
+#if GEOS_DEBUG > 1
cerr<<"GeometryGraph::insertPoint("<<coord.toString()<<" called"<<endl;
#endif
Node *n=nodes->addNode(coord);
@@ -450,6 +451,7 @@
{
EdgeIntersection *ei=*eiIt;
addSelfIntersectionNode(argIndex, ei->coord, eLoc);
+ GEOS_CHECK_FOR_INTERRUPTS();
}
}
}
Modified: branches/3.4/src/geomgraph/PlanarGraph.cpp
===================================================================
--- branches/3.4/src/geomgraph/PlanarGraph.cpp 2014-11-11 10:19:27 UTC (rev 4031)
+++ branches/3.4/src/geomgraph/PlanarGraph.cpp 2014-11-11 10:19:47 UTC (rev 4032)
@@ -71,6 +71,10 @@
/*public*/
PlanarGraph::~PlanarGraph()
{
+#if GEOS_DEBUG
+ std::cerr << "~PlanarGraph" << std::endl;
+#endif
+
delete nodes;
#if 1 // FIXME: PlanarGraph should *not* own edges!
for(size_t i=0, n=edges->size(); i<n; i++) {
@@ -166,7 +170,7 @@
PlanarGraph::addNode(Node *node)
{
assert(nodes);
-#if GEOS_DEBUG
+#if GEOS_DEBUG > 1
cerr << "PlanarGraph::addNode(Node * " << *node
<< ")" << endl;
#endif
@@ -177,7 +181,7 @@
Node*
PlanarGraph::addNode(const Coordinate& coord)
{
-#if GEOS_DEBUG
+#if GEOS_DEBUG > 1
cerr << "PlanarGraph::addNode(Coordinate& "
<< coord << ")" << endl;
#endif
Modified: branches/3.4/src/operation/relate/RelateComputer.cpp
===================================================================
--- branches/3.4/src/operation/relate/RelateComputer.cpp 2014-11-11 10:19:27 UTC (rev 4031)
+++ branches/3.4/src/operation/relate/RelateComputer.cpp 2014-11-11 10:19:47 UTC (rev 4032)
@@ -36,9 +36,19 @@
#include <geos/geomgraph/EdgeIntersectionList.h>
#include <geos/geomgraph/EdgeIntersection.h>
+#include <geos/util/Interrupt.h>
+
#include <vector>
#include <cassert>
+#ifndef GEOS_DEBUG
+#define GEOS_DEBUG 0
+#endif
+
+#if GEOS_DEBUG
+# include <iostream>
+#endif
+
using namespace geos::geom;
using namespace geos::geomgraph;
using namespace geos::geomgraph::index;
@@ -72,20 +82,62 @@
return im.release();
}
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing self nodes 1"
+ << std::endl;
+#endif
+
std::auto_ptr<SegmentIntersector> si1 (
(*arg)[0]->computeSelfNodes(&li,false)
);
+
+ GEOS_CHECK_FOR_INTERRUPTS();
+
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing self nodes 2"
+ << std::endl;
+#endif
+
std::auto_ptr<SegmentIntersector> si2 (
(*arg)[1]->computeSelfNodes(&li,false)
);
+ GEOS_CHECK_FOR_INTERRUPTS();
+
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing edge intersections"
+ << std::endl;
+#endif
+
// compute intersections between edges of the two input geometries
std::auto_ptr< SegmentIntersector> intersector (
(*arg)[0]->computeEdgeIntersections((*arg)[1], &li,false)
);
+
+ GEOS_CHECK_FOR_INTERRUPTS();
+
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "copying intersection nodes"
+ << std::endl;
+#endif
+
computeIntersectionNodes(0);
computeIntersectionNodes(1);
+ GEOS_CHECK_FOR_INTERRUPTS();
+
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "copying nodes and labels"
+ << std::endl;
+#endif
+
+ GEOS_CHECK_FOR_INTERRUPTS();
+
/*
* Copy the labelling for the nodes in the parent Geometries.
* These override any labels determined by intersections
@@ -94,21 +146,40 @@
copyNodesAndLabels(0);
copyNodesAndLabels(1);
+ GEOS_CHECK_FOR_INTERRUPTS();
+
/*
* complete the labelling for any nodes which only have a
* label for a single geometry
*/
//Debug.addWatch(nodes.find(new Coordinate(110, 200)));
//Debug.printWatch();
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "labeling isolated nodes"
+ << std::endl;
+#endif
labelIsolatedNodes();
//Debug.printWatch();
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing proper intersection matrix"
+ << std::endl;
+#endif
+
/*
* If a proper intersection was found, we can set a lower bound
* on the IM.
*/
computeProperIntersectionIM(intersector.get(), im.get());
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing improper intersections"
+ << std::endl;
+#endif
+
/*
* Now process improper intersections
* (eg where one or other of the geometrys has a vertex at the
@@ -141,6 +212,11 @@
* since isolated components will not have been replaced by new
* components formed by intersections.
*/
+#if GEOS_DEBUG
+ std::cerr << "RelateComputer::computeIM: "
+ << "computing labeling for isolated components"
+ << std::endl;
+#endif
//debugPrintln("Graph A isolated edges - ");
labelIsolatedEdges(0,1);
//debugPrintln("Graph B isolated edges - ");
More information about the geos-commits
mailing list