VTK
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 =========================================================================*/
41 #ifndef vtkAffineRepresentation2D_h
42 #define vtkAffineRepresentation2D_h
43 
44 #include "vtkInteractionWidgetsModule.h" // For export macro
46 
47 class vtkProperty2D;
48 class vtkActor2D;
50 class vtkPolyData;
51 class vtkPoints;
52 class vtkCellArray;
53 class vtkTextProperty;
54 class vtkLeaderActor2D;
55 class vtkTextMapper;
56 class vtkActor2D;
57 
58 
59 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
60 {
61 public:
66 
68 
72  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
83  vtkSetClampMacro(BoxWidth,int,10,VTK_INT_MAX);
84  vtkGetMacro(BoxWidth,int);
85  vtkSetClampMacro(CircleWidth,int,10,VTK_INT_MAX);
86  vtkGetMacro(CircleWidth,int);
87  vtkSetClampMacro(AxesWidth,int,10,VTK_INT_MAX);
88  vtkGetMacro(AxesWidth,int);
90 
92 
97  void SetOrigin(const double o[3]) {this->SetOrigin(o[0],o[1],o[2]);}
98  void SetOrigin(double ox, double oy, double oz);
99  vtkGetVector3Macro(Origin,double);
101 
110  void GetTransform(vtkTransform *t) override;
111 
113 
116  void SetProperty(vtkProperty2D*);
117  void SetSelectedProperty(vtkProperty2D*);
118  void SetTextProperty(vtkTextProperty*);
119  vtkGetObjectMacro(Property,vtkProperty2D);
120  vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
121  vtkGetObjectMacro(TextProperty,vtkTextProperty);
123 
125 
130  vtkSetMacro(DisplayText,vtkTypeBool);
131  vtkGetMacro(DisplayText,vtkTypeBool);
132  vtkBooleanMacro(DisplayText,vtkTypeBool);
134 
136 
143  void PlaceWidget(double bounds[6]) override;
144  void StartWidgetInteraction(double eventPos[2]) override;
145  void WidgetInteraction(double eventPos[2]) override;
146  void EndWidgetInteraction(double eventPos[2]) override;
147  int ComputeInteractionState(int X, int Y, int modify=0) override;
148  void BuildRepresentation() override;
150 
152 
155  void ShallowCopy(vtkProp *prop) override;
156  void GetActors2D(vtkPropCollection *) override;
157  void ReleaseGraphicsResources(vtkWindow *) override;
158  int RenderOverlay(vtkViewport *viewport) override;
160 
161 protected:
163  ~vtkAffineRepresentation2D() override;
164 
165  // Methods to manipulate the cursor
166  void Translate(double eventPos[2]);
167  void Scale(double eventPos[2]);
168  void Rotate(double eventPos[2]);
169  void Shear(double eventPos[2]);
170  void Highlight(int highlight) override;
171  void UpdateText(const char *text, double eventPos[2]);
172 
173  // The width of the widget in normalized viewport coordinates.
174  int BoxWidth;
177 
178  // Display text
180 
181  // Internal variables for bookkeeping (in display coordinates unless noted)
182  double CurrentWidth;
185 
186  // The internal transformation matrix
189  double Origin[4]; //the current origin in world coordinates
190  double DisplayOrigin[3]; //the current origin in display coordinates
191  double CurrentTranslation[3]; //translation this movement
192  double StartWorldPosition[4]; //Start event position converted to world
193  double StartAngle; //The starting angle (always positive)
194  double CurrentAngle;
195  double CurrentScale[2];
196  double CurrentShear[2];
197  void ApplyShear(); //helper method to apply shear to matrix
198 
199  // Properties used to control the appearance of selected objects and
200  // the manipulator in general.
204  void CreateDefaultProperties();
205  double Opacity;
207 
208  // Support picking
209  double LastEventPosition[2];
210 
211  // These are the classes that form the geometric representation -----------
212  // The label
215 
216  // The outer box
222 
228 
229  // The circle
235 
241 
242  // The translation axes
247 
248 private:
250  void operator=(const vtkAffineRepresentation2D&) = delete;
251 };
252 
253 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
virtual void EndWidgetInteraction(double newEventPos[2])
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:157
a actor that draws 2D data
Definition: vtkActor2D.h:39
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:54
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:47
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
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:33
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:44
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
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:37
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:33