Merge branch 'master' into rake
This commit is contained in:
commit
6584c8b624
@ -93,78 +93,84 @@ public:
|
|||||||
|
|
||||||
/** warning: caller needs to take care of synchronization! */
|
/** warning: caller needs to take care of synchronization! */
|
||||||
inline bool wayFunction(_Way &w) {
|
inline bool wayFunction(_Way &w) {
|
||||||
|
|
||||||
std::string accessClass( w.keyVals.Find(settings.accessTag) );
|
|
||||||
std::string access( w.keyVals.Find("access") );
|
|
||||||
std::string highway( w.keyVals.Find("highway") );
|
|
||||||
|
|
||||||
//class tag like bicycle=yes/no overrides everything else
|
|
||||||
if("yes" == accessClass || "permissive" == accessClass || "designated" == accessClass || "official" == accessClass)
|
|
||||||
w.access = true;
|
|
||||||
else if("no" == accessClass)
|
|
||||||
w.access = false;
|
|
||||||
else {
|
|
||||||
std::string route( w.keyVals.Find("route") );
|
|
||||||
std::string man_made( w.keyVals.Find("man_made") );
|
|
||||||
//speedprofile allows routing on this type of way/route/man_made?
|
|
||||||
if(settings[highway] > 0 || settings[route] > 0 || settings[man_made] > 0) {
|
|
||||||
if(0 < access.size()) { //fastest way to check for non-empty string
|
|
||||||
if( access == "yes" || access == "permissive" || access == "designated" || access == "public" )
|
|
||||||
w.access = true;
|
|
||||||
else
|
|
||||||
w.access = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
w.access = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( w.access == true && (1 < w.path.size()) ) {
|
|
||||||
std::string name( w.keyVals.Find("name") );
|
|
||||||
std::string ref( w.keyVals.Find("ref"));
|
|
||||||
std::string oneway( w.keyVals.Find("oneway"));
|
|
||||||
std::string onewayClass( w.keyVals.Find("oneway:"+accessClass));
|
|
||||||
std::string junction( w.keyVals.Find("junction") );
|
|
||||||
double maxspeed( atoi(w.keyVals.Find("maxspeed").c_str()) );
|
|
||||||
std::string barrier( w.keyVals.Find("barrier") );
|
|
||||||
|
|
||||||
//name
|
|
||||||
if ( 0 < ref.length() )
|
|
||||||
w.name = ref;
|
|
||||||
else if ( 0 < name.length() )
|
|
||||||
w.name = name;
|
|
||||||
|
|
||||||
//roundabout
|
|
||||||
if(junction == "roundabout")
|
|
||||||
w.roundabout = true;
|
|
||||||
|
|
||||||
//speed
|
|
||||||
if(0 < maxspeed && (maxspeed < settings[highway]) )
|
|
||||||
w.speed = maxspeed;
|
|
||||||
else
|
|
||||||
w.speed = settings[highway];
|
|
||||||
|
|
||||||
//TODO: type is not set, perhaps use a bimap'ed speed profile to do set the type correctly?
|
|
||||||
w.type = 1;
|
|
||||||
|
|
||||||
//oneway
|
//Get the properties of the way.
|
||||||
if( settings.obeyOneways ) {
|
std::string highway( w.keyVals.Find("highway") );
|
||||||
//TODO: handle cycleway=opposite_*
|
std::string name( w.keyVals.Find("name") );
|
||||||
if( oneway == "no" || oneway == "0" || oneway == "false" ||
|
std::string ref( w.keyVals.Find("ref"));
|
||||||
onewayClass == "no" || onewayClass == "0" || onewayClass == "false")
|
std::string oneway( w.keyVals.Find("oneway"));
|
||||||
w.direction = _Way::bidirectional;
|
std::string junction( w.keyVals.Find("junction") );
|
||||||
else if( oneway == "yes" || oneway == "1" || oneway == "true" ||
|
std::string route( w.keyVals.Find("route") );
|
||||||
onewayClass == "yes" || onewayClass == "1" || onewayClass == "true" ||
|
int maxspeed( atoi(w.keyVals.Find("maxspeed").c_str()) );
|
||||||
junction == "roundabout" || highway == "motorway_link" || highway == "motorway" )
|
std::string access( w.keyVals.Find("access") );
|
||||||
w.direction = _Way::oneway;
|
std::string accessTag( w.keyVals.Find(settings.accessTag) );
|
||||||
else if( oneway == "-1") {
|
std::string man_made( w.keyVals.Find("man_made") );
|
||||||
w.direction = _Way::opposite;
|
std::string barrier( w.keyVals.Find("barrier") );
|
||||||
std::reverse( w.path.begin(), w.path.end() );
|
|
||||||
}
|
//Save the name of the way if it has one, ref has precedence over name tag.
|
||||||
else
|
if ( 0 < ref.length() )
|
||||||
w.direction = _Way::bidirectional;
|
w.name = ref;
|
||||||
}
|
else
|
||||||
|
if ( 0 < name.length() )
|
||||||
|
w.name = name;
|
||||||
|
|
||||||
|
if(junction == "roundabout") {
|
||||||
|
w.roundabout = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Is the highway tag listed as usable way?
|
||||||
|
if(0 < settings[highway] || "yes" == accessTag || "designated" == accessTag) {
|
||||||
|
|
||||||
|
if(0 < settings[highway]) {
|
||||||
|
if(0 < maxspeed)
|
||||||
|
w.speed = std::min(maxspeed, settings[highway]);
|
||||||
|
else
|
||||||
|
w.speed = settings[highway];
|
||||||
|
} else {
|
||||||
|
w.speed = settings.defaultSpeed;
|
||||||
|
highway = "default";
|
||||||
|
}
|
||||||
|
w.useful = true;
|
||||||
|
|
||||||
|
//Okay, do we have access to that way?
|
||||||
|
if(0 < access.size()) { //fastest way to check for non-empty string
|
||||||
|
//If access is forbidden, we don't want to route there.
|
||||||
|
if(access == "private" || access == "no" || access == "agricultural" || access == "forestry" || access == "delivery") { //Todo: this is still hard coded
|
||||||
|
w.access = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if("no" == accessTag) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Let's process oneway property, if speed profile obeys to it
|
||||||
|
if(oneway != "no" && oneway != "false" && oneway != "0" && settings.obeyOneways) {
|
||||||
|
//if oneway tag is in forward direction or if actually roundabout
|
||||||
|
if(junction == "roundabout" || oneway == "yes" || oneway == "true" || oneway == "1") {
|
||||||
|
w.direction = _Way::oneway;
|
||||||
|
} else {
|
||||||
|
if( oneway == "-1")
|
||||||
|
w.direction = _Way::opposite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Is the route tag listed as usable way in the profile?
|
||||||
|
if(settings[route] > 0 || settings[man_made] > 0) {
|
||||||
|
w.useful = true;
|
||||||
|
w.speed = settings[route];
|
||||||
|
w.direction = _Way::bidirectional;
|
||||||
|
if(0 < settings[route])
|
||||||
|
highway = route;
|
||||||
|
else if (0 < settings[man_made]) {
|
||||||
|
highway = man_made;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( w.useful && w.access && (1 < w.path.size()) ) { //Only true if the way is specified by the speed profile
|
||||||
|
//TODO: type is not set, perhaps use a bimap'ed speed profile to do set the type correctly?
|
||||||
|
w.type = settings.GetHighwayTypeID(highway);
|
||||||
|
|
||||||
//Get the unique identifier for the street name
|
//Get the unique identifier for the street name
|
||||||
const StringMap::const_iterator strit = stringMap->find(w.name);
|
const StringMap::const_iterator strit = stringMap->find(w.name);
|
||||||
if(strit == stringMap->end()) {
|
if(strit == stringMap->end()) {
|
||||||
@ -175,7 +181,7 @@ public:
|
|||||||
w.nameID = strit->second;
|
w.nameID = strit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(-1 == w.speed) {
|
if(-1 == w.speed){
|
||||||
WARN("found way with bogus speed, id: " << w.id);
|
WARN("found way with bogus speed, id: " << w.id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -184,6 +190,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( w.direction == _Way::opposite ){
|
||||||
|
std::reverse( w.path.begin(), w.path.end() );
|
||||||
|
}
|
||||||
|
|
||||||
for(vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
|
for(vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
|
||||||
externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout));
|
externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout));
|
||||||
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
||||||
@ -193,9 +203,8 @@ public:
|
|||||||
//The following information is needed to identify start and end segments of restrictions
|
//The following information is needed to identify start and end segments of restrictions
|
||||||
externalMemory->wayStartEndVector.push_back(_WayIDStartAndEndEdge(w.id, w.path[0], w.path[1], w.path[w.path.size()-2], w.path[w.path.size()-1]));
|
externalMemory->wayStartEndVector.push_back(_WayIDStartAndEndEdge(w.id, w.path[0], w.path[1], w.path[w.path.size()-2], w.path[w.path.size()-1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EXTRACTORCALLBACKS_H_ */
|
#endif /* EXTRACTORCALLBACKS_H_ */
|
@ -35,7 +35,8 @@ struct _PathData {
|
|||||||
short turnInstruction;
|
short turnInstruction;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::unordered_map<std::string, NodeID> StringMap;
|
typedef boost::unordered_map<std::string, NodeID > StringMap;
|
||||||
|
typedef boost::unordered_map<std::string, std::pair<int, int> > StringToIntPairMap;
|
||||||
|
|
||||||
struct _Node : NodeInfo{
|
struct _Node : NodeInfo{
|
||||||
_Node(int _lat, int _lon, unsigned int _id) : NodeInfo(_lat, _lon, _id) {}
|
_Node(int _lat, int _lon, unsigned int _id) : NodeInfo(_lat, _lon, _id) {}
|
||||||
@ -254,19 +255,28 @@ struct CmpWayByID : public std::binary_function<_WayIDStartAndEndEdge, _WayIDSta
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
Settings() : obeyPollards(true), obeyOneways(true), useRestrictions(true), accessTag("motorcar") {}
|
Settings() : obeyPollards(true), obeyOneways(true), useRestrictions(true), accessTag("motorcar"), defaultSpeed(30), excludeFromGrid("ferry") {}
|
||||||
StringMap speedProfile;
|
StringToIntPairMap speedProfile;
|
||||||
int operator[](const string & param) const {
|
int operator[](const std::string & param) const {
|
||||||
if(speedProfile.find(param) == speedProfile.end())
|
if(speedProfile.find(param) == speedProfile.end())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return speedProfile.at(param);
|
return speedProfile.at(param).first;
|
||||||
|
}
|
||||||
|
int GetHighwayTypeID(const std::string & param) const {
|
||||||
|
if(speedProfile.find(param) == speedProfile.end()) {
|
||||||
|
DEBUG("There is a bug with highway \"" << param << "\"");
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return speedProfile.at(param).second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool obeyPollards;
|
bool obeyPollards;
|
||||||
bool obeyOneways;
|
bool obeyOneways;
|
||||||
bool useRestrictions;
|
bool useRestrictions;
|
||||||
string accessTag;
|
std::string accessTag;
|
||||||
|
int defaultSpeed;
|
||||||
|
std::string excludeFromGrid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
||||||
|
@ -304,18 +304,22 @@ public:
|
|||||||
|
|
||||||
_GridEdge smallestEdge;
|
_GridEdge smallestEdge;
|
||||||
_Coordinate tmp, newEndpoint;
|
_Coordinate tmp, newEndpoint;
|
||||||
double dist = (numeric_limits<double>::max)();
|
double dist = numeric_limits<double>::max();
|
||||||
BOOST_FOREACH(_GridEdge candidate, candidates) {
|
BOOST_FOREACH(_GridEdge candidate, candidates) {
|
||||||
double r = 0.;
|
double r = 0.;
|
||||||
double tmpDist = ComputeDistance(startCoord, candidate.startCoord, candidate.targetCoord, tmp, &r);
|
double tmpDist = ComputeDistance(startCoord, candidate.startCoord, candidate.targetCoord, tmp, &r);
|
||||||
if(DoubleEpsilonCompare(dist, tmpDist) && 1 == std::abs((int)candidate.edgeBasedNode-(int)resultNode.edgeBasedNode)) {
|
if(DoubleEpsilonCompare(dist, tmpDist) && 1 == std::abs((int)candidate.edgeBasedNode-(int)resultNode.edgeBasedNode)) {
|
||||||
resultNode.weight2 = candidate.weight;
|
resultNode.weight2 = candidate.weight;
|
||||||
|
// INFO("b) " << candidate.edgeBasedNode << ", dist: " << tmpDist);
|
||||||
if(candidate.edgeBasedNode < resultNode.edgeBasedNode) {
|
if(candidate.edgeBasedNode < resultNode.edgeBasedNode) {
|
||||||
resultNode.edgeBasedNode = candidate.edgeBasedNode;
|
resultNode.edgeBasedNode = candidate.edgeBasedNode;
|
||||||
std::swap(resultNode.weight1, resultNode.weight2);
|
std::swap(resultNode.weight1, resultNode.weight2);
|
||||||
}
|
}
|
||||||
|
// } else if(std::fabs(dist - tmpDist) < 1) {
|
||||||
|
// INFO("b) ignored " << candidate.edgeBasedNode << " at distance " << tmpDist);
|
||||||
}
|
}
|
||||||
if(tmpDist < dist && !DoubleEpsilonCompare(dist, tmpDist)) {
|
if(tmpDist < dist && !DoubleEpsilonCompare(dist, tmpDist)) {
|
||||||
|
// INFO("a) " << candidate.edgeBasedNode << ", dist: " << tmpDist);
|
||||||
resultNode.Reset();
|
resultNode.Reset();
|
||||||
resultNode.edgeBasedNode = candidate.edgeBasedNode;
|
resultNode.edgeBasedNode = candidate.edgeBasedNode;
|
||||||
resultNode.nodeBasedEdgeNameID = candidate.nameID;
|
resultNode.nodeBasedEdgeNameID = candidate.nameID;
|
||||||
@ -326,6 +330,8 @@ public:
|
|||||||
foundNode = true;
|
foundNode = true;
|
||||||
smallestEdge = candidate;
|
smallestEdge = candidate;
|
||||||
newEndpoint = tmp;
|
newEndpoint = tmp;
|
||||||
|
// } else if(tmpDist < dist) {
|
||||||
|
// INFO("a) ignored " << candidate.edgeBasedNode << " at distance " << std::fabs(dist - tmpDist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,13 +346,13 @@ public:
|
|||||||
|
|
||||||
double ratio = std::min(1., LengthOfVector(smallestEdge.startCoord, newEndpoint)/LengthOfVector(smallestEdge.startCoord, smallestEdge.targetCoord) );
|
double ratio = std::min(1., LengthOfVector(smallestEdge.startCoord, newEndpoint)/LengthOfVector(smallestEdge.startCoord, smallestEdge.targetCoord) );
|
||||||
assert(ratio >= 0 && ratio <=1);
|
assert(ratio >= 0 && ratio <=1);
|
||||||
// INFO("Old weight1: " << resultNode.weight1 << ", old weight2: " << resultNode.weight2);
|
// INFO("Old weight1: " << resultNode.weight1 << ", old weight2: " << resultNode.weight2);
|
||||||
resultNode.weight1 *= ratio;
|
resultNode.weight1 *= ratio;
|
||||||
if(INT_MAX != resultNode.weight2) {
|
if(INT_MAX != resultNode.weight2) {
|
||||||
resultNode.weight2 *= (1-ratio);
|
resultNode.weight2 *= (1-ratio);
|
||||||
// INFO("New weight1: " << resultNode.weight1 << ", new weight2: " << resultNode.weight2);
|
// INFO("New weight1: " << resultNode.weight1 << ", new weight2: " << resultNode.weight2);
|
||||||
}
|
}
|
||||||
// INFO("bidirected: " << (resultNode.isBidirected() ? "yes" : "no") << "\n--")
|
// INFO("selected node: " << resultNode.edgeBasedNode << ", bidirected: " << (resultNode.isBidirected() ? "yes" : "no") << "\n--")
|
||||||
return foundNode;
|
return foundNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,14 +91,18 @@ public:
|
|||||||
|
|
||||||
//insert start and/or target node of start edge
|
//insert start and/or target node of start edge
|
||||||
_forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode, -phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.edgeBasedNode);
|
_forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode, -phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.edgeBasedNode);
|
||||||
|
// INFO("a) forw insert " << phantomNodes.startPhantom.edgeBasedNode << ", weight: " << -phantomNodes.startPhantom.weight1);
|
||||||
if(phantomNodes.startPhantom.isBidirected() ) {
|
if(phantomNodes.startPhantom.isBidirected() ) {
|
||||||
_forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode+1, -phantomNodes.startPhantom.weight2, phantomNodes.startPhantom.edgeBasedNode+1);
|
// INFO("b) forw insert " << phantomNodes.startPhantom.edgeBasedNode+1 << ", weight: " << -phantomNodes.startPhantom.weight2);
|
||||||
|
_forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode+1, -phantomNodes.startPhantom.weight2, phantomNodes.startPhantom.edgeBasedNode+1);
|
||||||
}
|
}
|
||||||
//insert start and/or target node of target edge id
|
//insert start and/or target node of target edge id
|
||||||
_backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode, -phantomNodes.targetPhantom.weight1, phantomNodes.targetPhantom.edgeBasedNode);
|
_backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode, -phantomNodes.targetPhantom.weight2, phantomNodes.targetPhantom.edgeBasedNode);
|
||||||
|
// INFO("c) back insert " << phantomNodes.targetPhantom.edgeBasedNode << ", weight: " << -phantomNodes.targetPhantom.weight2);
|
||||||
if(phantomNodes.targetPhantom.isBidirected() ) {
|
if(phantomNodes.targetPhantom.isBidirected() ) {
|
||||||
_backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode+1, -phantomNodes.targetPhantom.weight2, phantomNodes.targetPhantom.edgeBasedNode+1);
|
_backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode+1, -phantomNodes.targetPhantom.weight1, phantomNodes.targetPhantom.edgeBasedNode+1);
|
||||||
}
|
// INFO("d) back insert " << phantomNodes.targetPhantom.edgeBasedNode+1 << ", weight: " << -phantomNodes.targetPhantom.weight1);
|
||||||
|
}
|
||||||
|
|
||||||
while(_forwardHeap->Size() + _backwardHeap->Size() > 0){
|
while(_forwardHeap->Size() + _backwardHeap->Size() > 0){
|
||||||
if(_forwardHeap->Size() > 0){
|
if(_forwardHeap->Size() > 0){
|
||||||
|
19
SConstruct
19
SConstruct
@ -74,15 +74,20 @@ else:
|
|||||||
|
|
||||||
if sys.platform == 'darwin': #Mac OS X
|
if sys.platform == 'darwin': #Mac OS X
|
||||||
env.Append(CPPPATH = ['/usr/include/libxml2'] ) #comes with os x
|
env.Append(CPPPATH = ['/usr/include/libxml2'] ) #comes with os x
|
||||||
#assume stxxl and boost are installed via homebrew.
|
#assume dependencies are installed with homebrew, and call out get folder locations
|
||||||
#call out to brew to get the folder locations
|
|
||||||
import subprocess
|
import subprocess
|
||||||
stxxl_prefix = subprocess.check_output(["brew", "--prefix", "libstxxl"]).strip()
|
stxxl_prefix = subprocess.check_output(["brew", "--prefix", "libstxxl"]).strip()
|
||||||
boost_prefix = subprocess.check_output(["brew", "--prefix", "boost"]).strip()
|
|
||||||
env.Append(CPPPATH = [stxxl_prefix+"/include"] )
|
env.Append(CPPPATH = [stxxl_prefix+"/include"] )
|
||||||
env.Append(LIBPATH = [stxxl_prefix+"/lib"] )
|
env.Append(LIBPATH = [stxxl_prefix+"/lib"] )
|
||||||
|
|
||||||
|
boost_prefix = subprocess.check_output(["brew", "--prefix", "boost"]).strip()
|
||||||
env.Append(CPPPATH = [boost_prefix+"/include"] )
|
env.Append(CPPPATH = [boost_prefix+"/include"] )
|
||||||
env.Append(LIBPATH = [boost_prefix+"/lib"] )
|
env.Append(LIBPATH = [boost_prefix+"/lib"] )
|
||||||
|
|
||||||
|
#libxml2_prefix = subprocess.check_output(["brew", "--prefix", "libxml2"]).strip()
|
||||||
|
#env.Append(CPPPATH = [libxml2_prefix+"/include"] )
|
||||||
|
#env.Append(LIBPATH = [libxml2_prefix+"/lib"] )
|
||||||
|
|
||||||
elif sys.platform.startswith("freebsd"):
|
elif sys.platform.startswith("freebsd"):
|
||||||
env.ParseConfig('pkg-config --cflags --libs protobuf')
|
env.ParseConfig('pkg-config --cflags --libs protobuf')
|
||||||
env.Append(CPPPATH = ['/usr/local/include', '/usr/local/include/libxml2'])
|
env.Append(CPPPATH = ['/usr/local/include', '/usr/local/include/libxml2'])
|
||||||
@ -105,9 +110,11 @@ else:
|
|||||||
env.Append(CPPPATH = ['/usr/include', '/usr/include/include', '/usr/include/libxml2/'])
|
env.Append(CPPPATH = ['/usr/include', '/usr/include/include', '/usr/include/libxml2/'])
|
||||||
|
|
||||||
|
|
||||||
if not conf.CheckHeader('omp.h'):
|
if sys.platform != 'darwin':
|
||||||
print "Compiler does not support OpenMP. Exiting"
|
if not conf.CheckHeader('omp.h'):
|
||||||
Exit(-1)
|
print "Compiler does not support OpenMP. Exiting"
|
||||||
|
Exit(-1)
|
||||||
|
|
||||||
if not conf.CheckLibWithHeader('xml2', 'libxml/xmlreader.h', 'CXX'):
|
if not conf.CheckLibWithHeader('xml2', 'libxml/xmlreader.h', 'CXX'):
|
||||||
print "libxml2 library or header not found. Exiting"
|
print "libxml2 library or header not found. Exiting"
|
||||||
Exit(-1)
|
Exit(-1)
|
||||||
|
@ -102,7 +102,7 @@ int main (int argc, char *argv[]) {
|
|||||||
boost::property_tree::ptree pt;
|
boost::property_tree::ptree pt;
|
||||||
try {
|
try {
|
||||||
INFO("Loading speed profiles")
|
INFO("Loading speed profiles")
|
||||||
boost::property_tree::ini_parser::read_ini("speedprofile.ini", pt);
|
boost::property_tree::ini_parser::read_ini("speedprofile.ini", pt);
|
||||||
INFO("Found the following speed profiles: ");
|
INFO("Found the following speed profiles: ");
|
||||||
int profileCounter(0);
|
int profileCounter(0);
|
||||||
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child("")) {
|
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child("")) {
|
||||||
@ -134,11 +134,20 @@ int main (int argc, char *argv[]) {
|
|||||||
if(name == "accessTag") {
|
if(name == "accessTag") {
|
||||||
settings.accessTag = value;
|
settings.accessTag = value;
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
if(name == "excludeFromGrid") {
|
||||||
|
settings.excludeFromGrid = value;
|
||||||
|
} else {
|
||||||
|
if(name == "defaultSpeed") {
|
||||||
|
settings.defaultSpeed = atoi(value.c_str());
|
||||||
|
settings.speedProfile["default"] = std::make_pair(settings.defaultSpeed, settings.speedProfile.size() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
settings.speedProfile[name] = std::make_pair(std::atoi(value.c_str()), settings.speedProfile.size() );
|
||||||
}
|
}
|
||||||
settings.speedProfile[name] = atoi(value.c_str());
|
|
||||||
}
|
}
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
ERR("caught: " << e.what() );
|
ERR("caught: " << e.what() );
|
||||||
@ -189,7 +198,7 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
cout << "[extractor] parsing finished after " << get_timestamp() - time << " seconds" << endl;
|
cout << "[extractor] parsing finished after " << get_timestamp() - time << " seconds" << endl;
|
||||||
time = get_timestamp();
|
time = get_timestamp();
|
||||||
boost::uint64_t memory_to_use = static_cast<boost::uint64_t>(amountOfRAM) * 1024 * 1024 * 1024;
|
boost::uint64_t memory_to_use = static_cast<boost::uint64_t>(amountOfRAM) * 1024 * 1024 * 1024;
|
||||||
|
|
||||||
cout << "[extractor] Sorting used nodes ... " << flush;
|
cout << "[extractor] Sorting used nodes ... " << flush;
|
||||||
stxxl::sort(externalMemory.usedNodeIDs.begin(), externalMemory.usedNodeIDs.end(), Cmp(), memory_to_use);
|
stxxl::sort(externalMemory.usedNodeIDs.begin(), externalMemory.usedNodeIDs.end(), Cmp(), memory_to_use);
|
||||||
@ -221,11 +230,11 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
while(wayStartAndEndEdgeIT != externalMemory.wayStartEndVector.end() && restrictionsIT != externalMemory.restrictionsVector.end()) {
|
while(wayStartAndEndEdgeIT != externalMemory.wayStartEndVector.end() && restrictionsIT != externalMemory.restrictionsVector.end()) {
|
||||||
if(wayStartAndEndEdgeIT->wayID < restrictionsIT->fromWay){
|
if(wayStartAndEndEdgeIT->wayID < restrictionsIT->fromWay){
|
||||||
++wayStartAndEndEdgeIT;
|
++wayStartAndEndEdgeIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(wayStartAndEndEdgeIT->wayID > restrictionsIT->fromWay) {
|
if(wayStartAndEndEdgeIT->wayID > restrictionsIT->fromWay) {
|
||||||
++restrictionsIT;
|
++restrictionsIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert(wayStartAndEndEdgeIT->wayID == restrictionsIT->fromWay);
|
assert(wayStartAndEndEdgeIT->wayID == restrictionsIT->fromWay);
|
||||||
@ -257,11 +266,11 @@ int main (int argc, char *argv[]) {
|
|||||||
wayStartAndEndEdgeIT = externalMemory.wayStartEndVector.begin();
|
wayStartAndEndEdgeIT = externalMemory.wayStartEndVector.begin();
|
||||||
while(wayStartAndEndEdgeIT != externalMemory.wayStartEndVector.end() && restrictionsIT != externalMemory.restrictionsVector.end()) {
|
while(wayStartAndEndEdgeIT != externalMemory.wayStartEndVector.end() && restrictionsIT != externalMemory.restrictionsVector.end()) {
|
||||||
if(wayStartAndEndEdgeIT->wayID < restrictionsIT->toWay){
|
if(wayStartAndEndEdgeIT->wayID < restrictionsIT->toWay){
|
||||||
++wayStartAndEndEdgeIT;
|
++wayStartAndEndEdgeIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(wayStartAndEndEdgeIT->wayID > restrictionsIT->toWay) {
|
if(wayStartAndEndEdgeIT->wayID > restrictionsIT->toWay) {
|
||||||
++restrictionsIT;
|
++restrictionsIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
NodeID viaNode = restrictionsIT->restriction.viaNode;
|
NodeID viaNode = restrictionsIT->restriction.viaNode;
|
||||||
@ -276,9 +285,7 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(UINT_MAX != restrictionsIT->restriction.fromNode && UINT_MAX != restrictionsIT->restriction.toNode) {
|
if(UINT_MAX != restrictionsIT->restriction.fromNode && UINT_MAX != restrictionsIT->restriction.toNode) {
|
||||||
++usableRestrictionsCounter;
|
++usableRestrictionsCounter;
|
||||||
} else {
|
|
||||||
INFO("Restriction from: " << restrictionsIT->restriction.fromNode << ", to: " << restrictionsIT->restriction.toNode);
|
|
||||||
}
|
}
|
||||||
++restrictionsIT;
|
++restrictionsIT;
|
||||||
}
|
}
|
||||||
@ -346,7 +353,7 @@ int main (int argc, char *argv[]) {
|
|||||||
STXXLEdgeVector::iterator edgeIT = externalMemory.allEdges.begin();
|
STXXLEdgeVector::iterator edgeIT = externalMemory.allEdges.begin();
|
||||||
while(edgeIT != externalMemory.allEdges.end() && nodesIT != externalMemory.allNodes.end()) {
|
while(edgeIT != externalMemory.allEdges.end() && nodesIT != externalMemory.allNodes.end()) {
|
||||||
if(edgeIT->start < nodesIT->id){
|
if(edgeIT->start < nodesIT->id){
|
||||||
++edgeIT;
|
++edgeIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(edgeIT->start > nodesIT->id) {
|
if(edgeIT->start > nodesIT->id) {
|
||||||
@ -374,11 +381,11 @@ int main (int argc, char *argv[]) {
|
|||||||
edgeIT = externalMemory.allEdges.begin();
|
edgeIT = externalMemory.allEdges.begin();
|
||||||
while(edgeIT != externalMemory.allEdges.end() && nodesIT != externalMemory.allNodes.end()) {
|
while(edgeIT != externalMemory.allEdges.end() && nodesIT != externalMemory.allNodes.end()) {
|
||||||
if(edgeIT->target < nodesIT->id){
|
if(edgeIT->target < nodesIT->id){
|
||||||
++edgeIT;
|
++edgeIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(edgeIT->target > nodesIT->id) {
|
if(edgeIT->target > nodesIT->id) {
|
||||||
++nodesIT;
|
++nodesIT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(edgeIT->target == nodesIT->id) {
|
if(edgeIT->target == nodesIT->id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user