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 =========================================================================*/
33 #ifndef vtkParallelopipedRepresentation_h
34 #define vtkParallelopipedRepresentation_h
35 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
38 
39 class vtkActor;
40 class vtkPlane;
41 class vtkPoints;
42 class vtkPolyData;
43 class vtkPolyDataMapper;
44 class vtkProperty;
45 class vtkCellArray;
46 class vtkTransform;
49 class vtkPlaneCollection;
50 class vtkParallelopipedTopology;
51 
54 {
55 public:
58 
60 
62  void PrintSelf(ostream& os, vtkIndent indent);
64 
66  virtual void GetActors(vtkPropCollection *pc);
67 
69 
77  virtual void PlaceWidget(double corners[8][3]);
78  virtual void PlaceWidget(double bounds[6]);
80 
82 
85  vtkSetMacro(InteractionState,int);
87 
94 
97 
99  virtual double *GetBounds();
100 
102 
103  virtual void SetHandleProperty (vtkProperty *);
106  vtkGetObjectMacro(HandleProperty, vtkProperty );
107  vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
108  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
110 
113 
115 
117  void HandlesOn();
118  void HandlesOff();
120 
122 
125  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
127 
129 
131  vtkGetObjectMacro(OutlineProperty,vtkProperty);
132  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
134 
137  virtual void BuildRepresentation();
138 
140 
142  virtual int RenderOverlay(vtkViewport *viewport);
143  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
145 
148  virtual int ComputeInteractionState(int X, int Y, int modify=0);
149 
150  //BTX - manage the state of the widget
152  {
153  Outside = 0,
166  RotatingParallelopiped
167  };
168  //ETX
169 
170  // Methods to manipulate the piped.
171  virtual void Translate( double translation[3] );
172  virtual void Translate( int X, int Y );
173  virtual void Scale( int X, int Y );
174 
177  virtual void PositionHandles();
178 
180 
184  vtkSetMacro( MinimumThickness, double );
185  vtkGetMacro( MinimumThickness, double );
187 
188 protected:
191 
193  void TranslatePoint( int n, const double motionVector[3] );
194 
197  void SetHandleHighlight( int handleIdx, vtkProperty *property );
198 
200 
206 
207  // Node can be a value within [0,7]. This will create a chair one one of
208  // the handle corners. '0 < InitialChairDepth < 1' value dicates the starting
209  // depth of the cavity.
210  void UpdateChairAtNode( int node );
211 
212  // Removes any existing chairs.
214 
215  // Convenience method to get just the planes that define the parallelopiped.
216  // If we aren't in chair mode, this will be the same as GetBoundingPlanes().
217  // If we are in chair mode, this will be the first 6 planes from amongst
218  // those returned by "GetBoundingPlanes".
219  // All planes have their normals pointing inwards.
221 
222  // Convenience method to edefine a plane passing through 3 points.
223  void DefinePlane( vtkPlane *, double p[3][3]);
224 
225  // Convenience method to edefine a plane passing through 3 pointIds of the
226  // parallelopiped. The point Ids must like in the range [0,15], ie the
227  // 15 points comprising the parallelopiped and the chair (also modelled
228  // as a parallelopiped)
230 
238 
239  double LastEventPosition[2];
240 
241  // Cache the axis index used for face aligned resize.
243 
248 
249 
250  // When a chair is carved out for the first time, this is the initial
251  // depth of the chair
253 
262  vtkParallelopipedTopology * Topology;
265 
266 private:
268  void operator=(const vtkParallelopipedRepresentation&); //Not implemented
269 };
270 
271 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkWidgetRepresentation.h
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkParallelopipedRepresentation::InitialChairDepth
double InitialChairDepth
Definition: vtkParallelopipedRepresentation.h:252
vtkParallelopipedRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkParallelopipedRepresentation.h:260
vtkParallelopipedRepresentation::ScalingParallelopiped
@ ScalingParallelopiped
Definition: vtkParallelopipedRepresentation.h:165
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkParallelopipedRepresentation::Scale
virtual void Scale(int X, int Y)
vtkParallelopipedRepresentation::LastResizeAxisIdx
int LastResizeAxisIdx
Definition: vtkParallelopipedRepresentation.h:242
vtkParallelopipedRepresentation::RemoveExistingChairs
void RemoveExistingChairs()
vtkParallelopipedRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *w)
vtkParallelopipedRepresentation::RenderOverlay
virtual int RenderOverlay(vtkViewport *viewport)
vtkParallelopipedRepresentation::DefinePlane
void DefinePlane(vtkPlane *, double p[3][3])
vtkParallelopipedRepresentation::TranslatePoint
void TranslatePoint(int n, const double motionVector[3])
vtkParallelopipedRepresentation::Translate
virtual void Translate(double translation[3])
vtkParallelopipedRepresentation::HighlightAllFaces
void HighlightAllFaces()
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkParallelopipedRepresentation::HandleRepresentations
vtkHandleRepresentation ** HandleRepresentations
Definition: vtkParallelopipedRepresentation.h:245
vtkParallelopipedRepresentation::UnHighlightAllFaces
void UnHighlightAllFaces()
vtkParallelopipedRepresentation::SetHandleHighlight
void SetHandleHighlight(int handleIdx, vtkProperty *property)
vtkParallelopipedRepresentation::GetBoundingPlanes
void GetBoundingPlanes(vtkPlaneCollection *pc)
vtkParallelopipedRepresentation::PlaceWidget
virtual void PlaceWidget(double corners[8][3])
vtkParallelopipedRepresentation::New
static vtkParallelopipedRepresentation * New()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:54
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:58
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkParallelopipedRepresentation::HexActor
vtkActor * HexActor
Definition: vtkParallelopipedRepresentation.h:231
vtkParallelopipedRepresentation::ResizingParallelopiped
@ ResizingParallelopiped
Definition: vtkParallelopipedRepresentation.h:161
vtkInteractionWidgetsModule.h
vtkParallelopipedRepresentation::PlaceWidget
virtual void PlaceWidget(double bounds[6])
vtkParallelopipedRepresentation::TranslatingParallelopiped
@ TranslatingParallelopiped
Definition: vtkParallelopipedRepresentation.h:164
vtkParallelopipedRepresentation::Translate
virtual void Translate(int X, int Y)
vtkParallelopipedRepresentation::RequestChairMode
@ RequestChairMode
Definition: vtkParallelopipedRepresentation.h:157
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkParallelopipedRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkParallelopipedRepresentation::GetActors
virtual void GetActors(vtkPropCollection *pc)
vtkParallelopipedRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
vtkParallelopipedRepresentation::ChairPointPlacer
vtkClosedSurfacePointPlacer * ChairPointPlacer
Definition: vtkParallelopipedRepresentation.h:261
vtkParallelopipedRepresentation::AbsoluteMinimumThickness
double AbsoluteMinimumThickness
Definition: vtkParallelopipedRepresentation.h:264
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkParallelopipedRepresentation::~vtkParallelopipedRepresentation
~vtkParallelopipedRepresentation()
vtkParallelopipedRepresentation::SetHandleRepresentation
void SetHandleRepresentation(vtkHandleRepresentation *handle)
vtkParallelopipedRepresentation::ResizingParallelopipedAlongAnAxis
@ ResizingParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:162
vtkParallelopipedRepresentation::HandlesOff
void HandlesOff()
vtkParallelopipedRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkParallelopipedRepresentation.h:244
vtkParallelopipedRepresentation::BuildRepresentation
virtual void BuildRepresentation()
vtkParallelopipedRepresentation::SetSelectedHandleProperty
virtual void SetSelectedHandleProperty(vtkProperty *)
vtkParallelopipedRepresentation::Inside
@ Inside
Definition: vtkParallelopipedRepresentation.h:154
vtkParallelopipedRepresentation::SetFaceHighlight
void SetFaceHighlight(vtkCellArray *face, vtkProperty *)
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
@ ChairMode
Definition: vtkParallelopipedRepresentation.h:163
vtkParallelopipedRepresentation::UpdateChairAtNode
void UpdateChairAtNode(int node)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkParallelopipedRepresentation::RequestResizeParallelopipedAlongAnAxis
@ RequestResizeParallelopipedAlongAnAxis
Definition: vtkParallelopipedRepresentation.h:156
vtkParallelopipedRepresentation::SetHandleProperty
virtual void SetHandleProperty(vtkProperty *)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkParallelopipedRepresentation::HexMapper
vtkPolyDataMapper * HexMapper
Definition: vtkParallelopipedRepresentation.h:232
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkParallelopipedRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkParallelopipedRepresentation.h:257
vtkParallelopipedRepresentation::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation(int index)
VTKINTERACTIONWIDGETS_EXPORT
#define VTKINTERACTIONWIDGETS_EXPORT
Definition: vtkInteractionWidgetsModule.h:15
vtkParallelopipedRepresentation::GetBounds
virtual double * GetBounds()
vtkParallelopipedRepresentation::GetPolyData
void GetPolyData(vtkPolyData *pd)
vtkParallelopipedRepresentation::MinimumThickness
double MinimumThickness
Definition: vtkParallelopipedRepresentation.h:263
vtkParallelopipedRepresentation::Topology
vtkParallelopipedTopology * Topology
Definition: vtkParallelopipedRepresentation.h:262
vtkParallelopipedRepresentation::HandlesOn
void HandlesOn()
vtkParallelopipedRepresentation::RequestRotateParallelopiped
@ RequestRotateParallelopiped
Definition: vtkParallelopipedRepresentation.h:160
vtkParallelopipedRepresentation::HexFaceMapper
vtkPolyDataMapper * HexFaceMapper
Definition: vtkParallelopipedRepresentation.h:236
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkParallelopipedRepresentation::Points
vtkPoints * Points
Definition: vtkParallelopipedRepresentation.h:234
vtkParallelopipedRepresentation::HexPolyData
vtkPolyData * HexPolyData
Definition: vtkParallelopipedRepresentation.h:233
vtkParallelopipedRepresentation::FaceProperty
vtkProperty * FaceProperty
Definition: vtkParallelopipedRepresentation.h:256
vtkParallelopipedRepresentation::_InteractionState
_InteractionState
Definition: vtkParallelopipedRepresentation.h:152
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkgl::face
GLenum GLuint GLint GLenum face
Definition: vtkgl.h:13568
vtkParallelopipedRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkParallelopipedRepresentation.h:258
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkClosedSurfacePointPlacer
PointPlacer to constrain validity within a set of convex planes.
Definition: vtkClosedSurfacePointPlacer.h:39
vtkParallelopipedRepresentation::SelectedFaceProperty
vtkProperty * SelectedFaceProperty
Definition: vtkParallelopipedRepresentation.h:259
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:36
vtkParallelopipedRepresentation
Default representation for vtkParallelopipedWidget.
Definition: vtkParallelopipedRepresentation.h:54
vtkgl::w
GLubyte GLubyte GLubyte GLubyte w
Definition: vtkgl.h:12054
vtkParallelopipedRepresentation::HexFaceActor
vtkActor * HexFaceActor
Definition: vtkParallelopipedRepresentation.h:235
vtkParallelopipedRepresentation::HoveredHandleProperty
vtkProperty * HoveredHandleProperty
Definition: vtkParallelopipedRepresentation.h:255
vtkParallelopipedRepresentation::SetHoveredHandleProperty
virtual void SetHoveredHandleProperty(vtkProperty *)
vtkParallelopipedRepresentation::DefinePlane
void DefinePlane(vtkPlane *, vtkIdType, vtkIdType, vtkIdType)
vtkX3D::translation
@ translation
Definition: vtkX3D.h:232
vtkPropCollection
a list of Props
Definition: vtkPropCollection.h:38
vtkParallelopipedRepresentation::vtkParallelopipedRepresentation
vtkParallelopipedRepresentation()
vtkParallelopipedRepresentation::HexFacePolyData
vtkPolyData * HexFacePolyData
Definition: vtkParallelopipedRepresentation.h:237
vtkParallelopipedRepresentation::PositionHandles
virtual void PositionHandles()
vtkParallelopipedRepresentation::RequestTranslateParallelopiped
@ RequestTranslateParallelopiped
Definition: vtkParallelopipedRepresentation.h:158
vtkParallelopipedRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkParallelopipedRepresentation::CurrentHandleIdx
int CurrentHandleIdx
Definition: vtkParallelopipedRepresentation.h:246
vtkParallelopipedRepresentation::RequestResizeParallelopiped
@ RequestResizeParallelopiped
Definition: vtkParallelopipedRepresentation.h:155
vtkParallelopipedRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkParallelopipedRepresentation.h:254
vtkParallelopipedRepresentation::RequestScaleParallelopiped
@ RequestScaleParallelopiped
Definition: vtkParallelopipedRepresentation.h:159
vtkParallelopipedRepresentation::GetParallelopipedBoundingPlanes
void GetParallelopipedBoundingPlanes(vtkPlaneCollection *pc)
vtkParallelopipedRepresentation::ChairHandleIdx
int ChairHandleIdx
Definition: vtkParallelopipedRepresentation.h:247