VTK  9.3.20240416
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 
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 
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 
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.
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.
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)
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
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
object to represent cell connectivity
Definition: vtkCellArray.h:286
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:108
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:135
represent and manipulate 3D points
Definition: vtkPoints.h:139
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:167
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:160
abstract specification for Viewports
Definition: vtkViewport.h:65
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ translation
Definition: vtkX3D.h:232
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO