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 =========================================================================*/
34 #ifndef vtkParallelopipedRepresentation_h
35 #define vtkParallelopipedRepresentation_h
36 
37 #include "vtkInteractionWidgetsModule.h" // For export macro
39 
40 class vtkActor;
41 class vtkPlane;
42 class vtkPoints;
43 class vtkPolyData;
44 class vtkPolyDataMapper;
45 class vtkProperty;
46 class vtkCellArray;
47 class vtkTransform;
50 class vtkPlaneCollection;
51 class vtkParallelopipedTopology;
52 
53 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation
55 {
56 public:
61 
63 
67  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
73  void GetActors(vtkPropCollection *pc) override;
74 
76 
90  virtual void PlaceWidget(double corners[8][3]);
91  void PlaceWidget(double bounds[6]) override;
93 
95 
100  vtkSetMacro(InteractionState,int);
102 
109  void GetBoundingPlanes( vtkPlaneCollection *pc );
110 
114  void GetPolyData(vtkPolyData *pd);
115 
119  double *GetBounds() override;
120 
122 
125  virtual void SetHandleProperty (vtkProperty *);
126  virtual void SetHoveredHandleProperty (vtkProperty *);
127  virtual void SetSelectedHandleProperty (vtkProperty *);
128  vtkGetObjectMacro(HandleProperty, vtkProperty );
129  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
130  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
132 
133  void SetHandleRepresentation(vtkHandleRepresentation *handle);
134  vtkHandleRepresentation* GetHandleRepresentation(int index);
135 
137 
141  void HandlesOn();
142  void HandlesOff();
144 
146 
150  vtkGetObjectMacro(FaceProperty,vtkProperty);
151  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
153 
155 
159  vtkGetObjectMacro(OutlineProperty,vtkProperty);
160  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
162 
167  void BuildRepresentation() override;
168 
170 
173  void ReleaseGraphicsResources(vtkWindow *w) override;
174  int RenderOverlay(vtkViewport *viewport) override;
175  int RenderOpaqueGeometry(vtkViewport *viewport) override;
177 
182  int ComputeInteractionState(int X, int Y, int modify=0) override;
183 
184  // Manage the state of the widget
186  {
187  Outside = 0,
200  RotatingParallelopiped
201  };
202 
203  // Methods to manipulate the piped.
204  virtual void Translate( double translation[3] );
205  virtual void Translate( int X, int Y );
206  virtual void Scale( int X, int Y );
207 
212  virtual void PositionHandles();
213 
215 
221  vtkSetMacro( MinimumThickness, double );
222  vtkGetMacro( MinimumThickness, double );
224 
225 protected:
228 
232  void TranslatePoint( int n, const double motionVector[3] );
233 
238  void SetHandleHighlight( int handleIdx, vtkProperty *property );
239 
241 
244  void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
245  void HighlightAllFaces();
246  void UnHighlightAllFaces();
248 
249  // Node can be a value within [0,7]. This will create a chair one one of
250  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
251  // depth of the cavity.
252  void UpdateChairAtNode( int node );
253 
254  // Removes any existing chairs.
255  void RemoveExistingChairs();
256 
257  // Convenience method to get just the planes that define the parallelopiped.
258  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
259  // If we are in chair mode, this will be the first 6 planes from amongst
260  // those returned by "GetBoundingPlanes".
261  // All planes have their normals pointing inwards.
262  void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
263 
264  // Convenience method to edefine a plane passing through 3 points.
265  void DefinePlane( vtkPlane *, double p[3][3]);
266 
267  // Convenience method to edefine a plane passing through 3 pointIds of the
268  // parallelopiped. The point Ids must like in the range [0,15], ie the
269  // 15 points comprising the parallelopiped and the chair (also modelled
270  // as a parallelopiped)
271  void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
272 
280 
281  double LastEventPosition[2];
282 
283  // Cache the axis index used for face aligned resize.
285 
290 
291 
292  // When a chair is carved out for the first time, this is the initial
293  // depth of the chair
295 
304  vtkParallelopipedTopology * Topology;
307 
308 private:
310  void operator=(const vtkParallelopipedRepresentation&) = delete;
311 };
312 
313 #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:51
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:65
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
Default representation for vtkParallelopipedWidget.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
perform various plane computations
Definition: vtkPlane.h:37
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:50
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:39