VTK
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 "vtkInteractionWidgetsModule.h" // For export macro
39 
40 class vtkActor;
41 class vtkPlane;
42 class vtkPoints;
43 class vtkPolyData;
44 class vtkPolyDataMapper;
45 class vtkProperty;
46 class vtkCellArray;
47 class vtkTransform;
50 class vtkPlaneCollection;
51 class vtkParallelopipedTopology;
52 
53 class VTKINTERACTIONWIDGETS_EXPORT vtkParallelopipedRepresentation
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 
109  void GetBoundingPlanes( vtkPlaneCollection *pc );
110 
114  void GetPolyData(vtkPolyData *pd);
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 
203  // Methods to manipulate the piped.
204  virtual void Translate( double translation[3] );
205  virtual void Translate( int X, int Y );
206  virtual void Scale( int X, int Y );
207 
212  virtual void PositionHandles();
213 
215 
221  vtkSetMacro( MinimumThickness, double );
222  vtkGetMacro( MinimumThickness, double );
224 
225 protected:
228 
232  void TranslatePoint( int n, const double motionVector[3] );
233 
238  void SetHandleHighlight( int handleIdx, vtkProperty *property );
239 
241 
244  void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
245  void HighlightAllFaces();
246  void UnHighlightAllFaces();
248 
249  // Node can be a value within [0,7]. This will create a chair one one of
250  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
251  // depth of the cavity.
252  void UpdateChairAtNode( int node );
253 
254  // Removes any existing chairs.
255  void RemoveExistingChairs();
256 
257  // Convenience method to get just the planes that define the parallelopiped.
258  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
259  // If we are in chair mode, this will be the first 6 planes from amongst
260  // those returned by "GetBoundingPlanes".
261  // All planes have their normals pointing inwards.
262  void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
263 
264  // Convenience method to edefine a plane passing through 3 points.
265  void DefinePlane( vtkPlane *, double p[3][3]);
266 
267  // Convenience method to edefine a plane passing through 3 pointIds of the
268  // parallelopiped. The point Ids must like in the range [0,15], ie the
269  // 15 points comprising the parallelopiped and the chair (also modelled
270  // as a parallelopiped)
271  void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
272 
280 
281  double LastEventPosition[2];
282 
283  // Cache the axis index used for face aligned resize.
285 
290 
291 
292  // When a chair is carved out for the first time, this is the initial
293  // depth of the chair
295 
304  vtkParallelopipedTopology * Topology;
307 
308 private:
310  void operator=(const vtkParallelopipedRepresentation&) = delete;
311 };
312 
313 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
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:217
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkParallelopipedRepresentation::InitialChairDepth
double InitialChairDepth
Definition: vtkParallelopipedRepresentation.h:294
vtkParallelopipedRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkParallelopipedRepresentation.h:302
vtkParallelopipedRepresentation::ScalingParallelopiped
Definition: vtkParallelopipedRepresentation.h:199
vtkParallelopipedRepresentation::LastResizeAxisIdx
int LastResizeAxisIdx
Definition: vtkParallelopipedRepresentation.h:284
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkParallelopipedRepresentation::HandleRepresentations
vtkHandleRepresentation ** HandleRepresentations
Definition: vtkParallelopipedRepresentation.h:287
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:60
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:58
vtkParallelopipedRepresentation::HexActor
vtkActor * HexActor
Definition: vtkParallelopipedRepresentation.h:273
vtkParallelopipedRepresentation::ResizingParallelopiped
Definition: vtkParallelopipedRepresentation.h:195
vtkParallelopipedRepresentation::TranslatingParallelopiped
Definition: vtkParallelopipedRepresentation.h:198
vtkParallelopipedRepresentation::RequestChairMode
Definition: vtkParallelopipedRepresentation.h:191
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkParallelopipedRepresentation::ChairPointPlacer
vtkClosedSurfacePointPlacer * ChairPointPlacer
Definition: vtkParallelopipedRepresentation.h:303
vtkParallelopipedRepresentation::AbsoluteMinimumThickness
double AbsoluteMinimumThickness
Definition: vtkParallelopipedRepresentation.h:306
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkParallelopipedRepresentation::ResizingParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:196
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:215
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkParallelopipedRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkParallelopipedRepresentation.h:286
vtkParallelopipedRepresentation::Inside
Definition: vtkParallelopipedRepresentation.h:188
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkParallelopipedRepresentation::ChairMode
Definition: vtkParallelopipedRepresentation.h:197
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkParallelopipedRepresentation::RequestResizeParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:190
vtkParallelopipedRepresentation::HexMapper
vtkPolyDataMapper * HexMapper
Definition: vtkParallelopipedRepresentation.h:274
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
Definition: vtkWidgetRepresentation.h:135
vtkParallelopipedRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkParallelopipedRepresentation.h:299
vtkParallelopipedRepresentation::MinimumThickness
double MinimumThickness
Definition: vtkParallelopipedRepresentation.h:305
vtkParallelopipedRepresentation::Topology
vtkParallelopipedTopology * Topology
Definition: vtkParallelopipedRepresentation.h:304
vtkParallelopipedRepresentation::RequestRotateParallelopiped
Definition: vtkParallelopipedRepresentation.h:194
vtkParallelopipedRepresentation::HexFaceMapper
vtkPolyDataMapper * HexFaceMapper
Definition: vtkParallelopipedRepresentation.h:278
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkParallelopipedRepresentation::Points
vtkPoints * Points
Definition: vtkParallelopipedRepresentation.h:276
vtkParallelopipedRepresentation::HexPolyData
vtkPolyData * HexPolyData
Definition: vtkParallelopipedRepresentation.h:275
vtkParallelopipedRepresentation::FaceProperty
vtkProperty * FaceProperty
Definition: vtkParallelopipedRepresentation.h:298
vtkParallelopipedRepresentation::_InteractionState
_InteractionState
Definition: vtkParallelopipedRepresentation.h:185
vtkParallelopipedRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkParallelopipedRepresentation.h:300
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:66
vtkClosedSurfacePointPlacer
PointPlacer to constrain validity within a set of convex planes.
Definition: vtkClosedSurfacePointPlacer.h:39
vtkParallelopipedRepresentation::SelectedFaceProperty
vtkProperty * SelectedFaceProperty
Definition: vtkParallelopipedRepresentation.h:301
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:36
vtkParallelopipedRepresentation
Default representation for vtkParallelopipedWidget.
Definition: vtkParallelopipedRepresentation.h:53
vtkParallelopipedRepresentation::HexFaceActor
vtkActor * HexFaceActor
Definition: vtkParallelopipedRepresentation.h:277
vtkParallelopipedRepresentation::HoveredHandleProperty
vtkProperty * HoveredHandleProperty
Definition: vtkParallelopipedRepresentation.h:297
vtkX3D::translation
Definition: vtkX3D.h:232
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:41
vtkX3D::index
Definition: vtkX3D.h:246
vtkParallelopipedRepresentation::HexFacePolyData
vtkPolyData * HexFacePolyData
Definition: vtkParallelopipedRepresentation.h:279
vtkParallelopipedRepresentation::RequestTranslateParallelopiped
Definition: vtkParallelopipedRepresentation.h:192
vtkParallelopipedRepresentation::CurrentHandleIdx
int CurrentHandleIdx
Definition: vtkParallelopipedRepresentation.h:288
vtkParallelopipedRepresentation::RequestResizeParallelopiped
Definition: vtkParallelopipedRepresentation.h:189
vtkParallelopipedRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkParallelopipedRepresentation.h:296
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:193
vtkParallelopipedRepresentation::ChairHandleIdx
int ChairHandleIdx
Definition: vtkParallelopipedRepresentation.h:289