diff options
author | Dmitry Kunin <dkunin@mapswith.me> | 2013-07-26 16:46:31 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:04:11 +0300 |
commit | 129178ca622dbe1dfec60ff8972795a7e7e35350 (patch) | |
tree | 7fd689dee50ea00b58930340fea6de0125d1e687 /map/track.cpp | |
parent | ed9502b18cd5f1680bd133a77b3d6acb91098220 (diff) |
[core] base classes for track, polyline
Diffstat (limited to 'map/track.cpp')
-rw-r--r-- | map/track.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/map/track.cpp b/map/track.cpp new file mode 100644 index 0000000000..bf6a082961 --- /dev/null +++ b/map/track.cpp @@ -0,0 +1,36 @@ +#include "track.hpp" +#include "../graphics/screen.hpp" +#include "../graphics/pen.hpp" +#include "../graphics/depth_constants.hpp" +#include "drawer.hpp" +#include "../geometry/screenbase.hpp" + +void Track::Draw(shared_ptr<PaintEvent> const & e) +{ + // do not draw degenerated points + if (Size() < 2) + return; + + graphics::Screen * screen = e->drawer()->screen(); + ScreenBase sb; + // pen + graphics::Pen::Info info(m_color, m_width); + uint32_t resId = screen->mapInfo(info); + + // depth + const double depth = graphics::debugDepth; + + // offset + const size_t offset = 0; + + // points + vector<m2::PointD> pixPoints(m_polyline.m_points.size()); + for (int i=0; i < pixPoints.size(); ++i) + pixPoints[i] = sb.GtoP(m_polyline.m_points[i]); + // add matrix? + + screen->drawPath(&pixPoints[0], pixPoints.size(), offset, resId, depth); +} + +m2::RectD Track::GetLimitRect() { return m_polyline.GetLimitRect(); } +size_t Track::Size() { return m_polyline.m_points.size(); } |