[geos-commits] [SCM] GEOS branch main updated. 1821b67432de802ead6f0c655c93e74e03ffd267
git at osgeo.org
git at osgeo.org
Thu Aug 15 14:14:57 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 has been updated
via 1821b67432de802ead6f0c655c93e74e03ffd267 (commit)
from e8e3e25549544cbaa672087bca765f190ec4d3b7 (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 1821b67432de802ead6f0c655c93e74e03ffd267
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu Aug 15 14:14:21 2024 -0700
Avoid overhead in zeroLenLine tests for non-line features. Some inlineing of trivial accessors.
diff --git a/include/geos/algorithm/CGAlgorithmsDD.h b/include/geos/algorithm/CGAlgorithmsDD.h
index cfb62aa80..ef251c3ee 100644
--- a/include/geos/algorithm/CGAlgorithmsDD.h
+++ b/include/geos/algorithm/CGAlgorithmsDD.h
@@ -87,7 +87,7 @@ public:
*
* Uses an approach due to Jonathan Shewchuk, which is in the public domain.
*/
- static int orientationIndexFilter(
+ static inline int orientationIndexFilter(
double pax, double pay,
double pbx, double pby,
double pcx, double pcy)
diff --git a/include/geos/operation/relateng/RelateGeometry.h b/include/geos/operation/relateng/RelateGeometry.h
index 3c071d056..e96a3b878 100644
--- a/include/geos/operation/relateng/RelateGeometry.h
+++ b/include/geos/operation/relateng/RelateGeometry.h
@@ -97,6 +97,13 @@ private:
static bool isZeroLength(const LineString* line);
+ bool isZeroLengthLine(const Geometry* g) const {
+ // avoid expensive zero-length calculation if not linear
+ if (getDimension() != Dimension::L)
+ return false;
+ return isZeroLength(g);
+ };
+
RelatePointLocator* getLocator();
Coordinate::ConstXYSet createUniquePoints();
@@ -141,15 +148,30 @@ public:
static std::string name(bool isA);
- const Geometry* getGeometry() const;
+ const Geometry* getGeometry() const {
+ return geom;
+ }
- bool isPrepared() const;
+ bool isPrepared() const {
+ return m_isPrepared;
+ }
- const Envelope* getEnvelope() const;
+ const Envelope* getEnvelope() const {
+ return geomEnv;
+ }
- int getDimension() const;
+ inline int getDimension() const {
+ return geomDim;
+ }
- bool hasDimension(int dim) const;
+ bool hasDimension(int dim) const {
+ switch (dim) {
+ case Dimension::P: return hasPoints;
+ case Dimension::L: return hasLines;
+ case Dimension::A: return hasAreas;
+ }
+ return false;
+ }
/**
* Gets the actual non-empty dimension of the geometry.
diff --git a/include/geos/operation/relateng/RelateSegmentString.h b/include/geos/operation/relateng/RelateSegmentString.h
index 556ac4d37..f2e6caff4 100644
--- a/include/geos/operation/relateng/RelateSegmentString.h
+++ b/include/geos/operation/relateng/RelateSegmentString.h
@@ -123,11 +123,17 @@ public:
bool isA, int elementId, int ringId,
const Geometry* poly, const RelateGeometry* parent);
- bool isA() const;
+ inline bool isA() const {
+ return m_isA;
+ }
- const RelateGeometry* getGeometry() const;
+ inline const RelateGeometry* getGeometry() const {
+ return m_inputGeom;
+ }
- const Geometry* getPolygonal() const;
+ inline const Geometry* getPolygonal() const {
+ return m_parentPolygonal;
+ }
NodeSection* createNodeSection(std::size_t segIndex, const CoordinateXY intPt) const;
diff --git a/include/geos/operation/relateng/TopologyComputer.h b/include/geos/operation/relateng/TopologyComputer.h
index cad2a1bc3..00b204693 100644
--- a/include/geos/operation/relateng/TopologyComputer.h
+++ b/include/geos/operation/relateng/TopologyComputer.h
@@ -67,7 +67,9 @@ private:
void initExteriorEmpty(bool geomNonEmpty);
- RelateGeometry& getGeometry(bool isA) const;
+ inline RelateGeometry& getGeometry(bool isA) const {
+ return isA ? geomA : geomB;
+ };
void updateDim(Location locA, Location locB, int dimension);
@@ -135,16 +137,16 @@ private:
public:
- TopologyComputer(
- TopologyPredicate& p_predicate,
- RelateGeometry& p_geomA,
- RelateGeometry& p_geomB)
- : predicate(p_predicate)
- , geomA(p_geomA)
- , geomB(p_geomB)
- {
- initExteriorDims();
- };
+ TopologyComputer(
+ TopologyPredicate& p_predicate,
+ RelateGeometry& p_geomA,
+ RelateGeometry& p_geomB)
+ : predicate(p_predicate)
+ , geomA(p_geomA)
+ , geomB(p_geomB)
+ {
+ initExteriorDims();
+ };
int getDimension(bool isA) const;
diff --git a/src/operation/relateng/RelateGeometry.cpp b/src/operation/relateng/RelateGeometry.cpp
index 94536c16e..8a9620053 100644
--- a/src/operation/relateng/RelateGeometry.cpp
+++ b/src/operation/relateng/RelateGeometry.cpp
@@ -56,7 +56,7 @@ RelateGeometry::RelateGeometry(const Geometry* input, bool isPrepared, const Bou
, geomEnv(input->getEnvelopeInternal())
, boundaryNodeRule(bnRule)
, geomDim(input->getDimension())
- , isLineZeroLen(isZeroLength(input))
+ , isLineZeroLen(isZeroLengthLine(input))
, isGeomEmpty(input->isEmpty())
{
analyzeDimensions();
@@ -154,47 +154,6 @@ RelateGeometry::isZeroLength(const LineString* line) {
}
-/* public */
-const Geometry*
-RelateGeometry::getGeometry() const
-{
- return geom;
-}
-
-/* public */
-bool
-RelateGeometry::isPrepared() const
-{
- return m_isPrepared;
-}
-
-/* public */
-const Envelope*
-RelateGeometry::getEnvelope() const
-{
- return geomEnv;
-}
-
-/* public */
-int
-RelateGeometry::getDimension() const
-{
- return geomDim;
-}
-
-/* public */
-bool
-RelateGeometry::hasDimension(int dim) const
-{
- switch (dim) {
- case Dimension::P: return hasPoints;
- case Dimension::L: return hasLines;
- case Dimension::A: return hasAreas;
- }
- return false;
-}
-
-
/* public */
int
RelateGeometry::getDimensionReal() const
@@ -210,6 +169,7 @@ RelateGeometry::getDimensionReal() const
return Dimension::P;
}
+
/* public */
bool
RelateGeometry::hasEdges() const
diff --git a/src/operation/relateng/RelateSegmentString.cpp b/src/operation/relateng/RelateSegmentString.cpp
index 5dfb5e716..41c0c4bbf 100644
--- a/src/operation/relateng/RelateSegmentString.cpp
+++ b/src/operation/relateng/RelateSegmentString.cpp
@@ -69,30 +69,6 @@ RelateSegmentString::createSegmentString(
}
-/* public */
-bool
-RelateSegmentString::isA() const
-{
- return m_isA;
-}
-
-
-/* public */
-const RelateGeometry*
-RelateSegmentString::getGeometry() const
-{
- return m_inputGeom;
-}
-
-
-/* public */
-const Geometry*
-RelateSegmentString::getPolygonal() const
-{
- return m_parentPolygonal;
-}
-
-
/* public */
NodeSection*
RelateSegmentString::createNodeSection(std::size_t segIndex, const CoordinateXY intPt) const
diff --git a/src/operation/relateng/TopologyComputer.cpp b/src/operation/relateng/TopologyComputer.cpp
index 984073e46..6d6d11b16 100644
--- a/src/operation/relateng/TopologyComputer.cpp
+++ b/src/operation/relateng/TopologyComputer.cpp
@@ -111,11 +111,12 @@ TopologyComputer::initExteriorEmpty(bool geomNonEmpty)
}
-/* private */
-RelateGeometry&
-TopologyComputer::getGeometry(bool isA) const
+/* public */
+bool
+TopologyComputer::isAreaArea() const
{
- return isA ? geomA : geomB;
+ return getDimension(RelateGeometry::GEOM_A) == Dimension::A
+ && getDimension(RelateGeometry::GEOM_B) == Dimension::A;
}
@@ -127,15 +128,6 @@ TopologyComputer::getDimension(bool isA) const
}
-/* public */
-bool
-TopologyComputer::isAreaArea() const
-{
- return getDimension(RelateGeometry::GEOM_A) == Dimension::A
- && getDimension(RelateGeometry::GEOM_B) == Dimension::A;
-}
-
-
/* public */
bool
TopologyComputer::isSelfNodingRequired() const
-----------------------------------------------------------------------
Summary of changes:
include/geos/algorithm/CGAlgorithmsDD.h | 2 +-
include/geos/operation/relateng/RelateGeometry.h | 40 +++++++++++++++-----
.../geos/operation/relateng/RelateSegmentString.h | 12 ++++--
include/geos/operation/relateng/TopologyComputer.h | 24 ++++++------
src/operation/relateng/RelateGeometry.cpp | 44 +---------------------
src/operation/relateng/RelateSegmentString.cpp | 24 ------------
src/operation/relateng/TopologyComputer.cpp | 18 +++------
7 files changed, 61 insertions(+), 103 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list