VTK
vtkContextTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextItem.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
26 #ifndef vtkContextTransform_h
27 #define vtkContextTransform_h
28 
29 #include "vtkRenderingContext2DModule.h" // For export macro
30 #include "vtkAbstractContextItem.h"
31 #include "vtkSmartPointer.h" // Needed for SP ivars.
32 #include "vtkVector.h" // Needed for ivars.
33 
34 class vtkTransform2D;
35 
36 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
37 {
38 public:
40  void PrintSelf(ostream &os, vtkIndent indent) override;
41 
45  static vtkContextTransform *New();
46 
52  void Update() override;
53 
57  bool Paint(vtkContext2D *painter) override;
58 
62  virtual void Identity();
63 
68  virtual void Translate(float dx, float dy);
69 
74  virtual void Scale(float dx, float dy);
75 
79  virtual void Rotate(float angle);
80 
84  virtual vtkTransform2D* GetTransform();
85 
89  vtkVector2f MapToParent(const vtkVector2f& point) override;
90 
94  vtkVector2f MapFromParent(const vtkVector2f& point) override;
95 
97 
101  vtkSetMacro(PanMouseButton, int);
102  vtkGetMacro(PanMouseButton, int);
104 
106 
110  vtkSetMacro(PanModifier, int);
111  vtkGetMacro(PanModifier, int);
113 
115 
119  vtkSetMacro(SecondaryPanMouseButton, int);
120  vtkGetMacro(SecondaryPanMouseButton, int);
122 
124 
128  vtkSetMacro(SecondaryPanModifier, int);
129  vtkGetMacro(SecondaryPanModifier, int);
131 
133 
137  vtkSetMacro(ZoomMouseButton, int);
138  vtkGetMacro(ZoomMouseButton, int);
140 
142 
146  vtkSetMacro(ZoomModifier, int);
147  vtkGetMacro(ZoomModifier, int);
149 
151 
155  vtkSetMacro(SecondaryZoomMouseButton, int);
156  vtkGetMacro(SecondaryZoomMouseButton, int);
158 
160 
164  vtkSetMacro(SecondaryZoomModifier, int);
165  vtkGetMacro(SecondaryZoomModifier, int);
167 
169 
172  vtkSetMacro(ZoomOnMouseWheel, bool);
173  vtkGetMacro(ZoomOnMouseWheel, bool);
174  vtkBooleanMacro(ZoomOnMouseWheel, bool);
176 
178 
181  vtkSetMacro(PanYOnMouseWheel, bool);
182  vtkGetMacro(PanYOnMouseWheel, bool);
183  vtkBooleanMacro(PanYOnMouseWheel, bool);
185 
189  bool Hit(const vtkContextMouseEvent &mouse) override;
190 
194  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
195 
199  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
200 
204  bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override;
205 
206 protected:
208  ~vtkContextTransform() override;
209 
211 
220 
223 
225 
226 private:
227  vtkContextTransform(const vtkContextTransform &) = delete;
228  void operator=(const vtkContextTransform &) = delete;
229 
230 };
231 
232 #endif //vtkContextTransform_h
virtual vtkVector2f MapFromParent(const vtkVector2f &point)
Maps the point from the parent coordinate system.
virtual vtkVector2f MapToParent(const vtkVector2f &point)
Maps the point to the parent coordinate system.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
all children of this item are transformed by the vtkTransform2D of this item.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartPointer< vtkTransform2D > Transform
describes linear transformations via a 3x3 matrix
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
base class for items that are part of a vtkContextScene.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Update()
Perform any updates to the item that may be necessary before rendering.