VTK  9.0.20201029
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 
37 class vtkActor;
38 class vtkPlane;
39 class vtkPoints;
40 class vtkPolyData;
41 class vtkPolyDataMapper;
42 class vtkProperty;
43 class vtkCellArray;
44 class vtkTransform;
47 class vtkPlaneCollection;
48 class vtkParallelopipedTopology;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation : public vtkWidgetRepresentation
51 {
52 public:
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 
105  void GetBoundingPlanes(vtkPlaneCollection* pc);
106 
110  void GetPolyData(vtkPolyData* pd);
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 
221 protected:
224 
228  void TranslatePoint(int n, const double motionVector[3]);
229 
234  void SetHandleHighlight(int handleIdx, vtkProperty* property);
235 
237 
240  void SetFaceHighlight(vtkCellArray* face, vtkProperty*);
241  void HighlightAllFaces();
242  void UnHighlightAllFaces();
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.
251  void RemoveExistingChairs();
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.
258  void GetParallelopipedBoundingPlanes(vtkPlaneCollection* pc);
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)
267  void DefinePlane(vtkPlane*, vtkIdType, vtkIdType, vtkIdType);
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 
303 private:
305  void operator=(const vtkParallelopipedRepresentation&) = delete;
306 };
307 
308 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkWidgetRepresentation.h
vtkWidgetRepresentation::GetActors
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
Definition: vtkWidgetRepresentation.h:210
vtkPlane
perform various plane computations
Definition: vtkPlane.h:33
vtkParallelopipedRepresentation::InitialChairDepth
double InitialChairDepth
Definition: vtkParallelopipedRepresentation.h:289
vtkParallelopipedRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkParallelopipedRepresentation.h:297
vtkParallelopipedRepresentation::ScalingParallelopiped
Definition: vtkParallelopipedRepresentation.h:195
vtkParallelopipedRepresentation::LastResizeAxisIdx
int LastResizeAxisIdx
Definition: vtkParallelopipedRepresentation.h:280
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkParallelopipedRepresentation::HandleRepresentations
vtkHandleRepresentation ** HandleRepresentations
Definition: vtkParallelopipedRepresentation.h:283
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkParallelopipedRepresentation::HexActor
vtkActor * HexActor
Definition: vtkParallelopipedRepresentation.h:269
vtkParallelopipedRepresentation::ResizingParallelopiped
Definition: vtkParallelopipedRepresentation.h:191
vtkParallelopipedRepresentation::TranslatingParallelopiped
Definition: vtkParallelopipedRepresentation.h:194
vtkParallelopipedRepresentation::RequestChairMode
Definition: vtkParallelopipedRepresentation.h:187
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkParallelopipedRepresentation::ChairPointPlacer
vtkClosedSurfacePointPlacer * ChairPointPlacer
Definition: vtkParallelopipedRepresentation.h:298
vtkParallelopipedRepresentation::AbsoluteMinimumThickness
double AbsoluteMinimumThickness
Definition: vtkParallelopipedRepresentation.h:301
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkParallelopipedRepresentation::ResizingParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:192
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:208
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkParallelopipedRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkParallelopipedRepresentation.h:282
vtkParallelopipedRepresentation::Inside
Definition: vtkParallelopipedRepresentation.h:184
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
vtkParallelopipedRepresentation::ChairMode
Definition: vtkParallelopipedRepresentation.h:193
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkParallelopipedRepresentation::RequestResizeParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:186
vtkParallelopipedRepresentation::HexMapper
vtkPolyDataMapper * HexMapper
Definition: vtkParallelopipedRepresentation.h:270
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
vtkParallelopipedRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkParallelopipedRepresentation.h:294
vtkParallelopipedRepresentation::MinimumThickness
double MinimumThickness
Definition: vtkParallelopipedRepresentation.h:300
vtkParallelopipedRepresentation::Topology
vtkParallelopipedTopology * Topology
Definition: vtkParallelopipedRepresentation.h:299
vtkParallelopipedRepresentation::RequestRotateParallelopiped
Definition: vtkParallelopipedRepresentation.h:190
vtkParallelopipedRepresentation::HexFaceMapper
vtkPolyDataMapper * HexFaceMapper
Definition: vtkParallelopipedRepresentation.h:274
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkParallelopipedRepresentation::Points
vtkPoints * Points
Definition: vtkParallelopipedRepresentation.h:272
vtkParallelopipedRepresentation::HexPolyData
vtkPolyData * HexPolyData
Definition: vtkParallelopipedRepresentation.h:271
vtkParallelopipedRepresentation::FaceProperty
vtkProperty * FaceProperty
Definition: vtkParallelopipedRepresentation.h:293
vtkParallelopipedRepresentation::_InteractionState
_InteractionState
Definition: vtkParallelopipedRepresentation.h:181
vtkParallelopipedRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkParallelopipedRepresentation.h:295
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkClosedSurfacePointPlacer
PointPlacer to constrain validity within a set of convex planes.
Definition: vtkClosedSurfacePointPlacer.h:39
vtkParallelopipedRepresentation::SelectedFaceProperty
vtkProperty * SelectedFaceProperty
Definition: vtkParallelopipedRepresentation.h:296
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:33
vtkParallelopipedRepresentation
Default representation for vtkParallelopipedWidget.
Definition: vtkParallelopipedRepresentation.h:50
vtkParallelopipedRepresentation::HexFaceActor
vtkActor * HexFaceActor
Definition: vtkParallelopipedRepresentation.h:273
vtkParallelopipedRepresentation::HoveredHandleProperty
vtkProperty * HoveredHandleProperty
Definition: vtkParallelopipedRepresentation.h:292
vtkX3D::translation
Definition: vtkX3D.h:238
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkX3D::index
Definition: vtkX3D.h:252
vtkParallelopipedRepresentation::HexFacePolyData
vtkPolyData * HexFacePolyData
Definition: vtkParallelopipedRepresentation.h:275
vtkParallelopipedRepresentation::RequestTranslateParallelopiped
Definition: vtkParallelopipedRepresentation.h:188
vtkParallelopipedRepresentation::CurrentHandleIdx
int CurrentHandleIdx
Definition: vtkParallelopipedRepresentation.h:284
vtkParallelopipedRepresentation::RequestResizeParallelopiped
Definition: vtkParallelopipedRepresentation.h:185
vtkParallelopipedRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkParallelopipedRepresentation.h:291
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkParallelopipedRepresentation::RequestScaleParallelopiped
Definition: vtkParallelopipedRepresentation.h:189
vtkParallelopipedRepresentation::ChairHandleIdx
int ChairHandleIdx
Definition: vtkParallelopipedRepresentation.h:285