Fixes test cucumber --tags @basic:63 and issue #105

This commit is contained in:
DennisOSRM 2012-02-14 17:17:11 +01:00
parent 0727ff09fa
commit 84b35f47a1

View File

@ -95,27 +95,32 @@ void DescriptionFactory::Run(const unsigned zoomLevel, const unsigned duration)
indexOfSegmentBegin = i; indexOfSegmentBegin = i;
} }
} }
// INFO("#segs: " << pathDescription.size());
//Post-processing to remove empty or nearly empty path segments //Post-processing to remove empty or nearly empty path segments
if(0. == startPhantom.ratio || 0 == pathDescription[0].length) { if(0 == pathDescription.back().length) {
if(pathDescription.size() > 2) // INFO("#segs: " << pathDescription.size() << ", last ratio: " << targetPhantom.ratio << ", length: " << pathDescription.back().length);
pathDescription.erase(pathDescription.begin()); if(pathDescription.size() > 2){
pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
pathDescription[0].necessary = true;
startPhantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
} else {
pathDescription[0].duration *= startPhantom.ratio;
}
if(1. == targetPhantom.ratio || 0 == pathDescription.back().length) {
if(pathDescription.size() > 2)
pathDescription.pop_back(); pathDescription.pop_back();
pathDescription.back().necessary = true; pathDescription.back().necessary = true;
pathDescription.back().turnInstruction = TurnInstructions.NoTurn; pathDescription.back().turnInstruction = TurnInstructions.NoTurn;
targetPhantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID; targetPhantom.nodeBasedEdgeNameID = (pathDescription.end()-2)->nameID;
// INFO("Deleting last turn instruction"); // INFO("Deleting last turn instruction");
}
} else { } else {
pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio); pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio);
} }
if(0 == pathDescription[0].length) {
if(pathDescription.size() > 2) {
pathDescription.erase(pathDescription.begin());
pathDescription[0].turnInstruction = TurnInstructions.HeadOn;
pathDescription[0].necessary = true;
startPhantom.nodeBasedEdgeNameID = pathDescription[0].nameID;
// INFO("Deleting first turn instruction, ratio: " << startPhantom.ratio << ", length: " << pathDescription[0].length);
}
} else {
pathDescription[0].duration *= startPhantom.ratio;
}
//Generalize poly line //Generalize poly line
dp.Run(pathDescription, zoomLevel); dp.Run(pathDescription, zoomLevel);