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 =========================================================================*/
40 #ifndef vtkConstrainedPointHandleRepresentation_h
41 #define vtkConstrainedPointHandleRepresentation_h
42 
43 #include "vtkInteractionWidgetsModule.h" // For export macro
45 
46 class vtkProperty;
47 class vtkActor;
48 class vtkPolyDataMapper;
49 class vtkPolyData;
50 class vtkGlyph3D;
51 class vtkPoints;
52 class vtkPolyData;
53 class vtkPlane;
54 class vtkPlaneCollection;
55 class vtkPlanes;
56 class vtkRenderer;
57 
58 class VTKINTERACTIONWIDGETS_EXPORT vtkConstrainedPointHandleRepresentation : public vtkHandleRepresentation
59 {
60 public:
65 
67 
71  void PrintSelf(ostream& os, vtkIndent indent);
73 
75 
80  void SetCursorShape(vtkPolyData *cursorShape);
81  vtkPolyData *GetCursorShape();
83 
85 
90  void SetActiveCursorShape(vtkPolyData *activeShape);
91  vtkPolyData *GetActiveCursorShape();
93 
95 
100  vtkSetClampMacro(ProjectionNormal,int,
103  vtkGetMacro(ProjectionNormal,int);
105 
107  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
109  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
111  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
113  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
114 
116 
120  void SetObliquePlane(vtkPlane *);
121  vtkGetObjectMacro(ObliquePlane, vtkPlane);
123 
125 
132  void SetProjectionPosition(double position);
133  vtkGetMacro(ProjectionPosition, double);
135 
137 
145  void AddBoundingPlane(vtkPlane *plane);
146  void RemoveBoundingPlane(vtkPlane *plane);
147  void RemoveAllBoundingPlanes();
148  virtual void SetBoundingPlanes(vtkPlaneCollection*);
149  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
150  void SetBoundingPlanes(vtkPlanes *planes);
152 
158  virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
159 
161 
166  void SetPosition(double x, double y, double z);
167  void SetPosition(double xyz[3]);
168  double* GetPosition();
169  void GetPosition(double xyz[3]);
171 
173 
177  vtkGetObjectMacro(Property,vtkProperty);
179 
181 
185  vtkGetObjectMacro(SelectedProperty,vtkProperty);
187 
189 
193  vtkGetObjectMacro(ActiveProperty,vtkProperty);
195 
197 
202  virtual void SetRenderer(vtkRenderer *ren);
203  virtual void BuildRepresentation();
204  virtual void StartWidgetInteraction(double eventPos[2]);
205  virtual void WidgetInteraction(double eventPos[2]);
206  virtual int ComputeInteractionState(int X, int Y, int modify);
208 
213  virtual void SetDisplayPosition(double pos[3]);
214 
216 
219  virtual void GetActors(vtkPropCollection *);
220  virtual void ReleaseGraphicsResources(vtkWindow *);
221  virtual int RenderOverlay(vtkViewport *viewport);
222  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
223  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
224  virtual int HasTranslucentPolygonalGeometry();
225  virtual void ShallowCopy(vtkProp* prop);
227 
228  enum {XAxis=0,YAxis,ZAxis,Oblique};
229 
230  void Highlight(int highlight);
231 
232 protected:
235 
236  // Render the cursor
244 
245  // Support picking
246  double LastPickPosition[3];
247  double LastEventPosition[2];
248 
249  // Methods to manipulate the cursor
250  void Translate(double eventPos[2]);
251  void Scale(double eventPos[2]);
252 
253 
254  // Properties used to control the appearance of selected objects and
255  // the manipulator in general.
259  void CreateDefaultProperties();
260 
261  // Controlling vars
266 
268 
269  // Internal method for computing 3D location from 2D screen position
270  int GetIntersectionPosition( double eventPos[2],
271  double worldPos[3],
272  double tolerance = 0.0,
273  vtkRenderer *renderer=0);
274 
275  // Internal method for getting the project normal as a vector
276  void GetProjectionNormal( double normal[3] );
277 
278  // Internal method for getting the origin of the
279  // constraining plane as a 3-tuple
280  void GetProjectionOrigin( double origin[3] );
281 
282 
283 
284  // Distance between where the mouse event happens and where the
285  // widget is focused - maintain this distance during interaction.
286  double InteractionOffset[2];
287 
288 private:
290  void operator=(const vtkConstrainedPointHandleRepresentation&) VTK_DELETE_FUNCTION;
291 };
292 
293 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
virtual void SetRenderer(vtkRenderer *ren)
Methods to make this class properly act like a vtkWidgetRepresentation.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
virtual void StartWidgetInteraction(double eventPos[2])
maintain a list of planes
implicit function for convex set of planes
Definition: vtkPlanes.h:54
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
a list of Props
virtual void ShallowCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
virtual int CheckConstraint(vtkRenderer *renderer, double pos[2])
Method has to be overridden in the subclasses which has constraints on placing the handle (Ex...
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
a simple class to control print indentation
Definition: vtkIndent.h:39
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
perform various plane computations
Definition: vtkPlane.h:37
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
For some exporters and other other operations we must be able to collect all the actors or volumes...
void PrintSelf(ostream &os, vtkIndent indent)
Standard methods for instances of this class.
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void Highlight(int vtkNotUsed(highlightOn))
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
point representation constrained to a 2D plane
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
represent and manipulate 3D points
Definition: vtkPoints.h:39