Merging further changes
This commit is contained in:
commit
6a71163912
@ -108,6 +108,9 @@ public:
|
|||||||
int tlon = edge.lon2;
|
int tlon = edge.lon2;
|
||||||
AddEdge( _GridEdge( edge.id, edge.nameID, edge.weight, _Coordinate(slat, slon), _Coordinate(tlat, tlon), edge.belongsToTinyComponent ) );
|
AddEdge( _GridEdge( edge.id, edge.nameID, edge.weight, _Coordinate(slat, slon), _Coordinate(tlat, tlon), edge.belongsToTinyComponent ) );
|
||||||
}
|
}
|
||||||
|
if( 0 == entries.size() ) {
|
||||||
|
ERR("No viable edges for nearest neighbor index. Aborting");
|
||||||
|
}
|
||||||
double timestamp = get_timestamp();
|
double timestamp = get_timestamp();
|
||||||
//create index file on disk, old one is over written
|
//create index file on disk, old one is over written
|
||||||
indexOutFile.open(fileIndexOut, std::ios::out | std::ios::binary | std::ios::trunc);
|
indexOutFile.open(fileIndexOut, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||||
|
@ -67,8 +67,7 @@ bool ExtractorCallbacks::restrictionFunction(_RawRestrictionContainer &r) {
|
|||||||
bool ExtractorCallbacks::wayFunction(_Way &w) {
|
bool ExtractorCallbacks::wayFunction(_Way &w) {
|
||||||
/*** Store name of way and split it into edge segments ***/
|
/*** Store name of way and split it into edge segments ***/
|
||||||
|
|
||||||
if ( w.speed > 0 ) { //Only true if the way is specified by the speed profile
|
if ( 0 < w.speed > 0 || 0 < w.duration ) { //Only true if the way is specified by the speed profile
|
||||||
|
|
||||||
//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()) {
|
||||||
@ -79,6 +78,11 @@ bool ExtractorCallbacks::wayFunction(_Way &w) {
|
|||||||
w.nameID = strit->second;
|
w.nameID = strit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(w.duration > 0) {
|
||||||
|
//TODO: iterate all way segments and set duration corresponding to the length of each segment
|
||||||
|
w.speed = w.duration/(w.path.size()-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(fabs(-1. - w.speed) < FLT_EPSILON){
|
if(fabs(-1. - w.speed) < FLT_EPSILON){
|
||||||
WARN("found way with bogus speed, id: " << w.id);
|
WARN("found way with bogus speed, id: " << w.id);
|
||||||
return true;
|
return true;
|
||||||
@ -93,7 +97,7 @@ bool ExtractorCallbacks::wayFunction(_Way &w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
|
for(std::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, w.ignoreInGrid, w.isDurationSet, w.isAccessRestricted));
|
externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout, w.ignoreInGrid, (w.duration > 0), w.isAccessRestricted));
|
||||||
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
||||||
}
|
}
|
||||||
externalMemory->usedNodeIDs.push_back(w.path.back());
|
externalMemory->usedNodeIDs.push_back(w.path.back());
|
||||||
|
@ -52,10 +52,10 @@ struct _Way {
|
|||||||
keyVals.EraseAll();
|
keyVals.EraseAll();
|
||||||
direction = _Way::notSure;
|
direction = _Way::notSure;
|
||||||
speed = -1;
|
speed = -1;
|
||||||
|
duration = -1;
|
||||||
type = -1;
|
type = -1;
|
||||||
access = true;
|
access = true;
|
||||||
roundabout = false;
|
roundabout = false;
|
||||||
isDurationSet = false;
|
|
||||||
isAccessRestricted = false;
|
isAccessRestricted = false;
|
||||||
ignoreInGrid = false;
|
ignoreInGrid = false;
|
||||||
}
|
}
|
||||||
@ -67,10 +67,10 @@ struct _Way {
|
|||||||
unsigned nameID;
|
unsigned nameID;
|
||||||
std::string name;
|
std::string name;
|
||||||
double speed;
|
double speed;
|
||||||
|
double duration;
|
||||||
short type;
|
short type;
|
||||||
bool access;
|
bool access;
|
||||||
bool roundabout;
|
bool roundabout;
|
||||||
bool isDurationSet;
|
|
||||||
bool isAccessRestricted;
|
bool isAccessRestricted;
|
||||||
bool ignoreInGrid;
|
bool ignoreInGrid;
|
||||||
std::vector< NodeID > path;
|
std::vector< NodeID > path;
|
||||||
|
@ -69,10 +69,10 @@ ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
|
|||||||
.def(luabind::constructor<>())
|
.def(luabind::constructor<>())
|
||||||
.def_readwrite("name", &_Way::name)
|
.def_readwrite("name", &_Way::name)
|
||||||
.def_readwrite("speed", &_Way::speed)
|
.def_readwrite("speed", &_Way::speed)
|
||||||
|
.def_readwrite("duration", &_Way::duration)
|
||||||
.def_readwrite("type", &_Way::type)
|
.def_readwrite("type", &_Way::type)
|
||||||
.def_readwrite("access", &_Way::access)
|
.def_readwrite("access", &_Way::access)
|
||||||
.def_readwrite("roundabout", &_Way::roundabout)
|
.def_readwrite("roundabout", &_Way::roundabout)
|
||||||
.def_readwrite("is_duration_set", &_Way::isDurationSet)
|
|
||||||
.def_readwrite("is_access_restricted", &_Way::isAccessRestricted)
|
.def_readwrite("is_access_restricted", &_Way::isAccessRestricted)
|
||||||
.def_readwrite("ignore_in_grid", &_Way::ignoreInGrid)
|
.def_readwrite("ignore_in_grid", &_Way::ignoreInGrid)
|
||||||
.def_readwrite("tags", &_Way::keyVals)
|
.def_readwrite("tags", &_Way::keyVals)
|
||||||
|
@ -139,7 +139,6 @@ bool XMLParser::Parse() {
|
|||||||
_RawRestrictionContainer XMLParser::_ReadXMLRestriction() {
|
_RawRestrictionContainer XMLParser::_ReadXMLRestriction() {
|
||||||
_RawRestrictionContainer restriction;
|
_RawRestrictionContainer restriction;
|
||||||
std::string exception_of_restriction_tag;
|
std::string exception_of_restriction_tag;
|
||||||
bool restriction_is_excepted = false;
|
|
||||||
|
|
||||||
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
|
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
|
||||||
const int depth = xmlTextReaderDepth( inputReader );while ( xmlTextReaderRead( inputReader ) == 1 ) {
|
const int depth = xmlTextReaderDepth( inputReader );while ( xmlTextReaderRead( inputReader ) == 1 ) {
|
||||||
|
@ -97,7 +97,6 @@ int main (int argc, char *argv[]) {
|
|||||||
std::string graphOut(argv[1]); graphOut += ".hsgr";
|
std::string graphOut(argv[1]); graphOut += ".hsgr";
|
||||||
std::string ramIndexOut(argv[1]); ramIndexOut += ".ramIndex";
|
std::string ramIndexOut(argv[1]); ramIndexOut += ".ramIndex";
|
||||||
std::string fileIndexOut(argv[1]); fileIndexOut += ".fileIndex";
|
std::string fileIndexOut(argv[1]); fileIndexOut += ".fileIndex";
|
||||||
std::string levelInfoOut(argv[1]); levelInfoOut += ".levels";
|
|
||||||
|
|
||||||
/*** Setup Scripting Environment ***/
|
/*** Setup Scripting Environment ***/
|
||||||
if(!testDataFile( (argc > 3 ? argv[3] : "profile.lua") )) {
|
if(!testDataFile( (argc > 3 ? argv[3] : "profile.lua") )) {
|
||||||
|
40
features/testbot/duration.feature
Normal file
40
features/testbot/duration.feature
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
@routing @testbot @routes @duration
|
||||||
|
Feature: Durations
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile "testbot"
|
||||||
|
|
||||||
|
Scenario: Duration of ways
|
||||||
|
Given the node map
|
||||||
|
| a | b | | | |
|
||||||
|
| | | | e | |
|
||||||
|
| | c | | | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | duration |
|
||||||
|
| ab | primary | 0:01 |
|
||||||
|
| bc | primary | 0:10 |
|
||||||
|
| cd | primary | 1:00 |
|
||||||
|
| de | primary | 10:00 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | distance | time |
|
||||||
|
| a | b | ab | 100m +-1 | 60s +-1 |
|
||||||
|
| b | c | bc | 200m +-1 | 600s +-1 |
|
||||||
|
| c | d | cd | 300m +-1 | 3600s +-1 |
|
||||||
|
| d | e | de | 144m +-2 | 36000s +-1 |
|
||||||
|
|
||||||
|
@todo
|
||||||
|
Scenario: Partial duration of ways
|
||||||
|
Given the node map
|
||||||
|
| a | b | | c |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | duration |
|
||||||
|
| abc | primary | 0:01 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | distance | time |
|
||||||
|
| a | c | abc | 300m +-1 | 60s +-1 |
|
||||||
|
| a | b | ab | 100m +-1 | 20s +-1 |
|
||||||
|
| b | c | bc | 200m +-1 | 40s +-1 |
|
22
features/testbot/graph.feature
Normal file
22
features/testbot/graph.feature
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@routing @graph
|
||||||
|
Feature: Basic Routing
|
||||||
|
Test the input data descibed on https://github.com/DennisOSRM/Project-OSRM/wiki/Graph-representation
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the profile "testbot"
|
||||||
|
|
||||||
|
@smallest
|
||||||
|
Scenario: Graph transformation
|
||||||
|
Given the node map
|
||||||
|
| | | d |
|
||||||
|
| a | b | c |
|
||||||
|
| | | e |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| abc |
|
||||||
|
| dce |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route |
|
||||||
|
| a | e | abc,dce |
|
@ -162,8 +162,7 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
way.direction = Way.bidirectional
|
way.direction = Way.bidirectional
|
||||||
way.ignore_in_grid = true
|
way.ignore_in_grid = true
|
||||||
if durationIsValid(duration) then
|
if durationIsValid(duration) then
|
||||||
way.speed = math.max( parseDuration(duration) / math.max(1, numberOfNodesInWay-1) )
|
way.duration = math.max( 1, parseDuration(duration) )
|
||||||
way.is_duration_set = true
|
|
||||||
else
|
else
|
||||||
way.speed = route_speeds[route]
|
way.speed = route_speeds[route]
|
||||||
end
|
end
|
||||||
|
@ -49,9 +49,7 @@ function way_function (way, numberOfNodesInWay)
|
|||||||
way.name = name
|
way.name = name
|
||||||
|
|
||||||
if route ~= nil and durationIsValid(duration) then
|
if route ~= nil and durationIsValid(duration) then
|
||||||
way.ignore_in_grid = true
|
way.duration = math.max( 1, parseDuration(duration) )
|
||||||
way.speed = math.max( 1, parseDuration(duration) / math.max(1, numberOfNodesInWay-1) )
|
|
||||||
way.is_duration_set = true
|
|
||||||
else
|
else
|
||||||
way.speed = speed_profile[highway] or speed_profile['default']
|
way.speed = speed_profile[highway] or speed_profile['default']
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user