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 =========================================================================*/
29 #ifndef vtkPointHandleRepresentation3D_h
30 #define vtkPointHandleRepresentation3D_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
35 
36 class vtkCursor3D;
37 class vtkProperty;
38 class vtkActor;
39 class vtkPolyDataMapper;
40 class vtkCellPicker;
41 
43 {
44 public:
47 
49 
51  void PrintSelf(ostream& os, vtkIndent indent);
53 
55 
60  virtual void SetWorldPosition(double p[3]);
61  virtual void SetDisplayPosition(double p[3]);
63 
65 
66  void SetOutline(int o)
67  {this->Cursor3D->SetOutline(o);}
68  int GetOutline()
69  {return this->Cursor3D->GetOutline();}
70  void OutlineOn()
71  {this->Cursor3D->OutlineOn();}
72  void OutlineOff()
73  {this->Cursor3D->OutlineOff();}
75 
77 
78  void SetXShadows(int o)
79  {this->Cursor3D->SetXShadows(o);}
81  {return this->Cursor3D->GetXShadows();}
82  void XShadowsOn()
83  {this->Cursor3D->XShadowsOn();}
84  void XShadowsOff()
85  {this->Cursor3D->XShadowsOff();}
87 
89 
90  void SetYShadows(int o)
91  {this->Cursor3D->SetYShadows(o);}
93  {return this->Cursor3D->GetYShadows();}
94  void YShadowsOn()
95  {this->Cursor3D->YShadowsOn();}
96  void YShadowsOff()
97  {this->Cursor3D->YShadowsOff();}
99 
101 
102  void SetZShadows(int o)
103  {this->Cursor3D->SetZShadows(o);}
105  {return this->Cursor3D->GetZShadows();}
106  void ZShadowsOn()
107  {this->Cursor3D->ZShadowsOn();}
108  void ZShadowsOff()
109  {this->Cursor3D->ZShadowsOff();}
111 
113 
124  vtkGetMacro(TranslationMode,int);
125  vtkBooleanMacro(TranslationMode,int);
127 
129 
130  void AllOn()
131  {
132  this->OutlineOn();
133  this->XShadowsOn();
134  this->YShadowsOn();
135  this->ZShadowsOn();
136  }
137  void AllOff()
138  {
139  this->OutlineOff();
140  this->XShadowsOff();
141  this->YShadowsOff();
142  this->ZShadowsOff();
143  }
145 
147 
151  vtkGetObjectMacro(SelectedProperty,vtkProperty);
153 
155 
159  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
160  vtkGetMacro(HotSpotSize,double);
162 
165  virtual void SetHandleSize(double size);
166 
168 
170  virtual double *GetBounds();
171  virtual void BuildRepresentation();
172  virtual void StartWidgetInteraction(double eventPos[2]);
173  virtual void WidgetInteraction(double eventPos[2]);
174  virtual int ComputeInteractionState(int X, int Y, int modify=0);
175  virtual void PlaceWidget(double bounds[6]);
177 
179 
180  virtual void ShallowCopy(vtkProp *prop);
181  virtual void DeepCopy(vtkProp *prop);
182  virtual void GetActors(vtkPropCollection *);
184  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
188 
189  void Highlight(int highlight);
190 
192 
202  vtkSetMacro( SmoothMotion, int );
203  vtkGetMacro( SmoothMotion, int );
204  vtkBooleanMacro( SmoothMotion, int );
206 
207 protected:
210 
211  // the cursor3D
215 
216 
217  // Do the picking
219  double LastPickPosition[3];
220  double LastEventPosition[2];
221 
222  // Register internal Pickers within PickingManager
223  virtual void RegisterPickers();
224 
225  // Methods to manipulate the cursor
227  void Translate(double *p1, double *p2);
228  void Scale(double *p1, double *p2, double eventPos[2]);
229  void MoveFocus(double *p1, double *p2);
230  void SizeBounds();
231 
232  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
233  // world coordinates), the new display position of the handle center is
234  // populated into requestedDisplayPos. This is again only a request for the
235  // new display position. It is up to the point placer to deduce the
236  // appropriate world co-ordinates that this display position will map into.
237  // The placer may even disallow such a movement.
238  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
239  // as the event position, ie the location of the mouse cursor. If its OFF,
240  // incremental offsets as described above are used to compute it.
241  void MoveFocusRequest( double *p1, double *p2,
242  double eventPos[2], double requestedDisplayPos[3] );
243 
244  // Properties used to control the appearance of selected objects and
245  // the manipulator in general.
249 
250  // The size of the hot spot.
251  double HotSpotSize;
252  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
255 
256  // Current handle sized (may reflect scaling)
258 
259  // Control how translation works
261 
263 
264 private:
266  void operator=(const vtkPointHandleRepresentation3D&); //Not implemented
267 };
268 
269 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkCursor3D.h
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkPointHandleRepresentation3D::XShadowsOff
void XShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:84
vtkPointHandleRepresentation3D::~vtkPointHandleRepresentation3D
~vtkPointHandleRepresentation3D()
vtkPointHandleRepresentation3D::SetSelectedProperty
void SetSelectedProperty(vtkProperty *)
vtkPointHandleRepresentation3D::SetXShadows
void SetXShadows(int o)
Definition: vtkPointHandleRepresentation3D.h:78
vtkCursor3D
generate a 3D cursor representation
Definition: vtkCursor3D.h:39
vtkPointHandleRepresentation3D::SetYShadows
void SetYShadows(int o)
Definition: vtkPointHandleRepresentation3D.h:90
vtkPointHandleRepresentation3D::WaitCount
int WaitCount
Definition: vtkPointHandleRepresentation3D.h:254
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:43
vtkPointHandleRepresentation3D::GetYShadows
int GetYShadows()
Definition: vtkPointHandleRepresentation3D.h:92
vtkPointHandleRepresentation3D::Highlight
void Highlight(int highlight)
vtkPointHandleRepresentation3D::HotSpotSize
double HotSpotSize
Definition: vtkPointHandleRepresentation3D.h:251
vtkPointHandleRepresentation3D::YShadowsOn
void YShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:94
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkPointHandleRepresentation3D::GetZShadows
int GetZShadows()
Definition: vtkPointHandleRepresentation3D.h:104
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:58
vtkPointHandleRepresentation3D::DetermineConstraintAxis
int DetermineConstraintAxis(int constraint, double *x, double *startPoint)
vtkPointHandleRepresentation3D::GetActors
virtual void GetActors(vtkPropCollection *)
vtkInteractionWidgetsModule.h
vtkPointHandleRepresentation3D::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkPointHandleRepresentation3D::SetWorldPosition
virtual void SetWorldPosition(double p[3])
vtkPointHandleRepresentation3D::MoveFocus
void MoveFocus(double *p1, double *p2)
vtkHandleRepresentation.h
vtkPointHandleRepresentation3D::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
vtkPointHandleRepresentation3D::AllOn
void AllOn()
Definition: vtkPointHandleRepresentation3D.h:130
vtkPointHandleRepresentation3D::SetOutline
void SetOutline(int o)
Definition: vtkPointHandleRepresentation3D.h:66
vtkPointHandleRepresentation3D::WidgetInteraction
virtual void WidgetInteraction(double eventPos[2])
vtkPointHandleRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkPointHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkPointHandleRepresentation3D.h:213
vtkPointHandleRepresentation3D::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkPointHandleRepresentation3D::GetXShadows
int GetXShadows()
Definition: vtkPointHandleRepresentation3D.h:80
vtkPointHandleRepresentation3D::CursorPicker
vtkCellPicker * CursorPicker
Definition: vtkPointHandleRepresentation3D.h:218
vtkPointHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkPointHandleRepresentation3D.h:247
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:137
vtkPointHandleRepresentation3D::SetDisplayPosition
virtual void SetDisplayPosition(double p[3])
vtkPointHandleRepresentation3D::SetTranslationMode
void SetTranslationMode(int mode)
vtkPointHandleRepresentation3D::SetProperty
void SetProperty(vtkProperty *)
vtkPointHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkPointHandleRepresentation3D.h:246
vtkPointHandleRepresentation3D::OutlineOff
void OutlineOff()
Definition: vtkPointHandleRepresentation3D.h:72
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkPointHandleRepresentation3D::SizeBounds
void SizeBounds()
vtkPointHandleRepresentation3D::SetZShadows
void SetZShadows(int o)
Definition: vtkPointHandleRepresentation3D.h:102
vtkPointHandleRepresentation3D::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
vtkPointHandleRepresentation3D::CreateDefaultProperties
void CreateDefaultProperties()
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkPointHandleRepresentation3D::ZShadowsOff
void ZShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:108
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkPointHandleRepresentation3D::BuildRepresentation
virtual void BuildRepresentation()
vtkPointHandleRepresentation3D::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
VTKINTERACTIONWIDGETS_EXPORT
#define VTKINTERACTIONWIDGETS_EXPORT
Definition: vtkInteractionWidgetsModule.h:15
vtkPointHandleRepresentation3D::TranslationMode
int TranslationMode
Definition: vtkPointHandleRepresentation3D.h:260
vtkPointHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkPointHandleRepresentation3D.h:253
vtkPointHandleRepresentation3D::MoveFocusRequest
void MoveFocusRequest(double *p1, double *p2, double eventPos[2], double requestedDisplayPos[3])
vtkPointHandleRepresentation3D::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkPointHandleRepresentation3D::ConstraintAxis
int ConstraintAxis
Definition: vtkPointHandleRepresentation3D.h:226
vtkPointHandleRepresentation3D::YShadowsOff
void YShadowsOff()
Definition: vtkPointHandleRepresentation3D.h:96
vtkPointHandleRepresentation3D::New
static vtkPointHandleRepresentation3D * New()
vtkPointHandleRepresentation3D::XShadowsOn
void XShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:82
vtkPointHandleRepresentation3D::Cursor3D
vtkCursor3D * Cursor3D
Definition: vtkPointHandleRepresentation3D.h:214
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkPointHandleRepresentation3D::GetBounds
virtual double * GetBounds()
vtkPointHandleRepresentation3D::ZShadowsOn
void ZShadowsOn()
Definition: vtkPointHandleRepresentation3D.h:106
vtkPointHandleRepresentation3D::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkPointHandleRepresentation3D::RegisterPickers
virtual void RegisterPickers()
vtkPointHandleRepresentation3D::SetHandleSize
virtual void SetHandleSize(double size)
vtkPointHandleRepresentation3D::SmoothMotion
int SmoothMotion
Definition: vtkPointHandleRepresentation3D.h:262
vtkPointHandleRepresentation3D::Translate
void Translate(double *p1, double *p2)
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkgl::mode
GLenum mode
Definition: vtkgl.h:12325
vtkPointHandleRepresentation3D::CurrentHandleSize
double CurrentHandleSize
Definition: vtkPointHandleRepresentation3D.h:257
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkPointHandleRepresentation3D::GetOutline
int GetOutline()
Definition: vtkPointHandleRepresentation3D.h:68
vtkPointHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkPointHandleRepresentation3D.h:212
vtkPointHandleRepresentation3D::PlaceWidget
virtual void PlaceWidget(double bounds[6])
vtkPointHandleRepresentation3D::OutlineOn
void OutlineOn()
Definition: vtkPointHandleRepresentation3D.h:70
vtkPointHandleRepresentation3D::vtkPointHandleRepresentation3D
vtkPointHandleRepresentation3D()
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
vtkPointHandleRepresentation3D::Scale
void Scale(double *p1, double *p2, double eventPos[2])
vtkPointHandleRepresentation3D::DeepCopy
virtual void DeepCopy(vtkProp *prop)