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 =========================================================================*/
34 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
35 #define vtkAbstractPolygonalHandleRepresentation3D_h
36 
37 #include "vtkInteractionWidgetsModule.h" // For export macro
39 
40 class vtkProperty;
41 class vtkPolyDataMapper;
42 class vtkCellPicker;
45 class vtkMatrix4x4;
46 class vtkPolyData;
48 class vtkActor;
49 class vtkFollower;
50 class vtkVectorText;
51 
52 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
54 {
55 public:
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
69  void SetWorldPosition(double p[3]) override;
70  void SetDisplayPosition(double p[3]) override;
72 
74 
77  void SetHandle( vtkPolyData * );
78  vtkPolyData * GetHandle();
80 
82 
85  void SetProperty(vtkProperty*);
86  void SetSelectedProperty(vtkProperty*);
87  vtkGetObjectMacro(Property,vtkProperty);
88  vtkGetObjectMacro(SelectedProperty,vtkProperty);
90 
95  virtual vtkAbstractTransform * GetTransform();
96 
98 
101  void BuildRepresentation() override;
102  void StartWidgetInteraction(double eventPos[2]) override;
103  void WidgetInteraction(double eventPos[2]) override;
104  int ComputeInteractionState(int X, int Y, int modify=0) override;
106 
108 
111  void ShallowCopy(vtkProp *prop) override;
112  void DeepCopy(vtkProp *prop) override;
113  void GetActors(vtkPropCollection *) override;
114  void ReleaseGraphicsResources(vtkWindow *) override;
115  int RenderOpaqueGeometry(vtkViewport *viewport) override;
116  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
118  double *GetBounds() override;
120 
122 
126  vtkSetMacro( LabelVisibility, vtkTypeBool );
127  vtkGetMacro( LabelVisibility, vtkTypeBool );
128  vtkBooleanMacro( LabelVisibility, vtkTypeBool );
129  virtual void SetLabelText( const char * label );
130  virtual char * GetLabelText();
132 
134 
137  virtual void SetLabelTextScale( double scale[3] );
138  void SetLabelTextScale(double x, double y, double z)
139  {
140  double scale[3] = {x, y, z};
141  this->SetLabelTextScale(scale);
142  }
143  virtual double * GetLabelTextScale();
145 
147 
150  vtkGetObjectMacro( LabelTextActor, vtkFollower );
152 
158  virtual void SetUniformScale( double scale );
159 
161 
164  vtkSetMacro( HandleVisibility, vtkTypeBool );
165  vtkGetMacro( HandleVisibility, vtkTypeBool );
166  vtkBooleanMacro( HandleVisibility, vtkTypeBool );
168 
169  void Highlight(int highlight) override;
170 
172 
183  vtkSetMacro( SmoothMotion, vtkTypeBool );
184  vtkGetMacro( SmoothMotion, vtkTypeBool );
185  vtkBooleanMacro( SmoothMotion, vtkTypeBool );
187 
188  /*
189  * Register internal Pickers within PickingManager
190  */
191  void RegisterPickers() override;
192 
193 protected:
196 
203  double LastPickPosition[3];
204  double LastEventPosition[2];
211 
212  // Methods to manipulate the cursor
213  virtual void Translate(double *p1, double *p2);
214  virtual void Scale(double *p1, double *p2, double eventPos[2]);
215  virtual void MoveFocus(double *p1, double *p2);
216 
217  void CreateDefaultProperties();
218 
219  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
220  // world coordinates), the new display position of the handle center is
221  // populated into requestedDisplayPos. This is again only a request for the
222  // new display position. It is up to the point placer to deduce the
223  // appropriate world co-ordinates that this display position will map into.
224  // The placer may even disallow such a movement.
225  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
226  // as the event position, ie the location of the mouse cursor. If its OFF,
227  // incremental offsets as described above are used to compute it.
228  void MoveFocusRequest( double *p1, double *p2,
229  double eventPos[2], double requestedDisplayPos[3] );
230 
231  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
232 
242  virtual void UpdateHandle();
243 
247  virtual void UpdateLabel();
248 
249  // Handle the label.
256 
257 private:
259  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
260 };
261 
262 #endif
263 
264 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:66
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:85
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.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
represent a user defined handle geometry in 3D while maintaining a fixed orientation w...
superclass for all geometric transformations
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
virtual void DeepCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:46
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual void Highlight(int vtkNotUsed(highlightOn))
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
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:47
void SetLabelTextScale(double x, double y, double z)
Scale text (font size along each dimension).