[geos-commits] r3281 - in trunk: include/geos/geomgraph
src/geomgraph
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Apr 18 11:08:24 EDT 2011
Author: strk
Date: 2011-04-18 08:08:24 -0700 (Mon, 18 Apr 2011)
New Revision: 3281
Modified:
trunk/include/geos/geomgraph/PlanarGraph.h
trunk/src/geomgraph/PlanarGraph.cpp
Log:
Turn PlanarGraph::linkResultDirectedEdges into a templated method
Modified: trunk/include/geos/geomgraph/PlanarGraph.h
===================================================================
--- trunk/include/geos/geomgraph/PlanarGraph.h 2011-04-13 11:52:12 UTC (rev 3280)
+++ trunk/include/geos/geomgraph/PlanarGraph.h 2011-04-18 15:08:24 UTC (rev 3281)
@@ -30,6 +30,7 @@
#include <geos/geom/Coordinate.h>
#include <geos/geomgraph/PlanarGraph.h>
#include <geos/geomgraph/NodeMap.h> // for typedefs
+#include <geos/geomgraph/DirectedEdgeStar.h> // for inlines
#include <geos/inline.h>
@@ -76,18 +77,32 @@
public:
/** \brief
- * For nodes in the vector, link the DirectedEdges at the node
- * that are in the result.
+ * For nodes in the collection (first..last),
+ * link the DirectedEdges at the node that are in the result.
*
* This allows clients to link only a subset of nodes in the graph,
* for efficiency (because they know that only a subset is of
* interest).
*/
- static void linkResultDirectedEdges(
- std::vector<Node*>::iterator start,
- std::vector<Node*>::iterator end);
- // throw(TopologyException);
+ template <typename It>
+ static void linkResultDirectedEdges(It first, It last)
+ // throw(TopologyException);
+ {
+ for ( ; first!=last; ++first )
+ {
+ Node *node=*first;
+ assert(node);
+ EdgeEndStar* ees = node->getEdges();
+ assert(ees);
+ DirectedEdgeStar* des = dynamic_cast<DirectedEdgeStar*>(ees);
+ assert(des);
+
+ // this might throw an exception
+ des->linkResultDirectedEdges();
+ }
+ }
+
PlanarGraph(const NodeFactory &nodeFact);
PlanarGraph();
Modified: trunk/src/geomgraph/PlanarGraph.cpp
===================================================================
--- trunk/src/geomgraph/PlanarGraph.cpp 2011-04-13 11:52:12 UTC (rev 3280)
+++ trunk/src/geomgraph/PlanarGraph.cpp 2011-04-18 15:08:24 UTC (rev 3281)
@@ -51,28 +51,6 @@
namespace geos {
namespace geomgraph { // geos.geomgraph
-/*public static*/
-void
-PlanarGraph::linkResultDirectedEdges(
- std::vector<Node*>::iterator start,
- std::vector<Node*>::iterator end)
- //throw(TopologyException *)
-{
- for ( vector<Node*>::iterator nodeit=start; nodeit!=end; ++nodeit )
- {
- Node *node=*nodeit;
- assert(node);
-
- EdgeEndStar* ees=node->getEdges();
- assert(ees);
- assert(dynamic_cast<DirectedEdgeStar*>(ees));
- DirectedEdgeStar* des = static_cast<DirectedEdgeStar*>(ees);
-
- // this might throw an exception
- des->linkResultDirectedEdges();
- }
-}
-
/*public*/
PlanarGraph::PlanarGraph(const NodeFactory &nodeFact)
:
More information about the geos-commits
mailing list