Don't remove small segments at start/begin if they are vias

This commit is contained in:
Patrick Niklaus 2015-06-02 17:51:17 +02:00
parent 71dc10ebea
commit 9967dbbaa9

View File

@ -173,6 +173,7 @@ void DescriptionFactory::Run(const unsigned zoom_level)
// } // }
// string0 = string1; // string0 = string1;
// } // }
//
float segment_length = 0.; float segment_length = 0.;
EdgeWeight segment_duration = 0; EdgeWeight segment_duration = 0;
@ -197,7 +198,8 @@ void DescriptionFactory::Run(const unsigned zoom_level)
// Post-processing to remove empty or nearly empty path segments // Post-processing to remove empty or nearly empty path segments
if (path_description.size() > 2 && if (path_description.size() > 2 &&
std::numeric_limits<float>::epsilon() > path_description.back().length) std::numeric_limits<float>::epsilon() > path_description.back().length &&
!(path_description.end() - 2)->is_via_location)
{ {
path_description.pop_back(); path_description.pop_back();
path_description.back().necessary = true; path_description.back().necessary = true;
@ -206,7 +208,8 @@ void DescriptionFactory::Run(const unsigned zoom_level)
} }
if (path_description.size() > 2 && if (path_description.size() > 2 &&
std::numeric_limits<float>::epsilon() > path_description.front().length) std::numeric_limits<float>::epsilon() > path_description.front().length &&
!(path_description.begin() + 1)->is_via_location)
{ {
path_description.erase(path_description.begin()); path_description.erase(path_description.begin());
path_description.front().turn_instruction = TurnInstruction::HeadOn; path_description.front().turn_instruction = TurnInstruction::HeadOn;