VTK
vtkLineWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLineWidget.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=========================================================================*/
73#ifndef vtkLineWidget_h
74#define vtkLineWidget_h
75
76#include "vtkInteractionWidgetsModule.h" // For export macro
77#include "vtk3DWidget.h"
78#include "vtkLineSource.h" // For passing calls to it
79
80class vtkActor;
82class vtkPoints;
83class vtkPolyData;
84class vtkProp;
85class vtkProperty;
86class vtkSphereSource;
87class vtkCellPicker;
88class vtkPointWidget;
89class vtkPWCallback;
90class vtkPW1Callback;
91class vtkPW2Callback;
92
93class VTKINTERACTIONWIDGETS_EXPORT vtkLineWidget : public vtk3DWidget
94{
95public:
99 static vtkLineWidget *New();
100
102 void PrintSelf(ostream& os, vtkIndent indent);
103
105
108 virtual void SetEnabled(int);
109 virtual void PlaceWidget(double bounds[6]);
111 {this->Superclass::PlaceWidget();}
112 void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
113 double zmin, double zmax)
114 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
116
120 void SetResolution(int r)
121 { this->LineSource->SetResolution(r); }
123 { return this->LineSource->GetResolution(); }
124
128 void SetPoint1(double x, double y, double z);
129 void SetPoint1(double x[3])
130 {this->SetPoint1(x[0], x[1], x[2]); }
131 double* GetPoint1()
132 {return this->LineSource->GetPoint1();}
133 void GetPoint1(double xyz[3])
134 {this->LineSource->GetPoint1(xyz);}
135
139 void SetPoint2(double x, double y, double z);
140 void SetPoint2(double x[3])
141 {this->SetPoint2(x[0], x[1], x[2]);}
142 double* GetPoint2()
143 {return this->LineSource->GetPoint2();}
144 void GetPoint2(double xyz[3])
145 {this->LineSource->GetPoint2(xyz);}
146
148
154 vtkSetClampMacro(Align, int, XAxis, None);
155 vtkGetMacro(Align, int);
156 void SetAlignToXAxis() { this->SetAlign(XAxis); }
157 void SetAlignToYAxis() { this->SetAlign(YAxis); }
158 void SetAlignToZAxis() { this->SetAlign(ZAxis); }
159 void SetAlignToNone() { this->SetAlign(None); }
161
163
169 vtkSetMacro(ClampToBounds,int);
170 vtkGetMacro(ClampToBounds,int);
171 vtkBooleanMacro(ClampToBounds,int);
173
182
184
189 vtkGetObjectMacro(HandleProperty,vtkProperty);
190 vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
192
194
198 vtkGetObjectMacro(LineProperty,vtkProperty);
199 vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
201
202protected:
205
206 // Manage the state of the widget
207 friend class vtkPWCallback;
208
209 int State;
211 {
212 Start=0,
216 Outside
217 };
218
219 //handles the events
220 static void ProcessEvents(vtkObject* object,
221 unsigned long event,
222 void* clientdata,
223 void* calldata);
224
225 // ProcessEvents() dispatches to these methods.
232 virtual void OnMouseMove();
233
234 // controlling ivars
235 int Align;
236
241 None
242 };
243
244 // the line
248 void HighlightLine(int highlight);
249
250 // glyphs representing hot spots (e.g., handles)
254
256 virtual void SizeHandles();
257 void HandlesOn(double length);
259 int HighlightHandle(vtkProp *prop); //returns cell id
260 void HighlightHandles(int highlight);
261
262 // Do the picking
266 double LastPosition[3];
267 void SetLinePosition(double x[3]);
268
269 // Register internal Pickers within PickingManager
270 virtual void RegisterPickers();
271
272 // Methods to manipulate the hexahedron.
273 void Scale(double *p1, double *p2, int X, int Y);
274
275 // Initial bounds
277 void ClampPosition(double x[3]);
278 int InBounds(double x[3]);
279
280 // Properties used to control the appearance of selected objects and
281 // the manipulator in general.
287
289
290 // Methods for managing the point widgets used to control the endpoints
294 vtkPWCallback *PWCallback;
295 vtkPW1Callback *PW1Callback;
296 vtkPW2Callback *PW2Callback;
300 int ForwardEvent(unsigned long event);
301
302private:
303 vtkLineWidget(const vtkLineWidget&) VTK_DELETE_FUNCTION;
304 void operator=(const vtkLineWidget&) VTK_DELETE_FUNCTION;
305};
306
307#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
a simple class to control print indentation
Definition: vtkIndent.h:40
create a line defined by two end points
Definition: vtkLineSource.h:43
3D widget for manipulating a line
Definition: vtkLineWidget.h:94
vtkProperty * SelectedLineProperty
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void SetPoint2(double x[3])
vtkCellPicker * HandlePicker
vtkPointWidget * CurrentPointWidget
vtkActor * CurrentHandle
void PlaceWidget()
vtkPointWidget * PointWidget
virtual void SizeHandles()
void GetPoint1(double xyz[3])
void OnRightButtonDown()
void SetPoint1(double x, double y, double z)
Set/Get the position of first end point.
vtkPointWidget * PointWidget2
void Scale(double *p1, double *p2, int X, int Y)
void HandlesOff()
void ClampPosition(double x[3])
vtkPW1Callback * PW1Callback
vtkProperty * SelectedHandleProperty
void OnLeftButtonUp()
vtkSphereSource ** HandleGeometry
vtkProperty * LineProperty
int InBounds(double x[3])
void CreateDefaultProperties()
void EnablePointWidget()
vtkPointWidget * PointWidget1
void SetAlignToYAxis()
int ForwardEvent(unsigned long event)
void HandlesOn(double length)
vtkActor * LineActor
void GetPoint2(double xyz[3])
vtkPWCallback * PWCallback
void SetAlignToZAxis()
virtual void SetEnabled(int)
Methods that satisfy the superclass' API.
vtkPolyDataMapper * LineMapper
void SetLinePosition(double x[3])
void SetAlignToNone()
vtkPolyDataMapper ** HandleMapper
void OnMiddleButtonUp()
double * GetPoint1()
void HighlightHandles(int highlight)
void OnRightButtonUp()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetAlignToXAxis()
vtkProperty * HandleProperty
double * GetPoint2()
void GenerateLine()
int HighlightHandle(vtkProp *prop)
void OnLeftButtonDown()
virtual void PlaceWidget(double bounds[6])
This method is used to initially place the widget.
void BuildRepresentation()
void SetPoint2(double x, double y, double z)
Set position of other end point.
void DisablePointWidget()
void HighlightLine(int highlight)
vtkLineSource * LineSource
vtkPW2Callback * PW2Callback
vtkActor ** Handle
void OnMiddleButtonDown()
vtkCellPicker * LinePicker
virtual void OnMouseMove()
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the line.
void SetResolution(int r)
Set/Get the resolution (number of subdivisions) of the line.
void SetPoint1(double x[3])
static vtkLineWidget * New()
Instantiate the object.
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
abstract base class for most VTK objects
Definition: vtkObject.h:60
position a point in 3D space
represent and manipulate 3D points
Definition: vtkPoints.h:40
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
@ length
Definition: vtkX3D.h:393
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.