/usr/include/vtk-6.3/vtkLineWidget.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 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkLineWidget.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 vtkLineWidget - 3D widget for manipulating a line
// .SECTION Description
// This 3D widget defines a line that can be interactively placed in a
// scene. The line has two handles (at its endpoints), plus the line can be
// picked to translate it in the scene. A nice feature of the object is that
// the vtkLineWidget, like any 3D widget, will work with the current
// interactor style and any other widgets present in the scene. That is, if
// vtkLineWidget does not handle an event, then all other registered
// observers (including the interactor style) have an opportunity to process
// the event. Otherwise, the vtkLineWidget will terminate the processing of
// the event that it handles.
//
// To use this object, just invoke SetInteractor() with the argument of the
// method a vtkRenderWindowInteractor. You may also wish to invoke
// "PlaceWidget()" to initially position the widget. The interactor will act
// normally until the "i" key (for "interactor") is pressed, at which point
// the vtkLineWidget will appear. (See superclass documentation for
// information about changing this behavior.) By grabbing one of the two end
// point handles (use the left mouse button), the line can be oriented and
// stretched (the other end point remains fixed). By grabbing the line
// itself, or using the middle mouse button, the entire line can be
// translated. Scaling (about the center of the line) is achieved by using
// the right mouse button. By moving the mouse "up" the render window the
// line will be made bigger; by moving "down" the render window the widget
// will be made smaller. Turn off the widget by pressing the "i" key again
// (or invoke the Off() method). (Note: picking the line or either one of the
// two end point handles causes a vtkPointWidget to appear. This widget has
// the ability to constrain motion to an axis by pressing the "shift" key
// while moving the mouse.)
//
// The vtkLineWidget has several methods that can be used in conjunction with
// other VTK objects. The Set/GetResolution() methods control the number of
// subdivisions of the line; the GetPolyData() method can be used to get the
// polygonal representation and can be used for things like seeding
// streamlines. Typical usage of the widget is to make use of the
// StartInteractionEvent, InteractionEvent, and EndInteractionEvent
// events. The InteractionEvent is called on mouse motion; the other two
// events are called on button down and button up (either left or right
// button).
//
// Some additional features of this class include the ability to control the
// properties of the widget. You can set the properties of the selected and
// unselected representations of the line. For example, you can set the
// property for the handles and line. In addition there are methods to
// constrain the line so that it is aligned along the x-y-z axes.
// .SECTION See Also
// vtk3DWidget vtkBoxWidget vtkPlaneWidget
#ifndef vtkLineWidget_h
#define vtkLineWidget_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtk3DWidget.h"
#include "vtkLineSource.h" // For passing calls to it
class vtkActor;
class vtkPolyDataMapper;
class vtkPoints;
class vtkPolyData;
class vtkProp;
class vtkProperty;
class vtkSphereSource;
class vtkCellPicker;
class vtkPointWidget;
class vtkPWCallback;
class vtkPW1Callback;
class vtkPW2Callback;
class VTKINTERACTIONWIDGETS_EXPORT vtkLineWidget : public vtk3DWidget
{
public:
// Description:
// Instantiate the object.
static vtkLineWidget *New();
vtkTypeMacro(vtkLineWidget,vtk3DWidget);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Methods that satisfy the superclass' API.
virtual void SetEnabled(int);
virtual void PlaceWidget(double bounds[6]);
void PlaceWidget()
{this->Superclass::PlaceWidget();}
void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
double zmin, double zmax)
{this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
// Description:
// Set/Get the resolution (number of subdivisions) of the line.
void SetResolution(int r)
{ this->LineSource->SetResolution(r); }
int GetResolution()
{ return this->LineSource->GetResolution(); }
// Description:
// Set/Get the position of first end point.
void SetPoint1(double x, double y, double z);
void SetPoint1(double x[3])
{this->SetPoint1(x[0], x[1], x[2]); }
double* GetPoint1()
{return this->LineSource->GetPoint1();}
void GetPoint1(double xyz[3])
{this->LineSource->GetPoint1(xyz);}
// Description:
// Set position of other end point.
void SetPoint2(double x, double y, double z);
void SetPoint2(double x[3])
{this->SetPoint2(x[0], x[1], x[2]);}
double* GetPoint2()
{return this->LineSource->GetPoint2();}
void GetPoint2(double xyz[3])
{this->LineSource->GetPoint2(xyz);}
// Description:
// Force the line widget to be aligned with one of the x-y-z axes.
// Remember that when the state changes, a ModifiedEvent is invoked.
// This can be used to snap the line to the axes if it is originally
// not aligned.
vtkSetClampMacro(Align, int, XAxis, None);
vtkGetMacro(Align, int);
void SetAlignToXAxis() { this->SetAlign(XAxis); }
void SetAlignToYAxis() { this->SetAlign(YAxis); }
void SetAlignToZAxis() { this->SetAlign(ZAxis); }
void SetAlignToNone() { this->SetAlign(None); }
// Description:
// Enable/disable clamping of the point end points to the bounding box
// of the data. The bounding box is defined from the last PlaceWidget()
// invocation, and includes the effect of the PlaceFactor which is used
// to gram/shrink the bounding box.
vtkSetMacro(ClampToBounds,int);
vtkGetMacro(ClampToBounds,int);
vtkBooleanMacro(ClampToBounds,int);
// Description:
// Grab the polydata (including points) that defines the line. The
// polydata consists of n+1 points, where n is the resolution of the
// line. These point values are guaranteed to be up-to-date when either the
// InteractionEvent or EndInteraction events are invoked. The user provides
// the vtkPolyData and the points and polyline 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 and normal can be
// manipulated.
vtkGetObjectMacro(HandleProperty,vtkProperty);
vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
// Description:
// Get the line properties. The properties of the line when selected
// and unselected can be manipulated.
vtkGetObjectMacro(LineProperty,vtkProperty);
vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
protected:
vtkLineWidget();
~vtkLineWidget();
//BTX - manage the state of the widget
friend class vtkPWCallback;
int State;
enum WidgetState
{
Start=0,
MovingHandle,
MovingLine,
Scaling,
Outside
};
//ETX
//handles the events
static void ProcessEvents(vtkObject* object,
unsigned long event,
void* clientdata,
void* calldata);
// ProcessEvents() dispatches to these methods.
void OnLeftButtonDown();
void OnLeftButtonUp();
void OnMiddleButtonDown();
void OnMiddleButtonUp();
void OnRightButtonDown();
void OnRightButtonUp();
virtual void OnMouseMove();
// controlling ivars
int Align;
//BTX
enum AlignmentState {
XAxis,
YAxis,
ZAxis,
None
};
//ETX
// the line
vtkActor *LineActor;
vtkPolyDataMapper *LineMapper;
vtkLineSource *LineSource;
void HighlightLine(int highlight);
// glyphs representing hot spots (e.g., handles)
vtkActor **Handle;
vtkPolyDataMapper **HandleMapper;
vtkSphereSource **HandleGeometry;
void BuildRepresentation();
virtual void SizeHandles();
void HandlesOn(double length);
void HandlesOff();
int HighlightHandle(vtkProp *prop); //returns cell id
void HighlightHandles(int highlight);
// Do the picking
vtkCellPicker *HandlePicker;
vtkCellPicker *LinePicker;
vtkActor *CurrentHandle;
double LastPosition[3];
void SetLinePosition(double x[3]);
// Register internal Pickers within PickingManager
virtual void RegisterPickers();
// Methods to manipulate the hexahedron.
void Scale(double *p1, double *p2, int X, int Y);
// Initial bounds
int ClampToBounds;
void ClampPosition(double x[3]);
int InBounds(double x[3]);
// Properties used to control the appearance of selected objects and
// the manipulator in general.
vtkProperty *HandleProperty;
vtkProperty *SelectedHandleProperty;
vtkProperty *LineProperty;
vtkProperty *SelectedLineProperty;
void CreateDefaultProperties();
void GenerateLine();
// Methods for managing the point widgets used to control the endpoints
vtkPointWidget *PointWidget;
vtkPointWidget *PointWidget1;
vtkPointWidget *PointWidget2;
vtkPWCallback *PWCallback;
vtkPW1Callback *PW1Callback;
vtkPW2Callback *PW2Callback;
vtkPointWidget *CurrentPointWidget;
void EnablePointWidget();
void DisablePointWidget();
int ForwardEvent(unsigned long event);
private:
vtkLineWidget(const vtkLineWidget&); //Not implemented
void operator=(const vtkLineWidget&); //Not implemented
};
#endif
|