VTK  9.1.0
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
45#ifndef vtkContextTransform_h
46#define vtkContextTransform_h
47
49#include "vtkRenderingContext2DModule.h" // For export macro
50#include "vtkSmartPointer.h" // Needed for SP ivars.
51#include "vtkVector.h" // Needed for ivars.
52
53class vtkTransform2D;
54
55class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
56{
57public:
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
65
71 void Update() override;
72
76 bool Paint(vtkContext2D* painter) override;
77
81 virtual void Identity();
82
87 virtual void Translate(float dx, float dy);
88
93 virtual void Scale(float dx, float dy);
94
98 virtual void Rotate(float angle);
99
104
108 vtkVector2f MapToParent(const vtkVector2f& point) override;
109
113 vtkVector2f MapFromParent(const vtkVector2f& point) override;
114
116
120 vtkSetMacro(PanMouseButton, int);
121 vtkGetMacro(PanMouseButton, int);
123
125
129 vtkSetMacro(PanModifier, int);
130 vtkGetMacro(PanModifier, int);
132
134
138 vtkSetMacro(SecondaryPanMouseButton, int);
139 vtkGetMacro(SecondaryPanMouseButton, int);
141
143
147 vtkSetMacro(SecondaryPanModifier, int);
148 vtkGetMacro(SecondaryPanModifier, int);
150
152
156 vtkSetMacro(ZoomMouseButton, int);
157 vtkGetMacro(ZoomMouseButton, int);
159
161
165 vtkSetMacro(ZoomModifier, int);
166 vtkGetMacro(ZoomModifier, int);
168
170
174 vtkSetMacro(SecondaryZoomMouseButton, int);
175 vtkGetMacro(SecondaryZoomMouseButton, int);
177
179
183 vtkSetMacro(SecondaryZoomModifier, int);
184 vtkGetMacro(SecondaryZoomModifier, int);
186
188
191 vtkSetMacro(ZoomOnMouseWheel, bool);
192 vtkGetMacro(ZoomOnMouseWheel, bool);
193 vtkBooleanMacro(ZoomOnMouseWheel, bool);
195
197
200 vtkSetMacro(PanYOnMouseWheel, bool);
201 vtkGetMacro(PanYOnMouseWheel, bool);
202 vtkBooleanMacro(PanYOnMouseWheel, bool);
204
208 bool Hit(const vtkContextMouseEvent& mouse) override;
209
213 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
214
218 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
219
223 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
224
225protected:
228
230
239
242
244
245private:
247 void operator=(const vtkContextTransform&) = delete;
248};
249
250#endif // vtkContextTransform_h
base class for items that are part of a vtkContextScene.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
data structure to represent mouse events.
all children of this item are transformed by the vtkTransform2D of this item.
static vtkContextTransform * New()
Creates a vtkContextTransform object.
bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override
Mouse wheel event.
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
virtual void Identity()
Reset the transform to the identity transformation.
virtual vtkTransform2D * GetTransform()
Access the vtkTransform2D that controls object transformation.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void Translate(float dx, float dy)
Translate the item by the specified amounts dx and dy in the x and y directions.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse press event.
vtkVector2f MapToParent(const vtkVector2f &point) override
Transforms a point to the parent coordinate system.
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the transform is interactive, false otherwise.
~vtkContextTransform() override
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkVector2f MapFromParent(const vtkVector2f &point) override
Transforms a point from the parent coordinate system.
virtual void Scale(float dx, float dy)
Scale the item by the specified amounts dx and dy in the x and y directions.
vtkSmartPointer< vtkTransform2D > Transform
virtual void Rotate(float angle)
Rotate the item by the specified angle.
a simple class to control print indentation
Definition: vtkIndent.h:113
Hold a reference to a vtkObjectBase instance.
describes linear transformations via a 3x3 matrix