VTK  9.1.0
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 =========================================================================*/
60 #ifndef vtkAffineRepresentation2D_h
61 #define vtkAffineRepresentation2D_h
62 
64 #include "vtkInteractionWidgetsModule.h" // For export macro
65 
66 class vtkProperty2D;
67 class vtkActor2D;
69 class vtkPolyData;
70 class vtkPoints;
71 class vtkCellArray;
72 class vtkTextProperty;
73 class vtkLeaderActor2D;
74 class vtkTextMapper;
75 class vtkActor2D;
76 
77 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
78 {
79 public:
84 
86 
90  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
94 
101  vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
102  vtkGetMacro(BoxWidth, int);
103  vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
104  vtkGetMacro(CircleWidth, int);
105  vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
106  vtkGetMacro(AxesWidth, int);
108 
110 
115  void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
116  void SetOrigin(double ox, double oy, double oz);
117  vtkGetVector3Macro(Origin, double);
119 
128  void GetTransform(vtkTransform* t) override;
129 
131 
137  vtkGetObjectMacro(Property, vtkProperty2D);
138  vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
139  vtkGetObjectMacro(TextProperty, vtkTextProperty);
141 
143 
148  vtkSetMacro(DisplayText, vtkTypeBool);
149  vtkGetMacro(DisplayText, vtkTypeBool);
150  vtkBooleanMacro(DisplayText, vtkTypeBool);
152 
154 
161  void PlaceWidget(double bounds[6]) override;
162  void StartWidgetInteraction(double eventPos[2]) override;
163  void WidgetInteraction(double eventPos[2]) override;
164  void EndWidgetInteraction(double eventPos[2]) override;
165  int ComputeInteractionState(int X, int Y, int modify = 0) override;
166  void BuildRepresentation() override;
168 
170 
173  void ShallowCopy(vtkProp* prop) override;
176  int RenderOverlay(vtkViewport* viewport) override;
178 
179 protected:
182 
183  // Methods to manipulate the cursor
184  void Translate(double eventPos[2]);
185  void Scale(double eventPos[2]);
186  void Rotate(double eventPos[2]);
187  void Shear(double eventPos[2]);
188  void Highlight(int highlight) override;
189  void UpdateText(const char* text, double eventPos[2]);
190 
191  // The width of the widget in normalized viewport coordinates.
192  int BoxWidth;
195 
196  // Display text
198 
199  // Internal variables for bookkeeping (in display coordinates unless noted)
200  double CurrentWidth;
203 
204  // The internal transformation matrix
207  double Origin[4]; // the current origin in world coordinates
208  double DisplayOrigin[3]; // the current origin in display coordinates
209  double CurrentTranslation[3]; // translation this movement
210  double StartWorldPosition[4]; // Start event position converted to world
211  double StartAngle; // The starting angle (always positive)
212  double CurrentAngle;
213  double CurrentScale[2];
214  double CurrentShear[2];
215  void ApplyShear(); // helper method to apply shear to matrix
216 
217  // Properties used to control the appearance of selected objects and
218  // the manipulator in general.
223  double Opacity;
225 
226  // Support picking
227  double LastEventPosition[2];
228 
229  // These are the classes that form the geometric representation -----------
230  // The label
233 
234  // The outer box
240 
246 
247  // The circle
253 
259 
260  // The translation axes
265 
266 private:
268  void operator=(const vtkAffineRepresentation2D&) = delete;
269 };
270 
271 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkAffineRepresentation2D::CircleMapper
vtkPolyDataMapper2D * CircleMapper
Definition: vtkAffineRepresentation2D.h:251
vtkAffineRepresentation2D::Box
vtkPolyData * Box
Definition: vtkAffineRepresentation2D.h:237
vtkAffineRepresentation2D::Property
vtkProperty2D * Property
Definition: vtkAffineRepresentation2D.h:219
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkAffineRepresentation2D::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:154
vtkAffineRepresentation2D::BoxActor
vtkActor2D * BoxActor
Definition: vtkAffineRepresentation2D.h:239
vtkAffineRepresentation2D::HXAxis
vtkLeaderActor2D * HXAxis
Definition: vtkAffineRepresentation2D.h:263
vtkAffineRepresentation2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
vtkAffineRepresentation2D::AxesWidth
int AxesWidth
Definition: vtkAffineRepresentation2D.h:194
vtkAffineRepresentation2D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkAffineRepresentation2D::CircleActor
vtkActor2D * CircleActor
Definition: vtkAffineRepresentation2D.h:252
vtkAffineRepresentation2D::Translate
void Translate(double eventPos[2])
vtkAffineRepresentation2D::New
static vtkAffineRepresentation2D * New()
Instantiate this class.
vtkAffineRepresentation2D::SetSelectedProperty
void SetSelectedProperty(vtkProperty2D *)
Set/Get the properties when unselected and selected.
vtkAffineRepresentation2D::CreateDefaultProperties
void CreateDefaultProperties()
vtkAffineRepresentation2D::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkAffineRepresentation2D.h:238
vtkAffineRepresentation2D::HBoxMapper
vtkPolyDataMapper2D * HBoxMapper
Definition: vtkAffineRepresentation2D.h:244
vtkAffineRepresentation2D::UpdateText
void UpdateText(const char *text, double eventPos[2])
vtkAffineRepresentation2D::CircleCellArray
vtkCellArray * CircleCellArray
Definition: vtkAffineRepresentation2D.h:249
vtkAffineRepresentation2D::DisplayText
vtkTypeBool DisplayText
Definition: vtkAffineRepresentation2D.h:197
vtkAffineRepresentation2D::CurrentWidth
double CurrentWidth
Definition: vtkAffineRepresentation2D.h:200
vtkAffineRepresentation2D::SetOrigin
void SetOrigin(const double o[3])
Specify the origin of the widget (in world coordinates).
Definition: vtkAffineRepresentation2D.h:115
vtkAffineRepresentation2D::TextProperty
vtkTextProperty * TextProperty
Definition: vtkAffineRepresentation2D.h:221
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkAffineRepresentation2D::HCircleCellArray
vtkCellArray * HCircleCellArray
Definition: vtkAffineRepresentation2D.h:255
vtkAffineRepresentation2D::TextMapper
vtkTextMapper * TextMapper
Definition: vtkAffineRepresentation2D.h:231
vtkAffineRepresentation2D::HCirclePoints
vtkPoints * HCirclePoints
Definition: vtkAffineRepresentation2D.h:254
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkAffineRepresentation2D::TotalTransform
vtkTransform * TotalTransform
Definition: vtkAffineRepresentation2D.h:206
vtkAffineRepresentation2D::vtkAffineRepresentation2D
vtkAffineRepresentation2D()
vtkAffineRepresentation2D::SelectedProperty
vtkProperty2D * SelectedProperty
Definition: vtkAffineRepresentation2D.h:220
vtkAffineRepresentation2D::HBoxActor
vtkActor2D * HBoxActor
Definition: vtkAffineRepresentation2D.h:245
vtkAffineRepresentation2D::HBoxPoints
vtkPoints * HBoxPoints
Definition: vtkAffineRepresentation2D.h:241
vtkAffineRepresentation.h
vtkAffineRepresentation2D::Highlight
void Highlight(int highlight) override
vtkAffineRepresentation
abstract class for representing affine transformation widgets
Definition: vtkAffineRepresentation.h:48
vtkAffineRepresentation2D::XAxis
vtkLeaderActor2D * XAxis
Definition: vtkAffineRepresentation2D.h:261
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:157
vtkAffineRepresentation2D::CircleWidth
int CircleWidth
Definition: vtkAffineRepresentation2D.h:193
vtkAffineRepresentation2D::EndWidgetInteraction
void EndWidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkAffineRepresentation2D::Shear
void Shear(double eventPos[2])
vtkAffineRepresentation2D::Circle
vtkPolyData * Circle
Definition: vtkAffineRepresentation2D.h:250
vtkAffineRepresentation2D::HCircleActor
vtkActor2D * HCircleActor
Definition: vtkAffineRepresentation2D.h:258
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkAffineRepresentation2D::BoxCellArray
vtkCellArray * BoxCellArray
Definition: vtkAffineRepresentation2D.h:236
vtkAffineRepresentation2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkAffineRepresentation2D::SelectedOpacity
double SelectedOpacity
Definition: vtkAffineRepresentation2D.h:224
vtkAffineRepresentation2D::HCircle
vtkPolyData * HCircle
Definition: vtkAffineRepresentation2D.h:256
vtkAffineRepresentation2D::BoxWidth
int BoxWidth
Definition: vtkAffineRepresentation2D.h:192
vtkAffineRepresentation2D::SetOrigin
void SetOrigin(double ox, double oy, double oz)
Specify the origin of the widget (in world coordinates).
vtkAffineRepresentation2D::BoxPoints
vtkPoints * BoxPoints
Definition: vtkAffineRepresentation2D.h:235
vtkAffineRepresentation2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Methods to make this class behave as a vtkProp.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:143
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
vtkAffineRepresentation2D::Scale
void Scale(double eventPos[2])
vtkAffineRepresentation2D::TextActor
vtkActor2D * TextActor
Definition: vtkAffineRepresentation2D.h:232
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:147
vtkAffineRepresentation2D::CirclePoints
vtkPoints * CirclePoints
Definition: vtkAffineRepresentation2D.h:248
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkAffineRepresentation2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
vtkAffineRepresentation2D::GetTransform
void GetTransform(vtkTransform *t) override
Retrieve a linear transform characterizing the affine transformation generated by this widget.
vtkAffineRepresentation2D::CurrentAngle
double CurrentAngle
Definition: vtkAffineRepresentation2D.h:212
vtkAffineRepresentation2D::SetTextProperty
void SetTextProperty(vtkTextProperty *)
Set/Get the properties when unselected and selected.
vtkAffineRepresentation2D::SetProperty
void SetProperty(vtkProperty2D *)
Set/Get the properties when unselected and selected.
vtkAffineRepresentation2D::HYAxis
vtkLeaderActor2D * HYAxis
Definition: vtkAffineRepresentation2D.h:264
vtkAffineRepresentation2D::Opacity
double Opacity
Definition: vtkAffineRepresentation2D.h:223
vtkAffineRepresentation2D::HCircleMapper
vtkPolyDataMapper2D * HCircleMapper
Definition: vtkAffineRepresentation2D.h:257
vtkAffineRepresentation2D::CurrentTransform
vtkTransform * CurrentTransform
Definition: vtkAffineRepresentation2D.h:205
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkAffineRepresentation2D::BuildRepresentation
void BuildRepresentation() override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkAffineRepresentation2D::YAxis
vtkLeaderActor2D * YAxis
Definition: vtkAffineRepresentation2D.h:262
vtkAffineRepresentation2D::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkAffineRepresentation2D::HBoxCellArray
vtkCellArray * HBoxCellArray
Definition: vtkAffineRepresentation2D.h:242
vtkAffineRepresentation2D::HBox
vtkPolyData * HBox
Definition: vtkAffineRepresentation2D.h:243
vtkAffineRepresentation2D::StartAngle
double StartAngle
Definition: vtkAffineRepresentation2D.h:211
vtkAffineRepresentation2D
represent 2D affine transformations
Definition: vtkAffineRepresentation2D.h:78
vtkAffineRepresentation2D::CurrentRadius
double CurrentRadius
Definition: vtkAffineRepresentation2D.h:201
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:85
vtkAffineRepresentation2D::Rotate
void Rotate(double eventPos[2])
vtkAffineRepresentation2D::GetActors2D
void GetActors2D(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
vtkAffineRepresentation2D::PlaceWidget
void PlaceWidget(double bounds[6]) override
Subclasses of vtkAffineRepresentation2D must implement these methods.
vtkLeaderActor2D
create a leader with optional label and arrows
Definition: vtkLeaderActor2D.h:57
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkAffineRepresentation2D::ApplyShear
void ApplyShear()
vtkAffineRepresentation2D::~vtkAffineRepresentation2D
~vtkAffineRepresentation2D() override
vtkAffineRepresentation2D::CurrentAxesWidth
double CurrentAxesWidth
Definition: vtkAffineRepresentation2D.h:202