VTK  9.3.0
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 
100 
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 
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.
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.
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)
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
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
object to represent cell connectivity
Definition: vtkCellArray.h:185
PointPlacer to constrain validity within a set of convex planes.
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:38
Default representation for vtkParallelopipedWidget.
void GetParallelopipedBoundingPlanes(vtkPlaneCollection *pc)
void PlaceWidget(double bounds[6]) override
Place the widget in the scene.
void TranslatePoint(int n, const double motionVector[3])
Translate the nth PtId (0 <= n <= 15) by the specified amount.
vtkClosedSurfacePointPlacer * ChairPointPlacer
void GetPolyData(vtkPolyData *pd)
The parallelopiped polydata.
void HighlightAllFaces()
Highlight face defined by the supplied ptids with the specified property.
virtual void PositionHandles()
Synchronize the parallelopiped handle positions with the Polygonal datastructure.
double * GetBounds() override
The parallelopiped polydata.
virtual void Translate(int X, int Y)
virtual void Translate(double translation[3])
void GetActors(vtkPropCollection *pc) override
Methods to satisfy the superclass.
virtual void Scale(int X, int Y)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void DefinePlane(vtkPlane *, vtkIdType, vtkIdType, vtkIdType)
void SetFaceHighlight(vtkCellArray *face, vtkProperty *)
Highlight face defined by the supplied ptids with the specified property.
static vtkParallelopipedRepresentation * New()
Instantiate the class.
void GetBoundingPlanes(vtkPlaneCollection *pc)
Get the bounding planes of the object.
void UnHighlightAllFaces()
Highlight face defined by the supplied ptids with the specified property.
void SetHandleHighlight(int handleIdx, vtkProperty *property)
Set the highlight state of a handle.
void DefinePlane(vtkPlane *, double p[3][3])
virtual void PlaceWidget(double corners[8][3])
Place the widget in the scene.
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:35
represent and manipulate 3D points
Definition: vtkPoints.h:38
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:66
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
abstract specification for Viewports
Definition: vtkViewport.h:54
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ translation
Definition: vtkX3D.h:232
@ index
Definition: vtkX3D.h:246
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)