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 
43 
44 class vtkProperty;
45 class vtkActor;
46 class vtkPolyDataMapper;
47 class vtkPolyData;
48 class vtkGlyph3D;
49 class vtkPoints;
50 class vtkPolyData;
51 class vtkPlane;
52 class vtkPlaneCollection;
53 class vtkPlanes;
54 class vtkRenderer;
55 
57 {
58 public:
61 
63 
65  void PrintSelf(ostream& os, vtkIndent indent);
67 
69 
72  void SetCursorShape(vtkPolyData *cursorShape);
73  vtkPolyData *GetCursorShape();
75 
77 
80  void SetActiveCursorShape(vtkPolyData *activeShape);
81  vtkPolyData *GetActiveCursorShape();
83 
85 
88  vtkSetClampMacro(ProjectionNormal,int,
91  vtkGetMacro(ProjectionNormal,int);
93 
95  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
97  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
99  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
101  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
102 
104 
106  void SetObliquePlane(vtkPlane *);
107  vtkGetObjectMacro(ObliquePlane, vtkPlane);
109 
111 
115  void SetProjectionPosition(double position);
116  vtkGetMacro(ProjectionPosition, double);
118 
120 
126  void AddBoundingPlane(vtkPlane *plane);
127  void RemoveBoundingPlane(vtkPlane *plane);
128  void RemoveAllBoundingPlanes();
129  virtual void SetBoundingPlanes(vtkPlaneCollection*);
130  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
131  void SetBoundingPlanes(vtkPlanes *planes);
133 
137  virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
138 
140 
143  void SetPosition(double x, double y, double z);
144  void SetPosition(double xyz[3]);
145  double* GetPosition();
146  void GetPosition(double xyz[3]);
148 
150 
152  vtkGetObjectMacro(Property,vtkProperty);
154 
156 
158  vtkGetObjectMacro(SelectedProperty,vtkProperty);
160 
162 
164  vtkGetObjectMacro(ActiveProperty,vtkProperty);
166 
168 
171  virtual void SetRenderer(vtkRenderer *ren);
172  virtual void BuildRepresentation();
173  virtual void StartWidgetInteraction(double eventPos[2]);
174  virtual void WidgetInteraction(double eventPos[2]);
175  virtual int ComputeInteractionState(int X, int Y, int modify);
177 
180  virtual void SetDisplayPosition(double pos[3]);
181 
183 
184  virtual void GetActors(vtkPropCollection *);
185  virtual void ReleaseGraphicsResources(vtkWindow *);
186  virtual int RenderOverlay(vtkViewport *viewport);
187  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
188  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
189  virtual int HasTranslucentPolygonalGeometry();
190  virtual void ShallowCopy(vtkProp* prop);
192 
193 //BTX
194  enum {XAxis=0,YAxis,ZAxis,Oblique};
195 //ETX
196 
197  void Highlight(int highlight);
198 
199 protected:
202 
203  // Render the cursor
211 
212  // Support picking
213  double LastPickPosition[3];
214  double LastEventPosition[2];
215 
216  // Methods to manipulate the cursor
217  void Translate(double eventPos[2]);
218  void Scale(double eventPos[2]);
219 
220 
221  // Properties used to control the appearance of selected objects and
222  // the manipulator in general.
226  void CreateDefaultProperties();
227 
228  // Controlling vars
233 
235 
236  // Internal method for computing 3D location from 2D screen position
237  int GetIntersectionPosition( double eventPos[2],
238  double worldPos[3],
239  double tolerance = 0.0,
240  vtkRenderer *renderer=0);
241 
242  // Internal method for getting the project normal as a vector
243  void GetProjectionNormal( double normal[3] );
244 
245  // Internal method for getting the origin of the
246  // constraining plane as a 3-tuple
247  void GetProjectionOrigin( double origin[3] );
248 
249 
250 
251  // Distance between where the mouse event happens and where the
252  // widget is focused - maintain this distance during interaction.
253  double InteractionOffset[2];
254 
255 private:
257  void operator=(const vtkConstrainedPointHandleRepresentation&); //Not implemented
258 };
259 
260 #endif