[geos-commits] r3127 - in trunk: include/geos/operation/sharedpaths
src/operation/sharedpaths
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Nov 29 04:33:41 EST 2010
Author: strk
Date: 2010-11-29 01:33:41 -0800 (Mon, 29 Nov 2010)
New Revision: 3127
Modified:
trunk/include/geos/operation/sharedpaths/SharedPathsOp.h
trunk/src/operation/sharedpaths/SharedPathsOp.cpp
Log:
Paths are always LINESTRING types
Modified: trunk/include/geos/operation/sharedpaths/SharedPathsOp.h
===================================================================
--- trunk/include/geos/operation/sharedpaths/SharedPathsOp.h 2010-11-29 09:33:31 UTC (rev 3126)
+++ trunk/include/geos/operation/sharedpaths/SharedPathsOp.h 2010-11-29 09:33:41 UTC (rev 3127)
@@ -49,6 +49,9 @@
{
public:
+ /// LineString vector (list of edges)
+ typedef std::vector<geom::LineString*> PathList;
+
/// Find paths shared between two linear geometries
//
/// @param g1
@@ -57,10 +60,6 @@
/// @param g2
/// Second geometry. Must be linear.
///
- /// @param tol
- /// Tolerance by which very close paths are considered shared.
- /// TODO: specify more about the semantic, check SnapOp
- ///
/// @param sameDir
/// Shared edges having the same direction are pushed
/// onto this vector. They'll be of type LineString.
@@ -73,9 +72,8 @@
///
static void sharedPathsOp(const geom::Geometry& g1,
const geom::Geometry& g2,
- double tol,
- std::vector<geom::Geometry*>& sameDirection,
- std::vector<geom::Geometry*>& oppositeDirection);
+ PathList& sameDirection,
+ PathList& oppositeDirection);
/// Constructor
//
@@ -87,12 +85,8 @@
///
SharedPathsOp(const geom::Geometry& g1, const geom::Geometry& g2);
- /// Get shared paths gith a given tolerance
+ /// Get shared paths
//
- /// @param tol
- /// Tolerance by which very close paths are considered shared.
- /// TODO: specify more about the semantic, check SnapOp
- ///
/// @param sameDir
/// Shared edges having the same direction are pushed
/// onto this vector. They'll be of type geom::LineString.
@@ -103,25 +97,20 @@
/// onto this vector. They'll be of type geom::LineString.
/// Ownership of the edges is tranferred.
///
- void getSharedPaths(double tolerance,
- std::vector<geom::Geometry*>& sameDirection,
- std::vector<geom::Geometry*>& oppositeDirection);
+ void getSharedPaths(PathList& sameDirection, PathList& oppositeDirection);
-private:
-
- /// LineString vector (list of edges)
- typedef std::vector<geom::LineString*> EdgeList;
-
/// Delete all edges in the list
- static void clearEdges(EdgeList& from);
+ static void clearEdges(PathList& from);
+private:
+
/// Get all the linear intersections
//
/// Ownership of linestring pushed to the given container
/// is transferred to caller. See clearEdges for a deep
/// release if you need one.
///
- void findLinearIntersections(EdgeList& to);
+ void findLinearIntersections(PathList& to);
/// Check if the given edge goes forward or backward on the given line.
//
Modified: trunk/src/operation/sharedpaths/SharedPathsOp.cpp
===================================================================
--- trunk/src/operation/sharedpaths/SharedPathsOp.cpp 2010-11-29 09:33:31 UTC (rev 3126)
+++ trunk/src/operation/sharedpaths/SharedPathsOp.cpp 2010-11-29 09:33:41 UTC (rev 3127)
@@ -35,12 +35,11 @@
/* public static */
void
SharedPathsOp::sharedPathsOp(const Geometry& g1, const Geometry& g2,
- double tol,
- std::vector<Geometry*>& sameDirection,
- std::vector<Geometry*>& oppositeDirection)
+ PathList& sameDirection,
+ PathList& oppositeDirection)
{
SharedPathsOp sp(g1, g2);
- sp.getSharedPaths(tol, sameDirection, oppositeDirection);
+ sp.getSharedPaths(sameDirection, oppositeDirection);
}
/* public */
@@ -55,25 +54,23 @@
/* public */
void
-SharedPathsOp::getSharedPaths(double tol,
- std::vector<Geometry*>& sameDirection,
- std::vector<Geometry*>& oppositeDirection)
+SharedPathsOp::getSharedPaths(PathList& forwDir, PathList& backDir)
{
- EdgeList paths;
+ PathList paths;
findLinearIntersections(paths);
for (size_t i=0, n=paths.size(); i<n; ++i)
{
LineString* path = paths[i];
- if ( isSameDirection(*path) ) sameDirection.push_back(path);
- else oppositeDirection.push_back(path);
+ if ( isSameDirection(*path) ) forwDir.push_back(path);
+ else backDir.push_back(path);
}
}
/* static private */
void
-SharedPathsOp::clearEdges(EdgeList& edges)
+SharedPathsOp::clearEdges(PathList& edges)
{
- for (EdgeList::const_iterator
+ for (PathList::const_iterator
i=edges.begin(), e=edges.end();
i!=e; ++i)
{
@@ -84,7 +81,7 @@
/* private */
void
-SharedPathsOp::findLinearIntersections(EdgeList& to)
+SharedPathsOp::findLinearIntersections(PathList& to)
{
using geos::operation::overlay::OverlayOp;
More information about the geos-commits
mailing list