[geos-commits] [SCM] GEOS branch master updated. 9b821a1759771181c177a1902721618d5f7bb042
git at osgeo.org
git at osgeo.org
Sun Sep 15 11:45:26 PDT 2019
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 9b821a1759771181c177a1902721618d5f7bb042 (commit)
from 917520838cdf6221abcf792795da051e22ef3ad6 (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 9b821a1759771181c177a1902721618d5f7bb042
Author: Daniel Baston <dbaston at gmail.com>
Date: Sun Sep 15 14:45:06 2019 -0400
Remove some unneeded heap allocs in EdgeEndBuilder
diff --git a/include/geos/operation/relate/EdgeEndBuilder.h b/include/geos/operation/relate/EdgeEndBuilder.h
index eacb6a0..c904a57 100644
--- a/include/geos/operation/relate/EdgeEndBuilder.h
+++ b/include/geos/operation/relate/EdgeEndBuilder.h
@@ -49,7 +49,7 @@ class GEOS_DLL EdgeEndBuilder {
public:
EdgeEndBuilder() {}
- std::vector<geomgraph::EdgeEnd*>* computeEdgeEnds(std::vector<geomgraph::Edge*>* edges);
+ std::vector<geomgraph::EdgeEnd*> computeEdgeEnds(std::vector<geomgraph::Edge*>* edges);
void computeEdgeEnds(geomgraph::Edge* edge, std::vector<geomgraph::EdgeEnd*>* l);
protected:
diff --git a/src/operation/relate/EdgeEndBuilder.cpp b/src/operation/relate/EdgeEndBuilder.cpp
index 62f38fe..28e8037 100644
--- a/src/operation/relate/EdgeEndBuilder.cpp
+++ b/src/operation/relate/EdgeEndBuilder.cpp
@@ -26,7 +26,6 @@
#include <vector>
-using namespace std;
using namespace geos::geomgraph;
using namespace geos::geom;
@@ -34,13 +33,12 @@ namespace geos {
namespace operation { // geos.operation
namespace relate { // geos.operation.relate
-vector<EdgeEnd*>*
-EdgeEndBuilder::computeEdgeEnds(vector<Edge*>* edges)
+std::vector<EdgeEnd*>
+EdgeEndBuilder::computeEdgeEnds(std::vector<Edge*>* edges)
{
- vector<EdgeEnd*>* l = new vector<EdgeEnd*>();
- for(vector<Edge*>::iterator i = edges->begin(); i < edges->end(); i++) {
- Edge* e = *i;
- computeEdgeEnds(e, l);
+ std::vector<EdgeEnd*> l;
+ for(Edge* e : *edges) {
+ computeEdgeEnds(e, &l);
}
return l;
}
@@ -50,7 +48,7 @@ EdgeEndBuilder::computeEdgeEnds(vector<Edge*>* edges)
* Edge (if any) and inserts them into the graph.
*/
void
-EdgeEndBuilder::computeEdgeEnds(Edge* edge, vector<EdgeEnd*>* l)
+EdgeEndBuilder::computeEdgeEnds(Edge* edge, std::vector<EdgeEnd*>* l)
{
EdgeIntersectionList& eiList = edge->getEdgeIntersectionList();
//Debug.print(eiList);
@@ -93,7 +91,7 @@ EdgeEndBuilder::computeEdgeEnds(Edge* edge, vector<EdgeEnd*>* l)
* eiCurr will always be an EdgeIntersection, but eiPrev may be null.
*/
void
-EdgeEndBuilder::createEdgeEndForPrev(Edge* edge, vector<EdgeEnd*>* l,
+EdgeEndBuilder::createEdgeEndForPrev(Edge* edge, std::vector<EdgeEnd*>* l,
EdgeIntersection* eiCurr, EdgeIntersection* eiPrev)
{
auto iPrev = eiCurr->segmentIndex;
@@ -126,7 +124,7 @@ EdgeEndBuilder::createEdgeEndForPrev(Edge* edge, vector<EdgeEnd*>* l,
* eiCurr will always be an EdgeIntersection, but eiNext may be null.
*/
void
-EdgeEndBuilder::createEdgeEndForNext(Edge* edge, vector<EdgeEnd*>* l,
+EdgeEndBuilder::createEdgeEndForNext(Edge* edge, std::vector<EdgeEnd*>* l,
EdgeIntersection* eiCurr, EdgeIntersection* eiNext)
{
size_t iNext = eiCurr->segmentIndex + 1;
diff --git a/src/operation/relate/RelateComputer.cpp b/src/operation/relate/RelateComputer.cpp
index fbe5b4c..0bc338d 100644
--- a/src/operation/relate/RelateComputer.cpp
+++ b/src/operation/relate/RelateComputer.cpp
@@ -189,13 +189,9 @@ RelateComputer::computeIM()
*/
// build EdgeEnds for all intersections
EdgeEndBuilder eeBuilder;
- std::unique_ptr< std::vector<EdgeEnd*> > ee0(
- eeBuilder.computeEdgeEnds((*arg)[0]->getEdges())
- );
- insertEdgeEnds(ee0.get());
- std::unique_ptr< std::vector<EdgeEnd*> > ee1(
- eeBuilder.computeEdgeEnds((*arg)[1]->getEdges())
- );
+ std::vector<EdgeEnd*> ee0 = eeBuilder.computeEdgeEnds((*arg)[0]->getEdges());
+ insertEdgeEnds(&ee0);
+ std::vector<EdgeEnd*> ee1 = eeBuilder.computeEdgeEnds((*arg)[1]->getEdges());
#if GEOS_DEBUG
std::cerr << "RelateComputer::computeIM: "
@@ -203,9 +199,7 @@ RelateComputer::computeIM()
<< std::endl;
#endif
- insertEdgeEnds(ee1.get());
- //Debug.println("==== NodeList ===");
- //Debug.print(nodes);
+ insertEdgeEnds(&ee1);
#if GEOS_DEBUG
std::cerr << "RelateComputer::computeIM: "
diff --git a/src/operation/relate/RelateNodeGraph.cpp b/src/operation/relate/RelateNodeGraph.cpp
index 270ce16..90b8eb6 100644
--- a/src/operation/relate/RelateNodeGraph.cpp
+++ b/src/operation/relate/RelateNodeGraph.cpp
@@ -70,13 +70,9 @@ RelateNodeGraph::build(GeometryGraph* geomGraph)
/**
* Build EdgeEnds for all intersections.
*/
- EdgeEndBuilder* eeBuilder = new EdgeEndBuilder();
- vector<EdgeEnd*>* eeList = eeBuilder->computeEdgeEnds(geomGraph->getEdges());
- insertEdgeEnds(eeList);
- delete eeBuilder;
- delete eeList;
- //Debug.println("==== NodeList ===");
- //Debug.print(nodes);
+ EdgeEndBuilder eeBuilder;
+ std::vector<EdgeEnd*> eeList = eeBuilder.computeEdgeEnds(geomGraph->getEdges());
+ insertEdgeEnds(&eeList);
}
/**
-----------------------------------------------------------------------
Summary of changes:
include/geos/operation/relate/EdgeEndBuilder.h | 2 +-
src/operation/relate/EdgeEndBuilder.cpp | 18 ++++++++----------
src/operation/relate/RelateComputer.cpp | 14 ++++----------
src/operation/relate/RelateNodeGraph.cpp | 10 +++-------
4 files changed, 16 insertions(+), 28 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list