Cleanung up NodeInformationHelpDesk
This commit is contained in:
parent
5ef4909bdd
commit
d57be5244c
@ -31,46 +31,41 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
class NodeInformationHelpDesk{
|
class NodeInformationHelpDesk{
|
||||||
public:
|
public:
|
||||||
NodeInformationHelpDesk(const char* ramIndexInput, const char* fileIndexInput, unsigned _numberOfNodes) : numberOfNodes(_numberOfNodes) {
|
NodeInformationHelpDesk(const char* ramIndexInput, const char* fileIndexInput, const unsigned _numberOfNodes) : numberOfNodes(_numberOfNodes) {
|
||||||
readOnlyGrid = new ReadOnlyGrid(ramIndexInput,fileIndexInput);
|
readOnlyGrid = new ReadOnlyGrid(ramIndexInput,fileIndexInput);
|
||||||
int2ExtNodeMap = new vector<_Coordinate>();
|
coordinateVector.reserve(numberOfNodes);
|
||||||
int2ExtNodeMap->reserve(numberOfNodes);
|
assert(0 == coordinateVector.size());
|
||||||
assert(0 == int2ExtNodeMap->size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~NodeInformationHelpDesk() {
|
~NodeInformationHelpDesk() {
|
||||||
delete int2ExtNodeMap;
|
|
||||||
delete readOnlyGrid;
|
delete readOnlyGrid;
|
||||||
}
|
}
|
||||||
void initNNGrid(ifstream& in) {
|
void initNNGrid(ifstream& in) {
|
||||||
while(!in.eof()) {
|
while(!in.eof()) {
|
||||||
NodeInfo b;
|
NodeInfo b;
|
||||||
in.read((char *)&b, sizeof(b));
|
in.read((char *)&b, sizeof(b));
|
||||||
int2ExtNodeMap->push_back(_Coordinate(b.lat, b.lon));
|
coordinateVector.push_back(_Coordinate(b.lat, b.lon));
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
readOnlyGrid->OpenIndexFiles();
|
readOnlyGrid->OpenIndexFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int getLatitudeOfNode(const NodeID node) const {
|
inline int getLatitudeOfNode(const NodeID node) const { return coordinateVector.at(node).lat; }
|
||||||
return int2ExtNodeMap->at(node).lat;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int getLongitudeOfNode(const NodeID node) const { return int2ExtNodeMap->at(node).lon; }
|
inline int getLongitudeOfNode(const NodeID node) const { return coordinateVector.at(node).lon; }
|
||||||
|
|
||||||
NodeID getNumberOfNodes() const { return numberOfNodes; }
|
inline NodeID getNumberOfNodes() const { return numberOfNodes; }
|
||||||
NodeID getNumberOfNodes2() const { return int2ExtNodeMap->size(); }
|
inline NodeID getNumberOfNodes2() const { return coordinateVector.size(); }
|
||||||
|
|
||||||
inline void FindNearestNodeCoordForLatLon(const _Coordinate& coord, _Coordinate& result) {
|
inline void FindNearestNodeCoordForLatLon(const _Coordinate& coord, _Coordinate& result) const {
|
||||||
readOnlyGrid->FindNearestCoordinateOnEdgeInNodeBasedGraph(coord, result);
|
readOnlyGrid->FindNearestCoordinateOnEdgeInNodeBasedGraph(coord, result);
|
||||||
}
|
}
|
||||||
bool FindPhantomNodeForCoordinate( const _Coordinate & location, PhantomNode & resultNode) {
|
inline void FindPhantomNodeForCoordinate( const _Coordinate & location, PhantomNode & resultNode) const {
|
||||||
return readOnlyGrid->FindPhantomNodeForCoordinate(location, resultNode);
|
readOnlyGrid->FindPhantomNodeForCoordinate(location, resultNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool FindRoutingStarts(const _Coordinate &start, const _Coordinate &target, PhantomNodes & phantomNodes) {
|
inline void FindRoutingStarts(const _Coordinate &start, const _Coordinate &target, PhantomNodes & phantomNodes) const {
|
||||||
readOnlyGrid->FindRoutingStarts(start, target, phantomNodes);
|
readOnlyGrid->FindRoutingStarts(start, target, phantomNodes);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void FindNearestPointOnEdge(const _Coordinate & input, _Coordinate& output){
|
inline void FindNearestPointOnEdge(const _Coordinate & input, _Coordinate& output){
|
||||||
@ -78,7 +73,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vector<_Coordinate> * int2ExtNodeMap;
|
std::vector<_Coordinate> coordinateVector;
|
||||||
ReadOnlyGrid * readOnlyGrid;
|
ReadOnlyGrid * readOnlyGrid;
|
||||||
unsigned numberOfNodes;
|
unsigned numberOfNodes;
|
||||||
};
|
};
|
||||||
|
@ -124,13 +124,12 @@ public:
|
|||||||
return _upperbound;
|
return _upperbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool FindRoutingStarts(const _Coordinate & start, const _Coordinate & target, PhantomNodes & routingStarts) const {
|
inline void FindRoutingStarts(const _Coordinate & start, const _Coordinate & target, PhantomNodes & routingStarts) const {
|
||||||
nodeHelpDesk->FindRoutingStarts(start, target, routingStarts);
|
nodeHelpDesk->FindRoutingStarts(start, target, routingStarts);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool FindPhantomNodeForCoordinate(const _Coordinate & location, PhantomNode & result) const {
|
inline void FindPhantomNodeForCoordinate(const _Coordinate & location, PhantomNode & result) const {
|
||||||
return nodeHelpDesk->FindPhantomNodeForCoordinate(location, result);
|
nodeHelpDesk->FindPhantomNodeForCoordinate(location, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NodeID GetNameIDForOriginDestinationNodeID(NodeID s, NodeID t) const {
|
inline NodeID GetNameIDForOriginDestinationNodeID(NodeID s, NodeID t) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user