Removing name substitution for now; Using Euclidean distance
approximation
This commit is contained in:
parent
81d26d7702
commit
b247c20dbf
@ -91,7 +91,7 @@ void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLe
|
|||||||
/** starts at index 1 */
|
/** starts at index 1 */
|
||||||
pathDescription[0].length = 0;
|
pathDescription[0].length = 0;
|
||||||
for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
||||||
pathDescription[i].length = ApproximateDistance(pathDescription[i-1].location, pathDescription[i].location);
|
pathDescription[i].length = ApproximateDistanceByEuclid(pathDescription[i-1].location, pathDescription[i].location);
|
||||||
}
|
}
|
||||||
|
|
||||||
double lengthOfSegment = 0;
|
double lengthOfSegment = 0;
|
||||||
@ -111,32 +111,37 @@ void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLe
|
|||||||
becomes:
|
becomes:
|
||||||
10. Turn left on B 36 for 35 km
|
10. Turn left on B 36 for 35 km
|
||||||
*/
|
*/
|
||||||
unsigned lastTurn = 0;
|
//TODO: rework to check only end and start of string.
|
||||||
for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
// stl string is way to expensive
|
||||||
string1 = sEngine.GetEscapedNameForNameID(pathDescription[i].nameID);
|
|
||||||
if(TurnInstructionsClass::GoStraight == pathDescription[i].turnInstruction) {
|
// unsigned lastTurn = 0;
|
||||||
if(std::string::npos != string0.find(string1+";") ||
|
// for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
||||||
std::string::npos != string0.find(";"+string1) ||
|
// string1 = sEngine.GetEscapedNameForNameID(pathDescription[i].nameID);
|
||||||
std::string::npos != string0.find(string1+" ;") ||
|
// if(TurnInstructionsClass::GoStraight == pathDescription[i].turnInstruction) {
|
||||||
std::string::npos != string0.find("; "+string1)){
|
// if(std::string::npos != string0.find(string1+";")
|
||||||
|
// || std::string::npos != string0.find(";"+string1)
|
||||||
|
// || std::string::npos != string0.find(string1+" ;")
|
||||||
|
// || std::string::npos != string0.find("; "+string1)
|
||||||
|
// ){
|
||||||
// INFO("->next correct: " << string0 << " contains " << string1);
|
// INFO("->next correct: " << string0 << " contains " << string1);
|
||||||
for(; lastTurn != i; ++lastTurn)
|
// for(; lastTurn != i; ++lastTurn)
|
||||||
pathDescription[lastTurn].nameID = pathDescription[i].nameID;
|
// pathDescription[lastTurn].nameID = pathDescription[i].nameID;
|
||||||
pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
|
// pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
|
||||||
} else if(std::string::npos != string1.find(string0+";") ||
|
// } else if(std::string::npos != string1.find(string0+";")
|
||||||
std::string::npos != string1.find(";"+string0) ||
|
// || std::string::npos != string1.find(";"+string0)
|
||||||
std::string::npos != string1.find(string0+" ;")||
|
// || std::string::npos != string1.find(string0+" ;")
|
||||||
std::string::npos != string1.find("; "+string0)) {
|
// || std::string::npos != string1.find("; "+string0)
|
||||||
|
// ){
|
||||||
// INFO("->prev correct: " << string1 << " contains " << string0);
|
// INFO("->prev correct: " << string1 << " contains " << string0);
|
||||||
pathDescription[i].nameID = pathDescription[i-1].nameID;
|
// pathDescription[i].nameID = pathDescription[i-1].nameID;
|
||||||
pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
|
// pathDescription[i].turnInstruction = TurnInstructionsClass::NoTurn;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
|
// if (TurnInstructionsClass::NoTurn != pathDescription[i].turnInstruction) {
|
||||||
lastTurn = i;
|
// lastTurn = i;
|
||||||
}
|
// }
|
||||||
string0 = string1;
|
// string0 = string1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
for(unsigned i = 1; i < pathDescription.size(); ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user