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