VTK
vtkPointHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointHandleRepresentation3D.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 =========================================================================*/
30 #ifndef vtkPointHandleRepresentation3D_h
31 #define vtkPointHandleRepresentation3D_h
32 
33 #include "vtkInteractionWidgetsModule.h" // For export macro
35 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
36 
37 class vtkCursor3D;
38 class vtkProperty;
39 class vtkActor;
40 class vtkPolyDataMapper;
41 class vtkCellPicker;
42 
43 class VTKINTERACTIONWIDGETS_EXPORT vtkPointHandleRepresentation3D : public vtkHandleRepresentation
44 {
45 public:
50 
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
67  void SetWorldPosition(double p[3]) override;
68  void SetDisplayPosition(double p[3]) override;
70 
74  void SetOutline(int o)
75  {this->Cursor3D->SetOutline(o);}
76  int GetOutline()
77  {return this->Cursor3D->GetOutline();}
78  void OutlineOn()
79  {this->Cursor3D->OutlineOn();}
80  void OutlineOff()
81  {this->Cursor3D->OutlineOff();}
82 
86  void SetXShadows(int o)
87  {this->Cursor3D->SetXShadows(o);}
89  {return this->Cursor3D->GetXShadows();}
90  void XShadowsOn()
91  {this->Cursor3D->XShadowsOn();}
92  void XShadowsOff()
93  {this->Cursor3D->XShadowsOff();}
94 
98  void SetYShadows(int o)
99  {this->Cursor3D->SetYShadows(o);}
101  {return this->Cursor3D->GetYShadows();}
102  void YShadowsOn()
103  {this->Cursor3D->YShadowsOn();}
104  void YShadowsOff()
105  {this->Cursor3D->YShadowsOff();}
106 
110  void SetZShadows(int o)
111  {this->Cursor3D->SetZShadows(o);}
113  {return this->Cursor3D->GetZShadows();}
114  void ZShadowsOn()
115  {this->Cursor3D->ZShadowsOn();}
116  void ZShadowsOff()
117  {this->Cursor3D->ZShadowsOff();}
118 
120 
131  void SetTranslationMode(vtkTypeBool mode);
132  vtkGetMacro(TranslationMode,vtkTypeBool);
133  vtkBooleanMacro(TranslationMode,vtkTypeBool);
135 
137 
140  void AllOn()
141  {
142  this->OutlineOn();
143  this->XShadowsOn();
144  this->YShadowsOn();
145  this->ZShadowsOn();
146  }
147  void AllOff()
148  {
149  this->OutlineOff();
150  this->XShadowsOff();
151  this->YShadowsOff();
152  this->ZShadowsOff();
153  }
155 
157 
160  void SetProperty(vtkProperty*);
161  void SetSelectedProperty(vtkProperty*);
162  vtkGetObjectMacro(Property,vtkProperty);
163  vtkGetObjectMacro(SelectedProperty,vtkProperty);
165 
167 
173  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
174  vtkGetMacro(HotSpotSize,double);
176 
180  void SetHandleSize(double size) override;
181 
183 
186  double *GetBounds() VTK_SIZEHINT(6) override;
187  void BuildRepresentation() override;
188  void StartWidgetInteraction(double eventPos[2]) override;
189  void WidgetInteraction(double eventPos[2]) override;
190  int ComputeInteractionState(int X, int Y, int modify=0) override;
191  void PlaceWidget(double bounds[6]) override;
192  void StartComplexInteraction(
194  vtkAbstractWidget *widget,
195  unsigned long event, void *calldata) override;
196  void ComplexInteraction(
198  vtkAbstractWidget *widget,
199  unsigned long event, void *calldata) override;
200  int ComputeComplexInteractionState(
202  vtkAbstractWidget *widget,
203  unsigned long event, void *calldata, int modify = 0) override;
205 
207 
210  void ShallowCopy(vtkProp *prop) override;
211  void DeepCopy(vtkProp *prop) override;
212  void GetActors(vtkPropCollection *) override;
213  void ReleaseGraphicsResources(vtkWindow *) override;
214  int RenderOpaqueGeometry(vtkViewport *viewport) override;
215  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
216  vtkTypeBool HasTranslucentPolygonalGeometry() override;
218 
219  void Highlight(int highlight) override;
220 
222 
233  vtkSetMacro( SmoothMotion, vtkTypeBool );
234  vtkGetMacro( SmoothMotion, vtkTypeBool );
235  vtkBooleanMacro( SmoothMotion, vtkTypeBool );
237 
238  /*
239  * Register internal Pickers within PickingManager
240  */
241  void RegisterPickers() override;
242 
243 protected:
245  ~vtkPointHandleRepresentation3D() override;
246 
247  // the cursor3D
248  vtkActor *Actor;
250  vtkCursor3D *Cursor3D;
251 
252 
253  // Do the picking
254  vtkCellPicker *CursorPicker;
255  double LastPickPosition[3];
256  double LastEventPosition[3];
257 
258  // Methods to manipulate the cursor
259  int ConstraintAxis;
260  void Translate(double *p1, double *p2);
261  void Scale(double *p1, double *p2, double eventPos[2]);
262  void MoveFocus(double *p1, double *p2);
263  void SizeBounds();
264 
265  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
266  // world coordinates), the new display position of the handle center is
267  // populated into requestedDisplayPos. This is again only a request for the
268  // new display position. It is up to the point placer to deduce the
269  // appropriate world co-ordinates that this display position will map into.
270  // The placer may even disallow such a movement.
271  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
272  // as the event position, ie the location of the mouse cursor. If its OFF,
273  // incremental offsets as described above are used to compute it.
274  void MoveFocusRequest( double *p1, double *p2,
275  double eventPos[2], double requestedDisplayPos[3] );
276 
277  // Properties used to control the appearance of selected objects and
278  // the manipulator in general.
279  vtkProperty *Property;
280  vtkProperty *SelectedProperty;
281  void CreateDefaultProperties();
282 
283  // The size of the hot spot.
284  double HotSpotSize;
285  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
286  int WaitingForMotion;
287  int WaitCount;
288 
289  // Current handle sized (may reflect scaling)
290  double CurrentHandleSize;
291 
292  // Control how translation works
293  vtkTypeBool TranslationMode;
294 
295  vtkTypeBool SmoothMotion;
296 
297 private:
299  void operator=(const vtkPointHandleRepresentation3D&) = delete;
300 };
301 
302 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkCursor3D.h
vtkPointHandleRepresentation3D::XShadowsOff
void XShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:92
vtkPointHandleRepresentation3D::SetXShadows
void SetXShadows(int o)
Turn on/off the wireframe x-shadows.
Definition: vtkPointHandleRepresentation3D.h:86
vtkCursor3D
generate a 3D cursor representation
Definition: vtkCursor3D.h:39
vtkPointHandleRepresentation3D::SetYShadows
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
Definition: vtkPointHandleRepresentation3D.h:98
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:43
vtkPointHandleRepresentation3D::GetYShadows
int GetYShadows()
Definition: vtkPointHandleRepresentation3D.h:100
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkPointHandleRepresentation3D::YShadowsOn
void YShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:102
vtkPointHandleRepresentation3D::GetZShadows
int GetZShadows()
Definition: vtkPointHandleRepresentation3D.h:112
vtkHandleRepresentation::SetWorldPosition
virtual void SetWorldPosition(double pos[3])
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:58
vtkHandleRepresentation.h
vtkPointHandleRepresentation3D::AllOn
void AllOn()
Convenience methods to turn outline and shadows on and off.
Definition: vtkPointHandleRepresentation3D.h:140
vtkPointHandleRepresentation3D::SetOutline
void SetOutline(int o)
Turn on/off the wireframe bounding box.
Definition: vtkPointHandleRepresentation3D.h:74
vtkWidgetRepresentation::SetHandleSize
virtual void SetHandleSize(double)
Set/Get the factor that controls the size of the handles that appear as part of the widget (if any).
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:63
vtkPointHandleRepresentation3D::GetXShadows
int GetXShadows()
Definition: vtkPointHandleRepresentation3D.h:88
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:215
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPointHandleRepresentation3D::AllOff
void AllOff()
Definition: vtkPointHandleRepresentation3D.h:147
vtkPointHandleRepresentation3D::OutlineOff
void OutlineOff()
Definition: vtkPointHandleRepresentation3D.h:80
vtkX3D::size
Definition: vtkX3D.h:253
vtkPointHandleRepresentation3D::SetZShadows
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
Definition: vtkPointHandleRepresentation3D.h:110
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:78
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkPointHandleRepresentation3D::ZShadowsOff
void ZShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:116
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkPointHandleRepresentation3D::YShadowsOff
void YShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:104
vtkPointHandleRepresentation3D::XShadowsOn
void XShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:90
vtkPointHandleRepresentation3D::ZShadowsOn
void ZShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:114
vtkX3D::mode
Definition: vtkX3D.h:247
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:66
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:41
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkPointHandleRepresentation3D::GetOutline
int GetOutline()
Definition: vtkPointHandleRepresentation3D.h:76
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPointHandleRepresentation3D::OutlineOn
void OutlineOn()
Definition: vtkPointHandleRepresentation3D.h:78