[geos-commits] [SCM] GEOS branch main-relate-ng updated. ce259945da21066105ad19fa2a9f986df5b2ef6a
git at osgeo.org
git at osgeo.org
Mon Aug 12 14:07:38 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 ce259945da21066105ad19fa2a9f986df5b2ef6a (commit)
from fe530fab013ab5c4bb8e955a99c98e88b8a4191b (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 ce259945da21066105ad19fa2a9f986df5b2ef6a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Aug 12 14:07:08 2024 -0700
Change API on RelateNG::relate() to always return IM matrix
diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index 64aaf8e3e..37b00020e 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -3755,7 +3755,7 @@ extern "C" {
const geos::geom::prep::PreparedGeometry* pg, const Geometry* g)
{
return execute(extHandle, [&]() -> char * {
- return gstrdup(pg->relate(g));
+ return gstrdup(pg->relate(g)->toString());
});
}
diff --git a/include/geos/geom/prep/BasicPreparedGeometry.h b/include/geos/geom/prep/BasicPreparedGeometry.h
index dcd9fe3a6..a666564b8 100644
--- a/include/geos/geom/prep/BasicPreparedGeometry.h
+++ b/include/geos/geom/prep/BasicPreparedGeometry.h
@@ -182,7 +182,7 @@ public:
/**
* Default implementation.
*/
- std::string relate(const geom::Geometry* g) const override;
+ std::unique_ptr<IntersectionMatrix> relate(const geom::Geometry* g) const override;
/**
* Default implementation.
diff --git a/include/geos/geom/prep/PreparedGeometry.h b/include/geos/geom/prep/PreparedGeometry.h
index 736950223..cdb8c777c 100644
--- a/include/geos/geom/prep/PreparedGeometry.h
+++ b/include/geos/geom/prep/PreparedGeometry.h
@@ -28,6 +28,7 @@ namespace geos {
class Geometry;
class Coordinate;
class CoordinateSequence;
+ class IntersectionMatrix;
}
}
@@ -235,7 +236,7 @@ public:
* @param geom the Geometry to test the
* @return the DE9IM matrix
*/
- virtual std::string relate(const geom::Geometry* g) const = 0;
+ virtual std::unique_ptr<IntersectionMatrix> relate(const geom::Geometry* g) const = 0;
/** \brief
* Compares the prepared geometry to the given geometry
diff --git a/include/geos/operation/relateng/RelateNG.h b/include/geos/operation/relateng/RelateNG.h
index f9b0e92b7..524c75085 100644
--- a/include/geos/operation/relateng/RelateNG.h
+++ b/include/geos/operation/relateng/RelateNG.h
@@ -272,7 +272,7 @@ public:
bool coveredBy(const Geometry* a);
bool equalsTopo(const Geometry* a);
bool relate(const Geometry* a, const std::string& pat);
- std::string relate(const Geometry* a);
+ std::unique_ptr<IntersectionMatrix> relate(const Geometry* a);
};
diff --git a/src/geom/prep/BasicPreparedGeometry.cpp b/src/geom/prep/BasicPreparedGeometry.cpp
index 9dac0b965..4d2816fe4 100644
--- a/src/geom/prep/BasicPreparedGeometry.cpp
+++ b/src/geom/prep/BasicPreparedGeometry.cpp
@@ -19,6 +19,7 @@
#include <geos/geom/prep/BasicPreparedGeometry.h>
#include <geos/geom/Coordinate.h>
+#include <geos/geom/IntersectionMatrix.h>
#include <geos/algorithm/PointLocator.h>
#include <geos/geom/util/ComponentCoordinateExtracter.h>
#include <geos/operation/distance/DistanceOp.h>
@@ -155,7 +156,7 @@ BasicPreparedGeometry::relate(const geom::Geometry* g, const std::string& pat) c
return getRelateNG()->relate(g, pat);
}
-std::string
+std::unique_ptr<IntersectionMatrix>
BasicPreparedGeometry::relate(const geom::Geometry* g) const
{
return getRelateNG()->relate(g);
diff --git a/src/operation/relateng/RelateNG.cpp b/src/operation/relateng/RelateNG.cpp
index 28d583011..42a965ba5 100644
--- a/src/operation/relateng/RelateNG.cpp
+++ b/src/operation/relateng/RelateNG.cpp
@@ -269,10 +269,10 @@ RelateNG::relate(const Geometry* b, const std::string& imPattern)
}
/* public */
-std::string
+std::unique_ptr<IntersectionMatrix>
RelateNG::relate(const Geometry* b)
{
- return evaluate(b)->toString();
+ return evaluate(b);
}
/************************************************************************/
diff --git a/tests/unit/operation/relateng/RelateNGTest.h b/tests/unit/operation/relateng/RelateNGTest.h
index 82a39b80f..a33ef1853 100644
--- a/tests/unit/operation/relateng/RelateNGTest.h
+++ b/tests/unit/operation/relateng/RelateNGTest.h
@@ -40,7 +40,7 @@ struct test_relateng_support {
ensure_equals("preparedContains", prep_a->contains(b), a->contains(b));
ensure_equals("preparedCrosses", prep_a->crosses(b), a->crosses(b));
ensure_equals("preparedTouches", prep_a->touches(b), a->touches(b));
- ensure_equals("preparedRelate", prep_a->relate(b), a->relate(b)->toString());
+ ensure_equals("preparedRelate", prep_a->relate(b)->toString(), a->relate(b)->toString());
}
void checkIntersectsDisjoint(const std::string& wkta, const std::string& wktb, bool expectedValue)
-----------------------------------------------------------------------
Summary of changes:
capi/geos_ts_c.cpp | 2 +-
include/geos/geom/prep/BasicPreparedGeometry.h | 2 +-
include/geos/geom/prep/PreparedGeometry.h | 3 ++-
include/geos/operation/relateng/RelateNG.h | 2 +-
src/geom/prep/BasicPreparedGeometry.cpp | 3 ++-
src/operation/relateng/RelateNG.cpp | 4 ++--
tests/unit/operation/relateng/RelateNGTest.h | 2 +-
7 files changed, 10 insertions(+), 8 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list