VTK
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPolygonalHandleRepresentation3D.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 =========================================================================*/
33 #ifndef __vtkAbstractPolygonalHandleRepresentation3D_h
34 #define __vtkAbstractPolygonalHandleRepresentation3D_h
35 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
38 
39 class vtkProperty;
40 class vtkPolyDataMapper;
41 class vtkCellPicker;
44 class vtkMatrix4x4;
45 class vtkPolyData;
47 class vtkActor;
48 class vtkFollower;
49 class vtkVectorText;
50 
51 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
53 {
54 public:
55 
57 
59  void PrintSelf(ostream& os, vtkIndent indent);
61 
63 
64  virtual void SetWorldPosition(double p[3]);
65  virtual void SetDisplayPosition(double p[3]);
67 
69 
70  void SetHandle( vtkPolyData * );
71  vtkPolyData * GetHandle();
73 
75 
76  void SetProperty(vtkProperty*);
77  void SetSelectedProperty(vtkProperty*);
78  vtkGetObjectMacro(Property,vtkProperty);
79  vtkGetObjectMacro(SelectedProperty,vtkProperty);
81 
84  virtual vtkAbstractTransform * GetTransform();
85 
87 
89  virtual void BuildRepresentation();
90  virtual void StartWidgetInteraction(double eventPos[2]);
91  virtual void WidgetInteraction(double eventPos[2]);
92  virtual int ComputeInteractionState(int X, int Y, int modify=0);
94 
96 
97  virtual void ShallowCopy(vtkProp *prop);
98  virtual void DeepCopy(vtkProp *prop);
99  virtual void GetActors(vtkPropCollection *);
100  virtual void ReleaseGraphicsResources(vtkWindow *);
101  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
102  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
103  virtual int HasTranslucentPolygonalGeometry();
104  virtual double *GetBounds();
106 
108 
110  vtkSetMacro( LabelVisibility, int );
111  vtkGetMacro( LabelVisibility, int );
112  vtkBooleanMacro( LabelVisibility, int );
113  virtual void SetLabelText( const char * label );
114  virtual char * GetLabelText();
116 
118 
119  virtual void SetLabelTextScale( double scale[3] );
120  void SetLabelTextScale(double x, double y, double z)
121  {
122  double scale[3] = {x, y, z};
123  this->SetLabelTextScale(scale);
124  }
125  virtual double * GetLabelTextScale();
127 
129 
130  vtkGetObjectMacro( LabelTextActor, vtkFollower );
132 
136  virtual void SetUniformScale( double scale );
137 
139 
140  vtkSetMacro( HandleVisibility, int );
141  vtkGetMacro( HandleVisibility, int );
142  vtkBooleanMacro( HandleVisibility, int );
144 
145  void Highlight(int highlight);
146 
148 
158  vtkSetMacro( SmoothMotion, int );
159  vtkGetMacro( SmoothMotion, int );
160  vtkBooleanMacro( SmoothMotion, int );
162 
163 protected:
166 
173  double LastPickPosition[3];
174  double LastEventPosition[2];
181 
182 
183  // Methods to manipulate the cursor
184  virtual void Translate(double *p1, double *p2);
185  virtual void Scale(double *p1, double *p2, double eventPos[2]);
186  virtual void MoveFocus(double *p1, double *p2);
187 
188  void CreateDefaultProperties();
189 
190  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
191  // world coordinates), the new display position of the handle center is
192  // populated into requestedDisplayPos. This is again only a request for the
193  // new display position. It is up to the point placer to deduce the
194  // appropriate world co-ordinates that this display position will map into.
195  // The placer may even disallow such a movement.
196  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
197  // as the event position, ie the location of the mouse cursor. If its OFF,
198  // incremental offsets as described above are used to compute it.
199  void MoveFocusRequest( double *p1, double *p2,
200  double eventPos[2], double requestedDisplayPos[3] );
201 
202  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
203 
211  virtual void UpdateHandle();
212 
214  virtual void UpdateLabel();
215 
216  // Handle the label.
223 
224 private:
226  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&); //Not implemented
227 };
228 
229 #endif
230 
231