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 =========================================================================*/
31 #ifndef vtkParallelopipedRepresentation_h
32 #define vtkParallelopipedRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkActor;
38 class vtkPlane;
39 class vtkPoints;
40 class vtkPolyData;
41 class vtkPolyDataMapper;
42 class vtkProperty;
43 class vtkCellArray;
44 class vtkTransform;
47 class vtkPlaneCollection;
48 class vtkParallelopipedTopology;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation
52 {
53 public:
58 
60 
64  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  void GetActors(vtkPropCollection *pc) override;
71 
73 
87  virtual void PlaceWidget(double corners[8][3]);
88  void PlaceWidget(double bounds[6]) override;
90 
92 
97  vtkSetMacro(InteractionState,int);
99 
106  void GetBoundingPlanes( vtkPlaneCollection *pc );
107 
111  void GetPolyData(vtkPolyData *pd);
112 
116  double *GetBounds() VTK_SIZEHINT(6) override;
117 
119 
122  virtual void SetHandleProperty (vtkProperty *);
123  virtual void SetHoveredHandleProperty (vtkProperty *);
124  virtual void SetSelectedHandleProperty (vtkProperty *);
125  vtkGetObjectMacro(HandleProperty, vtkProperty );
126  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
127  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
129 
130  void SetHandleRepresentation(vtkHandleRepresentation *handle);
131  vtkHandleRepresentation* GetHandleRepresentation(int index);
132 
134 
138  void HandlesOn();
139  void HandlesOff();
141 
143 
147  vtkGetObjectMacro(FaceProperty,vtkProperty);
148  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
150 
152 
156  vtkGetObjectMacro(OutlineProperty,vtkProperty);
157  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
159 
164  void BuildRepresentation() override;
165 
167 
170  void ReleaseGraphicsResources(vtkWindow *w) override;
171  int RenderOverlay(vtkViewport *viewport) override;
172  int RenderOpaqueGeometry(vtkViewport *viewport) override;
174 
179  int ComputeInteractionState(int X, int Y, int modify=0) override;
180 
181  // Manage the state of the widget
183  {
184  Outside = 0,
197  RotatingParallelopiped
198  };
199 
200  // Methods to manipulate the piped.
201  virtual void Translate( double translation[3] );
202  virtual void Translate( int X, int Y );
203  virtual void Scale( int X, int Y );
204 
209  virtual void PositionHandles();
210 
212 
218  vtkSetMacro( MinimumThickness, double );
219  vtkGetMacro( MinimumThickness, double );
221 
222 protected:
225 
229  void TranslatePoint( int n, const double motionVector[3] );
230 
235  void SetHandleHighlight( int handleIdx, vtkProperty *property );
236 
238 
241  void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
242  void HighlightAllFaces();
243  void UnHighlightAllFaces();
245 
246  // Node can be a value within [0,7]. This will create a chair one one of
247  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
248  // depth of the cavity.
249  void UpdateChairAtNode( int node );
250 
251  // Removes any existing chairs.
252  void RemoveExistingChairs();
253 
254  // Convenience method to get just the planes that define the parallelopiped.
255  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
256  // If we are in chair mode, this will be the first 6 planes from amongst
257  // those returned by "GetBoundingPlanes".
258  // All planes have their normals pointing inwards.
259  void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
260 
261  // Convenience method to edefine a plane passing through 3 points.
262  void DefinePlane( vtkPlane *, double p[3][3]);
263 
264  // Convenience method to edefine a plane passing through 3 pointIds of the
265  // parallelopiped. The point Ids must like in the range [0,15], ie the
266  // 15 points comprising the parallelopiped and the chair (also modelled
267  // as a parallelopiped)
268  void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
269 
277 
278  double LastEventPosition[2];
279 
280  // Cache the axis index used for face aligned resize.
282 
287 
288 
289  // When a chair is carved out for the first time, this is the initial
290  // depth of the chair
292 
301  vtkParallelopipedTopology * Topology;
304 
305 private:
307  void operator=(const vtkParallelopipedRepresentation&) = delete;
308 };
309 
310 #endif
vtkClosedSurfacePointPlacer * ChairPointPlacer
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:60
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defines interface between the widget and widget representation classes ...
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
Default representation for vtkParallelopipedWidget.
perform various plane computations
Definition: vtkPlane.h:31
#define VTK_SIZEHINT(...)
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:44
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
PointPlacer to constrain validity within a set of convex planes.
represent and manipulate 3D points
Definition: vtkPoints.h:33