Move edge-based node out ouf surrounding class
This commit is contained in:
parent
352bf8839b
commit
dee7c339b3
@ -26,6 +26,7 @@
|
|||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
#include "../DataStructures/DeallocatingVector.h"
|
#include "../DataStructures/DeallocatingVector.h"
|
||||||
#include "../DataStructures/DynamicGraph.h"
|
#include "../DataStructures/DynamicGraph.h"
|
||||||
|
#include "../DataStructures/EdgeBasedNode.h"
|
||||||
#include "../Extractor/ExtractorStructs.h"
|
#include "../Extractor/ExtractorStructs.h"
|
||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
#include "../DataStructures/ImportEdge.h"
|
#include "../DataStructures/ImportEdge.h"
|
||||||
@ -49,51 +50,6 @@
|
|||||||
|
|
||||||
class EdgeBasedGraphFactory : boost::noncopyable {
|
class EdgeBasedGraphFactory : boost::noncopyable {
|
||||||
public:
|
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{
|
struct SpeedProfileProperties{
|
||||||
SpeedProfileProperties() :
|
SpeedProfileProperties() :
|
||||||
trafficSignalPenalty(0),
|
trafficSignalPenalty(0),
|
||||||
|
51
DataStructures/EdgeBasedNode.h
Normal file
51
DataStructures/EdgeBasedNode.h
Normal file
@ -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
|
@ -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
|
//Exposes all data access interfaces to the algorithms via base class ptr
|
||||||
|
|
||||||
#include "../../Contractor/EdgeBasedGraphFactory.h"
|
|
||||||
#include "../../DataStructures/Coordinate.h"
|
#include "../../DataStructures/Coordinate.h"
|
||||||
|
#include "../../DataStructures/EdgeBasedNode.h"
|
||||||
|
#include "../../DataStructures/ImportNode.h"
|
||||||
#include "../../DataStructures/PhantomNodes.h"
|
#include "../../DataStructures/PhantomNodes.h"
|
||||||
#include "../../DataStructures/TurnInstructions.h"
|
#include "../../DataStructures/TurnInstructions.h"
|
||||||
#include "../../Util/OSRMException.h"
|
#include "../../Util/OSRMException.h"
|
||||||
@ -36,7 +37,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
template<class EdgeDataT>
|
template<class EdgeDataT>
|
||||||
class BaseDataFacade {
|
class BaseDataFacade {
|
||||||
public:
|
public:
|
||||||
typedef EdgeBasedGraphFactory::EdgeBasedNode RTreeLeaf;
|
typedef EdgeBasedNode RTreeLeaf;
|
||||||
typedef EdgeDataT EdgeData;
|
typedef EdgeDataT EdgeData;
|
||||||
BaseDataFacade( ) { }
|
BaseDataFacade( ) { }
|
||||||
virtual ~BaseDataFacade() { }
|
virtual ~BaseDataFacade() { }
|
||||||
|
Loading…
Reference in New Issue
Block a user