VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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;
54 class vtkPolyDataMapper2D;
55 class vtkPolyData;
56 class vtkPoints;
57 class vtkCellArray;
58 class vtkTextProperty;
59 class vtkLeaderActor2D;
60 class vtkTextMapper;
61 class vtkActor2D;
62 
63 
64 class VTKINTERACTIONWIDGETS_EXPORT vtkAffineRepresentation2D : public vtkAffineRepresentation
65 {
66 public:
68  static vtkAffineRepresentation2D *New();
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(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.
190  vtkProperty2D *Property;
191  vtkProperty2D *SelectedProperty;
192  vtkTextProperty *TextProperty;
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
202  vtkTextMapper *TextMapper;
203  vtkActor2D *TextActor;
204 
205  // The outer box
206  vtkPoints *BoxPoints;
209  vtkPolyDataMapper2D *BoxMapper;
210  vtkActor2D *BoxActor;
211 
212  vtkPoints *HBoxPoints;
215  vtkPolyDataMapper2D *HBoxMapper;
216  vtkActor2D *HBoxActor;
217 
218  // The circle
219  vtkPoints *CirclePoints;
222  vtkPolyDataMapper2D *CircleMapper;
223  vtkActor2D *CircleActor;
224 
225  vtkPoints *HCirclePoints;
228  vtkPolyDataMapper2D *HCircleMapper;
229  vtkActor2D *HCircleActor;
230 
231  // The translation axes
232  vtkLeaderActor2D *XAxis;
233  vtkLeaderActor2D *YAxis;
234  vtkLeaderActor2D *HXAxis;
235  vtkLeaderActor2D *HYAxis;
236 
237 private:
238  vtkAffineRepresentation2D(const vtkAffineRepresentation2D&); //Not implemented
239  void operator=(const vtkAffineRepresentation2D&); //Not implemented
240 };
241 
242 #endif
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
virtual void ShallowCopy(vtkProp *prop)
virtual void StartWidgetInteraction(double eventPos[2])
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:82
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void BuildRepresentation()=0
void PrintSelf(ostream &os, vtkIndent indent)
virtual void WidgetInteraction(double newEventPos[2])
represent 2D affine transformations
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))