/usr/include/vtk-6.3/vtkBoxRepresentation.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkBoxRepresentation.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkBoxRepresentation - a class defining the representation for the vtkBoxWidget2
// .SECTION Description
// This class is a concrete representation for the vtkBoxWidget2. It
// represents a box with seven handles: one on each of the six faces, plus a
// center handle. Through interaction with the widget, the box
// representation can be arbitrarily positioned in the 3D space.
//
// To use this representation, you normally use the PlaceWidget() method
// to position the widget at a specified region in space.
//
// .SECTION Caveats
// This class, and vtkBoxWidget2, are second generation VTK
// widgets. An earlier version of this functionality was defined in the
// class vtkBoxWidget.
// .SECTION See Also
// vtkBoxWidget2 vtkBoxWidget
#ifndef vtkBoxRepresentation_h
#define vtkBoxRepresentation_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkWidgetRepresentation.h"
class vtkActor;
class vtkPolyDataMapper;
class vtkLineSource;
class vtkSphereSource;
class vtkCellPicker;
class vtkProperty;
class vtkPolyData;
class vtkPoints;
class vtkPolyDataAlgorithm;
class vtkPointHandleRepresentation3D;
class vtkTransform;
class vtkPlanes;
class vtkBox;
class vtkDoubleArray;
class vtkMatrix4x4;
class VTKINTERACTIONWIDGETS_EXPORT vtkBoxRepresentation : public vtkWidgetRepresentation
{
public:
// Description:
// Instantiate the class.
static vtkBoxRepresentation *New();
// Description:
// Standard methods for the class.
vtkTypeMacro(vtkBoxRepresentation,vtkWidgetRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the planes describing the implicit function defined by the box
// widget. The user must provide the instance of the class vtkPlanes. Note
// that vtkPlanes is a subclass of vtkImplicitFunction, meaning that it can
// be used by a variety of filters to perform clipping, cutting, and
// selection of data. (The direction of the normals of the planes can be
// reversed enabling the InsideOut flag.)
void GetPlanes(vtkPlanes *planes);
// Description:
// Set/Get the InsideOut flag. This data member is used in conjunction
// with the GetPlanes() method. When off, the normals point out of the
// box. When on, the normals point into the hexahedron. InsideOut is off
// by default.
vtkSetMacro(InsideOut,int);
vtkGetMacro(InsideOut,int);
vtkBooleanMacro(InsideOut,int);
// Description:
// Retrieve a linear transform characterizing the transformation of the
// box. Note that the transformation is relative to where PlaceWidget()
// was initially called. This method modifies the transform provided. The
// transform can be used to control the position of vtkProp3D's, as well as
// other transformation operations (e.g., vtkTranformPolyData).
virtual void GetTransform(vtkTransform *t);
// Description:
// Set the position, scale and orientation of the box widget using the
// transform specified. Note that the transformation is relative to
// where PlaceWidget() was initially called (i.e., the original bounding
// box).
virtual void SetTransform(vtkTransform* t);
// Description:
// Grab the polydata (including points) that define the box widget. The
// polydata consists of 6 quadrilateral faces and 15 points. The first
// eight points define the eight corner vertices; the next six define the
// -x,+x, -y,+y, -z,+z face points; and the final point (the 15th out of 15
// points) defines the center of the box. These point values are guaranteed
// to be up-to-date when either the widget's corresponding InteractionEvent
// or EndInteractionEvent events are invoked. The user provides the
// vtkPolyData and the points and cells are added to it.
void GetPolyData(vtkPolyData *pd);
// Description:
// Get the handle properties (the little balls are the handles). The
// properties of the handles, when selected or normal, can be
// specified.
vtkGetObjectMacro(HandleProperty,vtkProperty);
vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
// Description:
// Get the face properties (the faces of the box). The
// properties of the face when selected and normal can be
// set.
vtkGetObjectMacro(FaceProperty,vtkProperty);
vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
// Description:
// Get the outline properties (the outline of the box). The
// properties of the outline when selected and normal can be
// set.
vtkGetObjectMacro(OutlineProperty,vtkProperty);
vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
// Description:
// Control the representation of the outline. This flag enables
// face wires. By default face wires are off.
void SetOutlineFaceWires(int);
vtkGetMacro(OutlineFaceWires,int);
void OutlineFaceWiresOn() {this->SetOutlineFaceWires(1);}
void OutlineFaceWiresOff() {this->SetOutlineFaceWires(0);}
// Description:
// Control the representation of the outline. This flag enables
// the cursor lines running between the handles. By default cursor
// wires are on.
void SetOutlineCursorWires(int);
vtkGetMacro(OutlineCursorWires,int);
void OutlineCursorWiresOn() {this->SetOutlineCursorWires(1);}
void OutlineCursorWiresOff() {this->SetOutlineCursorWires(0);}
// Description:
// Switches handles (the spheres) on or off by manipulating the underlying
// actor visibility.
virtual void HandlesOn();
virtual void HandlesOff();
// Description:
// These are methods that satisfy vtkWidgetRepresentation's API.
virtual void PlaceWidget(double bounds[6]);
virtual void BuildRepresentation();
virtual int ComputeInteractionState(int X, int Y, int modify=0);
virtual void StartWidgetInteraction(double e[2]);
virtual void WidgetInteraction(double e[2]);
virtual double *GetBounds();
// Description:
// Methods supporting, and required by, the rendering process.
virtual void ReleaseGraphicsResources(vtkWindow*);
virtual int RenderOpaqueGeometry(vtkViewport*);
virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
virtual int HasTranslucentPolygonalGeometry();
//BTX - used to manage the state of the widget
enum {Outside=0,MoveF0,MoveF1,MoveF2,MoveF3,MoveF4,MoveF5,Translating,Rotating,Scaling};
//ETX
// Description:
// The interaction state may be set from a widget (e.g., vtkBoxWidget2) or
// other object. This controls how the interaction with the widget
// proceeds. Normally this method is used as part of a handshaking
// process with the widget: First ComputeInteractionState() is invoked that
// returns a state based on geometric considerations (i.e., cursor near a
// widget feature), then based on events, the widget may modify this
// further.
void SetInteractionState(int state);
protected:
vtkBoxRepresentation();
~vtkBoxRepresentation();
// Manage how the representation appears
double LastEventPosition[3];
// the hexahedron (6 faces)
vtkActor *HexActor;
vtkPolyDataMapper *HexMapper;
vtkPolyData *HexPolyData;
vtkPoints *Points; //used by others as well
double N[6][3]; //the normals of the faces
// A face of the hexahedron
vtkActor *HexFace;
vtkPolyDataMapper *HexFaceMapper;
vtkPolyData *HexFacePolyData;
// glyphs representing hot spots (e.g., handles)
vtkActor **Handle;
vtkPolyDataMapper **HandleMapper;
vtkSphereSource **HandleGeometry;
virtual void PositionHandles();
int HighlightHandle(vtkProp *prop); //returns cell id
void HighlightFace(int cellId);
void HighlightOutline(int highlight);
virtual void ComputeNormals();
virtual void SizeHandles();
// wireframe outline
vtkActor *HexOutline;
vtkPolyDataMapper *OutlineMapper;
vtkPolyData *OutlinePolyData;
// Do the picking
vtkCellPicker *HandlePicker;
vtkCellPicker *HexPicker;
vtkActor *CurrentHandle;
int CurrentHexFace;
vtkCellPicker *LastPicker;
// Register internal Pickers within PickingManager
virtual void RegisterPickers();
// Transform the hexahedral points (used for rotations)
vtkTransform *Transform;
// Support GetBounds() method
vtkBox *BoundingBox;
// Properties used to control the appearance of selected objects and
// the manipulator in general.
vtkProperty *HandleProperty;
vtkProperty *SelectedHandleProperty;
vtkProperty *FaceProperty;
vtkProperty *SelectedFaceProperty;
vtkProperty *OutlineProperty;
vtkProperty *SelectedOutlineProperty;
virtual void CreateDefaultProperties();
// Control the orientation of the normals
int InsideOut;
int OutlineFaceWires;
int OutlineCursorWires;
void GenerateOutline();
// Helper methods
virtual void Translate(double *p1, double *p2);
virtual void Scale(double *p1, double *p2, int X, int Y);
virtual void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
void MovePlusXFace(double *p1, double *p2);
void MoveMinusXFace(double *p1, double *p2);
void MovePlusYFace(double *p1, double *p2);
void MoveMinusYFace(double *p1, double *p2);
void MovePlusZFace(double *p1, double *p2);
void MoveMinusZFace(double *p1, double *p2);
// Internal ivars for performance
vtkPoints *PlanePoints;
vtkDoubleArray *PlaneNormals;
vtkMatrix4x4 *Matrix;
//"dir" is the direction in which the face can be moved i.e. the axis passing
//through the center
void MoveFace(double *p1, double *p2, double *dir,
double *x1, double *x2, double *x3, double *x4,
double *x5);
//Helper method to obtain the direction in which the face is to be moved.
//Handles special cases where some of the scale factors are 0.
void GetDirection(const double Nx[3],const double Ny[3],
const double Nz[3], double dir[3]);
private:
vtkBoxRepresentation(const vtkBoxRepresentation&); //Not implemented
void operator=(const vtkBoxRepresentation&); //Not implemented
};
#endif
|