VTK  9.3.1
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
32 #ifndef vtkAffineRepresentation2D_h
33 #define vtkAffineRepresentation2D_h
34 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkProperty2D;
40 class vtkActor2D;
42 class vtkPolyData;
43 class vtkPoints;
44 class vtkCellArray;
45 class vtkTextProperty;
46 class vtkLeaderActor2D;
47 class vtkTextMapper;
48 class vtkActor2D;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
51 {
52 public:
57 
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
74  vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
75  vtkGetMacro(BoxWidth, int);
76  vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
77  vtkGetMacro(CircleWidth, int);
78  vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
79  vtkGetMacro(AxesWidth, int);
81 
83 
88  void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
89  void SetOrigin(double ox, double oy, double oz);
90  vtkGetVector3Macro(Origin, double);
92 
101  void GetTransform(vtkTransform* t) override;
102 
104 
107  void SetProperty(vtkProperty2D*);
108  void SetSelectedProperty(vtkProperty2D*);
109  void SetTextProperty(vtkTextProperty*);
110  vtkGetObjectMacro(Property, vtkProperty2D);
111  vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
112  vtkGetObjectMacro(TextProperty, vtkTextProperty);
114 
116 
121  vtkSetMacro(DisplayText, vtkTypeBool);
122  vtkGetMacro(DisplayText, vtkTypeBool);
123  vtkBooleanMacro(DisplayText, vtkTypeBool);
125 
127 
134  void PlaceWidget(double bounds[6]) override;
135  void StartWidgetInteraction(double eventPos[2]) override;
136  void WidgetInteraction(double eventPos[2]) override;
137  void EndWidgetInteraction(double eventPos[2]) override;
138  int ComputeInteractionState(int X, int Y, int modify = 0) override;
139  void BuildRepresentation() override;
141 
143 
146  void ShallowCopy(vtkProp* prop) override;
147  void GetActors2D(vtkPropCollection*) override;
148  void ReleaseGraphicsResources(vtkWindow*) override;
149  int RenderOverlay(vtkViewport* viewport) override;
151 
152 protected:
154  ~vtkAffineRepresentation2D() override;
155 
156  // Methods to manipulate the cursor
157  void Translate(double eventPos[2]);
158  void Scale(double eventPos[2]);
159  void Rotate(double eventPos[2]);
160  void Shear(double eventPos[2]);
161  void Highlight(int highlight) override;
162  void UpdateText(const char* text, double eventPos[2]);
163 
164  // The width of the widget in normalized viewport coordinates.
165  int BoxWidth;
168 
169  // Display text
171 
172  // Internal variables for bookkeeping (in display coordinates unless noted)
173  double CurrentWidth;
176 
177  // The internal transformation matrix
180  double Origin[4]; // the current origin in world coordinates
181  double DisplayOrigin[3]; // the current origin in display coordinates
182  double CurrentTranslation[3]; // translation this movement
183  double StartWorldPosition[4]; // Start event position converted to world
184  double StartAngle; // The starting angle (always positive)
185  double CurrentAngle;
186  double CurrentScale[2];
187  double CurrentShear[2];
188  void ApplyShear(); // helper method to apply shear to matrix
189 
190  // Properties used to control the appearance of selected objects and
191  // the manipulator in general.
195  void CreateDefaultProperties();
196  double Opacity;
198 
199  // Support picking
200  double LastEventPosition[2];
201 
202  // These are the classes that form the geometric representation -----------
203  // The label
206 
207  // The outer box
213 
219 
220  // The circle
226 
232 
233  // The translation axes
238 
239 private:
241  void operator=(const vtkAffineRepresentation2D&) = delete;
242 };
243 
244 VTK_ABI_NAMESPACE_END
245 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
virtual void EndWidgetInteraction(double newEventPos[2])
virtual void PlaceWidget(double vtkNotUsed(bounds)[6])
The following is a suggested API for widget representations.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing affine transformation widgets
abstract specification for Viewports
Definition: vtkViewport.h:44
void GetActors2D(vtkPropCollection *) override
virtual void StartWidgetInteraction(double eventPos[2])
#define VTK_INT_MAX
Definition: vtkType.h:144
a actor that draws 2D data
Definition: vtkActor2D.h:34
virtual void GetTransform(vtkTransform *t)=0
Retrieve a linear transform characterizing the affine transformation generated by this widget...
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void SetOrigin(const double o[3])
Specify the origin of the widget (in world coordinates).
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
2D text annotation
Definition: vtkTextMapper.h:39
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
a simple class to control print indentation
Definition: vtkIndent.h:28
create a leader with optional label and arrows
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
represent 2D affine transformations
represent text properties.
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
object to represent cell connectivity
Definition: vtkCellArray.h:175
virtual void Highlight(int vtkNotUsed(highlightOn))
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
represent surface properties of a 2D image
Definition: vtkProperty2D.h:29
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:28