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

git at osgeo.org git at osgeo.org
Tue Dec 18 15:02:57 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  fd0158e9c3224f415bfd2c689b6a8b685a605ebf (commit)
      from  2f6fce40a92912a5d0298719788b99c4d8243146 (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 fd0158e9c3224f415bfd2c689b6a8b685a605ebf
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Dec 18 15:02:26 2018 -0800

    Temporary envelope removal
    JTS e994715b263e7dda56a1b33caa4e0b7404ae60b8
    JTS 8a4277544cf972639ea906b054c66bc22ab7ae4f
    JTS 239881104355ec906de3bd69974614169fb14bb3

diff --git a/include/geos/geom/Envelope.h b/include/geos/geom/Envelope.h
index fa6dec9..19821f9 100644
--- a/include/geos/geom/Envelope.h
+++ b/include/geos/geom/Envelope.h
@@ -136,6 +136,16 @@ public:
 	static bool intersects(const Coordinate& p1, const Coordinate& p2,
 			const Coordinate& q1, const Coordinate& q2);
 
+    /**
+    *  Check if the extent defined by two extremal points
+    *  intersects the extent of this <code>Envelope</code>.
+    *
+    * @param a a point
+    * @param b another point
+    * @return <code>true</code> if the extents intersect
+    */
+    bool intersects(const Coordinate& a, const Coordinate& b) const;
+
 	/** \brief
 	 *  Initialize to a null <code>Envelope</code>.
 	 */
diff --git a/include/geos/index/chain/MonotoneChainOverlapAction.h b/include/geos/index/chain/MonotoneChainOverlapAction.h
index 96672f9..c9767c9 100644
--- a/include/geos/index/chain/MonotoneChainOverlapAction.h
+++ b/include/geos/index/chain/MonotoneChainOverlapAction.h
@@ -21,7 +21,6 @@
 
 #include <geos/export.h>
 #include <geos/geom/LineSegment.h>
-#include <geos/geom/Envelope.h>
 
 
 // Forward declarations
@@ -76,9 +75,6 @@ public:
 	                     const geom::LineSegment& /*seg2*/)
 	{}
 
-	// these envelopes are used during the MonotoneChain search process
-	geom::Envelope tempEnv1;
-	geom::Envelope tempEnv2;
 };
 
 } // namespace geos::index::chain
diff --git a/include/geos/index/chain/MonotoneChainSelectAction.h b/include/geos/index/chain/MonotoneChainSelectAction.h
index ec1e807..49bec11 100644
--- a/include/geos/index/chain/MonotoneChainSelectAction.h
+++ b/include/geos/index/chain/MonotoneChainSelectAction.h
@@ -65,9 +65,6 @@ public:
 	 */
 	virtual void select(const geom::LineSegment& seg) = 0;
 
-	// these envelopes are used during the MonotoneChain search process
-	// should only be visible by classes in this package
-	geom::Envelope tempEnv1;
 };
 
 
diff --git a/src/geom/Envelope.cpp b/src/geom/Envelope.cpp
index 280d5ea..c688195 100644
--- a/src/geom/Envelope.cpp
+++ b/src/geom/Envelope.cpp
@@ -80,6 +80,24 @@ Envelope::intersects(const Coordinate& p1, const Coordinate& p2,
 }
 
 /*public*/
+bool Envelope::intersects(const Coordinate& a, const Coordinate& b) const {
+
+    double envminx = (a.x < b.x) ? a.x : b.x;
+    if (envminx > maxx) return false;
+
+    double envmaxx = (a.x > b.x) ? a.x : b.x;
+    if (envmaxx < minx) return false;
+
+    double envminy = (a.y < b.y) ? a.y : b.y;
+    if (envminy > maxy) return false;
+
+    double envmaxy = (a.y > b.y) ? a.y : b.y;
+    if (envmaxy < miny) return false;
+
+    return true;
+}
+
+/*public*/
 double
 Envelope::distance(double x0,double y0,double x1,double y1)
 {
diff --git a/src/index/chain/MonotoneChain.cpp b/src/index/chain/MonotoneChain.cpp
index 3a9e689..00b9801 100644
--- a/src/index/chain/MonotoneChain.cpp
+++ b/src/index/chain/MonotoneChain.cpp
@@ -85,7 +85,6 @@ MonotoneChain::computeSelect(const Envelope& searchEnv,
 {
     const Coordinate& p0=pts[start0];
     const Coordinate& p1=pts[end0];
-    mcs.tempEnv1.init(p0,p1);
 
     //Debug.println("trying:"+p0+p1+" [ "+start0+","+end0+" ]");
     // terminating condition for the recursion
@@ -96,7 +95,7 @@ MonotoneChain::computeSelect(const Envelope& searchEnv,
         return;
     }
     // nothing to do if the envelopes don't overlap
-    if (!searchEnv.intersects(mcs.tempEnv1))
+    if (!searchEnv.intersects(p0, p1))
         return;
     // the chains overlap,so split each in half and iterate (binary search)
     size_t mid = (start0 + end0) / 2;
@@ -142,10 +141,8 @@ MonotoneChain::computeOverlaps(size_t start0, size_t end0,
     const Coordinate& p10 = mc.pts[start1];
     const Coordinate& p11 = mc.pts[end1];
 
-    // nothing to do if the envelopes of these chains don't overlap
-    mco.tempEnv1.init(p00, p01);
-    mco.tempEnv2.init(p10, p11);
-    if (!mco.tempEnv1.intersects(mco.tempEnv2)) return;
+    // nothing to do if the envelopes of these subchains don't overlap
+    if (!Envelope::intersects(p00, p01, p10, p11)) return;
 
     // the chains overlap,so split each in half and iterate (binary search)
     size_t mid0=(start0+end0)/2;

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

Summary of changes:
 include/geos/geom/Envelope.h                          | 10 ++++++++++
 include/geos/index/chain/MonotoneChainOverlapAction.h |  4 ----
 include/geos/index/chain/MonotoneChainSelectAction.h  |  3 ---
 src/geom/Envelope.cpp                                 | 18 ++++++++++++++++++
 src/index/chain/MonotoneChain.cpp                     |  9 +++------
 5 files changed, 31 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list