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 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
38 
39 class vtkActor;
40 class vtkPlane;
41 class vtkPoints;
42 class vtkPolyData;
43 class vtkPolyDataMapper;
44 class vtkProperty;
45 class vtkCellArray;
46 class vtkTransform;
49 class vtkPlaneCollection;
50 class vtkParallelopipedTopology;
51 
54 {
55 public:
58 
60 
62  void PrintSelf(ostream& os, vtkIndent indent);
64 
66  virtual void GetActors(vtkPropCollection *pc);
67 
69 
77  virtual void PlaceWidget(double corners[8][3]);
78  virtual void PlaceWidget(double bounds[6]);
80 
82 
85  vtkSetMacro(InteractionState,int);
87 
93  void GetBoundingPlanes( vtkPlaneCollection *pc );
94 
96  void GetPolyData(vtkPolyData *pd);
97 
99  virtual double *GetBounds();
100 
102 
103  virtual void SetHandleProperty (vtkProperty *);
104  virtual void SetHoveredHandleProperty (vtkProperty *);
105  virtual void SetSelectedHandleProperty (vtkProperty *);
106  vtkGetObjectMacro(HandleProperty, vtkProperty );
107  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
108  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
110 
111  void SetHandleRepresentation(vtkHandleRepresentation *handle);
112  vtkHandleRepresentation* GetHandleRepresentation(int index);
113 
115 
117  void HandlesOn();
118  void HandlesOff();
120 
122 
124  vtkGetObjectMacro(FaceProperty,vtkProperty);
125  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
127 
129 
131  vtkGetObjectMacro(OutlineProperty,vtkProperty);
132  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
134 
137  virtual void BuildRepresentation();
138 
140 
141  virtual void ReleaseGraphicsResources(vtkWindow *w);
142  virtual int RenderOverlay(vtkViewport *viewport);
143  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
145 
148  virtual int ComputeInteractionState(int X, int Y, int modify=0);
149 
150  //BTX - manage the state of the widget
152  {
153  Outside = 0,
166  RotatingParallelopiped
167  };
168  //ETX
169 
170  // Methods to manipulate the piped.
171  virtual void Translate( double translation[3] );
172  virtual void Translate( int X, int Y );
173  virtual void Scale( int X, int Y );
174 
177  virtual void PositionHandles();
178 
180 
184  vtkSetMacro( MinimumThickness, double );
185  vtkGetMacro( MinimumThickness, double );
187 
188 protected:
191 
193  void TranslatePoint( int n, const double motionVector[3] );
194 
197  void SetHandleHighlight( int handleIdx, vtkProperty *property );
198 
200 
202  void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
203  void HighlightAllFaces();
204  void UnHighlightAllFaces();
206 
207  // Node can be a value within [0,7]. This will create a chair one one of
208  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
209  // depth of the cavity.
210  void UpdateChairAtNode( int node );
211 
212  // Removes any existing chairs.
213  void RemoveExistingChairs();
214 
215  // Convenience method to get just the planes that define the parallelopiped.
216  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
217  // If we are in chair mode, this will be the first 6 planes from amongst
218  // those returned by "GetBoundingPlanes".
219  // All planes have their normals pointing inwards.
220  void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
221 
222  // Convenience method to edefine a plane passing through 3 points.
223  void DefinePlane( vtkPlane *, double p[3][3]);
224 
225  // Convenience method to edefine a plane passing through 3 pointIds of the
226  // parallelopiped. The point Ids must like in the range [0,15], ie the
227  // 15 points comprising the parallelopiped and the chair (also modelled
228  // as a parallelopiped)
229  void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
230 
238 
239  double LastEventPosition[2];
240 
241  // Cache the axis index used for face aligned resize.
243 
248 
249 
250  // When a chair is carved out for the first time, this is the initial
251  // depth of the chair
253 
262  vtkParallelopipedTopology * Topology;
265 
266 private:
268  void operator=(const vtkParallelopipedRepresentation&); //Not implemented
269 };
270 
271 #endif
vtkClosedSurfacePointPlacer * ChairPointPlacer
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
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
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
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:36
#define VTKINTERACTIONWIDGETS_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
Default representation for vtkParallelopipedWidget.
perform various plane computations
Definition: vtkPlane.h:36
virtual void GetActors(vtkPropCollection *)
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:49
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