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 =========================================================================*/
47 #ifndef vtkAffineRepresentation2D_h
48 #define vtkAffineRepresentation2D_h
49 
50 #include "vtkInteractionWidgetsModule.h" // For export macro
52 
53 class vtkProperty2D;
54 class vtkActor2D;
56 class vtkPolyData;
57 class vtkPoints;
58 class vtkCellArray;
59 class vtkTextProperty;
60 class vtkLeaderActor2D;
61 class vtkTextMapper;
62 class vtkActor2D;
63 
64 
65 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
66 {
67 public:
72 
74 
78  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
82 
89  vtkSetClampMacro(BoxWidth,int,10,VTK_INT_MAX);
90  vtkGetMacro(BoxWidth,int);
91  vtkSetClampMacro(CircleWidth,int,10,VTK_INT_MAX);
92  vtkGetMacro(CircleWidth,int);
93  vtkSetClampMacro(AxesWidth,int,10,VTK_INT_MAX);
94  vtkGetMacro(AxesWidth,int);
96 
98 
103  void SetOrigin(const double o[3]) {this->SetOrigin(o[0],o[1],o[2]);}
104  void SetOrigin(double ox, double oy, double oz);
105  vtkGetVector3Macro(Origin,double);
107 
116  void GetTransform(vtkTransform *t) override;
117 
119 
122  void SetProperty(vtkProperty2D*);
123  void SetSelectedProperty(vtkProperty2D*);
124  void SetTextProperty(vtkTextProperty*);
125  vtkGetObjectMacro(Property,vtkProperty2D);
126  vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
127  vtkGetObjectMacro(TextProperty,vtkTextProperty);
129 
131 
136  vtkSetMacro(DisplayText,int);
137  vtkGetMacro(DisplayText,int);
138  vtkBooleanMacro(DisplayText,int);
140 
142 
149  void PlaceWidget(double bounds[6]) override;
150  void StartWidgetInteraction(double eventPos[2]) override;
151  void WidgetInteraction(double eventPos[2]) override;
152  void EndWidgetInteraction(double eventPos[2]) override;
153  int ComputeInteractionState(int X, int Y, int modify=0) override;
154  void BuildRepresentation() override;
156 
158 
161  void ShallowCopy(vtkProp *prop) override;
162  void GetActors2D(vtkPropCollection *) override;
163  void ReleaseGraphicsResources(vtkWindow *) override;
164  int RenderOverlay(vtkViewport *viewport) override;
166 
167 protected:
169  ~vtkAffineRepresentation2D() override;
170 
171  // Methods to manipulate the cursor
172  void Translate(double eventPos[2]);
173  void Scale(double eventPos[2]);
174  void Rotate(double eventPos[2]);
175  void Shear(double eventPos[2]);
176  void Highlight(int highlight) override;
177  void UpdateText(const char *text, double eventPos[2]);
178 
179  // The width of the widget in normalized viewport coordinates.
180  int BoxWidth;
183 
184  // Display text
186 
187  // Internal variables for bookkeeping (in display coordinates unless noted)
188  double CurrentWidth;
191 
192  // The internal transformation matrix
195  double Origin[4]; //the current origin in world coordinates
196  double DisplayOrigin[3]; //the current origin in display coordinates
197  double CurrentTranslation[3]; //translation this movement
198  double StartWorldPosition[4]; //Start event position converted to world
199  double StartAngle; //The starting angle (always positive)
200  double CurrentAngle;
201  double CurrentScale[2];
202  double CurrentShear[2];
203  void ApplyShear(); //helper method to apply shear to matrix
204 
205  // Properties used to control the appearance of selected objects and
206  // the manipulator in general.
210  void CreateDefaultProperties();
211  double Opacity;
213 
214  // Support picking
215  double LastEventPosition[2];
216 
217  // These are the classes that form the geometric representation -----------
218  // The label
221 
222  // The outer box
228 
234 
235  // The circle
241 
247 
248  // The translation axes
253 
254 private:
256  void operator=(const vtkAffineRepresentation2D&) = delete;
257 };
258 
259 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
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:47
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:45
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:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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:53
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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:39
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.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
object to represent cell connectivity
Definition: vtkCellArray.h:50
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:40
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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:39