VTK
vtkConstrainedPointHandleRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkConstrainedPointHandleRepresentation.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 =========================================================================*/
39 #ifndef vtkConstrainedPointHandleRepresentation_h
40 #define vtkConstrainedPointHandleRepresentation_h
41 
42 #include "vtkInteractionWidgetsModule.h" // For export macro
44 
45 class vtkProperty;
46 class vtkActor;
47 class vtkPolyDataMapper;
48 class vtkPolyData;
49 class vtkGlyph3D;
50 class vtkPoints;
51 class vtkPolyData;
52 class vtkPlane;
53 class vtkPlaneCollection;
54 class vtkPlanes;
55 class vtkRenderer;
56 
58 {
59 public:
62 
64 
66  void PrintSelf(ostream& os, vtkIndent indent);
68 
70 
73  void SetCursorShape(vtkPolyData *cursorShape);
76 
78 
81  void SetActiveCursorShape(vtkPolyData *activeShape);
84 
86 
89  vtkSetClampMacro(ProjectionNormal,int,
92  vtkGetMacro(ProjectionNormal,int);
94 
96  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
98  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
100  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
102  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
103 
105 
108  vtkGetObjectMacro(ObliquePlane, vtkPlane);
110 
112 
117  vtkGetMacro(ProjectionPosition, double);
119 
121 
134 
138  virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
139 
141 
144  void SetPosition(double x, double y, double z);
145  void SetPosition(double xyz[3]);
146  double* GetPosition();
147  void GetPosition(double xyz[3]);
149 
151 
155 
157 
159  vtkGetObjectMacro(SelectedProperty,vtkProperty);
161 
163 
167 
169 
172  virtual void SetRenderer(vtkRenderer *ren);
173  virtual void BuildRepresentation();
174  virtual void StartWidgetInteraction(double eventPos[2]);
175  virtual void WidgetInteraction(double eventPos[2]);
176  virtual int ComputeInteractionState(int X, int Y, int modify);
178 
181  virtual void SetDisplayPosition(double pos[3]);
182 
184 
185  virtual void GetActors(vtkPropCollection *);
187  virtual int RenderOverlay(vtkViewport *viewport);
188  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
191  virtual void ShallowCopy(vtkProp* prop);
193 
194 //BTX
195  enum {XAxis=0,YAxis,ZAxis,Oblique};
196 //ETX
197 
198  void Highlight(int highlight);
199 
200 protected:
203 
204  // Render the cursor
212 
213  // Support picking
214  double LastPickPosition[3];
215  double LastEventPosition[2];
216 
217  // Methods to manipulate the cursor
218  void Translate(double eventPos[2]);
219  void Scale(double eventPos[2]);
220 
221 
222  // Properties used to control the appearance of selected objects and
223  // the manipulator in general.
228 
229  // Controlling vars
234 
236 
237  // Internal method for computing 3D location from 2D screen position
238  int GetIntersectionPosition( double eventPos[2],
239  double worldPos[3],
240  double tolerance = 0.0,
241  vtkRenderer *renderer=0);
242 
243  // Internal method for getting the project normal as a vector
244  void GetProjectionNormal( double normal[3] );
245 
246  // Internal method for getting the origin of the
247  // constraining plane as a 3-tuple
248  void GetProjectionOrigin( double origin[3] );
249 
250 
251 
252  // Distance between where the mouse event happens and where the
253  // widget is focused - maintain this distance during interaction.
254  double InteractionOffset[2];
255 
256 private:
258  void operator=(const vtkConstrainedPointHandleRepresentation&); //Not implemented
259 };
260 
261 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkConstrainedPointHandleRepresentation::ZAxis
@ ZAxis
Definition: vtkConstrainedPointHandleRepresentation.h:195
vtkConstrainedPointHandleRepresentation
point representation constrained to a 2D plane
Definition: vtkConstrainedPointHandleRepresentation.h:58
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkConstrainedPointHandleRepresentation::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkConstrainedPointHandleRepresentation.h:225
vtkConstrainedPointHandleRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkConstrainedPointHandleRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport)
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToXAxis
void SetProjectionNormalToXAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:95
vtkConstrainedPointHandleRepresentation::SetPosition
void SetPosition(double x, double y, double z)
vtkConstrainedPointHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
vtkConstrainedPointHandleRepresentation::RemoveAllBoundingPlanes
void RemoveAllBoundingPlanes()
vtkConstrainedPointHandleRepresentation::Scale
void Scale(double eventPos[2])
vtkConstrainedPointHandleRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify)
vtkConstrainedPointHandleRepresentation::CheckConstraint
virtual int CheckConstraint(vtkRenderer *renderer, double pos[2])
vtkConstrainedPointHandleRepresentation::Actor
vtkActor * Actor
Definition: vtkConstrainedPointHandleRepresentation.h:205
vtkConstrainedPointHandleRepresentation::SetBoundingPlanes
void SetBoundingPlanes(vtkPlanes *planes)
vtkConstrainedPointHandleRepresentation::ProjectionPosition
double ProjectionPosition
Definition: vtkConstrainedPointHandleRepresentation.h:231
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:58
vtkConstrainedPointHandleRepresentation::GetPosition
double * GetPosition()
vtkConstrainedPointHandleRepresentation::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkConstrainedPointHandleRepresentation.h:206
vtkInteractionWidgetsModule.h
vtkConstrainedPointHandleRepresentation::CursorShape
vtkPolyData * CursorShape
Definition: vtkConstrainedPointHandleRepresentation.h:208
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkConstrainedPointHandleRepresentation::ActiveCursorShape
vtkPolyData * ActiveCursorShape
Definition: vtkConstrainedPointHandleRepresentation.h:209
vtkConstrainedPointHandleRepresentation::GetIntersectionPosition
int GetIntersectionPosition(double eventPos[2], double worldPos[3], double tolerance=0.0, vtkRenderer *renderer=0)
vtkHandleRepresentation.h
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:54
vtkConstrainedPointHandleRepresentation::ProjectToPlane
int ProjectToPlane
Definition: vtkConstrainedPointHandleRepresentation.h:232
vtkConstrainedPointHandleRepresentation::Property
vtkProperty * Property
Definition: vtkConstrainedPointHandleRepresentation.h:224
vtkConstrainedPointHandleRepresentation::SetRenderer
virtual void SetRenderer(vtkRenderer *ren)
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkConstrainedPointHandleRepresentation::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
vtkConstrainedPointHandleRepresentation::SetPosition
void SetPosition(double xyz[3])
vtkConstrainedPointHandleRepresentation::Translate
void Translate(double eventPos[2])
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkConstrainedPointHandleRepresentation::New
static vtkConstrainedPointHandleRepresentation * New()
vtkConstrainedPointHandleRepresentation::RemoveBoundingPlane
void RemoveBoundingPlane(vtkPlane *plane)
vtkConstrainedPointHandleRepresentation::vtkConstrainedPointHandleRepresentation
vtkConstrainedPointHandleRepresentation()
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToOblique
void SetProjectionNormalToOblique()
Definition: vtkConstrainedPointHandleRepresentation.h:101
vtkConstrainedPointHandleRepresentation::ObliquePlane
vtkPlane * ObliquePlane
Definition: vtkConstrainedPointHandleRepresentation.h:233
vtkConstrainedPointHandleRepresentation::ActiveProperty
vtkProperty * ActiveProperty
Definition: vtkConstrainedPointHandleRepresentation.h:226
vtkConstrainedPointHandleRepresentation::SetActiveCursorShape
void SetActiveCursorShape(vtkPolyData *activeShape)
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToZAxis
void SetProjectionNormalToZAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:99
vtkConstrainedPointHandleRepresentation::AddBoundingPlane
void AddBoundingPlane(vtkPlane *plane)
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkConstrainedPointHandleRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkConstrainedPointHandleRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkConstrainedPointHandleRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
vtkConstrainedPointHandleRepresentation::RenderOverlay
virtual int RenderOverlay(vtkViewport *viewport)
vtkConstrainedPointHandleRepresentation::GetProjectionNormal
void GetProjectionNormal(double normal[3])
vtkConstrainedPointHandleRepresentation::Highlight
void Highlight(int highlight)
vtkConstrainedPointHandleRepresentation::GetActiveCursorShape
vtkPolyData * GetActiveCursorShape()
vtkConstrainedPointHandleRepresentation::BoundingPlanes
vtkPlaneCollection * BoundingPlanes
Definition: vtkConstrainedPointHandleRepresentation.h:235
vtkConstrainedPointHandleRepresentation::GetPosition
void GetPosition(double xyz[3])
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkConstrainedPointHandleRepresentation::FocalData
vtkPolyData * FocalData
Definition: vtkConstrainedPointHandleRepresentation.h:210
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToYAxis
void SetProjectionNormalToYAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:97
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkConstrainedPointHandleRepresentation::WidgetInteraction
virtual void WidgetInteraction(double eventPos[2])
vtkGlyph3D
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkConstrainedPointHandleRepresentation::SetCursorShape
void SetCursorShape(vtkPolyData *cursorShape)
vtkConstrainedPointHandleRepresentation::Glypher
vtkGlyph3D * Glypher
Definition: vtkConstrainedPointHandleRepresentation.h:207
vtkConstrainedPointHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkConstrainedPointHandleRepresentation::~vtkConstrainedPointHandleRepresentation
~vtkConstrainedPointHandleRepresentation()
VTKINTERACTIONWIDGETS_EXPORT
#define VTKINTERACTIONWIDGETS_EXPORT
Definition: vtkInteractionWidgetsModule.h:15
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkConstrainedPointHandleRepresentation::Oblique
@ Oblique
Definition: vtkConstrainedPointHandleRepresentation.h:195
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkConstrainedPointHandleRepresentation::XAxis
@ XAxis
Definition: vtkConstrainedPointHandleRepresentation.h:195
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkConstrainedPointHandleRepresentation::YAxis
@ YAxis
Definition: vtkConstrainedPointHandleRepresentation.h:195
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkConstrainedPointHandleRepresentation::GetProjectionOrigin
void GetProjectionOrigin(double origin[3])
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:36
vtkConstrainedPointHandleRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
vtkConstrainedPointHandleRepresentation::BuildRepresentation
virtual void BuildRepresentation()
vtkConstrainedPointHandleRepresentation::SetBoundingPlanes
virtual void SetBoundingPlanes(vtkPlaneCollection *)
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkConstrainedPointHandleRepresentation::ProjectionNormal
int ProjectionNormal
Definition: vtkConstrainedPointHandleRepresentation.h:230
vtkConstrainedPointHandleRepresentation::GetCursorShape
vtkPolyData * GetCursorShape()
vtkConstrainedPointHandleRepresentation::FocalPoint
vtkPoints * FocalPoint
Definition: vtkConstrainedPointHandleRepresentation.h:211
vtkConstrainedPointHandleRepresentation::GetActors
virtual void GetActors(vtkPropCollection *)
vtkConstrainedPointHandleRepresentation::SetProjectionPosition
void SetProjectionPosition(double position)
vtkConstrainedPointHandleRepresentation::SetObliquePlane
void SetObliquePlane(vtkPlane *)