VTK: Rendering/Context2D/vtkContextTransform.h Source File

| VTK 9.3.1

vtkContextTransform.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3
26 #ifndef vtkContextTransform_h
27 #define vtkContextTransform_h
28
29 #include "vtkAbstractContextItem.h"
30 #include "vtkRenderingContext2DModule.h" // For export macro
31 #include "vtkSmartPointer.h" // Needed for SP ivars.
32 #include "vtkVector.h" // Needed for ivars.
33
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkTransform2D;
36
37 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
38 {
39 public:
40 vtkTypeMacro(vtkContextTransform, vtkAbstractContextItem);
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
46 static vtkContextTransform* New();
47
53 void Update() override;
54
58 bool Paint(vtkContext2D* painter) override;
59
63 virtual void Identity();
64
69 virtual void Translate(float dx, float dy);
70
75 virtual void Scale(float dx, float dy);
76
80 virtual void Rotate(float angle);
81
85 virtual vtkTransform2D* GetTransform();
86
90 vtkVector2f MapToParent(const vtkVector2f& point) override;
91
95 vtkVector2f MapFromParent(const vtkVector2f& point) override;
96
98
102 vtkSetMacro(PanMouseButton, int);
103 vtkGetMacro(PanMouseButton, int);
105
107
111 vtkSetMacro(PanModifier, int);
112 vtkGetMacro(PanModifier, int);
114
116
120 vtkSetMacro(SecondaryPanMouseButton, int);
121 vtkGetMacro(SecondaryPanMouseButton, int);
123
125
129 vtkSetMacro(SecondaryPanModifier, int);
130 vtkGetMacro(SecondaryPanModifier, int);
132
134
138 vtkSetMacro(ZoomMouseButton, int);
139 vtkGetMacro(ZoomMouseButton, int);
141
143
147 vtkSetMacro(ZoomModifier, int);
148 vtkGetMacro(ZoomModifier, int);
150
152
156 vtkSetMacro(SecondaryZoomMouseButton, int);
157 vtkGetMacro(SecondaryZoomMouseButton, int);
159
161
165 vtkSetMacro(SecondaryZoomModifier, int);
166 vtkGetMacro(SecondaryZoomModifier, int);
168
170
173 vtkSetMacro(ZoomOnMouseWheel, bool);
174 vtkGetMacro(ZoomOnMouseWheel, bool);
175 vtkBooleanMacro(ZoomOnMouseWheel, bool);
177
179
182 vtkSetMacro(PanYOnMouseWheel, bool);
183 vtkGetMacro(PanYOnMouseWheel, bool);
184 vtkBooleanMacro(PanYOnMouseWheel, bool);
186
190 bool Hit(const vtkContextMouseEvent& mouse) override;
191
195 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
196
200 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
201
205 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
206
207 protected:
208 vtkContextTransform();
209 ~vtkContextTransform() override;
210
211 vtkSmartPointer<vtkTransform2D> Transform;
212
213 int PanMouseButton;
214 int PanModifier;
215 int ZoomMouseButton;
216 int ZoomModifier;
217 int SecondaryPanMouseButton;
218 int SecondaryPanModifier;
219 int SecondaryZoomMouseButton;
220 int SecondaryZoomModifier;
221
222 bool ZoomOnMouseWheel;
223 bool PanYOnMouseWheel;
224
225 vtkVector2f ZoomAnchor;
226
227 private:
228 vtkContextTransform(const vtkContextTransform&) = delete;
229 void operator=(const vtkContextTransform&) = delete;
230 };
231
232 VTK_ABI_NAMESPACE_END
233 #endif // vtkContextTransform_h
vtkAbstractContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkAbstractContextItem.h:30
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:39
vtkContextTransform
all children of this item are transformed by the vtkTransform2D of this item.
Definition: vtkContextTransform.h:38
vtkContextTransform::PanYOnMouseWheel
bool PanYOnMouseWheel
Definition: vtkContextTransform.h:223
vtkContextTransform::ZoomAnchor
vtkVector2f ZoomAnchor
Definition: vtkContextTransform.h:225
vtkContextTransform::PanModifier
int PanModifier
Definition: vtkContextTransform.h:214
vtkContextTransform::vtkContextTransform
vtkContextTransform()
vtkContextTransform::SecondaryPanModifier
int SecondaryPanModifier
Definition: vtkContextTransform.h:218
vtkContextTransform::ZoomMouseButton
int ZoomMouseButton
Definition: vtkContextTransform.h:215
vtkContextTransform::MouseWheelEvent
bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override
Mouse wheel event.
vtkContextTransform::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
vtkContextTransform::Identity
virtual void Identity()
Reset the transform to the identity transformation.
vtkContextTransform::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkContextTransform::GetTransform
virtual vtkTransform2D * GetTransform()
Access the vtkTransform2D that controls object transformation.
vtkContextTransform::Translate
virtual void Translate(float dx, float dy)
Translate the item by the specified amounts dx and dy in the x and y directions.
vtkContextTransform::SecondaryPanMouseButton
int SecondaryPanMouseButton
Definition: vtkContextTransform.h:217
vtkContextTransform::SecondaryZoomMouseButton
int SecondaryZoomMouseButton
Definition: vtkContextTransform.h:219
vtkContextTransform::MouseMoveEvent
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkContextTransform::MouseButtonPressEvent
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse press event.
vtkContextTransform::MapToParent
vtkVector2f MapToParent(const vtkVector2f &point) override
Transforms a point to the parent coordinate system.
vtkContextTransform::New
static vtkContextTransform * New()
Creates a vtkContextTransform object.
vtkContextTransform::Hit
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the transform is interactive, false otherwise.
vtkContextTransform::~vtkContextTransform
~vtkContextTransform() override
vtkContextTransform::ZoomModifier
int ZoomModifier
Definition: vtkContextTransform.h:216
vtkContextTransform::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkContextTransform::MapFromParent
vtkVector2f MapFromParent(const vtkVector2f &point) override
Transforms a point from the parent coordinate system.
vtkContextTransform::ZoomOnMouseWheel
bool ZoomOnMouseWheel
Definition: vtkContextTransform.h:222
vtkContextTransform::PanMouseButton
int PanMouseButton
Definition: vtkContextTransform.h:213
vtkContextTransform::Scale
virtual void Scale(float dx, float dy)
Scale the item by the specified amounts dx and dy in the x and y directions.
vtkContextTransform::Transform
vtkSmartPointer< vtkTransform2D > Transform
Definition: vtkContextTransform.h:211
vtkContextTransform::Rotate
virtual void Rotate(float angle)
Rotate the item by the specified angle.
vtkContextTransform::SecondaryZoomModifier
int SecondaryZoomModifier
Definition: vtkContextTransform.h:220
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSmartPointer< vtkTransform2D >
vtkTransform2D
describes linear transformations via a 3x3 matrix
Definition: vtkTransform2D.h:41
vtkVector2f
Definition: vtkVector.h:463
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkAbstractContextItem.h
vtkSmartPointer.h
vtkVector.h