remove unneeded includes, fix variable names
This commit is contained in:
parent
293b462fd2
commit
fd0946b770
@ -27,9 +27,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
#include "../Algorithms/StronglyConnectedComponents.h"
|
#include "../Algorithms/StronglyConnectedComponents.h"
|
||||||
#include "../DataStructures/DynamicGraph.h"
|
|
||||||
#include "../DataStructures/QueryEdge.h"
|
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
|
||||||
#include "../Util/GraphLoader.h"
|
#include "../Util/GraphLoader.h"
|
||||||
#include "../Util/OSRMException.h"
|
#include "../Util/OSRMException.h"
|
||||||
#include "../Util/SimpleLogger.h"
|
#include "../Util/SimpleLogger.h"
|
||||||
@ -40,16 +37,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef QueryEdge::EdgeData EdgeData;
|
std::vector<NodeInfo> coordinate_list;
|
||||||
typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
|
|
||||||
|
|
||||||
std::vector<NodeInfo> internal_to_external_node_map;
|
|
||||||
std::vector<TurnRestriction> restrictions_vector;
|
std::vector<TurnRestriction> restrictions_vector;
|
||||||
std::vector<NodeID> bollard_node_IDs_vector;
|
std::vector<NodeID> bollard_ID_list;
|
||||||
std::vector<NodeID> traffic_light_node_IDs_vector;
|
std::vector<NodeID> trafficlight_ID_list;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
// enable logging
|
||||||
LogPolicy::GetInstance().Unmute();
|
LogPolicy::GetInstance().Unmute();
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
{
|
{
|
||||||
@ -65,6 +60,7 @@ int main(int argc, char *argv[])
|
|||||||
FingerPrint fingerprint_loaded;
|
FingerPrint fingerprint_loaded;
|
||||||
restriction_ifstream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
restriction_ifstream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
|
||||||
|
|
||||||
|
// check fingerprint and warn if necessary
|
||||||
if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
|
||||||
{
|
{
|
||||||
SimpleLogger().Write(logWARNING) << argv[2] << " was prepared with a different build. "
|
SimpleLogger().Write(logWARNING) << argv[2] << " was prepared with a different build. "
|
||||||
@ -79,6 +75,7 @@ int main(int argc, char *argv[])
|
|||||||
restriction_ifstream.read((char *)&usable_restriction_count, sizeof(uint32_t));
|
restriction_ifstream.read((char *)&usable_restriction_count, sizeof(uint32_t));
|
||||||
restrictions_vector.resize(usable_restriction_count);
|
restrictions_vector.resize(usable_restriction_count);
|
||||||
|
|
||||||
|
// load restrictions
|
||||||
if (usable_restriction_count>0)
|
if (usable_restriction_count>0)
|
||||||
{
|
{
|
||||||
restriction_ifstream.read((char *)&(restrictions_vector[0]),
|
restriction_ifstream.read((char *)&(restrictions_vector[0]),
|
||||||
@ -86,20 +83,19 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
restriction_ifstream.close();
|
restriction_ifstream.close();
|
||||||
|
|
||||||
std::ifstream input_stream;
|
std::ifstream input_stream(argv[1], std::ifstream::in | std::ifstream::binary);
|
||||||
input_stream.open(argv[1], std::ifstream::in | std::ifstream::binary);
|
|
||||||
|
|
||||||
if (!input_stream.is_open())
|
if (!input_stream.is_open())
|
||||||
{
|
{
|
||||||
throw OSRMException("Cannot open osrm file");
|
throw OSRMException("Cannot open osrm file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load graph data
|
||||||
std::vector<ImportEdge> edge_list;
|
std::vector<ImportEdge> edge_list;
|
||||||
const NodeID number_of_nodes = readBinaryOSRMGraphFromStream(input_stream,
|
const NodeID number_of_nodes = readBinaryOSRMGraphFromStream(input_stream,
|
||||||
edge_list,
|
edge_list,
|
||||||
bollard_node_IDs_vector,
|
bollard_ID_list,
|
||||||
traffic_light_node_IDs_vector,
|
trafficlight_ID_list,
|
||||||
&internal_to_external_node_map,
|
&coordinate_list,
|
||||||
restrictions_vector);
|
restrictions_vector);
|
||||||
input_stream.close();
|
input_stream.close();
|
||||||
|
|
||||||
@ -107,23 +103,21 @@ int main(int argc, char *argv[])
|
|||||||
"size of restrictions_vector changed");
|
"size of restrictions_vector changed");
|
||||||
|
|
||||||
SimpleLogger().Write() << restrictions_vector.size() << " restrictions, "
|
SimpleLogger().Write() << restrictions_vector.size() << " restrictions, "
|
||||||
<< bollard_node_IDs_vector.size() << " bollard nodes, "
|
<< bollard_ID_list.size() << " bollard nodes, "
|
||||||
<< traffic_light_node_IDs_vector.size() << " traffic lights";
|
<< trafficlight_ID_list.size() << " traffic lights";
|
||||||
|
|
||||||
/***
|
|
||||||
* Building an edge-expanded graph from node-based input an turn
|
|
||||||
* restrictions
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// Building an edge-expanded graph from node-based input an turn
|
||||||
|
// restrictions
|
||||||
SimpleLogger().Write() << "Starting SCC graph traversal";
|
SimpleLogger().Write() << "Starting SCC graph traversal";
|
||||||
std::shared_ptr<TarjanSCC> tarjan =
|
std::shared_ptr<TarjanSCC> tarjan =
|
||||||
std::make_shared<TarjanSCC>(number_of_nodes,
|
std::make_shared<TarjanSCC>(number_of_nodes,
|
||||||
edge_list,
|
edge_list,
|
||||||
bollard_node_IDs_vector,
|
bollard_ID_list,
|
||||||
traffic_light_node_IDs_vector,
|
trafficlight_ID_list,
|
||||||
restrictions_vector,
|
restrictions_vector,
|
||||||
internal_to_external_node_map);
|
coordinate_list);
|
||||||
std::vector<ImportEdge>().swap(edge_list);
|
edge_list.clear();
|
||||||
|
edge_list.shrink_to_fit();
|
||||||
|
|
||||||
tarjan->Run();
|
tarjan->Run();
|
||||||
SimpleLogger().Write() << "finished component analysis";
|
SimpleLogger().Write() << "finished component analysis";
|
||||||
|
Loading…
Reference in New Issue
Block a user