[geos-commits] r2549 - in trunk/source: headers/geos/operation
headers/geos/operation/relate operation operation/relate
svn_geos at osgeo.org
svn_geos at osgeo.org
Fri Jun 5 13:50:34 EDT 2009
Author: strk
Date: 2009-06-05 13:50:34 -0400 (Fri, 05 Jun 2009)
New Revision: 2549
Modified:
trunk/source/headers/geos/operation/GeometryGraphOperation.h
trunk/source/headers/geos/operation/relate/RelateOp.h
trunk/source/operation/GeometryGraphOperation.cpp
trunk/source/operation/relate/RelateOp.cpp
Log:
Boundary Node Rule support in relateOp. JTS-1.10.
Modified: trunk/source/headers/geos/operation/GeometryGraphOperation.h
===================================================================
--- trunk/source/headers/geos/operation/GeometryGraphOperation.h 2009-06-05 13:44:48 UTC (rev 2548)
+++ trunk/source/headers/geos/operation/GeometryGraphOperation.h 2009-06-05 17:50:34 UTC (rev 2549)
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: operation/GeometryGraphOperation.java rev. 1.14 (JTS-1.7)
+ * Last port: operation/GeometryGraphOperation.java rev. 1.18 (JTS-1.10)
*
**********************************************************************/
@@ -27,6 +27,9 @@
// Forward declarations
namespace geos {
+ namespace algorithm {
+ class BoundaryNodeRule;
+ }
namespace geom {
class Geometry;
class PrecisionModel;
@@ -48,6 +51,10 @@
GeometryGraphOperation(const geom::Geometry *g0,
const geom::Geometry *g1);
+ GeometryGraphOperation(const geom::Geometry *g0,
+ const geom::Geometry *g1,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule);
+
GeometryGraphOperation(const geom::Geometry *g0);
virtual ~GeometryGraphOperation();
Modified: trunk/source/headers/geos/operation/relate/RelateOp.h
===================================================================
--- trunk/source/headers/geos/operation/relate/RelateOp.h 2009-06-05 13:44:48 UTC (rev 2548)
+++ trunk/source/headers/geos/operation/relate/RelateOp.h 2009-06-05 17:50:34 UTC (rev 2549)
@@ -13,7 +13,7 @@
*
**********************************************************************
*
- * Last port: operation/relate/RelateOp.java rev. 1.17 (JTS-1.7)
+ * Last port: operation/relate/RelateOp.java rev. 1.19 (JTS-1.10)
*
* EXPOSED GEOS HEADER
*
@@ -27,6 +27,9 @@
// Forward declarations
namespace geos {
+ namespace algorithm {
+ class BoundaryNodeRule;
+ }
namespace geom {
class IntersectionMatrix;
class Geometry;
@@ -39,26 +42,87 @@
namespace relate { // geos::operation::relate
/** \brief
- * Implements the relate() operation on Geometry.
+ * Implements the SFS <tt>relate()</tt> operation on two
+ * geom::Geometry objects.
+ *
+ * This class supports specifying a custom algorithm::BoundaryNodeRule
+ * to be used during the relate computation.
*
- * WARNING: The current implementation of this class will compute a result for
- * GeometryCollections. However, the semantics of this operation are
- * not well-defined and the value returned may not represent
- * an appropriate notion of relate.
+ * <b>Note:</b> custom Boundary Node Rules do not (currently)
+ * affect the results of other Geometry methods (such
+ * as {@link Geometry::getBoundary}. The results of
+ * these methods may not be consistent with the relationship computed by
+ * a custom Boundary Node Rule.
+ *
*/
class RelateOp: public GeometryGraphOperation {
public:
+ /** \brief
+ * Computes the geom::IntersectionMatrix for the spatial relationship
+ * between two geom::Geometry objects, using the default (OGC SFS)
+ * Boundary Node Rule
+ *
+ * @param a a Geometry to test. Ownership left to caller.
+ * @param b a Geometry to test. Ownership left to caller.
+ *
+ * @return the IntersectonMatrix for the spatial relationship
+ * between the geometries. Ownership transferred.
+ */
static geom::IntersectionMatrix* relate(
const geom::Geometry *a,
const geom::Geometry *b);
+ /** \brief
+ * Computes the geom::IntersectionMatrix for the spatial relationship
+ * between two geom::Geometry objects, using a specified
+ * Boundary Node Rule
+ *
+ * @param a a Geometry to test. Ownership left to caller.
+ * @param b a Geometry to test. Ownership left to caller.
+ * @param boundaryNodeRule the Boundary Node Rule to use.
+ *
+ * @return the IntersectonMatrix for the spatial relationship
+ * between the geometries. Ownership transferred.
+ */
+ static geom::IntersectionMatrix* relate(
+ const geom::Geometry *a,
+ const geom::Geometry *b,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule);
+
+ /** \brief
+ * Creates a new Relate operation, using the default (OGC SFS)
+ * Boundary Node Rule.
+ *
+ * @param g0 a Geometry to relate. Ownership left to caller.
+ * @param g1 another Geometry to relate. Ownership to caller.
+ */
RelateOp(const geom::Geometry *g0,
const geom::Geometry *g1);
+ /** \brief
+ * Creates a new Relate operation with a specified
+ * Boundary Node Rule.
+ *
+ * @param g0 a Geometry to relate. Ownership left to caller.
+ * @param g1 another Geometry to relate. Ownership to caller.
+ * @param boundaryNodeRule the Boundary Node Rule to use
+ */
+ RelateOp(const geom::Geometry *g0,
+ const geom::Geometry *g1,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule);
+
virtual ~RelateOp();
+ /** \brief
+ * Gets the IntersectionMatrix for the spatial relationship
+ * between the input geometries.
+ *
+ * @return the geom::IntersectionMatrix for the spatial
+ * relationship between the input geometries.
+ * Ownership transferred.
+ */
geom::IntersectionMatrix* getIntersectionMatrix();
private:
Modified: trunk/source/operation/GeometryGraphOperation.cpp
===================================================================
--- trunk/source/operation/GeometryGraphOperation.cpp 2009-06-05 13:44:48 UTC (rev 2548)
+++ trunk/source/operation/GeometryGraphOperation.cpp 2009-06-05 17:50:34 UTC (rev 2549)
@@ -14,12 +14,13 @@
*
**********************************************************************
*
- * Last port: operation/GeometryGraphOperation.java rev. 1.14 (JTS-1.7)
+ * Last port: operation/GeometryGraphOperation.java rev. 1.18 (JTS-1.10)
*
**********************************************************************/
#include <geos/operation/GeometryGraphOperation.h>
#include <geos/algorithm/LineIntersector.h>
+#include <geos/algorithm/BoundaryNodeRule.h>
#include <geos/geomgraph/GeometryGraph.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/PrecisionModel.h>
@@ -52,11 +53,35 @@
else
setComputationPrecision(pm1);
- arg[0]=new GeometryGraph(0, g0);
- arg[1]=new GeometryGraph(1, g1);
+ arg[0]=new GeometryGraph(0, g0,
+ algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE);
+ arg[1]=new GeometryGraph(1, g1,
+ algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE);
}
+GeometryGraphOperation::GeometryGraphOperation(const Geometry *g0,
+ const Geometry *g1,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule)
+ :
+ arg(2)
+{
+ const PrecisionModel* pm0 = g0->getPrecisionModel();
+ assert(pm0);
+ const PrecisionModel* pm1 = g1->getPrecisionModel();
+ assert(pm1);
+
+ // use the most precise model for the result
+ if (pm0->compareTo(pm1) >= 0)
+ setComputationPrecision(pm0);
+ else
+ setComputationPrecision(pm1);
+
+ arg[0]=new GeometryGraph(0, g0, boundaryNodeRule);
+ arg[1]=new GeometryGraph(1, g1, boundaryNodeRule);
+}
+
+
GeometryGraphOperation::GeometryGraphOperation(const Geometry *g0):
arg(1)
{
Modified: trunk/source/operation/relate/RelateOp.cpp
===================================================================
--- trunk/source/operation/relate/RelateOp.cpp 2009-06-05 13:44:48 UTC (rev 2548)
+++ trunk/source/operation/relate/RelateOp.cpp 2009-06-05 17:50:34 UTC (rev 2549)
@@ -14,7 +14,7 @@
*
**********************************************************************
*
- * Last port: operation/relate/RelateOp.java rev. 1.17 (JTS-1.7)
+ * Last port: operation/relate/RelateOp.java rev. 1.19 (JTS-1.10)
*
**********************************************************************/
@@ -43,12 +43,28 @@
return relOp.getIntersectionMatrix();
}
+IntersectionMatrix*
+RelateOp::relate(const Geometry *a, const Geometry *b,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule)
+{
+ RelateOp relOp(a, b, boundaryNodeRule);
+ return relOp.getIntersectionMatrix();
+}
+
RelateOp::RelateOp(const Geometry *g0, const Geometry *g1):
GeometryGraphOperation(g0, g1),
relateComp(&arg)
{
}
+RelateOp::RelateOp(const Geometry *g0, const Geometry *g1,
+ const algorithm::BoundaryNodeRule& boundaryNodeRule)
+ :
+ GeometryGraphOperation(g0, g1, boundaryNodeRule),
+ relateComp(&arg)
+{
+}
+
RelateOp::~RelateOp()
{
}
More information about the geos-commits
mailing list