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) VTK_OVERRIDE;
41 
45  static vtkContextTransform *New();
46 
52  void Update() VTK_OVERRIDE;
53 
57  bool Paint(vtkContext2D *painter) VTK_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) VTK_OVERRIDE;
90 
94  vtkVector2f MapFromParent(const vtkVector2f& point) VTK_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) VTK_OVERRIDE;
190 
194  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
195 
199  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
200 
204  bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) VTK_OVERRIDE;
205 
206 protected:
208  ~vtkContextTransform() VTK_OVERRIDE;
209 
211 
212  int PanMouseButton;
213  int PanModifier;
214  int ZoomMouseButton;
215  int ZoomModifier;
216  int SecondaryPanMouseButton;
217  int SecondaryPanModifier;
218  int SecondaryZoomMouseButton;
219  int SecondaryZoomModifier;
220 
221  bool ZoomOnMouseWheel;
222  bool PanYOnMouseWheel;
223 
224  vtkVector2f ZoomAnchor;
225 
226 private:
227  vtkContextTransform(const vtkContextTransform &) VTK_DELETE_FUNCTION;
228  void operator=(const vtkContextTransform &) VTK_DELETE_FUNCTION;
229 
230 };
231 
232 #endif //vtkContextTransform_h
Hold a reference to a vtkObjectBase instance.
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
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
describes linear transformations via a 3x3 matrix
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
base class for items that are part of a vtkContextScene.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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.
Transform
Definition: ADIOSDefs.h:39