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);
74  vtkPolyData *GetCursorShape();
76 
78 
81  void SetActiveCursorShape(vtkPolyData *activeShape);
82  vtkPolyData *GetActiveCursorShape();
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 
107  void SetObliquePlane(vtkPlane *);
108  vtkGetObjectMacro(ObliquePlane, vtkPlane);
110 
112 
116  void SetProjectionPosition(double position);
117  vtkGetMacro(ProjectionPosition, double);
119 
121 
127  void AddBoundingPlane(vtkPlane *plane);
128  void RemoveBoundingPlane(vtkPlane *plane);
129  void RemoveAllBoundingPlanes();
130  virtual void SetBoundingPlanes(vtkPlaneCollection*);
131  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
132  void SetBoundingPlanes(vtkPlanes *planes);
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 
153  vtkGetObjectMacro(Property,vtkProperty);
155 
157 
159  vtkGetObjectMacro(SelectedProperty,vtkProperty);
161 
163 
165  vtkGetObjectMacro(ActiveProperty,vtkProperty);
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 *);
186  virtual void ReleaseGraphicsResources(vtkWindow *);
187  virtual int RenderOverlay(vtkViewport *viewport);
188  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
189  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
190  virtual int HasTranslucentPolygonalGeometry();
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.
227  void CreateDefaultProperties();
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
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
virtual void SetRenderer(vtkRenderer *ren)
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:63
virtual void StartWidgetInteraction(double eventPos[2])
maintain a list of planes
implicit function for convex set of planes
Definition: vtkPlanes.h:53
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void BuildRepresentation()=0
a list of Props
virtual void ShallowCopy(vtkProp *prop)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
virtual int CheckConstraint(vtkRenderer *renderer, double pos[2])
virtual int HasTranslucentPolygonalGeometry()
a simple class to control print indentation
Definition: vtkIndent.h:38
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:110
perform various plane computations
Definition: vtkPlane.h:36
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
void PrintSelf(ostream &os, vtkIndent indent)
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void Highlight(int vtkNotUsed(highlightOn))
static vtkObject * New()
point representation constrained to a 2D plane
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void SetDisplayPosition(double pos[3])
represent and manipulate 3D points
Definition: vtkPoints.h:38