VTK  9.1.0
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=========================================================================*/
31#ifndef vtkParallelopipedRepresentation_h
32#define vtkParallelopipedRepresentation_h
33
34#include "vtkInteractionWidgetsModule.h" // For export macro
36
37class vtkActor;
38class vtkPlane;
39class vtkPoints;
40class vtkPolyData;
42class vtkProperty;
43class vtkCellArray;
44class vtkTransform;
48class vtkParallelopipedTopology;
49
50class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
51{
52public:
57
59
63 void PrintSelf(ostream& os, vtkIndent indent) override;
65
69 void GetActors(vtkPropCollection* pc) override;
70
72
86 virtual void PlaceWidget(double corners[8][3]);
87 void PlaceWidget(double bounds[6]) override;
89
91
96 vtkSetMacro(InteractionState, int);
98
106
111
115 double* GetBounds() VTK_SIZEHINT(6) override;
116
118
121 virtual void SetHandleProperty(vtkProperty*);
122 virtual void SetHoveredHandleProperty(vtkProperty*);
123 virtual void SetSelectedHandleProperty(vtkProperty*);
124 vtkGetObjectMacro(HandleProperty, vtkProperty);
125 vtkGetObjectMacro(HoveredHandleProperty, vtkProperty);
126 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
128
129 void SetHandleRepresentation(vtkHandleRepresentation* handle);
130 vtkHandleRepresentation* GetHandleRepresentation(int index);
131
133
137 void HandlesOn();
138 void HandlesOff();
140
142
146 vtkGetObjectMacro(FaceProperty, vtkProperty);
147 vtkGetObjectMacro(SelectedFaceProperty, vtkProperty);
149
151
155 vtkGetObjectMacro(OutlineProperty, vtkProperty);
156 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
158
163 void BuildRepresentation() override;
164
166
169 void ReleaseGraphicsResources(vtkWindow* w) override;
170 int RenderOverlay(vtkViewport* viewport) override;
171 int RenderOpaqueGeometry(vtkViewport* viewport) override;
173
178 int ComputeInteractionState(int X, int Y, int modify = 0) override;
179
180 // Manage the state of the widget
182 {
183 Outside = 0,
196 RotatingParallelopiped
197 };
198
199 // Methods to manipulate the piped.
200 virtual void Translate(double translation[3]);
201 virtual void Translate(int X, int Y);
202 virtual void Scale(int X, int Y);
203
208 virtual void PositionHandles();
209
211
217 vtkSetMacro(MinimumThickness, double);
218 vtkGetMacro(MinimumThickness, double);
220
221protected:
224
228 void TranslatePoint(int n, const double motionVector[3]);
229
234 void SetHandleHighlight(int handleIdx, vtkProperty* property);
235
237
244
245 // Node can be a value within [0,7]. This will create a chair one one of
246 // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
247 // depth of the cavity.
248 void UpdateChairAtNode(int node);
249
250 // Removes any existing chairs.
252
253 // Convenience method to get just the planes that define the parallelopiped.
254 // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
255 // If we are in chair mode, this will be the first 6 planes from amongst
256 // those returned by "GetBoundingPlanes".
257 // All planes have their normals pointing inwards.
259
260 // Convenience method to edefine a plane passing through 3 points.
261 void DefinePlane(vtkPlane*, double p[3][3]);
262
263 // Convenience method to edefine a plane passing through 3 pointIds of the
264 // parallelopiped. The point Ids must like in the range [0,15], ie the
265 // 15 points comprising the parallelopiped and the chair (also modelled
266 // as a parallelopiped)
268
276
277 double LastEventPosition[2];
278
279 // Cache the axis index used for face aligned resize.
281
286
287 // When a chair is carved out for the first time, this is the initial
288 // depth of the chair
290
299 vtkParallelopipedTopology* Topology;
302
303private:
305 void operator=(const vtkParallelopipedRepresentation&) = delete;
306};
307
308#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
object to represent cell connectivity
Definition: vtkCellArray.h:290
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:113
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.
double * GetBounds() override
The parallelopiped polydata.
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.
virtual void Translate(int X, int Y)
virtual void Translate(double translation[3])
static vtkParallelopipedRepresentation * New()
Instantiate the class.
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.
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:143
represent and manipulate 3D points
Definition: vtkPoints.h:143
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
an ordered list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:171
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
abstract specification for Viewports
Definition: vtkViewport.h:47
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ translation
Definition: vtkX3D.h:238
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)