some refactoring
This commit is contained in:
parent
c209245b0e
commit
29e363e7fb
@ -23,7 +23,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
#include "NodeCoords.h"
|
#include "NodeCoords.h"
|
||||||
#include "PhantomNodes.h"
|
#include "PhantomNodes.h"
|
||||||
#include "QueryEdge.h"
|
|
||||||
#include "StaticRTree.h"
|
#include "StaticRTree.h"
|
||||||
#include "../Contractor/EdgeBasedGraphFactory.h"
|
#include "../Contractor/EdgeBasedGraphFactory.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
@ -82,7 +81,10 @@ public:
|
|||||||
|
|
||||||
OriginalEdgeData deserialized_originalEdgeData;
|
OriginalEdgeData deserialized_originalEdgeData;
|
||||||
for(unsigned i = 0; i < numberOfOrigEdges; ++i) {
|
for(unsigned i = 0; i < numberOfOrigEdges; ++i) {
|
||||||
edgesInStream.read((char*)&(deserialized_originalEdgeData), sizeof(OriginalEdgeData));
|
edgesInStream.read(
|
||||||
|
(char*)&(deserialized_originalEdgeData),
|
||||||
|
sizeof(OriginalEdgeData)
|
||||||
|
);
|
||||||
origEdgeData_viaNode[i] = deserialized_originalEdgeData.viaNode;
|
origEdgeData_viaNode[i] = deserialized_originalEdgeData.viaNode;
|
||||||
origEdgeData_nameID[i] = deserialized_originalEdgeData.nameID;
|
origEdgeData_nameID[i] = deserialized_originalEdgeData.nameID;
|
||||||
origEdgeData_turnInstruction[i] = deserialized_originalEdgeData.turnInstruction;
|
origEdgeData_turnInstruction[i] = deserialized_originalEdgeData.turnInstruction;
|
||||||
@ -124,7 +126,10 @@ public:
|
|||||||
const unsigned zoom_level = 18
|
const unsigned zoom_level = 18
|
||||||
) const {
|
) const {
|
||||||
PhantomNode resulting_phantom_node;
|
PhantomNode resulting_phantom_node;
|
||||||
bool foundNode = FindPhantomNodeForCoordinate(input_coordinate, resulting_phantom_node, zoom_level);
|
bool foundNode = FindPhantomNodeForCoordinate(
|
||||||
|
input_coordinate,
|
||||||
|
resulting_phantom_node, zoom_level
|
||||||
|
);
|
||||||
result = resulting_phantom_node.location;
|
result = resulting_phantom_node.location;
|
||||||
return foundNode;
|
return foundNode;
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,13 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "../../Util/GraphLoader.h"
|
#include "../../Util/GraphLoader.h"
|
||||||
|
|
||||||
QueryObjectsStorage::QueryObjectsStorage(
|
QueryObjectsStorage::QueryObjectsStorage(
|
||||||
std::string hsgrPath,
|
const std::string & hsgrPath,
|
||||||
std::string ramIndexPath,
|
const std::string & ramIndexPath,
|
||||||
std::string fileIndexPath,
|
const std::string & fileIndexPath,
|
||||||
std::string nodesPath,
|
const std::string & nodesPath,
|
||||||
std::string edgesPath,
|
const std::string & edgesPath,
|
||||||
std::string namesPath,
|
const std::string & namesPath,
|
||||||
std::string timestampPath
|
const std::string & timestampPath
|
||||||
) {
|
) {
|
||||||
INFO("loading graph data");
|
INFO("loading graph data");
|
||||||
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
|
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
|
||||||
@ -43,6 +43,7 @@ QueryObjectsStorage::QueryObjectsStorage(
|
|||||||
edgeList,
|
edgeList,
|
||||||
&checkSum
|
&checkSum
|
||||||
);
|
);
|
||||||
|
hsgrInStream.close();
|
||||||
|
|
||||||
INFO("Data checksum is " << checkSum);
|
INFO("Data checksum is " << checkSum);
|
||||||
graph = new QueryGraph(nodeList, edgeList);
|
graph = new QueryGraph(nodeList, edgeList);
|
||||||
@ -68,7 +69,12 @@ QueryObjectsStorage::QueryObjectsStorage(
|
|||||||
if(!nodesInStream) { ERR(nodesPath << " not found"); }
|
if(!nodesInStream) { ERR(nodesPath << " not found"); }
|
||||||
std::ifstream edgesInStream(edgesPath.c_str(), std::ios::binary);
|
std::ifstream edgesInStream(edgesPath.c_str(), std::ios::binary);
|
||||||
if(!edgesInStream) { ERR(edgesPath << " not found"); }
|
if(!edgesInStream) { ERR(edgesPath << " not found"); }
|
||||||
nodeHelpDesk = new NodeInformationHelpDesk(ramIndexPath.c_str(), fileIndexPath.c_str(), n, checkSum);
|
nodeHelpDesk = new NodeInformationHelpDesk(
|
||||||
|
ramIndexPath.c_str(),
|
||||||
|
fileIndexPath.c_str(),
|
||||||
|
n,
|
||||||
|
checkSum
|
||||||
|
);
|
||||||
nodeHelpDesk->initNNGrid(nodesInStream, edgesInStream);
|
nodeHelpDesk->initNNGrid(nodesInStream, edgesInStream);
|
||||||
|
|
||||||
//deserialize street name list
|
//deserialize street name list
|
||||||
@ -77,7 +83,6 @@ QueryObjectsStorage::QueryObjectsStorage(
|
|||||||
if(!namesInStream) { ERR(namesPath << " not found"); }
|
if(!namesInStream) { ERR(namesPath << " not found"); }
|
||||||
unsigned size(0);
|
unsigned size(0);
|
||||||
namesInStream.read((char *)&size, sizeof(unsigned));
|
namesInStream.read((char *)&size, sizeof(unsigned));
|
||||||
// names = new std::vector<std::string>();
|
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
for(unsigned i = 0; i < size; ++i) {
|
for(unsigned i = 0; i < size; ++i) {
|
||||||
@ -88,7 +93,6 @@ QueryObjectsStorage::QueryObjectsStorage(
|
|||||||
names.push_back(buf);
|
names.push_back(buf);
|
||||||
}
|
}
|
||||||
std::vector<std::string>(names).swap(names);
|
std::vector<std::string>(names).swap(names);
|
||||||
hsgrInStream.close();
|
|
||||||
namesInStream.close();
|
namesInStream.close();
|
||||||
INFO("All query data structures loaded");
|
INFO("All query data structures loaded");
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "../../DataStructures/StaticGraph.h"
|
#include "../../DataStructures/StaticGraph.h"
|
||||||
|
|
||||||
struct QueryObjectsStorage {
|
struct QueryObjectsStorage {
|
||||||
typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
|
typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
|
||||||
typedef QueryGraph::InputEdge InputEdge;
|
typedef QueryGraph::InputEdge InputEdge;
|
||||||
|
|
||||||
NodeInformationHelpDesk * nodeHelpDesk;
|
NodeInformationHelpDesk * nodeHelpDesk;
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
@ -39,7 +39,15 @@ struct QueryObjectsStorage {
|
|||||||
std::string timestamp;
|
std::string timestamp;
|
||||||
unsigned checkSum;
|
unsigned checkSum;
|
||||||
|
|
||||||
QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath);
|
QueryObjectsStorage(
|
||||||
|
const std::string & hsgrPath,
|
||||||
|
const std::string & ramIndexPath,
|
||||||
|
const std::string & fileIndexPath,
|
||||||
|
const std::string & nodesPath,
|
||||||
|
const std::string & edgesPath,
|
||||||
|
const std::string & namesPath,
|
||||||
|
const std::string & timestampPath
|
||||||
|
);
|
||||||
|
|
||||||
~QueryObjectsStorage();
|
~QueryObjectsStorage();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user