From 9967dbbaa93209809c9dab7a99aae2746ee687cf Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 2 Jun 2015 17:51:17 +0200 Subject: [PATCH] Don't remove small segments at start/begin if they are vias --- descriptors/description_factory.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/descriptors/description_factory.cpp b/descriptors/description_factory.cpp index e4665622f..71dd79513 100644 --- a/descriptors/description_factory.cpp +++ b/descriptors/description_factory.cpp @@ -173,6 +173,7 @@ void DescriptionFactory::Run(const unsigned zoom_level) // } // string0 = string1; // } + // float segment_length = 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 if (path_description.size() > 2 && - std::numeric_limits::epsilon() > path_description.back().length) + std::numeric_limits::epsilon() > path_description.back().length && + !(path_description.end() - 2)->is_via_location) { path_description.pop_back(); path_description.back().necessary = true; @@ -206,7 +208,8 @@ void DescriptionFactory::Run(const unsigned zoom_level) } if (path_description.size() > 2 && - std::numeric_limits::epsilon() > path_description.front().length) + std::numeric_limits::epsilon() > path_description.front().length && + !(path_description.begin() + 1)->is_via_location) { path_description.erase(path_description.begin()); path_description.front().turn_instruction = TurnInstruction::HeadOn;