From dee7c339b35678f5eff965da6750a40b1dc4de3f Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Fri, 11 Oct 2013 16:14:59 +0200 Subject: [PATCH] Move edge-based node out ouf surrounding class --- Contractor/EdgeBasedGraphFactory.h | 46 +---------------------- DataStructures/EdgeBasedNode.h | 51 ++++++++++++++++++++++++++ Server/DataStructures/BaseDataFacade.h | 5 ++- 3 files changed, 55 insertions(+), 47 deletions(-) create mode 100644 DataStructures/EdgeBasedNode.h diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index 5f4df157b..6b2fe5cc4 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -26,6 +26,7 @@ #include "../typedefs.h" #include "../DataStructures/DeallocatingVector.h" #include "../DataStructures/DynamicGraph.h" +#include "../DataStructures/EdgeBasedNode.h" #include "../Extractor/ExtractorStructs.h" #include "../DataStructures/HashTable.h" #include "../DataStructures/ImportEdge.h" @@ -49,51 +50,6 @@ class EdgeBasedGraphFactory : boost::noncopyable { public: - struct EdgeBasedNode { - EdgeBasedNode() : - id(INT_MAX), - lat1(INT_MAX), - lat2(INT_MAX), - lon1(INT_MAX), - lon2(INT_MAX >> 1), - belongsToTinyComponent(false), - nameID(UINT_MAX), - weight(UINT_MAX >> 1), - ignoreInGrid(false) - { } - - bool operator<(const EdgeBasedNode & other) const { - return other.id < id; - } - - bool operator==(const EdgeBasedNode & other) const { - return id == other.id; - } - - inline FixedPointCoordinate Centroid() const { - FixedPointCoordinate centroid; - //The coordinates of the midpoint are given by: - //x = (x1 + x2) /2 and y = (y1 + y2) /2. - centroid.lon = (std::min(lon1, lon2) + std::max(lon1, lon2))/2; - centroid.lat = (std::min(lat1, lat2) + std::max(lat1, lat2))/2; - return centroid; - } - - inline bool isIgnored() const { - return ignoreInGrid; - } - - NodeID id; - int lat1; - int lat2; - int lon1; - int lon2:31; - bool belongsToTinyComponent:1; - NodeID nameID; - unsigned weight:31; - bool ignoreInGrid:1; - }; - struct SpeedProfileProperties{ SpeedProfileProperties() : trafficSignalPenalty(0), diff --git a/DataStructures/EdgeBasedNode.h b/DataStructures/EdgeBasedNode.h new file mode 100644 index 000000000..542eda451 --- /dev/null +++ b/DataStructures/EdgeBasedNode.h @@ -0,0 +1,51 @@ +#ifndef EDGE_BASED_NODE_H +#define EDGE_BASED_NODE_H + +#include "Coordinate.h" + +struct EdgeBasedNode { + EdgeBasedNode() : + id(INT_MAX), + lat1(INT_MAX), + lat2(INT_MAX), + lon1(INT_MAX), + lon2(INT_MAX >> 1), + belongsToTinyComponent(false), + nameID(UINT_MAX), + weight(UINT_MAX >> 1), + ignoreInGrid(false) + { } + + bool operator<(const EdgeBasedNode & other) const { + return other.id < id; + } + + bool operator==(const EdgeBasedNode & other) const { + return id == other.id; + } + + inline FixedPointCoordinate Centroid() const { + FixedPointCoordinate centroid; + //The coordinates of the midpoint are given by: + //x = (x1 + x2) /2 and y = (y1 + y2) /2. + centroid.lon = (std::min(lon1, lon2) + std::max(lon1, lon2))/2; + centroid.lat = (std::min(lat1, lat2) + std::max(lat1, lat2))/2; + return centroid; + } + + inline bool isIgnored() const { + return ignoreInGrid; + } + + NodeID id; + int lat1; + int lat2; + int lon1; + int lon2:31; + bool belongsToTinyComponent:1; + NodeID nameID; + unsigned weight:31; + bool ignoreInGrid:1; +}; + +#endif //EDGE_BASED_NODE_H \ No newline at end of file diff --git a/Server/DataStructures/BaseDataFacade.h b/Server/DataStructures/BaseDataFacade.h index d74ef5cbc..55c0a8f84 100644 --- a/Server/DataStructures/BaseDataFacade.h +++ b/Server/DataStructures/BaseDataFacade.h @@ -23,8 +23,9 @@ or see http://www.gnu.org/licenses/agpl.txt. //Exposes all data access interfaces to the algorithms via base class ptr -#include "../../Contractor/EdgeBasedGraphFactory.h" #include "../../DataStructures/Coordinate.h" +#include "../../DataStructures/EdgeBasedNode.h" +#include "../../DataStructures/ImportNode.h" #include "../../DataStructures/PhantomNodes.h" #include "../../DataStructures/TurnInstructions.h" #include "../../Util/OSRMException.h" @@ -36,7 +37,7 @@ or see http://www.gnu.org/licenses/agpl.txt. template class BaseDataFacade { public: - typedef EdgeBasedGraphFactory::EdgeBasedNode RTreeLeaf; + typedef EdgeBasedNode RTreeLeaf; typedef EdgeDataT EdgeData; BaseDataFacade( ) { } virtual ~BaseDataFacade() { }