VTK  9.2.6
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
38 #include "vtkInteractionWidgetsModule.h" // For export macro
40 
41 class vtkActor;
42 class vtkPlane;
43 class vtkPoints;
44 class vtkPolyData;
45 class vtkPolyDataMapper;
46 class vtkProperty;
47 class vtkCellArray;
48 class vtkTransform;
51 class vtkPlaneCollection;
52 class vtkParallelopipedTopology;
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
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() VTK_SIZEHINT(6) 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 #if !defined(VTK_LEGACY_REMOVE)
203  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
205 #endif
206 
207  // Methods to manipulate the piped.
208  virtual void Translate(double translation[3]);
209  virtual void Translate(int X, int Y);
210  virtual void Scale(int X, int Y);
211 
216  virtual void PositionHandles();
217 
219 
225  vtkSetMacro(MinimumThickness, double);
226  vtkGetMacro(MinimumThickness, double);
228 
229 protected:
232 
236  void TranslatePoint(int n, const double motionVector[3]);
237 
242  void SetHandleHighlight(int handleIdx, vtkProperty* property);
243 
245 
248  void SetFaceHighlight(vtkCellArray* face, vtkProperty*);
249  void HighlightAllFaces();
250  void UnHighlightAllFaces();
252 
253  // Node can be a value within [0,7]. This will create a chair one one of
254  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
255  // depth of the cavity.
256  void UpdateChairAtNode(int node);
257 
258  // Removes any existing chairs.
259  void RemoveExistingChairs();
260 
261  // Convenience method to get just the planes that define the parallelopiped.
262  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
263  // If we are in chair mode, this will be the first 6 planes from amongst
264  // those returned by "GetBoundingPlanes".
265  // All planes have their normals pointing inwards.
266  void GetParallelopipedBoundingPlanes(vtkPlaneCollection* pc);
267 
268  // Convenience method to edefine a plane passing through 3 points.
269  void DefinePlane(vtkPlane*, double p[3][3]);
270 
271  // Convenience method to edefine a plane passing through 3 pointIds of the
272  // parallelopiped. The point Ids must like in the range [0,15], ie the
273  // 15 points comprising the parallelopiped and the chair (also modelled
274  // as a parallelopiped)
275  void DefinePlane(vtkPlane*, vtkIdType, vtkIdType, vtkIdType);
276 
284 
285  double LastEventPosition[2];
286 
287  // Cache the axis index used for face aligned resize.
289 
294 
295  // When a chair is carved out for the first time, this is the initial
296  // depth of the chair
298 
307  vtkParallelopipedTopology* Topology;
310 
311 private:
313  void operator=(const vtkParallelopipedRepresentation&) = delete;
314 };
315 
316 #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 void PlaceWidget(double vtkNotUsed(bounds)[6])
The following is a suggested API for widget representations.
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
#define VTK_DEPRECATED_IN_9_2_0(reason)
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:38
a simple class to control print indentation
Definition: vtkIndent.h:39
Default representation for vtkParallelopipedWidget.
perform various plane computations
Definition: vtkPlane.h:36
#define VTK_SIZEHINT(...)
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:186
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