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 
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  // Register internal Pickers within PickingManager
183  virtual void RegisterPickers();
184 
185  // Methods to manipulate the cursor
186  virtual void Translate(double *p1, double *p2);
187  virtual void Scale(double *p1, double *p2, double eventPos[2]);
188  virtual void MoveFocus(double *p1, double *p2);
189 
190  void CreateDefaultProperties();
191 
192  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
193  // world coordinates), the new display position of the handle center is
194  // populated into requestedDisplayPos. This is again only a request for the
195  // new display position. It is up to the point placer to deduce the
196  // appropriate world co-ordinates that this display position will map into.
197  // The placer may even disallow such a movement.
198  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
199  // as the event position, ie the location of the mouse cursor. If its OFF,
200  // incremental offsets as described above are used to compute it.
201  void MoveFocusRequest( double *p1, double *p2,
202  double eventPos[2], double requestedDisplayPos[3] );
203 
204  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
205 
213  virtual void UpdateHandle();
214 
216  virtual void UpdateLabel();
217 
218  // Handle the label.
225 
226 private:
228  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&); //Not implemented
229 };
230 
231 #endif
232 
233 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
virtual void SetWorldPosition(double pos[3])
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:63
virtual void StartWidgetInteraction(double eventPos[2])
transform points and associated normals and vectors for polygonal dataset
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void BuildRepresentation()=0
a list of Props
virtual void ShallowCopy(vtkProp *prop)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
virtual int HasTranslucentPolygonalGeometry()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void RegisterPickers()
represent a user defined handle geometry in 3D while maintaining a fixed orientation w...
superclass for all geometric transformations
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
void PrintSelf(ostream &os, vtkIndent indent)
virtual void DeepCopy(vtkProp *prop)
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
a subclass of actor that always faces the camera
Definition: vtkFollower.h:45
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:68
virtual void Highlight(int vtkNotUsed(highlightOn))
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void SetDisplayPosition(double pos[3])
convert a matrix to a transform
create polygonal text
Definition: vtkVectorText.h:46