[geos-commits] [SCM] GEOS branch main-relate-ng updated. 02987197e3a45cf2bf46b5644d42ffbd902232e6
git at osgeo.org
git at osgeo.org
Fri Aug 9 12:37:00 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 02987197e3a45cf2bf46b5644d42ffbd902232e6 (commit)
from f6fc2e2261ba86c71a90d71e08175b204e22955a (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 02987197e3a45cf2bf46b5644d42ffbd902232e6
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Aug 9 12:36:37 2024 -0700
Use RelateNG as default implementations on BasicPreparedGeometry, over-ridden by existing implementations on PreparedPolygon, etc
diff --git a/include/geos/geom/prep/BasicPreparedGeometry.h b/include/geos/geom/prep/BasicPreparedGeometry.h
index 4297c67f0..4653aa15f 100644
--- a/include/geos/geom/prep/BasicPreparedGeometry.h
+++ b/include/geos/geom/prep/BasicPreparedGeometry.h
@@ -21,7 +21,7 @@
#include <geos/geom/prep/PreparedGeometry.h> // for inheritance
#include <geos/geom/Coordinate.h>
-//#include <geos/operation/relateng/RelateNG.h>
+#include <geos/operation/relateng/RelateNG.h>
#include <vector>
#include <string>
@@ -38,6 +38,8 @@ namespace geos {
namespace geom { // geos::geom
namespace prep { // geos::geom::prep
+using geos::operation::relateng::RelateNG;
+
// * \class BasicPreparedGeometry
/**
@@ -57,6 +59,15 @@ class BasicPreparedGeometry: public PreparedGeometry {
private:
const geom::Geometry* baseGeom;
std::vector<const CoordinateXY*> representativePts;
+ mutable std::unique_ptr<RelateNG> relate_ng;
+
+ std::unique_ptr<RelateNG>& getRelateNG() const
+ {
+ if (relate_ng == nullptr)
+ relate_ng = RelateNG::prepare(baseGeom);
+
+ return relate_ng;
+ }
protected:
/**
diff --git a/src/geom/prep/BasicPreparedGeometry.cpp b/src/geom/prep/BasicPreparedGeometry.cpp
index 3dc08f569..1c7df4322 100644
--- a/src/geom/prep/BasicPreparedGeometry.cpp
+++ b/src/geom/prep/BasicPreparedGeometry.cpp
@@ -92,69 +92,61 @@ BasicPreparedGeometry::isAnyTargetComponentInTest(const geom::Geometry* testGeom
bool
BasicPreparedGeometry::contains(const geom::Geometry* g) const
{
- return baseGeom->contains(g);
+ return getRelateNG()->contains(g);
}
bool
BasicPreparedGeometry::containsProperly(const geom::Geometry* g) const
{
- // since raw relate is used, provide some optimizations
-
- // short-circuit test
- if(! baseGeom->getEnvelopeInternal()->contains(g->getEnvelopeInternal())) {
- return false;
- }
-
- // otherwise, compute using relate mask
- return baseGeom->relate(g, "T**FF*FF*");
+ return getRelateNG()->relate(g, "T**FF*FF*");
}
bool
BasicPreparedGeometry::coveredBy(const geom::Geometry* g) const
{
- return baseGeom->coveredBy(g);
+ return getRelateNG()->coveredBy(g);
}
bool
BasicPreparedGeometry::covers(const geom::Geometry* g) const
{
- return baseGeom->covers(g);
+ return getRelateNG()->covers(g);
}
bool
BasicPreparedGeometry::crosses(const geom::Geometry* g) const
{
- return baseGeom->crosses(g);
+ return getRelateNG()->crosses(g);
}
bool
BasicPreparedGeometry::disjoint(const geom::Geometry* g) const
{
- return ! intersects(g);
+ return getRelateNG()->disjoint(g);
}
bool
BasicPreparedGeometry::intersects(const geom::Geometry* g) const
{
- return baseGeom->intersects(g);
+ return getRelateNG()->intersects(g);
}
bool
BasicPreparedGeometry::overlaps(const geom::Geometry* g) const
{
- return baseGeom->overlaps(g);
+ return getRelateNG()->overlaps(g);
}
bool
BasicPreparedGeometry::touches(const geom::Geometry* g) const
{
- return baseGeom->touches(g);
+ return getRelateNG()->touches(g);
}
bool
BasicPreparedGeometry::within(const geom::Geometry* g) const
{
- return baseGeom->within(g);
+ return getRelateNG()->within(g);
}
std::unique_ptr<geom::CoordinateSequence>
-----------------------------------------------------------------------
Summary of changes:
include/geos/geom/prep/BasicPreparedGeometry.h | 13 +++++++++++-
src/geom/prep/BasicPreparedGeometry.cpp | 28 +++++++++-----------------
2 files changed, 22 insertions(+), 19 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list