VTK  9.0.20210616
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 "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 class vtkTransform2D;
35 
36 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
37 {
38 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
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 
85 
90 
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:
209 
211 
220 
223 
225 
226 private:
227  vtkContextTransform(const vtkContextTransform&) = delete;
228  void operator=(const vtkContextTransform&) = delete;
229 };
230 
231 #endif // vtkContextTransform_h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:35
vtkContextTransform::Transform
vtkSmartPointer< vtkTransform2D > Transform
Definition: vtkContextTransform.h:210
vtkContextTransform::Rotate
virtual void Rotate(float angle)
Rotate the item by the specified angle.
vtkContextTransform::Hit
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the transform is interactive, false otherwise.
vtkAbstractContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkAbstractContextItem.h:41
vtkTransform2D
describes linear transformations via a 3x3 matrix
Definition: vtkTransform2D.h:46
vtkContextTransform::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkContextTransform::SecondaryPanModifier
int SecondaryPanModifier
Definition: vtkContextTransform.h:217
vtkContextTransform::PanMouseButton
int PanMouseButton
Definition: vtkContextTransform.h:212
vtkContextTransform::ZoomAnchor
vtkVector2f ZoomAnchor
Definition: vtkContextTransform.h:224
vtkSmartPointer< vtkTransform2D >
vtkVector.h
vtkContextTransform::MapToParent
vtkVector2f MapToParent(const vtkVector2f &point) override
Transforms a point to the parent coordinate system.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
vtkContextTransform::ZoomModifier
int ZoomModifier
Definition: vtkContextTransform.h:215
vtkContextTransform::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
vtkContextTransform::MouseMoveEvent
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkContextTransform::PanModifier
int PanModifier
Definition: vtkContextTransform.h:213
vtkContextTransform::vtkContextTransform
vtkContextTransform()
vtkContextTransform::New
static vtkContextTransform * New()
Creates a vtkContextTransform object.
vtkX3D::point
@ point
Definition: vtkX3D.h:242
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:216
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkContextTransform::GetTransform
virtual vtkTransform2D * GetTransform()
Access the vtkTransform2D that controls object transformation.
vtkSmartPointer.h
vtkContextTransform::Identity
virtual void Identity()
Reset the transform to the identity transformation.
vtkContextTransform::~vtkContextTransform
~vtkContextTransform() override
vtkAbstractContextItem.h
vtkContextTransform
all children of this item are transformed by the vtkTransform2D of this item.
Definition: vtkContextTransform.h:37
vtkContextTransform::MapFromParent
vtkVector2f MapFromParent(const vtkVector2f &point) override
Transforms a point from the parent coordinate system.
vtkContextTransform::ZoomMouseButton
int ZoomMouseButton
Definition: vtkContextTransform.h:214
vtkContextTransform::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkContextTransform::MouseButtonPressEvent
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse press event.
vtkContextTransform::SecondaryZoomModifier
int SecondaryZoomModifier
Definition: vtkContextTransform.h:219
vtkContextTransform::SecondaryZoomMouseButton
int SecondaryZoomMouseButton
Definition: vtkContextTransform.h:218
vtkContextTransform::ZoomOnMouseWheel
bool ZoomOnMouseWheel
Definition: vtkContextTransform.h:221
vtkContextTransform::PanYOnMouseWheel
bool PanYOnMouseWheel
Definition: vtkContextTransform.h:222
vtkVector2f
Definition: vtkVector.h:432
vtkContextTransform::MouseWheelEvent
bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override
Mouse wheel event.
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.