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);
58 
60 
67  virtual void SetWorldPosition(double p[3]);
68  virtual void SetDisplayPosition(double p[3]);
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 
132  vtkGetMacro(TranslationMode,int);
133  vtkBooleanMacro(TranslationMode,int);
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 
162  vtkGetObjectMacro(Property,vtkProperty);
163  vtkGetObjectMacro(SelectedProperty,vtkProperty);
165 
167 
173  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
174  vtkGetMacro(HotSpotSize,double);
176 
180  virtual void SetHandleSize(double size);
181 
183 
186  virtual double *GetBounds();
187  virtual void BuildRepresentation();
188  virtual void StartWidgetInteraction(double eventPos[2]);
189  virtual void WidgetInteraction(double eventPos[2]);
190  virtual int ComputeInteractionState(int X, int Y, int modify=0);
191  virtual void PlaceWidget(double bounds[6]);
193 
195 
198  virtual void ShallowCopy(vtkProp *prop);
199  virtual void DeepCopy(vtkProp *prop);
200  virtual void GetActors(vtkPropCollection *);
202  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
206 
207  void Highlight(int highlight);
208 
210 
221  vtkSetMacro( SmoothMotion, int );
222  vtkGetMacro( SmoothMotion, int );
223  vtkBooleanMacro( SmoothMotion, int );
225 
226 protected:
229 
230  // the cursor3D
234 
235 
236  // Do the picking
238  double LastPickPosition[3];
239  double LastEventPosition[2];
240 
241  // Register internal Pickers within PickingManager
242  virtual void RegisterPickers();
243 
244  // Methods to manipulate the cursor
246  void Translate(double *p1, double *p2);
247  void Scale(double *p1, double *p2, double eventPos[2]);
248  void MoveFocus(double *p1, double *p2);
249  void SizeBounds();
250 
251  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
252  // world coordinates), the new display position of the handle center is
253  // populated into requestedDisplayPos. This is again only a request for the
254  // new display position. It is up to the point placer to deduce the
255  // appropriate world co-ordinates that this display position will map into.
256  // The placer may even disallow such a movement.
257  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
258  // as the event position, ie the location of the mouse cursor. If its OFF,
259  // incremental offsets as described above are used to compute it.
260  void MoveFocusRequest( double *p1, double *p2,
261  double eventPos[2], double requestedDisplayPos[3] );
262 
263  // Properties used to control the appearance of selected objects and
264  // the manipulator in general.
268 
269  // The size of the hot spot.
270  double HotSpotSize;
271  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
274 
275  // Current handle sized (may reflect scaling)
277 
278  // Control how translation works
280 
282 
283 private:
285  void operator=(const vtkPointHandleRepresentation3D&) VTK_DELETE_FUNCTION;
286 };
287 
288 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:43
vtkCursor3D.h
vtkPointHandleRepresentation3D::XShadowsOff
void XShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:92
vtkPointHandleRepresentation3D::~vtkPointHandleRepresentation3D
~vtkPointHandleRepresentation3D()
vtkPointHandleRepresentation3D::SetSelectedProperty
void SetSelectedProperty(vtkProperty *)
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:40
vtkPointHandleRepresentation3D::SetYShadows
void SetYShadows(int o)
Turn on/off the wireframe y-shadows.
Definition: vtkPointHandleRepresentation3D.h:98
vtkPointHandleRepresentation3D::WaitCount
int WaitCount
Definition: vtkPointHandleRepresentation3D.h:273
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:44
vtkPointHandleRepresentation3D::GetYShadows
int GetYShadows()
Definition: vtkPointHandleRepresentation3D.h:100
vtkPointHandleRepresentation3D::Highlight
void Highlight(int highlight)
vtkPointHandleRepresentation3D::HotSpotSize
double HotSpotSize
Definition: vtkPointHandleRepresentation3D.h:270
vtkPointHandleRepresentation3D::YShadowsOn
void YShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:102
vtkPointHandleRepresentation3D::GetZShadows
int GetZShadows()
Definition: vtkPointHandleRepresentation3D.h:112
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:59
vtkPointHandleRepresentation3D::DetermineConstraintAxis
int DetermineConstraintAxis(int constraint, double *x, double *startPoint)
vtkPointHandleRepresentation3D::GetActors
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkPointHandleRepresentation3D::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
Methods to make this class behave as a vtkProp.
vtkPointHandleRepresentation3D::SetWorldPosition
virtual void SetWorldPosition(double p[3])
Set the position of the point in world and display coordinates.
vtkPointHandleRepresentation3D::MoveFocus
void MoveFocus(double *p1, double *p2)
vtkHandleRepresentation.h
vtkPointHandleRepresentation3D::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
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
vtkPointHandleRepresentation3D::WidgetInteraction
virtual void WidgetInteraction(double eventPos[2])
vtkPointHandleRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkPointHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkPointHandleRepresentation3D.h:232
vtkPointHandleRepresentation3D::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkPointHandleRepresentation3D::GetXShadows
int GetXShadows()
Definition: vtkPointHandleRepresentation3D.h:88
vtkPointHandleRepresentation3D::CursorPicker
vtkCellPicker * CursorPicker
Definition: vtkPointHandleRepresentation3D.h:237
vtkPointHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkPointHandleRepresentation3D.h:266
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkPointHandleRepresentation3D::AllOff
void AllOff()
Definition: vtkPointHandleRepresentation3D.h:147
vtkPointHandleRepresentation3D::SetDisplayPosition
virtual void SetDisplayPosition(double p[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkPointHandleRepresentation3D::SetTranslationMode
void SetTranslationMode(int mode)
If translation mode is on, as the widget is moved the bounding box, shadows, and cursor are all trans...
vtkPointHandleRepresentation3D::SetProperty
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
vtkPointHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkPointHandleRepresentation3D.h:265
vtkPointHandleRepresentation3D::OutlineOff
void OutlineOff()
Definition: vtkPointHandleRepresentation3D.h:80
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkPointHandleRepresentation3D::SizeBounds
void SizeBounds()
vtkPointHandleRepresentation3D::SetZShadows
void SetZShadows(int o)
Turn on/off the wireframe z-shadows.
Definition: vtkPointHandleRepresentation3D.h:110
vtkPointHandleRepresentation3D::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
vtkPointHandleRepresentation3D::CreateDefaultProperties
void CreateDefaultProperties()
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkPointHandleRepresentation3D::ZShadowsOff
void ZShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:116
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkPointHandleRepresentation3D::BuildRepresentation
virtual void BuildRepresentation()
vtkPointHandleRepresentation3D::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
vtkPointHandleRepresentation3D::TranslationMode
int TranslationMode
Definition: vtkPointHandleRepresentation3D.h:279
vtkPointHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkPointHandleRepresentation3D.h:272
vtkPointHandleRepresentation3D::MoveFocusRequest
void MoveFocusRequest(double *p1, double *p2, double eventPos[2], double requestedDisplayPos[3])
vtkPointHandleRepresentation3D::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkPointHandleRepresentation3D::ConstraintAxis
int ConstraintAxis
Definition: vtkPointHandleRepresentation3D.h:245
vtkPointHandleRepresentation3D::YShadowsOff
void YShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:104
vtkPointHandleRepresentation3D::New
static vtkPointHandleRepresentation3D * New()
Instantiate this class.
vtkPointHandleRepresentation3D::XShadowsOn
void XShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:90
vtkPointHandleRepresentation3D::Cursor3D
vtkCursor3D * Cursor3D
Definition: vtkPointHandleRepresentation3D.h:233
vtkPointHandleRepresentation3D::GetBounds
virtual double * GetBounds()
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkPointHandleRepresentation3D::ZShadowsOn
void ZShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:114
vtkX3D::mode
@ mode
Definition: vtkX3D.h:247
vtkPointHandleRepresentation3D::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:65
vtkPointHandleRepresentation3D::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkPointHandleRepresentation3D::SetHandleSize
virtual void SetHandleSize(double size)
Overload the superclasses SetHandleSize() method to update internal variables.
vtkPointHandleRepresentation3D::SmoothMotion
int SmoothMotion
Definition: vtkPointHandleRepresentation3D.h:281
vtkPointHandleRepresentation3D::Translate
void Translate(double *p1, double *p2)
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:39
vtkPointHandleRepresentation3D::CurrentHandleSize
double CurrentHandleSize
Definition: vtkPointHandleRepresentation3D.h:276
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkPointHandleRepresentation3D::GetOutline
int GetOutline()
Definition: vtkPointHandleRepresentation3D.h:76
vtkPointHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkPointHandleRepresentation3D.h:231
vtkPointHandleRepresentation3D::PlaceWidget
virtual void PlaceWidget(double bounds[6])
vtkPointHandleRepresentation3D::OutlineOn
void OutlineOn()
Definition: vtkPointHandleRepresentation3D.h:78
vtkPointHandleRepresentation3D::vtkPointHandleRepresentation3D
vtkPointHandleRepresentation3D()
vtkPointHandleRepresentation3D::Scale
void Scale(double *p1, double *p2, double eventPos[2])
vtkPointHandleRepresentation3D::DeepCopy
virtual void DeepCopy(vtkProp *prop)