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  // Manage the state of the widget
152  {
153  Outside = 0,
166  RotatingParallelopiped
167  };
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: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:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
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