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 =========================================================================*/
46 #ifndef vtkAffineRepresentation2D_h
47 #define vtkAffineRepresentation2D_h
48 
49 #include "vtkInteractionWidgetsModule.h" // For export macro
51 
52 class vtkProperty2D;
53 class vtkActor2D;
55 class vtkPolyData;
56 class vtkPoints;
57 class vtkCellArray;
58 class vtkTextProperty;
59 class vtkLeaderActor2D;
60 class vtkTextMapper;
61 class vtkActor2D;
62 
63 
65 {
66 public:
69 
71 
73  void PrintSelf(ostream& os, vtkIndent indent);
75 
77 
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 
94  void SetOrigin(const double o[3]) {this->SetOrigin(o[0],o[1],o[2]);}
95  void SetOrigin(double ox, double oy, double oz);
96  vtkGetVector3Macro(Origin,double);
98 
105  virtual void GetTransform(vtkTransform *t);
106 
108 
109  void SetProperty(vtkProperty2D*);
110  void SetSelectedProperty(vtkProperty2D*);
111  void SetTextProperty(vtkTextProperty*);
112  vtkGetObjectMacro(Property,vtkProperty2D);
113  vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
114  vtkGetObjectMacro(TextProperty,vtkTextProperty);
116 
118 
122  vtkSetMacro(DisplayText,int);
123  vtkGetMacro(DisplayText,int);
124  vtkBooleanMacro(DisplayText,int);
126 
128 
133  virtual void PlaceWidget(double bounds[6]);
134  virtual void StartWidgetInteraction(double eventPos[2]);
135  virtual void WidgetInteraction(double eventPos[2]);
136  virtual void EndWidgetInteraction(double eventPos[2]);
137  virtual int ComputeInteractionState(int X, int Y, int modify=0);
138  virtual void BuildRepresentation();
140 
142 
143  virtual void ShallowCopy(vtkProp *prop);
144  virtual void GetActors2D(vtkPropCollection *);
145  virtual void ReleaseGraphicsResources(vtkWindow *);
146  virtual int RenderOverlay(vtkViewport *viewport);
148 
149 protected:
152 
153  // Methods to manipulate the cursor
154  void Translate(double eventPos[2]);
155  void Scale(double eventPos[2]);
156  void Rotate(double eventPos[2]);
157  void Shear(double eventPos[2]);
158  void Highlight(int highlight);
159  void UpdateText(const char *text, double eventPos[2]);
160 
161  // The width of the widget in normalized viewport coordinates.
162  int BoxWidth;
165 
166  // Display text
168 
169  // Internal variables for bookkeeping (in display coordinates unless noted)
170  double CurrentWidth;
173 
174  // The internal transformation matrix
178  double Origin[4]; //the current origin in world coordinates
179  double DisplayOrigin[3]; //the current origin in display coordinates
180  double CurrentTranslation[3]; //translation this movement
181  double StartWorldPosition[4]; //Start event position converted to world
182  double StartAngle; //The starting angle (always positive)
183  double CurrentAngle;
184  double CurrentScale[2];
185  double CurrentShear[2];
186  void ApplyShear(); //helper method to apply shear to matrix
187 
188  // Properties used to control the appearance of selected objects and
189  // the manipulator in general.
193  void CreateDefaultProperties();
194  double Opacity;
196 
197  // Support picking
198  double LastEventPosition[2];
199 
200  // These are the classes that form the geometric representation -----------
201  // The label
204 
205  // The outer box
211 
217 
218  // The circle
224 
230 
231  // The translation axes
236 
237 private:
238  vtkAffineRepresentation2D(const vtkAffineRepresentation2D&); //Not implemented
239  void operator=(const vtkAffineRepresentation2D&); //Not implemented
240 };
241 
242 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
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:46
virtual void ShallowCopy(vtkProp *prop)
virtual void StartWidgetInteraction(double eventPos[2])
#define VTK_INT_MAX
Definition: vtkType.h:132
a actor that draws 2D data
Definition: vtkActor2D.h:44
virtual void GetTransform(vtkTransform *t)=0
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
void SetOrigin(const double o[3])
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void BuildRepresentation()=0
2D text annotation
Definition: vtkTextMapper.h:52
a list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
create a leader with optional label and arrows
virtual void WidgetInteraction(double newEventPos[2])
represent 2D affine transformations
represent text properties.
object to represent cell connectivity
Definition: vtkCellArray.h:49
virtual void GetActors2D(vtkPropCollection *)
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
virtual void Highlight(int vtkNotUsed(highlightOn))
represent surface properties of a 2D image
Definition: vtkProperty2D.h:39
static vtkObject * New()
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:38