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 =========================================================================*/
31 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
32 #define vtkAbstractPolygonalHandleRepresentation3D_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkProperty;
38 class vtkPolyDataMapper;
39 class vtkCellPicker;
42 class vtkMatrix4x4;
43 class vtkPolyData;
45 class vtkActor;
46 class vtkFollower;
47 class vtkVectorText;
48 
49 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
51 {
52 public:
53 
55 
59  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
63 
66  void SetWorldPosition(double p[3]) VTK_OVERRIDE;
67  void SetDisplayPosition(double p[3]) VTK_OVERRIDE;
69 
71 
74  void SetHandle( vtkPolyData * );
75  vtkPolyData * GetHandle();
77 
79 
82  void SetProperty(vtkProperty*);
83  void SetSelectedProperty(vtkProperty*);
84  vtkGetObjectMacro(Property,vtkProperty);
85  vtkGetObjectMacro(SelectedProperty,vtkProperty);
87 
92  virtual vtkAbstractTransform * GetTransform();
93 
95 
98  void BuildRepresentation() VTK_OVERRIDE;
99  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
100  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
101  int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
103 
105 
108  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
109  void DeepCopy(vtkProp *prop) VTK_OVERRIDE;
110  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
111  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
112  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
113  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
114  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
115  double *GetBounds() VTK_OVERRIDE;
117 
119 
123  vtkSetMacro( LabelVisibility, int );
124  vtkGetMacro( LabelVisibility, int );
125  vtkBooleanMacro( LabelVisibility, int );
126  virtual void SetLabelText( const char * label );
127  virtual char * GetLabelText();
129 
131 
134  virtual void SetLabelTextScale( double scale[3] );
135  void SetLabelTextScale(double x, double y, double z)
136  {
137  double scale[3] = {x, y, z};
138  this->SetLabelTextScale(scale);
139  }
140  virtual double * GetLabelTextScale();
142 
144 
147  vtkGetObjectMacro( LabelTextActor, vtkFollower );
149 
155  virtual void SetUniformScale( double scale );
156 
158 
161  vtkSetMacro( HandleVisibility, int );
162  vtkGetMacro( HandleVisibility, int );
163  vtkBooleanMacro( HandleVisibility, int );
165 
166  void Highlight(int highlight) VTK_OVERRIDE;
167 
169 
180  vtkSetMacro( SmoothMotion, int );
181  vtkGetMacro( SmoothMotion, int );
182  vtkBooleanMacro( SmoothMotion, int );
184 
185 protected:
188 
189  vtkActor * Actor;
191  vtkTransformPolyDataFilter * HandleTransformFilter;
192  vtkMatrixToLinearTransform * HandleTransform;
193  vtkMatrix4x4 * HandleTransformMatrix;
194  vtkCellPicker * HandlePicker;
195  double LastPickPosition[3];
196  double LastEventPosition[2];
197  int ConstraintAxis;
198  vtkProperty * Property;
199  vtkProperty * SelectedProperty;
200  int WaitingForMotion;
201  int WaitCount;
202  int HandleVisibility;
203 
204  // Register internal Pickers within PickingManager
205  void RegisterPickers() VTK_OVERRIDE;
206 
207  // Methods to manipulate the cursor
208  virtual void Translate(double *p1, double *p2);
209  virtual void Scale(double *p1, double *p2, double eventPos[2]);
210  virtual void MoveFocus(double *p1, double *p2);
211 
212  void CreateDefaultProperties();
213 
214  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
215  // world coordinates), the new display position of the handle center is
216  // populated into requestedDisplayPos. This is again only a request for the
217  // new display position. It is up to the point placer to deduce the
218  // appropriate world co-ordinates that this display position will map into.
219  // The placer may even disallow such a movement.
220  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
221  // as the event position, ie the location of the mouse cursor. If its OFF,
222  // incremental offsets as described above are used to compute it.
223  void MoveFocusRequest( double *p1, double *p2,
224  double eventPos[2], double requestedDisplayPos[3] );
225 
226  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
227 
237  virtual void UpdateHandle();
238 
242  virtual void UpdateLabel();
243 
244  // Handle the label.
245  int LabelVisibility;
246  vtkFollower *LabelTextActor;
247  vtkPolyDataMapper *LabelTextMapper;
248  vtkVectorText *LabelTextInput;
249  bool LabelAnnotationTextScaleInitialized;
250  int SmoothMotion;
251 
252 private:
254  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) VTK_DELETE_FUNCTION;
255 };
256 
257 #endif
258 
259 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
virtual void SetWorldPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
transform points and associated normals and vectors for polygonal dataset
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
represent a user defined handle geometry in 3D while maintaining a fixed orientation w...
superclass for all geometric transformations
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:40
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
virtual void Highlight(int vtkNotUsed(highlightOn))
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
convert a matrix to a transform
create polygonal text
Definition: vtkVectorText.h:41