VTK  9.7.1
vtkParallelopipedRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkParallelopipedRepresentation_h
23 #define vtkParallelopipedRepresentation_h
24 
25 #include "vtkInteractionWidgetsModule.h" // For export macro
27 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkActor;
31 class vtkPlane;
32 class vtkPoints;
33 class vtkPolyData;
34 class vtkPolyDataMapper;
35 class vtkProperty;
36 class vtkCellArray;
37 class vtkTransform;
40 class vtkPlaneCollection;
41 class vtkParallelopipedTopology;
42 
43 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkParallelopipedRepresentation
45 {
46 public:
51 
53 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
63  void GetActors(vtkPropCollection* pc) override;
64 
66 
80  virtual void PlaceWidget(double corners[8][3]);
81  void PlaceWidget(double bounds[6]) override;
83 
85 
90  vtkSetMacro(InteractionState, int);
92 
99  void GetBoundingPlanes(vtkPlaneCollection* pc);
100 
104  void GetPolyData(vtkPolyData* pd);
105 
109  double* GetBounds() VTK_SIZEHINT(6) override;
110 
112 
115  virtual void SetHandleProperty(vtkProperty*);
116  virtual void SetHoveredHandleProperty(vtkProperty*);
117  virtual void SetSelectedHandleProperty(vtkProperty*);
118  vtkGetObjectMacro(HandleProperty, vtkProperty);
119  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty);
120  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
122 
123  void SetHandleRepresentation(vtkHandleRepresentation* handle);
124  vtkHandleRepresentation* GetHandleRepresentation(int index);
125 
127 
131  void HandlesOn();
132  void HandlesOff();
134 
136 
140  vtkGetObjectMacro(FaceProperty, vtkProperty);
141  vtkGetObjectMacro(SelectedFaceProperty, vtkProperty);
143 
145 
149  vtkGetObjectMacro(OutlineProperty, vtkProperty);
150  vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
152 
157  void BuildRepresentation() override;
158 
160 
163  void ReleaseGraphicsResources(vtkWindow* w) override;
164  int RenderOverlay(vtkViewport* viewport) override;
165  int RenderOpaqueGeometry(vtkViewport* viewport) override;
167 
172  int ComputeInteractionState(int X, int Y, int modify = 0) override;
173 
174  // Manage the state of the widget
176  {
177  Outside = 0,
190  RotatingParallelopiped
191  };
192 
193  // Methods to manipulate the piped.
194  virtual void Translate(double translation[3]);
195  virtual void Translate(int X, int Y);
196  virtual void Scale(int X, int Y);
197 
202  virtual void PositionHandles();
203 
205 
211  vtkSetMacro(MinimumThickness, double);
212  vtkGetMacro(MinimumThickness, double);
214 
215 protected:
218 
222  void TranslatePoint(int n, const double motionVector[3]);
223 
228  void SetHandleHighlight(int handleIdx, vtkProperty* property);
229 
231 
234  void SetFaceHighlight(vtkCellArray* face, vtkProperty*);
235  void HighlightAllFaces();
236  void UnHighlightAllFaces();
238 
239  // Node can be a value within [0,7]. This will create a chair one one of
240  // the handle corners. '0 < InitialChairDepth < 1' value dictates the starting
241  // depth of the cavity.
242  void UpdateChairAtNode(int node);
243 
244  // Removes any existing chairs.
245  void RemoveExistingChairs();
246 
247  // Convenience method to get just the planes that define the parallelopiped.
248  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
249  // If we are in chair mode, this will be the first 6 planes from amongst
250  // those returned by "GetBoundingPlanes".
251  // All planes have their normals pointing inwards.
252  void GetParallelopipedBoundingPlanes(vtkPlaneCollection* pc);
253 
254  // Convenience method to edefine a plane passing through 3 points.
255  void DefinePlane(vtkPlane*, double p[3][3]);
256 
257  // Convenience method to edefine a plane passing through 3 pointIds of the
258  // parallelopiped. The point Ids must like in the range [0,15], ie the
259  // 15 points comprising the parallelopiped and the chair (also modelled
260  // as a parallelopiped)
261  void DefinePlane(vtkPlane*, vtkIdType, vtkIdType, vtkIdType);
262 
270 
271  double LastEventPosition[2];
272 
273  // Cache the axis index used for face aligned resize.
275 
280 
281  // When a chair is carved out for the first time, this is the initial
282  // depth of the chair
284 
293  vtkParallelopipedTopology* Topology;
296 
297 private:
299  void operator=(const vtkParallelopipedRepresentation&) = delete;
300 };
301 
302 VTK_ABI_NAMESPACE_END
303 #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:41
virtual void PlaceWidget(double bounds[6])
The following is a suggested API for widget representations.
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:59
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
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:41
a simple class to control print indentation
Definition: vtkIndent.h:28
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:177
#define VTK_MARSHALAUTO
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:30