VTK
vtkParallelopipedRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkParallelopipedRepresentation.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 =========================================================================*/
33 #ifndef __vtkParallelopipedRepresentation_h
34 #define __vtkParallelopipedRepresentation_h
35 
37 
38 class vtkActor;
39 class vtkPlane;
40 class vtkPoints;
41 class vtkPolyData;
42 class vtkPolyDataMapper;
43 class vtkProperty;
44 class vtkCellArray;
45 class vtkTransform;
48 class vtkPlaneCollection;
49 class vtkParallelopipedTopology;
50 
53 {
54 public:
57 
59 
61  void PrintSelf(ostream& os, vtkIndent indent);
63 
65  virtual void GetActors(vtkPropCollection *pc);
66 
68 
76  virtual void PlaceWidget(double corners[8][3]);
77  virtual void PlaceWidget(double bounds[6]);
79 
81 
84  vtkSetMacro(InteractionState,int);
86 
92  void GetBoundingPlanes( vtkPlaneCollection *pc );
93 
95  void GetPolyData(vtkPolyData *pd);
96 
98  virtual double *GetBounds();
99 
101 
102  virtual void SetHandleProperty (vtkProperty *);
103  virtual void SetHoveredHandleProperty (vtkProperty *);
104  virtual void SetSelectedHandleProperty (vtkProperty *);
105  vtkGetObjectMacro(HandleProperty, vtkProperty );
106  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
107  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
109 
110  void SetHandleRepresentation(vtkHandleRepresentation *handle);
111  vtkHandleRepresentation* GetHandleRepresentation(int index);
112 
114 
116  void HandlesOn();
117  void HandlesOff();
119 
121 
123  vtkGetObjectMacro(FaceProperty,vtkProperty);
124  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
126 
128 
130  vtkGetObjectMacro(OutlineProperty,vtkProperty);
131  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
133 
136  virtual void BuildRepresentation();
137 
139 
140  virtual void ReleaseGraphicsResources(vtkWindow *w);
141  virtual int RenderOverlay(vtkViewport *viewport);
142  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
144 
147  virtual int ComputeInteractionState(int X, int Y, int modify=0);
148 
149  //BTX - manage the state of the widget
151  {
152  Outside = 0,
165  RotatingParallelopiped
166  };
167  //ETX
168 
169  // Methods to manipulate the piped.
170  virtual void Translate( double translation[3] );
171  virtual void Translate( int X, int Y );
172  virtual void Scale( int X, int Y );
173 
176  virtual void PositionHandles();
177 
179 
183  vtkSetMacro( MinimumThickness, double );
184  vtkGetMacro( MinimumThickness, double );
186 
187 protected:
190 
192  void TranslatePoint( int n, const double motionVector[3] );
193 
196  void SetHandleHighlight( int handleIdx, vtkProperty *property );
197 
199 
201  void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
202  void HighlightAllFaces();
203  void UnHighlightAllFaces();
205 
206  // Node can be a value within [0,7]. This will create a chair one one of
207  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
208  // depth of the cavity.
209  void UpdateChairAtNode( int node );
210 
211  // Removes any existing chairs.
212  void RemoveExistingChairs();
213 
214  // Convenience method to get just the planes that define the parallelopiped.
215  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
216  // If we are in chair mode, this will be the first 6 planes from amongst
217  // those returned by "GetBoundingPlanes".
218  // All planes have their normals pointing inwards.
219  void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
220 
221  // Convenience method to edefine a plane passing through 3 points.
222  void DefinePlane( vtkPlane *, double p[3][3]);
223 
224  // Convenience method to edefine a plane passing through 3 pointIds of the
225  // parallelopiped. The point Ids must like in the range [0,15], ie the
226  // 15 points comprising the parallelopiped and the chair (also modelled
227  // as a parallelopiped)
228  void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
229 
237 
238  double LastEventPosition[2];
239 
240  // Cache the axis index used for face aligned resize.
242 
247 
248 
249  // When a chair is carved out for the first time, this is the initial
250  // depth of the chair
252 
261  vtkParallelopipedTopology * Topology;
264 
265 private:
267  void operator=(const vtkParallelopipedRepresentation&); //Not implemented
268 };
269 
270 #endif
vtkClosedSurfacePointPlacer * ChairPointPlacer
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:49
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:45
represent surface properties of a geometric object
Definition: vtkProperty.h:61
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:58
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
a list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
a simple class to control print indentation
Definition: vtkIndent.h:37
Default representation for vtkParallelopipedWidget.
perform various plane computations
Definition: vtkPlane.h:35
#define VTK_WIDGETS_EXPORT
virtual void GetActors(vtkPropCollection *)
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:48
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
PointPlacer to constrain validity within a set of convex planes.
represent and manipulate 3D points
Definition: vtkPoints.h:38