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

compass_arrow.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa9dd13adb89d50b29175075f09eeed370b18a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once

#include "gui/element.hpp"

#include "std/shared_ptr.hpp"
#include "std/unique_ptr.hpp"


namespace anim
{
  class Task;
}

namespace graphics
{
  class DisplayList;
  struct Resource;
}

class Framework;

/// Compass Arrow, which shows up when the screen is rotated,
/// and rotates screen back to straight orientation when beeing pressed
class CompassArrow : public gui::Element
{
  typedef gui::Element BaseT;

  mutable m2::PointI m_pixelSize;
  double m_angle;

  unique_ptr<graphics::DisplayList> m_dl;

  shared_ptr<anim::Task> m_animTask;

  void AlfaAnimEnded(bool isVisible);
  bool IsHidingAnim() const;
  float GetCurrentAlfa() const;
  void CreateAnim(double startAlfa, double endAlfa, double timeInterval, double timeOffset, bool isVisibleAtEnd);

  Framework * m_framework;
  graphics::Resource const * GetCompassResource() const;

  bool isBaseVisible() const;

public:
  struct Params : public BaseT::Params
  {
    Framework * m_framework;
    Params();
  };

  CompassArrow(Params const & p);

  void AnimateShow();
  void AnimateHide();

  void SetAngle(double angle);
  m2::PointI GetPixelSize() const;

  /// @name Override from graphics::Overlayelement and gui::Element.
  //@{
  virtual void GetMiniBoundRects(RectsT & rects) const;

  void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
  bool isVisible() const;
  bool hitTest(m2::PointD const & pt) const;

  void cache();
  void purge();

  bool onTapEnded(m2::PointD const & pt);
  //@}
};