VTK  9.2.20230606
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
39 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkActor;
44 class vtkPlane;
45 class vtkPoints;
46 class vtkPolyData;
47 class vtkPolyDataMapper;
48 class vtkProperty;
49 class vtkCellArray;
50 class vtkTransform;
53 class vtkPlaneCollection;
54 class vtkParallelopipedTopology;
55 
56 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
57 {
58 public:
63 
65 
69  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
75  void GetActors(vtkPropCollection* pc) override;
76 
78 
92  virtual void PlaceWidget(double corners[8][3]);
93  void PlaceWidget(double bounds[6]) override;
95 
97 
102  vtkSetMacro(InteractionState, int);
104 
112 
117 
121  double* GetBounds() VTK_SIZEHINT(6) override;
122 
124 
127  virtual void SetHandleProperty(vtkProperty*);
128  virtual void SetHoveredHandleProperty(vtkProperty*);
129  virtual void SetSelectedHandleProperty(vtkProperty*);
130  vtkGetObjectMacro(HandleProperty, vtkProperty);
131  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty);
132  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
134 
135  void SetHandleRepresentation(vtkHandleRepresentation* handle);
136  vtkHandleRepresentation* GetHandleRepresentation(int index);
137 
139 
143  void HandlesOn();
144  void HandlesOff();
146 
148 
152  vtkGetObjectMacro(FaceProperty, vtkProperty);
153  vtkGetObjectMacro(SelectedFaceProperty, vtkProperty);
155 
157 
161  vtkGetObjectMacro(OutlineProperty, vtkProperty);
162  vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
164 
169  void BuildRepresentation() override;
170 
172 
175  void ReleaseGraphicsResources(vtkWindow* w) override;
176  int RenderOverlay(vtkViewport* viewport) override;
177  int RenderOpaqueGeometry(vtkViewport* viewport) override;
179 
184  int ComputeInteractionState(int X, int Y, int modify = 0) override;
185 
186  // Manage the state of the widget
188  {
189  Outside = 0,
202  RotatingParallelopiped
203  };
204 #if !defined(VTK_LEGACY_REMOVE)
205  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
207 #endif
208 
209  // Methods to manipulate the piped.
210  virtual void Translate(double translation[3]);
211  virtual void Translate(int X, int Y);
212  virtual void Scale(int X, int Y);
213 
218  virtual void PositionHandles();
219 
221 
227  vtkSetMacro(MinimumThickness, double);
228  vtkGetMacro(MinimumThickness, double);
230 
231 protected:
234 
238  void TranslatePoint(int n, const double motionVector[3]);
239 
244  void SetHandleHighlight(int handleIdx, vtkProperty* property);
245 
247 
254 
255  // Node can be a value within [0,7]. This will create a chair one one of
256  // the handle corners. '0 < InitialChairDepth < 1' value dictates the starting
257  // depth of the cavity.
258  void UpdateChairAtNode(int node);
259 
260  // Removes any existing chairs.
262 
263  // Convenience method to get just the planes that define the parallelopiped.
264  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
265  // If we are in chair mode, this will be the first 6 planes from amongst
266  // those returned by "GetBoundingPlanes".
267  // All planes have their normals pointing inwards.
269 
270  // Convenience method to edefine a plane passing through 3 points.
271  void DefinePlane(vtkPlane*, double p[3][3]);
272 
273  // Convenience method to edefine a plane passing through 3 pointIds of the
274  // parallelopiped. The point Ids must like in the range [0,15], ie the
275  // 15 points comprising the parallelopiped and the chair (also modelled
276  // as a parallelopiped)
278 
286 
287  double LastEventPosition[2];
288 
289  // Cache the axis index used for face aligned resize.
291 
296 
297  // When a chair is carved out for the first time, this is the initial
298  // depth of the chair
300 
309  vtkParallelopipedTopology* Topology;
312 
313 private:
315  void operator=(const vtkParallelopipedRepresentation&) = delete;
316 };
317 
318 VTK_ABI_NAMESPACE_END
319 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:162
object to represent cell connectivity
Definition: vtkCellArray.h:297
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:120
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:147
represent and manipulate 3D points
Definition: vtkPoints.h:150
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:178
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:171
abstract specification for Viewports
Definition: vtkViewport.h:57
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
@ translation
Definition: vtkX3D.h:244
@ index
Definition: vtkX3D.h:258
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:327
#define VTK_SIZEHINT(...)