[geos-commits] r2546 - in trunk/source: geomgraph headers/geos/geomgraph

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Jun 5 08:42:14 EDT 2009


Author: strk
Date: 2009-06-05 08:42:14 -0400 (Fri, 05 Jun 2009)
New Revision: 2546

Modified:
   trunk/source/geomgraph/GeometryGraph.cpp
   trunk/source/headers/geos/geomgraph/GeometryGraph.h
   trunk/source/headers/geos/geomgraph/GeometryGraph.inl
Log:
Add support for custom BoundaryNodeRule bringing GeometryGraph to JTS-1.10


Modified: trunk/source/geomgraph/GeometryGraph.cpp
===================================================================
--- trunk/source/geomgraph/GeometryGraph.cpp	2009-06-05 12:07:52 UTC (rev 2545)
+++ trunk/source/geomgraph/GeometryGraph.cpp	2009-06-05 12:42:14 UTC (rev 2546)
@@ -14,11 +14,12 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ * Last port: geomgraph/GeometryGraph.java rev. 1.9 (JTS-1.10)
  *
  **********************************************************************/
 
 #include <geos/algorithm/CGAlgorithms.h>
+#include <geos/algorithm/BoundaryNodeRule.h>
 
 #include <geos/util/UnsupportedOperationException.h>
 
@@ -435,7 +436,7 @@
 
 	// determine the boundary status of the point according to the
 	// Boundary Determination Rule
-	int newLoc=determineBoundary(boundaryCount);
+	int newLoc = determineBoundary(boundaryNodeRule, boundaryCount);
 	lbl->setLocation(argIndex,newLoc);
 }
 
@@ -494,6 +495,55 @@
 	return invalidPoint;
 }
 
+GeometryGraph::GeometryGraph(int newArgIndex,
+		const geom::Geometry *newParentGeom)
+	:
+	PlanarGraph(),
+	parentGeom(newParentGeom),
+	useBoundaryDeterminationRule(true),
+	boundaryNodeRule(algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE),
+	argIndex(newArgIndex),
+	hasTooFewPointsVar(false)
+{
+	if (parentGeom!=NULL) add(parentGeom);
+}
+
+GeometryGraph::GeometryGraph(int newArgIndex,
+		const geom::Geometry *newParentGeom,
+		const algorithm::BoundaryNodeRule& bnr)
+	:
+	PlanarGraph(),
+	parentGeom(newParentGeom),
+	useBoundaryDeterminationRule(true),
+	boundaryNodeRule(bnr),
+	argIndex(newArgIndex),
+	hasTooFewPointsVar(false)
+{
+	if (parentGeom!=NULL) add(parentGeom);
+}
+
+GeometryGraph::GeometryGraph()
+	:
+	PlanarGraph(),
+	parentGeom(NULL),
+	useBoundaryDeterminationRule(true),
+	boundaryNodeRule(algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE),
+	argIndex(-1),
+	hasTooFewPointsVar(false)
+{
+}
+
+
+/* public static */
+int
+GeometryGraph::determineBoundary(
+	             const algorithm::BoundaryNodeRule& boundaryNodeRule,
+	                                            int boundaryCount)
+{
+	return boundaryNodeRule.isInBoundary(boundaryCount)
+		? Location::BOUNDARY : Location::INTERIOR;
+}
+
 } // namespace geos.geomgraph
 } // namespace geos
 

Modified: trunk/source/headers/geos/geomgraph/GeometryGraph.h
===================================================================
--- trunk/source/headers/geos/geomgraph/GeometryGraph.h	2009-06-05 12:07:52 UTC (rev 2545)
+++ trunk/source/headers/geos/geomgraph/GeometryGraph.h	2009-06-05 12:42:14 UTC (rev 2546)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ * Last port: geomgraph/GeometryGraph.java rev. 1.9 (JTS-1.10)
  *
  * EXPOSED GEOS HEADER
  *
@@ -47,6 +47,7 @@
 	}
 	namespace algorithm {
 		class LineIntersector;
+		class BoundaryNodeRule;
 	}
 	namespace geomgraph {
 		class Edge;
@@ -61,7 +62,9 @@
 namespace geos {
 namespace geomgraph { // geos.geomgraph
 
-class GeometryGraph: public PlanarGraph {
+class GeometryGraph: public PlanarGraph
+{
+
 using PlanarGraph::add;
 using PlanarGraph::findEdge;
 
@@ -86,6 +89,8 @@
 	 */
 	bool useBoundaryDeterminationRule;
 
+	const algorithm::BoundaryNodeRule& boundaryNodeRule;
+
 	/**
 	 * the index of this geometry as an argument to a spatial function
 	 * (used for labelling)
@@ -123,6 +128,13 @@
 	void insertPoint(int argIndex, const geom::Coordinate& coord,
 			int onLocation);
 
+	/** \brief
+	 * Adds candidate boundary points using the current
+	 * algorithm::BoundaryNodeRule.
+	 *
+	 * This is used to add the boundary
+	 * points of dim-1 geometries (Curves/MultiCurves).
+	 */
 	void insertBoundaryPoint(int argIndex, const geom::Coordinate& coord);
 
 	void addSelfIntersectionNodes(int argIndex);
@@ -143,10 +155,17 @@
 
 	static int determineBoundary(int boundaryCount);
 
+	static int determineBoundary(
+	             const algorithm::BoundaryNodeRule& boundaryNodeRule,
+	                                            int boundaryCount);
+
 	GeometryGraph();
 
 	GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom);
 
+	GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom,
+	              const algorithm::BoundaryNodeRule& boundaryNodeRule);
+
 	virtual ~GeometryGraph();
 
 
@@ -202,6 +221,9 @@
 
 	const geom::Coordinate& getInvalidPoint(); 
 
+	const algorithm::BoundaryNodeRule& getBoundaryNodeRule() const
+	{ return boundaryNodeRule; }
+
 };
 
 

Modified: trunk/source/headers/geos/geomgraph/GeometryGraph.inl
===================================================================
--- trunk/source/headers/geos/geomgraph/GeometryGraph.inl	2009-06-05 12:07:52 UTC (rev 2545)
+++ trunk/source/headers/geos/geomgraph/GeometryGraph.inl	2009-06-05 12:42:14 UTC (rev 2546)
@@ -13,7 +13,7 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ * Last port: geomgraph/GeometryGraph.java rev. 1.9 (JTS-1.10)
  *
  * EXPOSED GEOS HEADER
  *
@@ -52,30 +52,6 @@
 {
 }
 
-INLINE
-GeometryGraph::GeometryGraph(int newArgIndex,
-		const geom::Geometry *newParentGeom)
-	:
-	PlanarGraph(),
-	parentGeom(newParentGeom),
-	useBoundaryDeterminationRule(true),
-	argIndex(newArgIndex),
-	hasTooFewPointsVar(false)
-{
-	if (parentGeom!=NULL) add(parentGeom);
-}
-
-INLINE
-GeometryGraph::GeometryGraph()
-	:
-	PlanarGraph(),
-	parentGeom(NULL),
-	useBoundaryDeterminationRule(true),
-	argIndex(-1),
-	hasTooFewPointsVar(false)
-{
-}
-
 } // namespace geos::geomgraph
 } // namespace geos
 



More information about the geos-commits mailing list