Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2013-10-10 21:10:09 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:04:16 +0300
commitdabbd775ca1fb49c992c19c15c9161b38fdcd3c2 (patch)
treee48b2e953ed65bd3417850cf61f47f6715741398 /map/track.hpp
parent185538d258aa6a954149657dd3fbd9f27eb4345d (diff)
Recreate track's display list only when scale changed.
Diffstat (limited to 'map/track.hpp')
-rw-r--r--map/track.hpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/map/track.hpp b/map/track.hpp
index 8e17625ae8..85eb587b0e 100644
--- a/map/track.hpp
+++ b/map/track.hpp
@@ -5,70 +5,71 @@
#include "../graphics/color.hpp"
-#include "../std/shared_ptr.hpp"
#include "../std/noncopyable.hpp"
class Navigator;
-class PaintEvent;
-
namespace graphics
{
class Screen;
class DisplayList;
- class PaintEvent;
}
class Track : private noncopyable
{
+ typedef math::Matrix<double, 3, 3> MatrixT;
+
public:
~Track();
typedef m2::PolylineD PolylineD;
Track()
- : m_isVisible(true), m_name("unnamed_track"), m_width(5),
+ : m_isVisible(true), m_width(5),
m_color(graphics::Color::fromARGB(0xFFFF0000)),
m_dList(0)
{}
explicit Track(PolylineD const & polyline)
- : m_isVisible(true), m_name("unnamed_track"), m_width(5),
+ : m_isVisible(true), m_width(5),
m_color(graphics::Color::fromARGB(0xFFFF0000)),
m_polyline(polyline),
m_dList(0)
- {}
+ {
+ ASSERT_GREATER(polyline.GetSize(), 1, ());
+
+ m_rect = m_polyline.GetLimitRect();
+ }
/// @note Move semantics is used here.
Track * CreatePersistent();
- void Draw(shared_ptr<PaintEvent> const & e);
- void UpdateDisplayList(Navigator & navigator, graphics::Screen * dListScreen);
- void DeleteDisplayList();
-
- size_t Size() const;
- m2::RectD GetLimitRect() const;
+ void Draw(graphics::Screen * pScreen, MatrixT const & matrix) const;
+ void CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix) const;
+ void DeleteDisplayList() const;
+ bool HasDisplayList() const { return m_dList != 0; }
/// @name Simple Getters-Setter
//@{
bool IsVisible() const { return m_isVisible; }
void SetVisible(bool visible) { m_isVisible = visible; }
- size_t GetWidth() const { return m_width; }
- void SetWidth(size_t width) { m_width = width; }
+ size_t GetWidth() const { return m_width; }
+ void SetWidth(size_t width) { m_width = width; }
- graphics::Color GetColor() const { return m_color; }
- void SetColor(graphics::Color color) { m_color = color; }
+ graphics::Color GetColor() const { return m_color; }
+ void SetColor(graphics::Color color) { m_color = color; }
- string GetName() const { return m_name; }
- void SetName(string const & name) { m_name = name; }
+ string const & GetName() const { return m_name; }
+ void SetName(string const & name) { m_name = name; }
- double GetLength() const { return m_polyline.GetLength(); }
PolylineD const & GetPolyline() const { return m_polyline; }
+ m2::RectD const & GetLimitRect() const { return m_rect; }
+ //@}
+ double GetLength() const { return m_polyline.GetLength(); }
double GetShortestSquareDistance(m2::PointD const & point) const;
- //@}
void Swap(Track & rhs);
@@ -79,10 +80,7 @@ private:
graphics::Color m_color;
PolylineD m_polyline;
+ m2::RectD m_rect;
- ScreenBase m_screenBase;
- graphics::DisplayList * m_dList;
-
- bool IsViewportChanged(ScreenBase const & sb) const;
- inline bool HasDisplayList() const { return m_dList != 0; }
+ mutable graphics::DisplayList * m_dList;
};