[geos-commits] [SCM] GEOS branch master updated. 27f86283ab954a905f65495067981276bd1f5fe1
git at osgeo.org
git at osgeo.org
Wed Sep 18 17:26:23 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 27f86283ab954a905f65495067981276bd1f5fe1 (commit)
from c17501f0a9c5132e455eb5995be5ebcf536f7bb6 (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 27f86283ab954a905f65495067981276bd1f5fe1
Author: Daniel Baston <dbaston at gmail.com>
Date: Wed Sep 18 20:26:06 2019 -0400
Simplify access to NodeMap
Using "auto" removes boilerplate and makes it easier to try different
backing containers for NodeMap. I tried unordered_map but did not see a
performance benefit.
diff --git a/include/geos/operation/relate/RelateNodeGraph.h b/include/geos/operation/relate/RelateNodeGraph.h
index 88ee2f4..7f642ee 100644
--- a/include/geos/operation/relate/RelateNodeGraph.h
+++ b/include/geos/operation/relate/RelateNodeGraph.h
@@ -20,6 +20,7 @@
#define GEOS_OP_RELATE_RELATENODEGRAPH_H
#include <geos/export.h>
+#include <geos/geomgraph/NodeMap.h>
#include <map>
#include <vector>
@@ -35,7 +36,6 @@ namespace geomgraph {
class Node;
class GeometryGraph;
class EdgeEnd;
-class NodeMap;
}
}
@@ -73,8 +73,7 @@ public:
virtual ~RelateNodeGraph();
- std::map<geom::Coordinate*, geomgraph::Node*,
- geom::CoordinateLessThen>& getNodeMap();
+ geomgraph::NodeMap::container& getNodeMap();
void build(geomgraph::GeometryGraph* geomGraph);
diff --git a/src/operation/overlay/LineBuilder.cpp b/src/operation/overlay/LineBuilder.cpp
index 372c382..d89f3a7 100644
--- a/src/operation/overlay/LineBuilder.cpp
+++ b/src/operation/overlay/LineBuilder.cpp
@@ -84,12 +84,10 @@ LineBuilder::build(OverlayOp::OpCode opCode)
void
LineBuilder::findCoveredLineEdges()
{
-// first set covered for all L edges at nodes which have A edges too
- map<Coordinate*, Node*, CoordinateLessThen>& nodeMap = op->getGraph().getNodeMap()->nodeMap;
- map<Coordinate*, Node*, CoordinateLessThen>::iterator it = nodeMap.begin();
- map<Coordinate*, Node*, CoordinateLessThen>::iterator endIt = nodeMap.end();
- for(; it != endIt; ++it) {
- Node* node = it->second;
+ // first set covered for all L edges at nodes which have A edges too
+ auto& nodeMap = op->getGraph().getNodeMap()->nodeMap;
+ for(auto& entry : nodeMap) {
+ Node* node = entry.second;
//node.print(System.out);
assert(dynamic_cast<DirectedEdgeStar*>(node->getEdges()));
DirectedEdgeStar* des = static_cast<DirectedEdgeStar*>(node->getEdges());
diff --git a/src/operation/overlay/PointBuilder.cpp b/src/operation/overlay/PointBuilder.cpp
index 6ff6aac..851f9c2 100644
--- a/src/operation/overlay/PointBuilder.cpp
+++ b/src/operation/overlay/PointBuilder.cpp
@@ -61,11 +61,9 @@ PointBuilder::build(OverlayOp::OpCode opCode)
void
PointBuilder::extractNonCoveredResultNodes(OverlayOp::OpCode opCode)
{
- map<Coordinate*, Node*, CoordinateLessThen>& nodeMap =
- op->getGraph().getNodeMap()->nodeMap;
- map<Coordinate*, Node*, CoordinateLessThen>::iterator it = nodeMap.begin();
- for(; it != nodeMap.end(); ++it) {
- Node* n = it->second;
+ auto& nodeMap = op->getGraph().getNodeMap()->nodeMap;
+ for(auto& entry : nodeMap) {
+ Node* n = entry.second;
// filter out nodes which are known to be in the result
if(n->isInResult()) {
diff --git a/src/operation/relate/RelateComputer.cpp b/src/operation/relate/RelateComputer.cpp
index 0bc338d..27b6313 100644
--- a/src/operation/relate/RelateComputer.cpp
+++ b/src/operation/relate/RelateComputer.cpp
@@ -413,11 +413,10 @@ RelateComputer::computeDisjointIM(IntersectionMatrix* imX)
void
RelateComputer::labelNodeEdges()
{
- std::map<Coordinate*, Node*, CoordinateLessThen>& nMap = nodes.nodeMap;
- std::map<Coordinate*, Node*, CoordinateLessThen>::iterator nodeIt;
- for(nodeIt = nMap.begin(); nodeIt != nMap.end(); nodeIt++) {
- assert(dynamic_cast<RelateNode*>(nodeIt->second));
- RelateNode* node = static_cast<RelateNode*>(nodeIt->second);
+ auto& nMap = nodes.nodeMap;
+ for(auto& entry : nMap) {
+ assert(dynamic_cast<RelateNode*>(entry.second));
+ RelateNode* node = static_cast<RelateNode*>(entry.second);
#if GEOS_DEBUG
std::cerr << "RelateComputer::labelNodeEdges: "
<< "node edges: " << *(node->getEdges())
@@ -433,22 +432,16 @@ RelateComputer::labelNodeEdges()
void
RelateComputer::updateIM(IntersectionMatrix& imX)
{
- //Debug.println(im);
std::vector<Edge*>::iterator ei = isolatedEdges.begin();
for(; ei < isolatedEdges.end(); ++ei) {
Edge* e = *ei;
e->GraphComponent::updateIM(imX);
- //Debug.println(im);
}
- std::map<Coordinate*, Node*, CoordinateLessThen>& nMap = nodes.nodeMap;
- std::map<Coordinate*, Node*, CoordinateLessThen>::iterator nodeIt;
- for(nodeIt = nMap.begin(); nodeIt != nMap.end(); nodeIt++) {
- RelateNode* node = (RelateNode*) nodeIt->second;
+ auto& nMap = nodes.nodeMap;
+ for(auto& entry : nMap) {
+ RelateNode* node = (RelateNode*) entry.second;
node->updateIM(imX);
- //Debug.println(im);
node->updateIMFromEdges(imX);
- //Debug.println(im);
- //node.print(System.out);
}
}
diff --git a/src/operation/relate/RelateNodeGraph.cpp b/src/operation/relate/RelateNodeGraph.cpp
index 90b8eb6..e4e8e0a 100644
--- a/src/operation/relate/RelateNodeGraph.cpp
+++ b/src/operation/relate/RelateNodeGraph.cpp
@@ -49,7 +49,7 @@ RelateNodeGraph::~RelateNodeGraph()
delete nodes;
}
-map<Coordinate*, Node*, CoordinateLessThen>&
+NodeMap::container&
RelateNodeGraph::getNodeMap()
{
return nodes->nodeMap;
@@ -124,13 +124,11 @@ RelateNodeGraph::computeIntersectionNodes(GeometryGraph* geomGraph,
void
RelateNodeGraph::copyNodesAndLabels(GeometryGraph* geomGraph, int argIndex)
{
- map<Coordinate*, Node*, CoordinateLessThen>& nMap = geomGraph->getNodeMap()->nodeMap;
- map<Coordinate*, Node*, CoordinateLessThen>::iterator nodeIt;
- for(nodeIt = nMap.begin(); nodeIt != nMap.end(); nodeIt++) {
- Node* graphNode = nodeIt->second;
+ auto& nMap = geomGraph->getNodeMap()->nodeMap;
+ for(auto& entry : nMap) {
+ Node* graphNode = entry.second;
Node* newNode = nodes->addNode(graphNode->getCoordinate());
newNode->setLabel(argIndex, graphNode->getLabel().getLocation(argIndex));
- //node.print(System.out);
}
}
diff --git a/src/operation/valid/ConsistentAreaTester.cpp b/src/operation/valid/ConsistentAreaTester.cpp
index 852df55..c3f3cda 100644
--- a/src/operation/valid/ConsistentAreaTester.cpp
+++ b/src/operation/valid/ConsistentAreaTester.cpp
@@ -87,10 +87,9 @@ ConsistentAreaTester::isNodeEdgeAreaLabelsConsistent()
{
assert(geomGraph);
- map<Coordinate*, Node*, CoordinateLessThen>& nMap = nodeGraph.getNodeMap();
- map<Coordinate*, Node*, CoordinateLessThen>::iterator nodeIt;
- for(nodeIt = nMap.begin(); nodeIt != nMap.end(); nodeIt++) {
- relate::RelateNode* node = static_cast<relate::RelateNode*>(nodeIt->second);
+ auto& nMap = nodeGraph.getNodeMap();
+ for(auto& entry : nMap) {
+ relate::RelateNode* node = static_cast<relate::RelateNode*>(entry.second);
if(!node->getEdges()->isAreaLabelsConsistent(*geomGraph)) {
invalidPoint = node->getCoordinate();
return false;
@@ -103,11 +102,10 @@ ConsistentAreaTester::isNodeEdgeAreaLabelsConsistent()
bool
ConsistentAreaTester::hasDuplicateRings()
{
- map<Coordinate*, Node*, CoordinateLessThen>& nMap = nodeGraph.getNodeMap();
- map<Coordinate*, Node*, CoordinateLessThen>::iterator nodeIt;
- for(nodeIt = nMap.begin(); nodeIt != nMap.end(); ++nodeIt) {
- assert(dynamic_cast<relate::RelateNode*>(nodeIt->second));
- relate::RelateNode* node = static_cast<relate::RelateNode*>(nodeIt->second);
+ auto& nMap = nodeGraph.getNodeMap();
+ for(auto& entry : nMap) {
+ assert(dynamic_cast<relate::RelateNode*>(entry.second));
+ relate::RelateNode* node = static_cast<relate::RelateNode*>(entry.second);
EdgeEndStar* ees = node->getEdges();
EdgeEndStar::iterator endIt = ees->end();
for(EdgeEndStar::iterator it = ees->begin(); it != endIt; ++it) {
-----------------------------------------------------------------------
Summary of changes:
include/geos/operation/relate/RelateNodeGraph.h | 5 ++---
src/operation/overlay/LineBuilder.cpp | 10 ++++------
src/operation/overlay/PointBuilder.cpp | 8 +++-----
src/operation/relate/RelateComputer.cpp | 21 +++++++--------------
src/operation/relate/RelateNodeGraph.cpp | 10 ++++------
src/operation/valid/ConsistentAreaTester.cpp | 16 +++++++---------
6 files changed, 27 insertions(+), 43 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list