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
45class vtkActor;
47class vtkLineSource;
48class vtkSphereSource;
49class vtkCellPicker;
50class vtkProperty;
51class vtkPolyData;
52class vtkPoints;
55class vtkTransform;
56class vtkPlanes;
57class vtkBox;
58class vtkDoubleArray;
59class vtkMatrix4x4;
60
61
62class VTKINTERACTIONWIDGETS_EXPORT vtkBoxRepresentation : public vtkWidgetRepresentation
63{
64public:
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
227protected:
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.
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
321private:
322 vtkBoxRepresentation(const vtkBoxRepresentation&) VTK_DELETE_FUNCTION;
323 void operator=(const vtkBoxRepresentation&) VTK_DELETE_FUNCTION;
324};
325
326#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
a class defining the representation for the vtkBoxWidget2
virtual int ComputeInteractionState(int X, int Y, int modify=0)
virtual void PositionHandles()
virtual void SetTransform(vtkTransform *t)
Set the position, scale and orientation of the box widget using the transform specified.
void GetPlanes(vtkPlanes *planes)
Get the planes describing the implicit function defined by the box widget.
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
virtual void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
void SetOutlineCursorWires(int)
Control the representation of the outline.
vtkPolyDataMapper * HexFaceMapper
virtual void HandlesOff()
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void HighlightFace(int cellId)
int HighlightHandle(vtkProp *prop)
void MovePlusZFace(double *p1, double *p2)
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkPolyDataMapper * OutlineMapper
void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3])
void MoveMinusZFace(double *p1, double *p2)
virtual void SizeHandles()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void WidgetInteraction(double e[2])
virtual void StartWidgetInteraction(double e[2])
vtkSphereSource ** HandleGeometry
virtual void GetTransform(vtkTransform *t)
Retrieve a linear transform characterizing the transformation of the box.
virtual void Scale(double *p1, double *p2, int X, int Y)
vtkDoubleArray * PlaneNormals
void MoveFace(double *p1, double *p2, double *dir, double *x1, double *x2, double *x3, double *x4, double *x5)
virtual void Translate(double *p1, double *p2)
vtkProperty * SelectedOutlineProperty
virtual void ComputeNormals()
vtkProperty * SelectedFaceProperty
void HighlightOutline(int highlight)
void MovePlusYFace(double *p1, double *p2)
virtual void PlaceWidget(double bounds[6])
These are methods that satisfy vtkWidgetRepresentation's API.
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that define the box widget.
vtkProperty * SelectedHandleProperty
virtual void ReleaseGraphicsResources(vtkWindow *)
Methods supporting, and required by, the rendering process.
vtkPolyDataMapper * HexMapper
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkPolyDataMapper ** HandleMapper
vtkCellPicker * HandlePicker
void SetInteractionState(int state)
The interaction state may be set from a widget (e.g., vtkBoxWidget2) or other object.
virtual void HandlesOn()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
virtual void BuildRepresentation()
void SetOutlineFaceWires(int)
Control the representation of the outline.
virtual void CreateDefaultProperties()
static vtkBoxRepresentation * New()
Instantiate the class.
void MoveMinusXFace(double *p1, double *p2)
virtual double * GetBounds()
Methods to make this class behave as a vtkProp.
void MovePlusXFace(double *p1, double *p2)
void MoveMinusYFace(double *p1, double *p2)
implicit function for a bounding box
Definition: vtkBox.h:42
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:40
create a line defined by two end points
Definition: vtkLineSource.h:43
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
implicit function for convex set of planes
Definition: vtkPlanes.h:55
represent the position of a point in 3D space
represent and manipulate 3D points
Definition: vtkPoints.h:40
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
represent surface properties of a geometric object
Definition: vtkProperty.h:65
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
abstract specification for Viewports
Definition: vtkViewport.h:48
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ dir
Definition: vtkX3D.h:324
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.