VTK  9.2.6
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 =========================================================================*/
53 #ifndef vtkAffineRepresentation2D_h
54 #define vtkAffineRepresentation2D_h
55 
57 #include "vtkInteractionWidgetsModule.h" // For export macro
58 
59 class vtkProperty2D;
60 class vtkActor2D;
62 class vtkPolyData;
63 class vtkPoints;
64 class vtkCellArray;
65 class vtkTextProperty;
66 class vtkLeaderActor2D;
67 class vtkTextMapper;
68 class vtkActor2D;
69 
70 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
71 {
72 public:
77 
79 
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
94  vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
95  vtkGetMacro(BoxWidth, int);
96  vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
97  vtkGetMacro(CircleWidth, int);
98  vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
99  vtkGetMacro(AxesWidth, int);
101 
103 
108  void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
109  void SetOrigin(double ox, double oy, double oz);
110  vtkGetVector3Macro(Origin, double);
112 
121  void GetTransform(vtkTransform* t) override;
122 
124 
130  vtkGetObjectMacro(Property, vtkProperty2D);
131  vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
132  vtkGetObjectMacro(TextProperty, vtkTextProperty);
134 
136 
141  vtkSetMacro(DisplayText, vtkTypeBool);
142  vtkGetMacro(DisplayText, vtkTypeBool);
143  vtkBooleanMacro(DisplayText, vtkTypeBool);
145 
147 
154  void PlaceWidget(double bounds[6]) override;
155  void StartWidgetInteraction(double eventPos[2]) override;
156  void WidgetInteraction(double eventPos[2]) override;
157  void EndWidgetInteraction(double eventPos[2]) override;
158  int ComputeInteractionState(int X, int Y, int modify = 0) override;
159  void BuildRepresentation() override;
161 
163 
166  void ShallowCopy(vtkProp* prop) override;
169  int RenderOverlay(vtkViewport* viewport) override;
171 
172 protected:
175 
176  // Methods to manipulate the cursor
177  void Translate(double eventPos[2]);
178  void Scale(double eventPos[2]);
179  void Rotate(double eventPos[2]);
180  void Shear(double eventPos[2]);
181  void Highlight(int highlight) override;
182  void UpdateText(const char* text, double eventPos[2]);
183 
184  // The width of the widget in normalized viewport coordinates.
185  int BoxWidth;
188 
189  // Display text
191 
192  // Internal variables for bookkeeping (in display coordinates unless noted)
193  double CurrentWidth;
196 
197  // The internal transformation matrix
200  double Origin[4]; // the current origin in world coordinates
201  double DisplayOrigin[3]; // the current origin in display coordinates
202  double CurrentTranslation[3]; // translation this movement
203  double StartWorldPosition[4]; // Start event position converted to world
204  double StartAngle; // The starting angle (always positive)
205  double CurrentAngle;
206  double CurrentScale[2];
207  double CurrentShear[2];
208  void ApplyShear(); // helper method to apply shear to matrix
209 
210  // Properties used to control the appearance of selected objects and
211  // the manipulator in general.
216  double Opacity;
218 
219  // Support picking
220  double LastEventPosition[2];
221 
222  // These are the classes that form the geometric representation -----------
223  // The label
226 
227  // The outer box
233 
239 
240  // The circle
246 
252 
253  // The translation axes
258 
259 private:
261  void operator=(const vtkAffineRepresentation2D&) = delete;
262 };
263 
264 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:55
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:196
a simple class to control print indentation
Definition: vtkIndent.h:49
create a leader with optional label and arrows
represent and manipulate 3D points
Definition: vtkPoints.h:49
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
represent surface properties of a 2D image
Definition: vtkProperty2D.h:50
2D text annotation
Definition: vtkTextMapper.h:60
represent text properties.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:70
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155