/usr/include/vtk-5.8/vtkLineRepresentation.h is in libvtk5-dev 5.8.0-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 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkLineRepresentation.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 vtkLineRepresentation - a class defining the representation for a vtkLineWidget2
// .SECTION Description
// This class is a concrete representation for the vtkLineWidget2. It
// represents a straight line with three handles: one at the beginning and
// ending of the line, and one used to translate the line. Through
// interaction with the widget, the line representation can be arbitrarily
// placed in the 3D space.
//
// To use this representation, you normally specify the position of the two
// end points (either in world or display coordinates). The PlaceWidget()
// method is also used to intially position the representation.
// .SECTION Caveats
// This class, and vtkLineWidget2, are next generation VTK
// widgets. An earlier version of this functionality was defined in the
// class vtkLineWidget.
// .SECTION See Also
// vtkLineWidget2 vtkLineWidget
#ifndef __vtkLineRepresentation_h
#define __vtkLineRepresentation_h
#include "vtkWidgetRepresentation.h"
class vtkActor;
class vtkPolyDataMapper;
class vtkLineSource;
class vtkSphereSource;
class vtkProperty;
class vtkPolyData;
class vtkPolyDataAlgorithm;
class vtkPointHandleRepresentation3D;
class vtkBox;
class vtkFollower;
class vtkVectorText;
class vtkPolyDataMapper;
class vtkCellPicker;
class VTK_WIDGETS_EXPORT vtkLineRepresentation : public vtkWidgetRepresentation
{
public:
// Description:
// Instantiate the class.
static vtkLineRepresentation *New();
// Description:
// Standard methods for the class.
vtkTypeMacro(vtkLineRepresentation,vtkWidgetRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Methods to Set/Get the coordinates of the two points defining
// this representation. Note that methods are available for both
// display and world coordinates.
void GetPoint1WorldPosition(double pos[3]);
double* GetPoint1WorldPosition();
void GetPoint1DisplayPosition(double pos[3]);
double* GetPoint1DisplayPosition();
void SetPoint1WorldPosition(double pos[3]);
void SetPoint1DisplayPosition(double pos[3]);
void GetPoint2DisplayPosition(double pos[3]);
double* GetPoint2DisplayPosition();
void GetPoint2WorldPosition(double pos[3]);
double* GetPoint2WorldPosition();
void SetPoint2WorldPosition(double pos[3]);
void SetPoint2DisplayPosition(double pos[3]);
// Description:
// This method is used to specify the type of handle representation to
// use for the three internal vtkHandleWidgets within vtkLineWidget2.
// To use this method, create a dummy vtkHandleWidget (or subclass),
// and then invoke this method with this dummy. Then the
// vtkLineRepresentation uses this dummy to clone three vtkHandleWidgets
// of the same type. Make sure you set the handle representation before
// the widget is enabled. (The method InstantiateHandleRepresentation()
// is invoked by the vtkLineWidget2.)
void SetHandleRepresentation(vtkPointHandleRepresentation3D *handle);
void InstantiateHandleRepresentation();
// Description:
// Get the three handle representations used for the vtkLineWidget2.
vtkGetObjectMacro(Point1Representation,vtkPointHandleRepresentation3D);
vtkGetObjectMacro(Point2Representation,vtkPointHandleRepresentation3D);
vtkGetObjectMacro(LineHandleRepresentation,vtkPointHandleRepresentation3D);
// Description:
// Get the end-point (sphere) properties. The properties of the end-points
// when selected and unselected can be manipulated.
vtkGetObjectMacro(EndPointProperty,vtkProperty);
vtkGetObjectMacro(SelectedEndPointProperty,vtkProperty);
// Description:
// Get the end-point (sphere) properties. The properties of the end-points
// when selected and unselected can be manipulated.
vtkGetObjectMacro(EndPoint2Property,vtkProperty);
vtkGetObjectMacro(SelectedEndPoint2Property,vtkProperty);
// Description:
// Get the line properties. The properties of the line when selected
// and unselected can be manipulated.
vtkGetObjectMacro(LineProperty,vtkProperty);
vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
// Description:
// The tolerance representing the distance to the widget (in pixels) in
// which the cursor is considered near enough to the line or end point
// to be active.
vtkSetClampMacro(Tolerance,int,1,100);
vtkGetMacro(Tolerance,int);
// Description:
// Set/Get the resolution (number of subdivisions) of the line. A line with
// resolution greater than one is useful when points along the line are
// desired; e.g., generating a rake of streamlines.
void SetResolution(int res);
int GetResolution();
// Description:
// Retrieve 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 whenever any
// one of the three handles are moved. To use this method, the user
// provides the vtkPolyData as an input argument, and the points and
// polyline are copied into it.
void GetPolyData(vtkPolyData *pd);
// 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 the rendering process.
virtual void GetActors(vtkPropCollection *pc);
virtual void ReleaseGraphicsResources(vtkWindow*);
virtual int RenderOpaqueGeometry(vtkViewport*);
virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
virtual int HasTranslucentPolygonalGeometry();
//BTX - manage the state of the widget
enum {Outside=0,OnP1,OnP2,TranslatingP1,TranslatingP2,OnLine,Scaling};
//ETX
// Description:
// The interaction state may be set from a widget (e.g., vtkLineWidget2) 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.
vtkSetClampMacro(InteractionState,int,Outside,Scaling);
// Description:
// Sets the visual appearance of the representation based on the
// state it is in. This state is usually the same as InteractionState.
virtual void SetRepresentationState(int);
vtkGetMacro(RepresentationState, int);
// Description:
// Overload the superclasses' GetMTime() because internal classes
// are used to keep the state of the representation.
virtual unsigned long GetMTime();
// Description:
// Overridden to set the rendererer on the internal representations.
virtual void SetRenderer(vtkRenderer *ren);
// Description:
// Show the distance between the points.
vtkSetMacro( DistanceAnnotationVisibility, int );
vtkGetMacro( DistanceAnnotationVisibility, int );
vtkBooleanMacro( DistanceAnnotationVisibility, int );
// Description:
// Specify the format to use for labelling the line. Note that an empty
// string results in no label, or a format string without a "%" character
// will not print the angle value.
vtkSetStringMacro(DistanceAnnotationFormat);
vtkGetStringMacro(DistanceAnnotationFormat);
// Description:
// Scale text (font size along each dimension).
void SetDistanceAnnotationScale(double x, double y, double z)
{
double scale[3];
scale[0] = x;
scale[1] = y;
scale[2] = z;
this->SetDistanceAnnotationScale(scale);
}
virtual void SetDistanceAnnotationScale( double scale[3] );
virtual double * GetDistanceAnnotationScale();
// Description:
// Get the distance between the points.
double GetDistance();
// Description:
// Convenience method to set the line color.
// Ideally one should use GetLineProperty()->SetColor().
void SetLineColor(double r, double g, double b);
// Description:
// Get the distance annotation property
virtual vtkProperty *GetDistanceAnnotationProperty();
// Description:
// Get the text actor
vtkGetObjectMacro(TextActor, vtkFollower);
protected:
vtkLineRepresentation();
~vtkLineRepresentation();
// The handle and the rep used to close the handles
vtkPointHandleRepresentation3D *HandleRepresentation;
vtkPointHandleRepresentation3D *Point1Representation;
vtkPointHandleRepresentation3D *Point2Representation;
vtkPointHandleRepresentation3D *LineHandleRepresentation;
// Manage how the representation appears
int RepresentationState;
// the line
vtkActor *LineActor;
vtkPolyDataMapper *LineMapper;
vtkLineSource *LineSource;
// glyphs representing hot spots (e.g., handles)
vtkActor **Handle;
vtkPolyDataMapper **HandleMapper;
vtkSphereSource **HandleGeometry;
// Properties used to control the appearance of selected objects and
// the manipulator in general.
vtkProperty *EndPointProperty;
vtkProperty *SelectedEndPointProperty;
vtkProperty *EndPoint2Property;
vtkProperty *SelectedEndPoint2Property;
vtkProperty *LineProperty;
vtkProperty *SelectedLineProperty;
void CreateDefaultProperties();
// Selection tolerance for the handles and the line
int Tolerance;
// Helper members
int ClampToBounds;
void ClampPosition(double x[3]);
void HighlightPoint(int ptId, int highlight);
void HighlightLine(int highlight);
int InBounds(double x[3]);
void SizeHandles();
// Ivars used during widget interaction to hold initial positions
double StartP1[3];
double StartP2[3];
double StartLineHandle[3];
double Length;
double LastEventPosition[3];
// Support GetBounds() method
vtkBox *BoundingBox;
// Need to keep track if we have successfully initialized the display position.
// The widget tends to do stuff in world coordinates, put if the renderer has
// not been assigned, then certain operations do not properly update the display
// position.
int InitializedDisplayPosition;
// Format for the label
int DistanceAnnotationVisibility;
char *DistanceAnnotationFormat;
vtkFollower *TextActor;
vtkPolyDataMapper *TextMapper;
vtkVectorText *TextInput;
double Distance;
bool AnnotationTextScaleInitialized;
vtkCellPicker *LinePicker;
private:
vtkLineRepresentation(const vtkLineRepresentation&); //Not implemented
void operator=(const vtkLineRepresentation&); //Not implemented
};
#endif
|