VTK
vtkBoxRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBoxRepresentation.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 =========================================================================*/
39 #ifndef vtkBoxRepresentation_h
40 #define vtkBoxRepresentation_h
41 
42 #include "vtkInteractionWidgetsModule.h" // For export macro
44 
45 class vtkActor;
46 class vtkPolyDataMapper;
47 class vtkLineSource;
48 class vtkSphereSource;
49 class vtkCellPicker;
50 class vtkProperty;
51 class vtkPolyData;
52 class vtkPoints;
55 class vtkTransform;
56 class vtkPlanes;
57 class vtkBox;
58 class vtkDoubleArray;
59 class vtkMatrix4x4;
60 
61 
62 class VTKINTERACTIONWIDGETS_EXPORT vtkBoxRepresentation : public vtkWidgetRepresentation
63 {
64 public:
69 
71 
75  void PrintSelf(ostream& os, vtkIndent indent);
77 
86  void GetPlanes(vtkPlanes *planes);
87 
89 
95  vtkSetMacro(InsideOut,int);
96  vtkGetMacro(InsideOut,int);
97  vtkBooleanMacro(InsideOut,int);
99 
107  virtual void GetTransform(vtkTransform *t);
108 
115  virtual void SetTransform(vtkTransform* t);
116 
128 
130 
135  vtkGetObjectMacro(HandleProperty,vtkProperty);
136  vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
138 
140 
145  vtkGetObjectMacro(FaceProperty,vtkProperty);
146  vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
148 
150 
155  vtkGetObjectMacro(OutlineProperty,vtkProperty);
156  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
158 
160 
165  vtkGetMacro(OutlineFaceWires,int);
166  void OutlineFaceWiresOn() {this->SetOutlineFaceWires(1);}
167  void OutlineFaceWiresOff() {this->SetOutlineFaceWires(0);}
169 
171 
177  vtkGetMacro(OutlineCursorWires,int);
178  void OutlineCursorWiresOn() {this->SetOutlineCursorWires(1);}
179  void OutlineCursorWiresOff() {this->SetOutlineCursorWires(0);}
181 
183 
187  virtual void HandlesOn();
188  virtual void HandlesOff();
190 
192 
195  virtual void PlaceWidget(double bounds[6]);
196  virtual void BuildRepresentation();
197  virtual int ComputeInteractionState(int X, int Y, int modify=0);
198  virtual void StartWidgetInteraction(double e[2]);
199  virtual void WidgetInteraction(double e[2]);
200  virtual double *GetBounds();
202 
204 
212 
213  // Used to manage the state of the widget
214  enum {Outside=0,MoveF0,MoveF1,MoveF2,MoveF3,MoveF4,MoveF5,Translating,Rotating,Scaling};
215 
225  void SetInteractionState(int state);
226 
227 protected:
230 
231  // Manage how the representation appears
232  double LastEventPosition[3];
233 
234  // the hexahedron (6 faces)
238  vtkPoints *Points; //used by others as well
239  double N[6][3]; //the normals of the faces
240 
241  // A face of the hexahedron
245 
246  // glyphs representing hot spots (e.g., handles)
250  virtual void PositionHandles();
251  int HighlightHandle(vtkProp *prop); //returns cell id
252  void HighlightFace(int cellId);
253  void HighlightOutline(int highlight);
254  virtual void ComputeNormals();
255  virtual void SizeHandles();
256 
257  // wireframe outline
261 
262  // Do the picking
268 
269  // Register internal Pickers within PickingManager
270  virtual void RegisterPickers();
271 
272  // Transform the hexahedral points (used for rotations)
274 
275  // Support GetBounds() method
277 
278  // Properties used to control the appearance of selected objects and
279  // the manipulator in general.
286  virtual void CreateDefaultProperties();
287 
288  // Control the orientation of the normals
293 
294  // Helper methods
295  virtual void Translate(double *p1, double *p2);
296  virtual void Scale(double *p1, double *p2, int X, int Y);
297  virtual void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
298  void MovePlusXFace(double *p1, double *p2);
299  void MoveMinusXFace(double *p1, double *p2);
300  void MovePlusYFace(double *p1, double *p2);
301  void MoveMinusYFace(double *p1, double *p2);
302  void MovePlusZFace(double *p1, double *p2);
303  void MoveMinusZFace(double *p1, double *p2);
304 
305  // Internal ivars for performance
309 
310  //"dir" is the direction in which the face can be moved i.e. the axis passing
311  //through the center
312  void MoveFace(double *p1, double *p2, double *dir,
313  double *x1, double *x2, double *x3, double *x4,
314  double *x5);
315  //Helper method to obtain the direction in which the face is to be moved.
316  //Handles special cases where some of the scale factors are 0.
317  void GetDirection(const double Nx[3],const double Ny[3],
318  const double Nz[3], double dir[3]);
319 
320 
321 private:
322  vtkBoxRepresentation(const vtkBoxRepresentation&) VTK_DELETE_FUNCTION;
323  void operator=(const vtkBoxRepresentation&) VTK_DELETE_FUNCTION;
324 };
325 
326 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:43
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkWidgetRepresentation.h
vtkBoxRepresentation::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkBoxRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkBoxRepresentation::HandlesOff
virtual void HandlesOff()
vtkBoxRepresentation::BuildRepresentation
virtual void BuildRepresentation()
vtkBoxRepresentation::Rotate
virtual void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
vtkBoxRepresentation::PlaneNormals
vtkDoubleArray * PlaneNormals
Definition: vtkBoxRepresentation.h:307
vtkBoxRepresentation::GetDirection
void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3])
vtkBoxRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkBoxRepresentation::Translate
virtual void Translate(double *p1, double *p2)
vtkBoxRepresentation::~vtkBoxRepresentation
~vtkBoxRepresentation()
vtkBoxRepresentation::SelectedOutlineProperty
vtkProperty * SelectedOutlineProperty
Definition: vtkBoxRepresentation.h:285
vtkBoxRepresentation
a class defining the representation for the vtkBoxWidget2
Definition: vtkBoxRepresentation.h:63
vtkBoxRepresentation::MoveFace
void MoveFace(double *p1, double *p2, double *dir, double *x1, double *x2, double *x3, double *x4, double *x5)
vtkPointHandleRepresentation3D
represent the position of a point in 3D space
Definition: vtkPointHandleRepresentation3D.h:44
vtkBoxRepresentation::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkBoxRepresentation::HighlightFace
void HighlightFace(int cellId)
vtkBoxRepresentation::OutlineCursorWires
int OutlineCursorWires
Definition: vtkBoxRepresentation.h:291
vtkBoxRepresentation::OutlineMapper
vtkPolyDataMapper * OutlineMapper
Definition: vtkBoxRepresentation.h:259
vtkBoxRepresentation::GetPolyData
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that define the box widget.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:55
vtkBoxRepresentation::OutlinePolyData
vtkPolyData * OutlinePolyData
Definition: vtkBoxRepresentation.h:260
vtkBoxRepresentation::Points
vtkPoints * Points
Definition: vtkBoxRepresentation.h:238
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkBoxRepresentation::HexPicker
vtkCellPicker * HexPicker
Definition: vtkBoxRepresentation.h:264
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:55
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkBoxRepresentation::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Methods supporting, and required by, the rendering process.
vtkBoxRepresentation::MovePlusZFace
void MovePlusZFace(double *p1, double *p2)
vtkBoxRepresentation::WidgetInteraction
virtual void WidgetInteraction(double e[2])
vtkBoxRepresentation::HexActor
vtkActor * HexActor
Definition: vtkBoxRepresentation.h:235
vtkBoxRepresentation::HandleMapper
vtkPolyDataMapper ** HandleMapper
Definition: vtkBoxRepresentation.h:248
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkBoxRepresentation::Handle
vtkActor ** Handle
Definition: vtkBoxRepresentation.h:247
vtkBoxRepresentation::InsideOut
int InsideOut
Definition: vtkBoxRepresentation.h:289
vtkBoxRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double e[2])
vtkBoxRepresentation::MoveMinusYFace
void MoveMinusYFace(double *p1, double *p2)
vtkBoxRepresentation::HandlesOn
virtual void HandlesOn()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
vtkBoxRepresentation::HexMapper
vtkPolyDataMapper * HexMapper
Definition: vtkBoxRepresentation.h:236
vtkBoxRepresentation::vtkBoxRepresentation
vtkBoxRepresentation()
vtkBoxRepresentation::HexOutline
vtkActor * HexOutline
Definition: vtkBoxRepresentation.h:258
vtkBoxRepresentation::HexFacePolyData
vtkPolyData * HexFacePolyData
Definition: vtkBoxRepresentation.h:244
vtkBoxRepresentation::HexFaceMapper
vtkPolyDataMapper * HexFaceMapper
Definition: vtkBoxRepresentation.h:243
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:47
vtkBoxRepresentation::GenerateOutline
void GenerateOutline()
vtkBoxRepresentation::MoveMinusXFace
void MoveMinusXFace(double *p1, double *p2)
vtkBoxRepresentation::Scale
virtual void Scale(double *p1, double *p2, int X, int Y)
vtkBoxRepresentation::HighlightOutline
void HighlightOutline(int highlight)
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkBoxRepresentation::Matrix
vtkMatrix4x4 * Matrix
Definition: vtkBoxRepresentation.h:308
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkBoxRepresentation::Translating
@ Translating
Definition: vtkBoxRepresentation.h:214
vtkBoxRepresentation::GetTransform
virtual void GetTransform(vtkTransform *t)
Retrieve a linear transform characterizing the transformation of the box.
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:43
vtkBoxRepresentation::OutlineFaceWiresOn
void OutlineFaceWiresOn()
Definition: vtkBoxRepresentation.h:166
vtkBoxRepresentation::PlaceWidget
virtual void PlaceWidget(double bounds[6])
These are methods that satisfy vtkWidgetRepresentation's API.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkBoxRepresentation::GetBounds
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
vtkBoxRepresentation::CreateDefaultProperties
virtual void CreateDefaultProperties()
vtkBoxRepresentation::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkBoxRepresentation::HexPolyData
vtkPolyData * HexPolyData
Definition: vtkBoxRepresentation.h:237
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBoxRepresentation::ComputeNormals
virtual void ComputeNormals()
vtkBoxRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkBoxRepresentation::MovePlusYFace
void MovePlusYFace(double *p1, double *p2)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBoxRepresentation::New
static vtkBoxRepresentation * New()
Instantiate the class.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkBoxRepresentation::HighlightHandle
int HighlightHandle(vtkProp *prop)
vtkBoxRepresentation::CurrentHandle
vtkActor * CurrentHandle
Definition: vtkBoxRepresentation.h:265
vtkBoxRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkBoxRepresentation.h:276
vtkBoxRepresentation::FaceProperty
vtkProperty * FaceProperty
Definition: vtkBoxRepresentation.h:282
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:42
vtkBoxRepresentation::SizeHandles
virtual void SizeHandles()
vtkBoxRepresentation::OutlineCursorWiresOff
void OutlineCursorWiresOff()
Definition: vtkBoxRepresentation.h:179
vtkBoxRepresentation::SelectedFaceProperty
vtkProperty * SelectedFaceProperty
Definition: vtkBoxRepresentation.h:283
vtkBoxRepresentation::HandleGeometry
vtkSphereSource ** HandleGeometry
Definition: vtkBoxRepresentation.h:249
vtkBoxRepresentation::CurrentHexFace
int CurrentHexFace
Definition: vtkBoxRepresentation.h:266
vtkBoxRepresentation::GetPlanes
void GetPlanes(vtkPlanes *planes)
Get the planes describing the implicit function defined by the box widget.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkBoxRepresentation::OutlineCursorWiresOn
void OutlineCursorWiresOn()
Definition: vtkBoxRepresentation.h:178
vtkBoxRepresentation::SetOutlineCursorWires
void SetOutlineCursorWires(int)
Control the representation of the outline.
vtkBoxRepresentation::Transform
vtkTransform * Transform
Definition: vtkBoxRepresentation.h:273
vtkBoxRepresentation::PositionHandles
virtual void PositionHandles()
vtkBoxRepresentation::SetInteractionState
void SetInteractionState(int state)
The interaction state may be set from a widget (e.g., vtkBoxWidget2) or other object.
vtkBoxRepresentation::HexFace
vtkActor * HexFace
Definition: vtkBoxRepresentation.h:242
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkBoxRepresentation::OutlineFaceWires
int OutlineFaceWires
Definition: vtkBoxRepresentation.h:290
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:65
vtkBoxRepresentation::LastPicker
vtkCellPicker * LastPicker
Definition: vtkBoxRepresentation.h:267
vtkBoxRepresentation::SetTransform
virtual void SetTransform(vtkTransform *t)
Set the position, scale and orientation of the box widget using the transform specified.
vtkBoxRepresentation::OutlineFaceWiresOff
void OutlineFaceWiresOff()
Definition: vtkBoxRepresentation.h:167
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkBoxRepresentation::HandleProperty
vtkProperty * HandleProperty
Definition: vtkBoxRepresentation.h:280
vtkBoxRepresentation::OutlineProperty
vtkProperty * OutlineProperty
Definition: vtkBoxRepresentation.h:284
vtkBoxRepresentation::MovePlusXFace
void MovePlusXFace(double *p1, double *p2)
vtkBoxRepresentation::SetOutlineFaceWires
void SetOutlineFaceWires(int)
Control the representation of the outline.
vtkBoxRepresentation::PlanePoints
vtkPoints * PlanePoints
Definition: vtkBoxRepresentation.h:306
vtkBoxRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkBoxRepresentation.h:281
vtkBoxRepresentation::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkBoxRepresentation.h:263
vtkBoxRepresentation::MoveMinusZFace
void MoveMinusZFace(double *p1, double *p2)
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:45