[geos-commits] [SCM] GEOS branch main-relate-ng updated. 222add30792744c4eeaefc8d5b785137709b92eb
git at osgeo.org
git at osgeo.org
Wed Aug 7 11:44:36 PDT 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main-relate-ng has been updated
via 222add30792744c4eeaefc8d5b785137709b92eb (commit)
via 08badca77de8257fc6fab7740460c988aedc0e19 (commit)
via 4adc4825e103713c4deb65c81c762dd3df71c53b (commit)
via 5b22130203397bb9c7a1d701d0b67e8513ca8372 (commit)
via 7791300797a36a326b27d7eb031ac4a600b90a07 (commit)
via b17470d44d875fe23ba682ebe7d63602911eb2c5 (commit)
from 5b160a0354e49e56d23acbc755a46a69dabdbe76 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 222add30792744c4eeaefc8d5b785137709b92eb
Merge: 08badca77 5b160a035
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Wed Aug 7 11:44:08 2024 -0700
Merge branch 'main-relate-ng' of github.com:libgeos/geos into main-relate-ng
commit 08badca77de8257fc6fab7740460c988aedc0e19
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Wed Aug 7 11:43:54 2024 -0700
Use RelateNG in CAPI predicates, add easy static calls and use them in Geometry also
diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index 4581860b6..b84c6015e 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -92,6 +92,10 @@
#include <geos/operation/valid/IsValidOp.h>
#include <geos/operation/valid/MakeValid.h>
#include <geos/operation/valid/RepeatedPointRemover.h>
+
+#include <geos/operation/relateng/RelateNG.h>
+#include <geos/operation/relateng/RelatePredicate.h>
+
#include <geos/precision/GeometryPrecisionReducer.h>
#include <geos/shape/fractal/HilbertEncoder.h>
#include <geos/simplify/DouglasPeuckerSimplifier.h>
@@ -205,6 +209,8 @@ using geos::operation::geounion::CascadedPolygonUnion;
using geos::operation::overlayng::OverlayNG;
using geos::operation::overlayng::UnaryUnionNG;
using geos::operation::overlayng::OverlayNGRobust;
+using geos::operation::relateng::RelateNG;
+using geos::operation::relateng::RelatePredicate;
using geos::operation::valid::TopologyValidationError;
using geos::precision::GeometryPrecisionReducer;
@@ -577,7 +583,7 @@ extern "C" {
GEOSDisjoint_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->disjoint(g2);
+ return RelateNG::Disjoint(g1, g2);
});
}
@@ -585,7 +591,7 @@ extern "C" {
GEOSTouches_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->touches(g2);
+ return RelateNG::Touches(g1, g2);
});
}
@@ -593,7 +599,7 @@ extern "C" {
GEOSIntersects_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->intersects(g2);
+ return RelateNG::Intersects(g1, g2);
});
}
@@ -601,7 +607,7 @@ extern "C" {
GEOSCrosses_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->crosses(g2);
+ return RelateNG::Crosses(g1, g2);
});
}
@@ -609,7 +615,7 @@ extern "C" {
GEOSWithin_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->within(g2);
+ return RelateNG::Within(g1, g2);
});
}
@@ -617,7 +623,7 @@ extern "C" {
GEOSContains_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->contains(g2);
+ return RelateNG::Contains(g1, g2);
});
}
@@ -625,7 +631,7 @@ extern "C" {
GEOSOverlaps_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->overlaps(g2);
+ return RelateNG::Overlaps(g1, g2);
});
}
@@ -633,7 +639,7 @@ extern "C" {
GEOSCovers_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->covers(g2);
+ return RelateNG::Covers(g1, g2);
});
}
@@ -641,7 +647,15 @@ extern "C" {
GEOSCoveredBy_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
{
return execute(extHandle, 2, [&]() {
- return g1->coveredBy(g2);
+ return RelateNG::CoveredBy(g1, g2);
+ });
+ }
+
+ char
+ GEOSEquals_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
+ {
+ return execute(extHandle, 2, [&]() {
+ return RelateNG::EqualsTopo(g1, g2);
});
}
@@ -827,14 +841,6 @@ extern "C" {
// general purpose
//-----------------------------------------------------------------
- char
- GEOSEquals_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2)
- {
- return execute(extHandle, 2, [&]() {
- return g1->equals(g2);
- });
- }
-
char
GEOSEqualsExact_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double tolerance)
{
diff --git a/include/geos/operation/relateng/RelateGeometry.h b/include/geos/operation/relateng/RelateGeometry.h
index ae4101111..81260efbb 100644
--- a/include/geos/operation/relateng/RelateGeometry.h
+++ b/include/geos/operation/relateng/RelateGeometry.h
@@ -44,15 +44,14 @@ namespace noding {
}
-using geos::algorithm::BoundaryNodeRule;
-using geos::noding::SegmentString;
-using namespace geos::geom;
-
-
namespace geos { // geos.
namespace operation { // geos.operation
namespace relateng { // geos.operation.relateng
+using namespace geos::geom;
+using geos::algorithm::BoundaryNodeRule;
+using geos::noding::SegmentString;
+
class GEOS_DLL RelateGeometry {
diff --git a/include/geos/operation/relateng/RelateNG.h b/include/geos/operation/relateng/RelateNG.h
index 60e637739..b7c0661a5 100644
--- a/include/geos/operation/relateng/RelateNG.h
+++ b/include/geos/operation/relateng/RelateNG.h
@@ -44,18 +44,17 @@ namespace relateng {
}
-using geos::geom::CoordinateXY;
+namespace geos { // geos.
+namespace operation { // geos.operation
+namespace relateng { // geos.operation.relateng
+
+
using geos::geom::CoordinateXY;
using geos::geom::Geometry;
using geos::algorithm::BoundaryNodeRule;
using geos::noding::MCIndexSegmentSetMutualIntersector;
-namespace geos { // geos.
-namespace operation { // geos.operation
-namespace relateng { // geos.operation.relateng
-
-
/**
* Computes the value of topological predicates between two geometries based on the
* Dimensionally-Extended 9-Intersection Model <https://en.wikipedia.org/wiki/DE-9IM> (DE-9IM).
@@ -251,7 +250,25 @@ public:
*/
bool evaluate(const Geometry* b, TopologyPredicate& predicate);
+ static bool Intersects(const Geometry* a, const Geometry* b);
+ static bool Crosses(const Geometry* a, const Geometry* b);
+
+ static bool Disjoint(const Geometry* a, const Geometry* b);
+
+ static bool Touches(const Geometry* a, const Geometry* b);
+
+ static bool Within(const Geometry* a, const Geometry* b);
+
+ static bool Contains(const Geometry* a, const Geometry* b);
+
+ static bool Overlaps(const Geometry* a, const Geometry* b);
+
+ static bool Covers(const Geometry* a, const Geometry* b);
+
+ static bool CoveredBy(const Geometry* a, const Geometry* b);
+
+ static bool EqualsTopo(const Geometry* a, const Geometry* b);
};
diff --git a/src/geom/Geometry.cpp b/src/geom/Geometry.cpp
index ffc1a0c02..344de042e 100644
--- a/src/geom/Geometry.cpp
+++ b/src/geom/Geometry.cpp
@@ -261,8 +261,7 @@ bool
Geometry::disjoint(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::DisjointPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Disjoint(this, g);
#else
return !intersects(g);
#endif
@@ -279,8 +278,7 @@ Geometry::touches(const Geometry* g) const
#endif
#if USE_RELATENG
- operation::relateng::RelatePredicate::TouchesPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Touches(this, g);
#else
std::unique_ptr<IntersectionMatrix> im(relate(g));
bool res = im->isTouches(getDimension(), g->getDimension());
@@ -325,8 +323,7 @@ Geometry::intersects(const Geometry* g) const
}
#if USE_RELATENG
- operation::relateng::RelatePredicate::IntersectsPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Intersects(this, g);
#else
if (getGeometryTypeId() == GEOS_GEOMETRYCOLLECTION) {
auto im = relate(g);
@@ -343,8 +340,7 @@ bool
Geometry::covers(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::CoversPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Covers(this, g);
#else
// optimization - lower dimension cannot cover areas
if(g->getDimension() == 2 && getDimension() < 2) {
@@ -381,8 +377,7 @@ bool
Geometry::crosses(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::CrossesPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Crosses(this, g);
#else
#ifdef SHORTCIRCUIT_PREDICATES
@@ -402,8 +397,7 @@ bool
Geometry::within(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::WithinPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Within(this, g);
#else
return g->contains(this);
#endif
@@ -413,8 +407,7 @@ bool
Geometry::contains(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::ContainsPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Contains(this, g);
#else
// optimization - lower dimension cannot contain areas
@@ -456,8 +449,7 @@ bool
Geometry::overlaps(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::OverlapsPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::Overlaps(this, g);
#else
#ifdef SHORTCIRCUIT_PREDICATES
@@ -490,8 +482,7 @@ bool
Geometry::equals(const Geometry* g) const
{
#if USE_RELATENG
- operation::relateng::RelatePredicate::EqualsTopoPredicate predicate;
- return operation::relateng::RelateNG::relate(this, g, predicate);
+ return operation::relateng::RelateNG::EqualsTopo(this, g);
#else
#ifdef SHORTCIRCUIT_PREDICATES
diff --git a/src/operation/relateng/RelateNG.cpp b/src/operation/relateng/RelateNG.cpp
index 13ab5a1ff..ec5a3da3a 100644
--- a/src/operation/relateng/RelateNG.cpp
+++ b/src/operation/relateng/RelateNG.cpp
@@ -57,6 +57,96 @@ namespace relateng { // geos.operation.relateng
#define GEOM_B RelateGeometry::GEOM_B
+/* public static */
+bool
+RelateNG::Intersects(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::IntersectsPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Crosses(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::CrossesPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Disjoint(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::DisjointPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Touches(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::TouchesPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Within(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::WithinPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Contains(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::ContainsPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Overlaps(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::OverlapsPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::Covers(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::CoversPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::CoveredBy(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::CoveredByPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
+/* public static */
+bool
+RelateNG::EqualsTopo(const Geometry* a, const Geometry* b)
+{
+ RelatePredicate::EqualsTopoPredicate pred;
+ RelateNG rng(a, false);
+ return rng.evaluate(b, pred);
+}
+
/* public static */
bool
RelateNG::relate(const Geometry* a, const Geometry* b, TopologyPredicate& pred)
@@ -146,8 +236,8 @@ RelateNG::evaluate(const Geometry* b, TopologyPredicate& predicate)
return false;
}
- util::ensureNoCurvedComponents(geomA.getGeometry());
- util::ensureNoCurvedComponents(b);
+ geos::util::ensureNoCurvedComponents(geomA.getGeometry());
+ geos::util::ensureNoCurvedComponents(b);
RelateGeometry geomB(b, boundaryNodeRule);
commit 4adc4825e103713c4deb65c81c762dd3df71c53b
Merge: 2c9b3cd65 5b2213020
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Wed Aug 7 08:56:33 2024 -0700
Merge branch 'main' of github.com:libgeos/geos into main-relate-ng
-----------------------------------------------------------------------
Summary of changes:
.github/workflows/ci.yml | 73 ++++++++++++-----
capi/geos_ts_c.cpp | 40 +++++----
include/geos/operation/relateng/RelateGeometry.h | 9 +--
include/geos/operation/relateng/RelateNG.h | 29 +++++--
src/algorithm/construct/MaximumInscribedCircle.cpp | 4 +-
src/geom/Geometry.cpp | 27 +++----
src/operation/relateng/RelateNG.cpp | 94 +++++++++++++++++++++-
web/content/project/development/tests.md | 4 +-
8 files changed, 207 insertions(+), 73 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list