VTK  9.0.1
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 
45 #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 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
59 {
60 public:
65 
67 
71  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
82  vtkSetClampMacro(BoxWidth, int, 10, VTK_INT_MAX);
83  vtkGetMacro(BoxWidth, int);
84  vtkSetClampMacro(CircleWidth, int, 10, VTK_INT_MAX);
85  vtkGetMacro(CircleWidth, int);
86  vtkSetClampMacro(AxesWidth, int, 10, VTK_INT_MAX);
87  vtkGetMacro(AxesWidth, int);
89 
91 
96  void SetOrigin(const double o[3]) { this->SetOrigin(o[0], o[1], o[2]); }
97  void SetOrigin(double ox, double oy, double oz);
98  vtkGetVector3Macro(Origin, double);
100 
109  void GetTransform(vtkTransform* t) override;
110 
112 
118  vtkGetObjectMacro(Property, vtkProperty2D);
119  vtkGetObjectMacro(SelectedProperty, vtkProperty2D);
120  vtkGetObjectMacro(TextProperty, vtkTextProperty);
122 
124 
129  vtkSetMacro(DisplayText, vtkTypeBool);
130  vtkGetMacro(DisplayText, vtkTypeBool);
131  vtkBooleanMacro(DisplayText, vtkTypeBool);
133 
135 
142  void PlaceWidget(double bounds[6]) override;
143  void StartWidgetInteraction(double eventPos[2]) override;
144  void WidgetInteraction(double eventPos[2]) override;
145  void EndWidgetInteraction(double eventPos[2]) override;
146  int ComputeInteractionState(int X, int Y, int modify = 0) override;
147  void BuildRepresentation() override;
149 
151 
154  void ShallowCopy(vtkProp* prop) override;
157  int RenderOverlay(vtkViewport* viewport) override;
159 
160 protected:
163 
164  // Methods to manipulate the cursor
165  void Translate(double eventPos[2]);
166  void Scale(double eventPos[2]);
167  void Rotate(double eventPos[2]);
168  void Shear(double eventPos[2]);
169  void Highlight(int highlight) override;
170  void UpdateText(const char* text, double eventPos[2]);
171 
172  // The width of the widget in normalized viewport coordinates.
173  int BoxWidth;
176 
177  // Display text
179 
180  // Internal variables for bookkeeping (in display coordinates unless noted)
181  double CurrentWidth;
184 
185  // The internal transformation matrix
188  double Origin[4]; // the current origin in world coordinates
189  double DisplayOrigin[3]; // the current origin in display coordinates
190  double CurrentTranslation[3]; // translation this movement
191  double StartWorldPosition[4]; // Start event position converted to world
192  double StartAngle; // The starting angle (always positive)
193  double CurrentAngle;
194  double CurrentScale[2];
195  double CurrentShear[2];
196  void ApplyShear(); // helper method to apply shear to matrix
197 
198  // Properties used to control the appearance of selected objects and
199  // the manipulator in general.
204  double Opacity;
206 
207  // Support picking
208  double LastEventPosition[2];
209 
210  // These are the classes that form the geometric representation -----------
211  // The label
214 
215  // The outer box
221 
227 
228  // The circle
234 
240 
241  // The translation axes
246 
247 private:
249  void operator=(const vtkAffineRepresentation2D&) = delete;
250 };
251 
252 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:34
vtkAffineRepresentation2D::CircleMapper
vtkPolyDataMapper2D * CircleMapper
Definition: vtkAffineRepresentation2D.h:232
vtkAffineRepresentation2D::Box
vtkPolyData * Box
Definition: vtkAffineRepresentation2D.h:218
vtkAffineRepresentation2D::Property
vtkProperty2D * Property
Definition: vtkAffineRepresentation2D.h:200
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkAffineRepresentation2D::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:45
vtkAffineRepresentation2D::BoxActor
vtkActor2D * BoxActor
Definition: vtkAffineRepresentation2D.h:220
vtkAffineRepresentation2D::HXAxis
vtkLeaderActor2D * HXAxis
Definition: vtkAffineRepresentation2D.h:244
vtkAffineRepresentation2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
vtkAffineRepresentation2D::AxesWidth
int AxesWidth
Definition: vtkAffineRepresentation2D.h:175
vtkAffineRepresentation2D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
vtkAffineRepresentation2D::CircleActor
vtkActor2D * CircleActor
Definition: vtkAffineRepresentation2D.h:233
vtkAffineRepresentation2D::Translate
void Translate(double eventPos[2])
vtkAffineRepresentation2D::New
static vtkAffineRepresentation2D * New()
Instantiate this class.
vtkAffineRepresentation2D::SetSelectedProperty
void SetSelectedProperty(vtkProperty2D *)
vtkAffineRepresentation2D::CreateDefaultProperties
void CreateDefaultProperties()
vtkAffineRepresentation2D::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkAffineRepresentation2D.h:219
vtkAffineRepresentation2D::HBoxMapper
vtkPolyDataMapper2D * HBoxMapper
Definition: vtkAffineRepresentation2D.h:225
vtkAffineRepresentation2D::UpdateText
void UpdateText(const char *text, double eventPos[2])
vtkAffineRepresentation2D::CircleCellArray
vtkCellArray * CircleCellArray
Definition: vtkAffineRepresentation2D.h:230
vtkAffineRepresentation2D::DisplayText
vtkTypeBool DisplayText
Definition: vtkAffineRepresentation2D.h:178
vtkAffineRepresentation2D::CurrentWidth
double CurrentWidth
Definition: vtkAffineRepresentation2D.h:181
vtkAffineRepresentation2D::SetOrigin
void SetOrigin(const double o[3])
Specify the origin of the widget (in world coordinates).
Definition: vtkAffineRepresentation2D.h:96
vtkAffineRepresentation2D::TextProperty
vtkTextProperty * TextProperty
Definition: vtkAffineRepresentation2D.h:202
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
vtkAffineRepresentation2D::HCircleCellArray
vtkCellArray * HCircleCellArray
Definition: vtkAffineRepresentation2D.h:236
vtkAffineRepresentation2D::TextMapper
vtkTextMapper * TextMapper
Definition: vtkAffineRepresentation2D.h:212
vtkAffineRepresentation2D::HCirclePoints
vtkPoints * HCirclePoints
Definition: vtkAffineRepresentation2D.h:235
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkAffineRepresentation2D::TotalTransform
vtkTransform * TotalTransform
Definition: vtkAffineRepresentation2D.h:187
vtkAffineRepresentation2D::vtkAffineRepresentation2D
vtkAffineRepresentation2D()
vtkAffineRepresentation2D::SelectedProperty
vtkProperty2D * SelectedProperty
Definition: vtkAffineRepresentation2D.h:201
vtkAffineRepresentation2D::HBoxActor
vtkActor2D * HBoxActor
Definition: vtkAffineRepresentation2D.h:226
vtkAffineRepresentation2D::HBoxPoints
vtkPoints * HBoxPoints
Definition: vtkAffineRepresentation2D.h:222
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:242
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:48
vtkAffineRepresentation2D::CircleWidth
int CircleWidth
Definition: vtkAffineRepresentation2D.h:174
vtkAffineRepresentation2D::EndWidgetInteraction
void EndWidgetInteraction(double eventPos[2]) override
vtkAffineRepresentation2D::Shear
void Shear(double eventPos[2])
vtkAffineRepresentation2D::Circle
vtkPolyData * Circle
Definition: vtkAffineRepresentation2D.h:231
vtkAffineRepresentation2D::HCircleActor
vtkActor2D * HCircleActor
Definition: vtkAffineRepresentation2D.h:239
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkAffineRepresentation2D::BoxCellArray
vtkCellArray * BoxCellArray
Definition: vtkAffineRepresentation2D.h:217
vtkAffineRepresentation2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
vtkAffineRepresentation2D::SelectedOpacity
double SelectedOpacity
Definition: vtkAffineRepresentation2D.h:205
vtkAffineRepresentation2D::HCircle
vtkPolyData * HCircle
Definition: vtkAffineRepresentation2D.h:237
vtkAffineRepresentation2D::BoxWidth
int BoxWidth
Definition: vtkAffineRepresentation2D.h:173
vtkAffineRepresentation2D::SetOrigin
void SetOrigin(double ox, double oy, double oz)
vtkAffineRepresentation2D::BoxPoints
vtkPoints * BoxPoints
Definition: vtkAffineRepresentation2D.h:216
vtkAffineRepresentation2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:45
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkAffineRepresentation2D::Scale
void Scale(double eventPos[2])
vtkAffineRepresentation2D::TextActor
vtkActor2D * TextActor
Definition: vtkAffineRepresentation2D.h:213
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:38
vtkAffineRepresentation2D::CirclePoints
vtkPoints * CirclePoints
Definition: vtkAffineRepresentation2D.h:229
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:40
vtkAffineRepresentation2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:193
vtkAffineRepresentation2D::SetTextProperty
void SetTextProperty(vtkTextProperty *)
vtkAffineRepresentation2D::SetProperty
void SetProperty(vtkProperty2D *)
Set/Get the properties when unselected and selected.
vtkAffineRepresentation2D::HYAxis
vtkLeaderActor2D * HYAxis
Definition: vtkAffineRepresentation2D.h:245
vtkAffineRepresentation2D::Opacity
double Opacity
Definition: vtkAffineRepresentation2D.h:204
vtkAffineRepresentation2D::HCircleMapper
vtkPolyDataMapper2D * HCircleMapper
Definition: vtkAffineRepresentation2D.h:238
vtkAffineRepresentation2D::CurrentTransform
vtkTransform * CurrentTransform
Definition: vtkAffineRepresentation2D.h:186
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkAffineRepresentation2D::BuildRepresentation
void BuildRepresentation() override
vtkAffineRepresentation2D::YAxis
vtkLeaderActor2D * YAxis
Definition: vtkAffineRepresentation2D.h:243
vtkAffineRepresentation2D::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
vtkAffineRepresentation2D::HBoxCellArray
vtkCellArray * HBoxCellArray
Definition: vtkAffineRepresentation2D.h:223
vtkAffineRepresentation2D::HBox
vtkPolyData * HBox
Definition: vtkAffineRepresentation2D.h:224
vtkAffineRepresentation2D::StartAngle
double StartAngle
Definition: vtkAffineRepresentation2D.h:192
vtkAffineRepresentation2D
represent 2D affine transformations
Definition: vtkAffineRepresentation2D.h:59
vtkAffineRepresentation2D::CurrentRadius
double CurrentRadius
Definition: vtkAffineRepresentation2D.h:182
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkAffineRepresentation2D::Rotate
void Rotate(double eventPos[2])
vtkAffineRepresentation2D::GetActors2D
void GetActors2D(vtkPropCollection *) override
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:183