VTK  9.3.20240423
vtkAffineRepresentation2D.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
51#ifndef vtkAffineRepresentation2D_h
52#define vtkAffineRepresentation2D_h
53
55#include "vtkInteractionWidgetsModule.h" // For export macro
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkProperty2D;
59class vtkActor2D;
61class vtkPolyData;
62class vtkPoints;
63class vtkCellArray;
64class vtkTextProperty;
66class vtkTextMapper;
67class vtkActor2D;
68
69class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
70{
71public:
76
78
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
86
93 vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
94 vtkGetMacro(BoxWidth, int);
95 vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
96 vtkGetMacro(CircleWidth, int);
97 vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
98 vtkGetMacro(AxesWidth, int);
100
102
107 void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
108 void SetOrigin(double ox, double oy, double oz);
109 vtkGetVector3Macro(Origin, double);
111
120 void GetTransform(vtkTransform* t) override;
121
123
129 vtkGetObjectMacro(Property, vtkProperty2D);
130 vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
131 vtkGetObjectMacro(TextProperty, vtkTextProperty);
133
135
140 vtkSetMacro(DisplayText, vtkTypeBool);
141 vtkGetMacro(DisplayText, vtkTypeBool);
142 vtkBooleanMacro(DisplayText, vtkTypeBool);
144
146
153 void PlaceWidget(double bounds[6]) override;
154 void StartWidgetInteraction(double eventPos[2]) override;
155 void WidgetInteraction(double eventPos[2]) override;
156 void EndWidgetInteraction(double eventPos[2]) override;
157 int ComputeInteractionState(int X, int Y, int modify = 0) override;
158 void BuildRepresentation() override;
160
162
165 void ShallowCopy(vtkProp* prop) override;
168 int RenderOverlay(vtkViewport* viewport) override;
170
171protected:
174
175 // Methods to manipulate the cursor
176 void Translate(double eventPos[2]);
177 void Scale(double eventPos[2]);
178 void Rotate(double eventPos[2]);
179 void Shear(double eventPos[2]);
180 void Highlight(int highlight) override;
181 void UpdateText(const char* text, double eventPos[2]);
182
183 // The width of the widget in normalized viewport coordinates.
187
188 // Display text
190
191 // Internal variables for bookkeeping (in display coordinates unless noted)
195
196 // The internal transformation matrix
199 double Origin[4]; // the current origin in world coordinates
200 double DisplayOrigin[3]; // the current origin in display coordinates
201 double CurrentTranslation[3]; // translation this movement
202 double StartWorldPosition[4]; // Start event position converted to world
203 double StartAngle; // The starting angle (always positive)
205 double CurrentScale[2];
206 double CurrentShear[2];
207 void ApplyShear(); // helper method to apply shear to matrix
208
209 // Properties used to control the appearance of selected objects and
210 // the manipulator in general.
215 double Opacity;
217
218 // Support picking
219 double LastEventPosition[2];
220
221 // These are the classes that form the geometric representation -----------
222 // The label
225
226 // The outer box
232
238
239 // The circle
245
251
252 // The translation axes
257
258private:
260 void operator=(const vtkAffineRepresentation2D&) = delete;
261};
262
263VTK_ABI_NAMESPACE_END
264#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
represent 2D affine transformations
void EndWidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
void GetTransform(vtkTransform *t) override
Retrieve a linear transform characterizing the affine transformation generated by this widget.
void PlaceWidget(double bounds[6]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
void ReleaseGraphicsResources(vtkWindow *) override
Methods to make this class behave as a vtkProp.
void WidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
void Shear(double eventPos[2])
int RenderOverlay(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void UpdateText(const char *text, double eventPos[2])
void Highlight(int highlight) override
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void BuildRepresentation() override
Subclasses of vtkAffineRepresentation2D must implement these methods.
void StartWidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
static vtkAffineRepresentation2D * New()
Instantiate this class.
void GetActors2D(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
void Translate(double eventPos[2])
void SetOrigin(const double o[3])
Specify the origin of the widget (in world coordinates).
int ComputeInteractionState(int X, int Y, int modify=0) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
void SetSelectedProperty(vtkProperty2D *)
Set/Get the properties when unselected and selected.
void SetOrigin(double ox, double oy, double oz)
Specify the origin of the widget (in world coordinates).
void Scale(double eventPos[2])
void Rotate(double eventPos[2])
void SetTextProperty(vtkTextProperty *)
Set/Get the properties when unselected and selected.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void SetProperty(vtkProperty2D *)
Set/Get the properties when unselected and selected.
~vtkAffineRepresentation2D() override
abstract class for representing affine transformation widgets
object to represent cell connectivity
a simple class to control print indentation
Definition vtkIndent.h:108
create a leader with optional label and arrows
represent and manipulate 3D points
Definition vtkPoints.h:139
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
represent surface properties of a 2D image
2D text annotation
represent text properties.
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:144