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);
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  virtual void GetTransform(vtkTransform *t);
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  virtual void PlaceWidget(double bounds[6]);
150  virtual void StartWidgetInteraction(double eventPos[2]);
151  virtual void WidgetInteraction(double eventPos[2]);
152  virtual void EndWidgetInteraction(double eventPos[2]);
153  virtual int ComputeInteractionState(int X, int Y, int modify=0);
154  virtual void BuildRepresentation();
156 
158 
161  virtual void ShallowCopy(vtkProp *prop);
162  virtual void GetActors2D(vtkPropCollection *);
163  virtual void ReleaseGraphicsResources(vtkWindow *);
164  virtual int RenderOverlay(vtkViewport *viewport);
166 
167 protected:
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);
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
196  double Origin[4]; //the current origin in world coordinates
197  double DisplayOrigin[3]; //the current origin in display coordinates
198  double CurrentTranslation[3]; //translation this movement
199  double StartWorldPosition[4]; //Start event position converted to world
200  double StartAngle; //The starting angle (always positive)
201  double CurrentAngle;
202  double CurrentScale[2];
203  double CurrentShear[2];
204  void ApplyShear(); //helper method to apply shear to matrix
205 
206  // Properties used to control the appearance of selected objects and
207  // the manipulator in general.
211  void CreateDefaultProperties();
212  double Opacity;
214 
215  // Support picking
216  double LastEventPosition[2];
217 
218  // These are the classes that form the geometric representation -----------
219  // The label
222 
223  // The outer box
229 
235 
236  // The circle
242 
248 
249  // The translation axes
254 
255 private:
256  vtkAffineRepresentation2D(const vtkAffineRepresentation2D&) VTK_DELETE_FUNCTION;
257  void operator=(const vtkAffineRepresentation2D&) VTK_DELETE_FUNCTION;
258 };
259 
260 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkAffineRepresentation2D::CircleMapper
vtkPolyDataMapper2D * CircleMapper
Definition: vtkAffineRepresentation2D.h:240
vtkAffineRepresentation2D::Box
vtkPolyData * Box
Definition: vtkAffineRepresentation2D.h:226
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:130
vtkAffineRepresentation2D::Property
vtkProperty2D * Property
Definition: vtkAffineRepresentation2D.h:208
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:153
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkAffineRepresentation2D::BoxActor
vtkActor2D * BoxActor
Definition: vtkAffineRepresentation2D.h:228
vtkAffineRepresentation2D::HXAxis
vtkLeaderActor2D * HXAxis
Definition: vtkAffineRepresentation2D.h:252
vtkWidgetRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:132
vtkAffineRepresentation2D::AxesWidth
int AxesWidth
Definition: vtkAffineRepresentation2D.h:182
vtkAffineRepresentation2D::DisplayText
int DisplayText
Definition: vtkAffineRepresentation2D.h:185
vtkAffineRepresentation2D::CircleActor
vtkActor2D * CircleActor
Definition: vtkAffineRepresentation2D.h:241
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkAffineRepresentation::GetTransform
virtual void GetTransform(vtkTransform *t)=0
Retrieve a linear transform characterizing the affine transformation generated by this widget.
vtkAffineRepresentation::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkAffineRepresentation2D::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkAffineRepresentation2D.h:227
vtkAffineRepresentation2D::HBoxMapper
vtkPolyDataMapper2D * HBoxMapper
Definition: vtkAffineRepresentation2D.h:233
vtkAffineRepresentation2D::TempTransform
vtkTransform * TempTransform
Definition: vtkAffineRepresentation2D.h:195
vtkAffineRepresentation2D::CircleCellArray
vtkCellArray * CircleCellArray
Definition: vtkAffineRepresentation2D.h:238
vtkAffineRepresentation2D::CurrentWidth
double CurrentWidth
Definition: vtkAffineRepresentation2D.h:188
vtkAffineRepresentation2D::SetOrigin
void SetOrigin(const double o[3])
Specify the origin of the widget (in world coordinates).
Definition: vtkAffineRepresentation2D.h:103
vtkAffineRepresentation2D::TextProperty
vtkTextProperty * TextProperty
Definition: vtkAffineRepresentation2D.h:210
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkAffineRepresentation::Rotate
Definition: vtkAffineRepresentation.h:81
vtkAffineRepresentation2D::HCircleCellArray
vtkCellArray * HCircleCellArray
Definition: vtkAffineRepresentation2D.h:244
vtkAffineRepresentation2D::TextMapper
vtkTextMapper * TextMapper
Definition: vtkAffineRepresentation2D.h:220
vtkAffineRepresentation2D::HCirclePoints
vtkPoints * HCirclePoints
Definition: vtkAffineRepresentation2D.h:243
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkAffineRepresentation2D::TotalTransform
vtkTransform * TotalTransform
Definition: vtkAffineRepresentation2D.h:194
vtkWidgetRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:186
vtkAffineRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkAffineRepresentation2D::SelectedProperty
vtkProperty2D * SelectedProperty
Definition: vtkAffineRepresentation2D.h:209
vtkAffineRepresentation2D::HBoxActor
vtkActor2D * HBoxActor
Definition: vtkAffineRepresentation2D.h:234
vtkAffineRepresentation2D::HBoxPoints
vtkPoints * HBoxPoints
Definition: vtkAffineRepresentation2D.h:230
vtkAffineRepresentation.h
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:131
vtkAffineRepresentation
abstract class for representing affine transformation widgets
Definition: vtkAffineRepresentation.h:47
vtkAffineRepresentation2D::XAxis
vtkLeaderActor2D * XAxis
Definition: vtkAffineRepresentation2D.h:250
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkAffineRepresentation2D::CircleWidth
int CircleWidth
Definition: vtkAffineRepresentation2D.h:181
vtkAffineRepresentation::Translate
Definition: vtkAffineRepresentation.h:81
vtkAffineRepresentation2D::Circle
vtkPolyData * Circle
Definition: vtkAffineRepresentation2D.h:239
vtkAffineRepresentation2D::HCircleActor
vtkActor2D * HCircleActor
Definition: vtkAffineRepresentation2D.h:247
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkAffineRepresentation2D::BoxCellArray
vtkCellArray * BoxCellArray
Definition: vtkAffineRepresentation2D.h:225
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkAffineRepresentation2D::SelectedOpacity
double SelectedOpacity
Definition: vtkAffineRepresentation2D.h:213
vtkAffineRepresentation2D::HCircle
vtkPolyData * HCircle
Definition: vtkAffineRepresentation2D.h:245
vtkAffineRepresentation2D::BoxWidth
int BoxWidth
Definition: vtkAffineRepresentation2D.h:180
vtkAffineRepresentation2D::BoxPoints
vtkPoints * BoxPoints
Definition: vtkAffineRepresentation2D.h:224
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
vtkAffineRepresentation2D::TextActor
vtkActor2D * TextActor
Definition: vtkAffineRepresentation2D.h:221
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
Definition: vtkWidgetRepresentation.h:129
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkAffineRepresentation2D::CirclePoints
vtkPoints * CirclePoints
Definition: vtkAffineRepresentation2D.h:237
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkAffineRepresentation2D::CurrentAngle
double CurrentAngle
Definition: vtkAffineRepresentation2D.h:201
vtkWidgetRepresentation::GetActors2D
virtual void GetActors2D(vtkPropCollection *)
Definition: vtkWidgetRepresentation.h:184
vtkAffineRepresentation2D::HYAxis
vtkLeaderActor2D * HYAxis
Definition: vtkAffineRepresentation2D.h:253
vtkAffineRepresentation2D::Opacity
double Opacity
Definition: vtkAffineRepresentation2D.h:212
vtkAffineRepresentation2D::HCircleMapper
vtkPolyDataMapper2D * HCircleMapper
Definition: vtkAffineRepresentation2D.h:246
vtkAffineRepresentation2D::CurrentTransform
vtkTransform * CurrentTransform
Definition: vtkAffineRepresentation2D.h:193
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkAffineRepresentation2D::YAxis
vtkLeaderActor2D * YAxis
Definition: vtkAffineRepresentation2D.h:251
vtkAffineRepresentation2D::HBoxCellArray
vtkCellArray * HBoxCellArray
Definition: vtkAffineRepresentation2D.h:231
vtkAffineRepresentation2D::HBox
vtkPolyData * HBox
Definition: vtkAffineRepresentation2D.h:232
vtkAffineRepresentation2D::StartAngle
double StartAngle
Definition: vtkAffineRepresentation2D.h:200
vtkAffineRepresentation2D
represent 2D affine transformations
Definition: vtkAffineRepresentation2D.h:65
vtkWidgetRepresentation::RenderOverlay
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
Definition: vtkWidgetRepresentation.h:187
vtkAffineRepresentation2D::CurrentRadius
double CurrentRadius
Definition: vtkAffineRepresentation2D.h:189
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkLeaderActor2D
create a leader with optional label and arrows
Definition: vtkLeaderActor2D.h:59
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkWidgetRepresentation::Highlight
virtual void Highlight(int vtkNotUsed(highlightOn))
Definition: vtkWidgetRepresentation.h:136
vtkAffineRepresentation2D::CurrentAxesWidth
double CurrentAxesWidth
Definition: vtkAffineRepresentation2D.h:190