diff options
author | vng <viktor.govako@gmail.com> | 2013-10-11 18:47:02 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:04:16 +0300 |
commit | ed41bd902a5834e7ea4fd01587f34080c5ff2206 (patch) | |
tree | 5354e6fd471334e38bb76f6fab7bc70a5bd463f3 /map/track.cpp | |
parent | dabbd775ca1fb49c992c19c15c9161b38fdcd3c2 (diff) |
[tracks] Simplify path before display list creation.
Diffstat (limited to 'map/track.cpp')
-rw-r--r-- | map/track.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/map/track.cpp b/map/track.cpp index c77f6ad5a7..0f84f75e1f 100644 --- a/map/track.cpp +++ b/map/track.cpp @@ -6,6 +6,7 @@ #include "../graphics/display_list.hpp" #include "../geometry/distance.hpp" +#include "../geometry/simplification.hpp" #include "../base/timer.hpp" #include "../base/logging.hpp" @@ -62,11 +63,18 @@ void Track::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matri graphics::Pen::Info info(m_color, m_width); uint32_t resId = dlScreen->mapInfo(info); - /// @todo add simplification - vector<m2::PointD> pts(m_polyline.GetSize()); - transform(m_polyline.Begin(), m_polyline.End(), pts.begin(), DoLeftProduct<MatrixT>(matrix)); + typedef buffer_vector<m2::PointD, 32> PointContainerT; + size_t const count = m_polyline.GetSize(); - dlScreen->drawPath(pts.data(), pts.size(), 0, resId, graphics::tracksDepth); + PointContainerT pts1(count); + transform(m_polyline.Begin(), m_polyline.End(), pts1.begin(), DoLeftProduct<MatrixT>(matrix)); + + PointContainerT pts2; + pts2.reserve(count); + SimplifyDP(pts1.begin(), pts1.end(), math::sqr(m_width), + m2::DistanceToLineSquare<m2::PointD>(), MakeBackInsertFunctor(pts2)); + + dlScreen->drawPath(pts2.data(), pts2.size(), 0, resId, graphics::tracksDepth); dlScreen->setDisplayList(0); dlScreen->endFrame(); |