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

events.hpp « render - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 81756179c023b6e80fe3f16bb12c98801ae2a959 (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
74
75
76
77
78
79
80
81
82
#pragma once

#include "geometry/screenbase.hpp"
#include "geometry/point2d.hpp"

#include "base/commands_queue.hpp"


class DragEvent
{
  m2::PointD m_pt;
public:
  DragEvent(double x, double y) : m_pt(x, y) {}
  inline m2::PointD const & Pos() const { return m_pt; }
};

class RotateEvent
{
  double m_Angle;
public:
  RotateEvent(double x1, double y1, double x2, double y2)
  {
    m_Angle = atan2(y2 - y1, x2 - x1);
  }

  inline double Angle() const { return m_Angle; }
};

class ScaleEvent
{
  m2::PointD m_Pt1, m_Pt2;
public:
  ScaleEvent(double x1, double y1, double x2, double y2) : m_Pt1(x1, y1), m_Pt2(x2, y2) {}
  inline m2::PointD const & Pt1() const { return m_Pt1; }
  inline m2::PointD const & Pt2() const { return m_Pt2; }
};

class ScaleToPointEvent
{
  m2::PointD m_Pt1;
  double m_factor;
public:
  ScaleToPointEvent(double x1, double y1, double factor) : m_Pt1(x1, y1), m_factor(factor) {}
  inline m2::PointD const & Pt() const { return m_Pt1; }
  inline double ScaleFactor() const { return m_factor; }
};

#ifndef USE_DRAPE
class Drawer;

class PaintEvent
{
  Drawer * m_drawer;
  core::CommandsQueue::Environment const * m_env;
  bool m_isCancelled;
  bool m_isEmptyDrawing;

public:
  PaintEvent(Drawer * drawer, core::CommandsQueue::Environment const * env = 0);

  Drawer * drawer() const;
  void cancel();
  bool isCancelled() const;
  bool isEmptyDrawing() const;
  void setIsEmptyDrawing(bool flag);
};

class PaintOverlayEvent
{
public:
  PaintOverlayEvent(Drawer * drawer, ScreenBase const & modelView)
    : m_drawer(drawer), m_modelView(modelView) {}

  ScreenBase const & GetModelView() const { return m_modelView; }
  Drawer * GetDrawer() const { return m_drawer; }
  m2::RectD const & GetClipRect() const { return m_modelView.ClipRect(); }

private:
  Drawer * m_drawer;
  ScreenBase m_modelView;
};
#endif // USE_DRAPE