VTK  9.2.5
vtkAffineRepresentation2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAffineRepresentation2D.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 =========================================================================*/
63 #ifndef vtkAffineRepresentation2D_h
64 #define vtkAffineRepresentation2D_h
65 
67 #include "vtkInteractionWidgetsModule.h" // For export macro
68 
69 class vtkProperty2D;
70 class vtkActor2D;
72 class vtkPolyData;
73 class vtkPoints;
74 class vtkCellArray;
75 class vtkTextProperty;
76 class vtkLeaderActor2D;
77 class vtkTextMapper;
78 class vtkActor2D;
79 
80 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
81 {
82 public:
87 
89 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
97 
104  vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
105  vtkGetMacro(BoxWidth, int);
106  vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
107  vtkGetMacro(CircleWidth, int);
108  vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
109  vtkGetMacro(AxesWidth, int);
111 
113 
118  void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
119  void SetOrigin(double ox, double oy, double oz);
120  vtkGetVector3Macro(Origin, double);
122 
131  void GetTransform(vtkTransform* t) override;
132 
134 
140  vtkGetObjectMacro(Property, vtkProperty2D);
141  vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
142  vtkGetObjectMacro(TextProperty, vtkTextProperty);
144 
146 
151  vtkSetMacro(DisplayText, vtkTypeBool);
152  vtkGetMacro(DisplayText, vtkTypeBool);
153  vtkBooleanMacro(DisplayText, vtkTypeBool);
155 
157 
164  void PlaceWidget(double bounds[6]) override;
165  void StartWidgetInteraction(double eventPos[2]) override;
166  void WidgetInteraction(double eventPos[2]) override;
167  void EndWidgetInteraction(double eventPos[2]) override;
168  int ComputeInteractionState(int X, int Y, int modify = 0) override;
169  void BuildRepresentation() override;
171 
173 
176  void ShallowCopy(vtkProp* prop) override;
179  int RenderOverlay(vtkViewport* viewport) override;
181 
182 protected:
185 
186  // Methods to manipulate the cursor
187  void Translate(double eventPos[2]);
188  void Scale(double eventPos[2]);
189  void Rotate(double eventPos[2]);
190  void Shear(double eventPos[2]);
191  void Highlight(int highlight) override;
192  void UpdateText(const char* text, double eventPos[2]);
193 
194  // The width of the widget in normalized viewport coordinates.
195  int BoxWidth;
198 
199  // Display text
201 
202  // Internal variables for bookkeeping (in display coordinates unless noted)
203  double CurrentWidth;
206 
207  // The internal transformation matrix
210  double Origin[4]; // the current origin in world coordinates
211  double DisplayOrigin[3]; // the current origin in display coordinates
212  double CurrentTranslation[3]; // translation this movement
213  double StartWorldPosition[4]; // Start event position converted to world
214  double StartAngle; // The starting angle (always positive)
215  double CurrentAngle;
216  double CurrentScale[2];
217  double CurrentShear[2];
218  void ApplyShear(); // helper method to apply shear to matrix
219 
220  // Properties used to control the appearance of selected objects and
221  // the manipulator in general.
226  double Opacity;
228 
229  // Support picking
230  double LastEventPosition[2];
231 
232  // These are the classes that form the geometric representation -----------
233  // The label
236 
237  // The outer box
243 
249 
250  // The circle
256 
262 
263  // The translation axes
268 
269 private:
271  void operator=(const vtkAffineRepresentation2D&) = delete;
272 };
273 
274 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
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.
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).
static vtkAffineRepresentation2D * New()
Instantiate this class.
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
Definition: vtkCellArray.h:296
a simple class to control print indentation
Definition: vtkIndent.h:119
create a leader with optional label and arrows
represent and manipulate 3D points
Definition: vtkPoints.h:149
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a 2D image
2D text annotation
represent text properties.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155