[geos-commits] [SCM] GEOS branch master updated. cf25cdbcf040a6a9e86b21fc14efd98da58d6166

git at osgeo.org git at osgeo.org
Wed Dec 19 09:35:03 PST 2018


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  cf25cdbcf040a6a9e86b21fc14efd98da58d6166 (commit)
      from  72662a8a10e408f1ccadfe9ed6f90d4572c24bdb (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 cf25cdbcf040a6a9e86b21fc14efd98da58d6166
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Dec 19 09:34:46 2018 -0800

    Remove extra coordinate references in MonotoneChain classes
    JTS 0315e8ab509ff49646187cda0dfcb7f286e5ba4d

diff --git a/include/geos/geomgraph/index/MonotoneChain.h b/include/geos/geomgraph/index/MonotoneChain.h
index 3a546ec..f353136 100644
--- a/include/geos/geomgraph/index/MonotoneChain.h
+++ b/include/geos/geomgraph/index/MonotoneChain.h
@@ -24,6 +24,7 @@
 #include <geos/export.h>
 #include <geos/geomgraph/index/SweepLineEventObj.h> // for inheritance
 #include <geos/geomgraph/index/MonotoneChainEdge.h> // for inline
+#include <geos/geomgraph/index/MonotoneChain.h>
 
 // Forward declarations
 namespace geos {
@@ -61,8 +62,6 @@ public:
 };
 
 
-
-
 } // namespace geos.geomgraph.index
 } // namespace geos.geomgraph
 } // namespace geos
diff --git a/include/geos/geomgraph/index/MonotoneChainEdge.h b/include/geos/geomgraph/index/MonotoneChainEdge.h
index 518efa3..19ed048 100644
--- a/include/geos/geomgraph/index/MonotoneChainEdge.h
+++ b/include/geos/geomgraph/index/MonotoneChainEdge.h
@@ -70,6 +70,9 @@ private:
 		const MonotoneChainEdge &mce,
 		size_t start1, size_t end1,
 		SegmentIntersector &ei);
+
+    bool overlaps(size_t start0, size_t end0, const MonotoneChainEdge& mce, size_t start1, size_t end1);
+
 };
 
 } // namespace geos.geomgraph.index
diff --git a/include/geos/index/chain/MonotoneChain.h b/include/geos/index/chain/MonotoneChain.h
index 2873bae..af17385 100644
--- a/include/geos/index/chain/MonotoneChain.h
+++ b/include/geos/index/chain/MonotoneChain.h
@@ -148,6 +148,8 @@ private:
 			     std::size_t start1, std::size_t end1,
 	                     MonotoneChainOverlapAction& mco);
 
+    bool overlaps(size_t start0, size_t end0, const MonotoneChain& mc, int start1, size_t end1);
+
 	/// Externally owned
 	const geom::CoordinateSequence& pts;
 
diff --git a/src/geomgraph/index/MonotoneChainEdge.cpp b/src/geomgraph/index/MonotoneChainEdge.cpp
index af2bbb8..fd15901 100644
--- a/src/geomgraph/index/MonotoneChainEdge.cpp
+++ b/src/geomgraph/index/MonotoneChainEdge.cpp
@@ -129,12 +129,7 @@ MonotoneChainEdge::computeIntersectsForChain(size_t start0, size_t end0,
 		return;
 	}
 
-	const Coordinate& p00=pts->getAt(start0);
-	const Coordinate& p01=pts->getAt(end0);
-	const Coordinate& p10=mce.pts->getAt(start1);
-	const Coordinate& p11=mce.pts->getAt(end1);
-
-	if (!Envelope::intersects(p00, p01, p10, p11)) return;
+	if (!overlaps(start0, end0, mce, start1, end1)) return;
 	// the chains overlap, so split each in half and iterate
 	// (binary search)
 	size_t mid0 = (start0 + end0) / 2;
@@ -161,6 +156,15 @@ MonotoneChainEdge::computeIntersectsForChain(size_t start0, size_t end0,
 	}
 }
 
+bool
+MonotoneChainEdge::overlaps(size_t start0, size_t end0, const MonotoneChainEdge& mce, size_t start1, size_t end1)
+{
+    return Envelope::intersects(pts->getAt(start0), pts->getAt(end0),
+        mce.pts->getAt(start1), mce.pts->getAt(end1));
+}
+
+
+
 } // namespace geos.geomgraph.index
 } // namespace geos.geomgraph
 } // namespace geos
diff --git a/src/index/chain/MonotoneChain.cpp b/src/index/chain/MonotoneChain.cpp
index 00b9801..53f6af1 100644
--- a/src/index/chain/MonotoneChain.cpp
+++ b/src/index/chain/MonotoneChain.cpp
@@ -86,11 +86,9 @@ MonotoneChain::computeSelect(const Envelope& searchEnv,
     const Coordinate& p0=pts[start0];
     const Coordinate& p1=pts[end0];
 
-    //Debug.println("trying:"+p0+p1+" [ "+start0+","+end0+" ]");
     // terminating condition for the recursion
     if(end0-start0==1)
     {
-        //Debug.println("computeSelect:"+p0+p1);
         mcs.select(*this, start0);
         return;
     }
@@ -128,7 +126,6 @@ MonotoneChain::computeOverlaps(size_t start0, size_t end0,
                                size_t start1, size_t end1,
                                MonotoneChainOverlapAction& mco)
 {
-    //Debug.println("computeIntersectsForChain:"+p00+p01+p10+p11);
     // terminating condition for the recursion
     if (end0-start0==1 && end1-start1==1)
     {
@@ -136,13 +133,8 @@ MonotoneChain::computeOverlaps(size_t start0, size_t end0,
         return;
     }
 
-    const Coordinate& p00 = pts[start0];
-    const Coordinate& p01 = pts[end0];
-    const Coordinate& p10 = mc.pts[start1];
-    const Coordinate& p11 = mc.pts[end1];
-
     // nothing to do if the envelopes of these subchains don't overlap
-    if (!Envelope::intersects(p00, p01, p10, p11)) return;
+    if (!overlaps(start0, end0, mc, start1, end1)) return;
 
     // the chains overlap,so split each in half and iterate (binary search)
     size_t mid0=(start0+end0)/2;
@@ -168,6 +160,14 @@ MonotoneChain::computeOverlaps(size_t start0, size_t end0,
     }
 }
 
+/*private*/
+bool
+MonotoneChain::overlaps(size_t start0, size_t end0, const MonotoneChain& mc, int start1, size_t end1)
+{
+    return Envelope::intersects(pts.getAt(start0), pts.getAt(end0),
+        mc.pts.getAt(start1), mc.pts.getAt(end1));
+}
+
 } // namespace geos.index.chain
 } // namespace geos.index
 } // namespace geos

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

Summary of changes:
 include/geos/geomgraph/index/MonotoneChain.h     |  3 +--
 include/geos/geomgraph/index/MonotoneChainEdge.h |  3 +++
 include/geos/index/chain/MonotoneChain.h         |  2 ++
 src/geomgraph/index/MonotoneChainEdge.cpp        | 16 ++++++++++------
 src/index/chain/MonotoneChain.cpp                | 18 +++++++++---------
 5 files changed, 25 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list