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

git at osgeo.org git at osgeo.org
Wed Nov 21 08:08:11 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  c3edeee872465ffdea54e32ddb23b316bb61cddb (commit)
       via  bab58cf04f5c8857cd61fd542669dffbcfa624d1 (commit)
      from  5f92026c20de11c4c0f46c5feb9665523c2922cf (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 c3edeee872465ffdea54e32ddb23b316bb61cddb
Merge: 5f92026 bab58cf
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Nov 21 11:07:41 2018 -0500

    Merge remote-tracking branch 'dbaston/mc-cleanup'


commit bab58cf04f5c8857cd61fd542669dffbcfa624d1
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Nov 20 18:51:39 2018 -0500

    Tidy MCPointInRing
    
    Remove unneeded heap allocations and manual deletes.

diff --git a/src/algorithm/MCPointInRing.cpp b/src/algorithm/MCPointInRing.cpp
index f098575..d085908 100644
--- a/src/algorithm/MCPointInRing.cpp
+++ b/src/algorithm/MCPointInRing.cpp
@@ -84,29 +84,21 @@ MCPointInRing::isInside(const Coordinate& pt)
 {
 	crossings=0;
 	// test all segments intersected by ray from pt in positive x direction
-	Envelope *rayEnv=new Envelope(DoubleNegInfinity,DoubleInfinity,pt.y,pt.y);
+	Envelope rayEnv(DoubleNegInfinity,DoubleInfinity,pt.y,pt.y);
 	interval.min=pt.y;
 	interval.max=pt.y;
-	vector<void*> *segs=tree->query(&interval);
-	//System.out.println("query size=" + segs.size());
-	MCSelecter *mcSelecter=new MCSelecter(pt,this);
-	for(int i=0;i<(int)segs->size();i++) {
-		chain::MonotoneChain *mc=(chain::MonotoneChain*) (*segs)[i];
-		testMonotoneChain(rayEnv,mcSelecter,mc);
+	std::unique_ptr<vector<void*>> segs{tree->query(&interval)};
+
+	MCSelecter mcSelecter(pt,this);
+	for(auto& seg : *segs) {
+		chain::MonotoneChain *mc= reinterpret_cast<chain::MonotoneChain*>(seg);
+		testMonotoneChain(&rayEnv,&mcSelecter,mc);
 	}
+
 	/*
-	*  p is inside if number of crossings is odd.
-	*/
-//	for(int i=0;i<(int)segs->size();i++) {
-//		delete (chain::MonotoneChain*) (*segs)[i];
-//	}
-	delete segs;
-	delete rayEnv;
-	delete mcSelecter;
-	if((crossings%2)==1) {
-		return true;
-	}
-	return false;
+	 *  p is inside if number of crossings is odd.
+	 */
+	return crossings % 2 == 1;
 }
 
 

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

Summary of changes:
 src/algorithm/MCPointInRing.cpp | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list