VTK  9.3.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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
26 #include "vtkInteractionWidgetsModule.h" // For export macro
27 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkActor;
32 class vtkPlane;
33 class vtkPoints;
34 class vtkPolyData;
35 class vtkPolyDataMapper;
36 class vtkProperty;
37 class vtkCellArray;
38 class vtkTransform;
41 class vtkPlaneCollection;
42 class vtkParallelopipedTopology;
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
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 #if !defined(VTK_LEGACY_REMOVE)
193  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
195 #endif
196 
197  // Methods to manipulate the piped.
198  virtual void Translate(double translation[3]);
199  virtual void Translate(int X, int Y);
200  virtual void Scale(int X, int Y);
201 
206  virtual void PositionHandles();
207 
209 
215  vtkSetMacro(MinimumThickness, double);
216  vtkGetMacro(MinimumThickness, double);
218 
219 protected:
222 
226  void TranslatePoint(int n, const double motionVector[3]);
227 
232  void SetHandleHighlight(int handleIdx, vtkProperty* property);
233 
235 
238  void SetFaceHighlight(vtkCellArray* face, vtkProperty*);
239  void HighlightAllFaces();
240  void UnHighlightAllFaces();
242 
243  // Node can be a value within [0,7]. This will create a chair one one of
244  // the handle corners. '0 < InitialChairDepth < 1' value dictates the starting
245  // depth of the cavity.
246  void UpdateChairAtNode(int node);
247 
248  // Removes any existing chairs.
249  void RemoveExistingChairs();
250 
251  // Convenience method to get just the planes that define the parallelopiped.
252  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
253  // If we are in chair mode, this will be the first 6 planes from amongst
254  // those returned by "GetBoundingPlanes".
255  // All planes have their normals pointing inwards.
256  void GetParallelopipedBoundingPlanes(vtkPlaneCollection* pc);
257 
258  // Convenience method to edefine a plane passing through 3 points.
259  void DefinePlane(vtkPlane*, double p[3][3]);
260 
261  // Convenience method to edefine a plane passing through 3 pointIds of the
262  // parallelopiped. The point Ids must like in the range [0,15], ie the
263  // 15 points comprising the parallelopiped and the chair (also modelled
264  // as a parallelopiped)
265  void DefinePlane(vtkPlane*, vtkIdType, vtkIdType, vtkIdType);
266 
274 
275  double LastEventPosition[2];
276 
277  // Cache the axis index used for face aligned resize.
279 
284 
285  // When a chair is carved out for the first time, this is the initial
286  // depth of the chair
288 
297  vtkParallelopipedTopology* Topology;
300 
301 private:
303  void operator=(const vtkParallelopipedRepresentation&) = delete;
304 };
305 
306 VTK_ABI_NAMESPACE_END
307 #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:40
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:44
represent surface properties of a geometric object
Definition: vtkProperty.h:56
#define VTK_DEPRECATED_IN_9_2_0(reason)
maintain a list of planes
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:49
int vtkIdType
Definition: vtkType.h:315
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:27
a simple class to control print indentation
Definition: vtkIndent.h:28
Default representation for vtkParallelopipedWidget.
perform various plane computations
Definition: vtkPlane.h:25
#define VTK_SIZEHINT(...)
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:175
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:28