[geos-commits] [SCM] GEOS branch master updated. 3d538890ce80faf2c073291e3b1a07fcd243d3dc

git at osgeo.org git at osgeo.org
Wed Nov 25 09:41:51 PST 2020


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, master has been updated
       via  3d538890ce80faf2c073291e3b1a07fcd243d3dc (commit)
       via  997b73e51412c8508dcd4665e79d48d3870b218c (commit)
      from  c79133f302d72093f7123befcd21c357ce60f08c (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 3d538890ce80faf2c073291e3b1a07fcd243d3dc
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Nov 25 09:41:45 2020 -0800

    Mark some methods const again, since getEnvelope changed

diff --git a/include/geos/index/strtree/SimpleSTRnode.h b/include/geos/index/strtree/SimpleSTRnode.h
index 4d5b52b..909de7b 100644
--- a/include/geos/index/strtree/SimpleSTRnode.h
+++ b/include/geos/index/strtree/SimpleSTRnode.h
@@ -80,7 +80,7 @@ public:
     /**
      * Returns a representation of space that encloses this Node
      */
-    const geom::Envelope& getEnvelope() {
+    const inline geom::Envelope& getEnvelope() const {
         return bounds;
     }
 
@@ -116,9 +116,9 @@ public:
         return ! isLeaf();
     }
 
-    double area()
+    double area() const
     {
-        return getEnvelope().getArea();
+        return bounds.getArea();
     }
 
 

commit 997b73e51412c8508dcd4665e79d48d3870b218c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Nov 25 09:37:39 2020 -0800

    Replace lazy envelope generation with calculation of node bounds as tree builds.

diff --git a/include/geos/index/strtree/SimpleSTRnode.h b/include/geos/index/strtree/SimpleSTRnode.h
index 4100c80..4d5b52b 100644
--- a/include/geos/index/strtree/SimpleSTRnode.h
+++ b/include/geos/index/strtree/SimpleSTRnode.h
@@ -43,8 +43,6 @@ private:
     geom::Envelope bounds;
     std::size_t level;
 
-    void computeBounds();
-
 public:
 
     /*
@@ -83,9 +81,6 @@ public:
      * Returns a representation of space that encloses this Node
      */
     const geom::Envelope& getEnvelope() {
-        if(bounds.isNull()) {
-            computeBounds();
-        }
         return bounds;
     }
 
@@ -109,11 +104,7 @@ public:
      * Adds either an AbstractNode, or if this is a leaf node, a data object
      * (wrapped in an ItemBoundable)
      */
-    void addChildNode(SimpleSTRnode* childNode)
-    {
-        assert(bounds.isNull());
-        childNodes.push_back(childNode);
-    }
+    void addChildNode(SimpleSTRnode* childNode);
 
     bool isLeaf() const override
     {
diff --git a/src/index/strtree/SimpleSTRnode.cpp b/src/index/strtree/SimpleSTRnode.cpp
index 047dafc..a11ca3e 100644
--- a/src/index/strtree/SimpleSTRnode.cpp
+++ b/src/index/strtree/SimpleSTRnode.cpp
@@ -23,14 +23,6 @@ namespace index { // geos.index
 namespace strtree { // geos.index.strtree
 
 
-void
-SimpleSTRnode::computeBounds()
-{
-    for (auto* node: childNodes) {
-        bounds.expandToInclude(node->getEnvelope());
-    }
-}
-
 /*public*/
 void
 SimpleSTRnode::toString(std::ostream& os, int indentLevel) const
@@ -44,6 +36,19 @@ SimpleSTRnode::toString(std::ostream& os, int indentLevel) const
     }
 }
 
+/*public*/
+void
+SimpleSTRnode::addChildNode(SimpleSTRnode* childNode)
+{
+    if (bounds.isNull())
+        bounds = childNode->getEnvelope();
+    else
+        bounds.expandToInclude(childNode->getEnvelope());
+
+    childNodes.push_back(childNode);
+}
+
+
 
 } // namespace geos.index.strtree
 } // namespace geos.index

-----------------------------------------------------------------------

Summary of changes:
 include/geos/index/strtree/SimpleSTRnode.h | 17 ++++-------------
 src/index/strtree/SimpleSTRnode.cpp        | 21 +++++++++++++--------
 2 files changed, 17 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list