VTK  9.2.6
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
40 
41 class vtkActor;
42 class vtkPlane;
43 class vtkPoints;
44 class vtkPolyData;
45 class vtkPolyDataMapper;
46 class vtkProperty;
47 class vtkCellArray;
48 class vtkTransform;
51 class vtkPlaneCollection;
52 class vtkParallelopipedTopology;
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
55 {
56 public:
61 
63 
67  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
73  void GetActors(vtkPropCollection* pc) override;
74 
76 
90  virtual void PlaceWidget(double corners[8][3]);
91  void PlaceWidget(double bounds[6]) override;
93 
95 
100  vtkSetMacro(InteractionState, int);
102 
110 
115 
119  double* GetBounds() VTK_SIZEHINT(6) override;
120 
122 
125  virtual void SetHandleProperty(vtkProperty*);
126  virtual void SetHoveredHandleProperty(vtkProperty*);
127  virtual void SetSelectedHandleProperty(vtkProperty*);
128  vtkGetObjectMacro(HandleProperty, vtkProperty);
129  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty);
130  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
132 
133  void SetHandleRepresentation(vtkHandleRepresentation* handle);
134  vtkHandleRepresentation* GetHandleRepresentation(int index);
135 
137 
141  void HandlesOn();
142  void HandlesOff();
144 
146 
150  vtkGetObjectMacro(FaceProperty, vtkProperty);
151  vtkGetObjectMacro(SelectedFaceProperty, vtkProperty);
153 
155 
159  vtkGetObjectMacro(OutlineProperty, vtkProperty);
160  vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
162 
167  void BuildRepresentation() override;
168 
170 
173  void ReleaseGraphicsResources(vtkWindow* w) override;
174  int RenderOverlay(vtkViewport* viewport) override;
175  int RenderOpaqueGeometry(vtkViewport* viewport) override;
177 
182  int ComputeInteractionState(int X, int Y, int modify = 0) override;
183 
184  // Manage the state of the widget
186  {
187  Outside = 0,
200  RotatingParallelopiped
201  };
202 #if !defined(VTK_LEGACY_REMOVE)
203  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
205 #endif
206 
207  // Methods to manipulate the piped.
208  virtual void Translate(double translation[3]);
209  virtual void Translate(int X, int Y);
210  virtual void Scale(int X, int Y);
211 
216  virtual void PositionHandles();
217 
219 
225  vtkSetMacro(MinimumThickness, double);
226  vtkGetMacro(MinimumThickness, double);
228 
229 protected:
232 
236  void TranslatePoint(int n, const double motionVector[3]);
237 
242  void SetHandleHighlight(int handleIdx, vtkProperty* property);
243 
245 
252 
253  // Node can be a value within [0,7]. This will create a chair one one of
254  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
255  // depth of the cavity.
256  void UpdateChairAtNode(int node);
257 
258  // Removes any existing chairs.
260 
261  // Convenience method to get just the planes that define the parallelopiped.
262  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
263  // If we are in chair mode, this will be the first 6 planes from amongst
264  // those returned by "GetBoundingPlanes".
265  // All planes have their normals pointing inwards.
267 
268  // Convenience method to edefine a plane passing through 3 points.
269  void DefinePlane(vtkPlane*, double p[3][3]);
270 
271  // Convenience method to edefine a plane passing through 3 pointIds of the
272  // parallelopiped. The point Ids must like in the range [0,15], ie the
273  // 15 points comprising the parallelopiped and the chair (also modelled
274  // as a parallelopiped)
276 
284 
285  double LastEventPosition[2];
286 
287  // Cache the axis index used for face aligned resize.
289 
294 
295  // When a chair is carved out for the first time, this is the initial
296  // depth of the chair
298 
307  vtkParallelopipedTopology* Topology;
310 
311 private:
313  void operator=(const vtkParallelopipedRepresentation&) = delete;
314 };
315 
316 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
object to represent cell connectivity
Definition: vtkCellArray.h:296
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:119
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:146
represent and manipulate 3D points
Definition: vtkPoints.h:149
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:177
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
abstract specification for Viewports
Definition: vtkViewport.h:56
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ translation
Definition: vtkX3D.h:238
@ index
Definition: vtkX3D.h:252
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)