[geos-commits] [SCM] GEOS branch main-relate-ng updated. 2c9b3cd652118d17af99e1ee902d498f780f7af9
git at osgeo.org
git at osgeo.org
Fri Aug 2 12:19:26 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 2c9b3cd652118d17af99e1ee902d498f780f7af9 (commit)
from 41bd100781782aabc477892db73a937ba08e6cb9 (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 2c9b3cd652118d17af99e1ee902d498f780f7af9
Author: Martin Davis <mtnclimb at gmail.com>
Date: Fri Aug 2 12:19:05 2024 -0700
Allow empty geoms to test equal
diff --git a/include/geos/operation/relateng/RelatePredicate.h b/include/geos/operation/relateng/RelatePredicate.h
index fc5fc000d..ca1db412f 100644
--- a/include/geos/operation/relateng/RelatePredicate.h
+++ b/include/geos/operation/relateng/RelatePredicate.h
@@ -490,12 +490,20 @@ class EqualsTopoPredicate : public IMPredicate {
return std::string("equals");
}
+ bool requireInteraction() const override {
+ //-- allow EMPTY = EMPTY
+ return false;
+ };
+
void init(int _dimA, int _dimB) override {
IMPredicate::init(_dimA, _dimB);
- require(dimA == dimB);
+ //-- don't require equal dims, because EMPTY = EMPTY for all dims
}
void init(const Envelope& envA, const Envelope& envB) override {
+ //-- handle EMPTY = EMPTY cases
+ setValueIf(true, envA.isNull() && envB.isNull());
+
require(envA.equals(&envB));
}
diff --git a/src/operation/relateng/RelateNG.cpp b/src/operation/relateng/RelateNG.cpp
index d4b8baea5..13ab5a1ff 100644
--- a/src/operation/relateng/RelateNG.cpp
+++ b/src/operation/relateng/RelateNG.cpp
@@ -151,10 +151,6 @@ RelateNG::evaluate(const Geometry* b, TopologyPredicate& predicate)
RelateGeometry geomB(b, boundaryNodeRule);
- if (geomA.isEmpty() && geomB.isEmpty()) {
- //TODO: what if predicate is disjoint? Perhaps use result on disjoint envs?
- return finishValue(predicate);
- }
int dimA = geomA.getDimensionReal();
int dimB = geomB.getDimensionReal();
diff --git a/tests/unit/operation/relateng/RelateNGTest.cpp b/tests/unit/operation/relateng/RelateNGTest.cpp
index cf0a2403b..5e3fca8d2 100644
--- a/tests/unit/operation/relateng/RelateNGTest.cpp
+++ b/tests/unit/operation/relateng/RelateNGTest.cpp
@@ -841,37 +841,32 @@ void object::test<60> ()
//================ Empty Geometries ==============
+//-- test equals against all combinations of empty geometries
template<>
template<>
void object::test<61> ()
{
- std::string a = "POINT EMPTY";
- std::string b = "POINT EMPTY";
- checkRelate(a, b, "FFFFFFFF2");
- checkEquals(a, b, true);
-}
+ std::string empties[] = {
+ "POINT EMPTY",
+ "LINESTRING EMPTY",
+ "POLYGON EMPTY",
+ "MULTIPOINT EMPTY",
+ "MULTILINESTRING EMPTY",
+ "MULTIPOLYGON EMPTY",
+ "GEOMETRYCOLLECTION EMPTY"
+ };
+ int nempty = 7;
+ for (int i = 0; i < nempty; i++) {
+ for (int j = 0; j < nempty; j++) {
+ std::string a = empties[i];
+ std::string b = empties[j];
+ checkRelate(a, b, "FFFFFFFF2");
+ checkEquals(a, b, true);
+ }
+ }
-template<>
-template<>
-void object::test<62> ()
-{
- std::string a = "LINESTRING EMPTY";
- std::string b = "LINESTRING EMPTY";
- checkRelate(a, b, "FFFFFFFF2");
- checkEquals(a, b, true);
}
-template<>
-template<>
-void object::test<63> ()
-{
- std::string a = "GEOMETRYCOLLECTION EMPTY";
- std::string b = "GEOMETRYCOLLECTION EMPTY";
- checkRelate(a, b, "FFFFFFFF2");
- checkEquals(a, b, true);
-}
-
-
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
include/geos/operation/relateng/RelatePredicate.h | 10 +++++-
src/operation/relateng/RelateNG.cpp | 4 ---
tests/unit/operation/relateng/RelateNGTest.cpp | 43 ++++++++++-------------
3 files changed, 28 insertions(+), 29 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list