VTK
vtkSplineWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSplineWidget.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=========================================================================*/
87#ifndef vtkSplineWidget_h
88#define vtkSplineWidget_h
89
90#include "vtkInteractionWidgetsModule.h" // For export macro
91#include "vtk3DWidget.h"
92
93class vtkActor;
94class vtkCellPicker;
97class vtkPlaneSource;
98class vtkPoints;
99class vtkPolyData;
100class vtkProp;
101class vtkProperty;
102class vtkSphereSource;
103class vtkTransform;
104
105#define VTK_PROJECTION_YZ 0
106#define VTK_PROJECTION_XZ 1
107#define VTK_PROJECTION_XY 2
108#define VTK_PROJECTION_OBLIQUE 3
109
110class VTKINTERACTIONWIDGETS_EXPORT vtkSplineWidget : public vtk3DWidget
111{
112public:
117
119 void PrintSelf(ostream& os, vtkIndent indent);
120
122
125 virtual void SetEnabled(int);
126 virtual void PlaceWidget(double bounds[6]);
128 {this->Superclass::PlaceWidget();}
129 void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
130 double zmin, double zmax)
131 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
133
135
143 vtkSetMacro(ProjectToPlane,int);
144 vtkGetMacro(ProjectToPlane,int);
145 vtkBooleanMacro(ProjectToPlane,int);
147
153
154 vtkSetClampMacro(ProjectionNormal,int,VTK_PROJECTION_YZ,VTK_PROJECTION_OBLIQUE);
155 vtkGetMacro(ProjectionNormal,int);
157 { this->SetProjectionNormal(0); }
159 { this->SetProjectionNormal(1); }
161 { this->SetProjectionNormal(2); }
163 { this->SetProjectionNormal(3); }
164
166
174 vtkGetMacro(ProjectionPosition, double);
176
185
187
192 vtkGetObjectMacro(HandleProperty, vtkProperty);
194 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
196
198
203 vtkGetObjectMacro(LineProperty, vtkProperty);
205 vtkGetObjectMacro(SelectedLineProperty, vtkProperty);
207
209
212 virtual void SetNumberOfHandles(int npts);
213 vtkGetMacro(NumberOfHandles, int);
215
217
222 vtkGetMacro(Resolution,int);
224
226
235 vtkGetObjectMacro(ParametricSpline,vtkParametricSpline);
237
239
243 void SetHandlePosition(int handle, double x, double y, double z);
244 void SetHandlePosition(int handle, double xyz[3]);
245 void GetHandlePosition(int handle, double xyz[3]);
246 double* GetHandlePosition(int handle);
248
250
257 void SetClosed(int closed);
258 vtkGetMacro(Closed,int);
259 vtkBooleanMacro(Closed,int);
261
267 int IsClosed();
268
275
283
285
289 vtkSetClampMacro(ProcessEvents, int, 0, 1);
290 vtkGetMacro(ProcessEvents, int);
291 vtkBooleanMacro( ProcessEvents, int );
293
294protected:
297
298 // Manage the state of the widget
299 int State;
301 {
302 Start=0,
308 Outside
309 };
310
311 //handles the events
312 static void ProcessEventsHandler(vtkObject* object,
313 unsigned long event,
314 void* clientdata,
315 void* calldata);
316
317 // ProcessEventsHandler() dispatches to these methods.
325
326 // Controlling vars
331
332 // Projection capabilities
336
337 // The spline
343
344 // The line segments
346 void HighlightLine(int highlight);
348
349 // Glyphs representing hot spots (e.g., handles)
353 int HighlightHandle(vtkProp *prop); //returns handle index or -1 on fail
354 virtual void SizeHandles();
355 void InsertHandleOnLine(double* pos);
356 void EraseHandle(const int&);
357
358 // Do the picking
363
364 // Register internal Pickers within PickingManager
365 virtual void RegisterPickers();
366
367 // Methods to manipulate the spline.
368 void MovePoint(double *p1, double *p2);
369 void Scale(double *p1, double *p2, int X, int Y);
370 void Translate(double *p1, double *p2);
371 void Spin(double *p1, double *p2, double *vpn);
372
373 // Transform the control points (used for spinning)
375
376 // Properties used to control the appearance of selected objects and
377 // the manipulator in general.
383
384 // For efficient spinning
385 double Centroid[3];
388
389private:
390 vtkSplineWidget(const vtkSplineWidget&) VTK_DELETE_FUNCTION;
391 void operator=(const vtkSplineWidget&) VTK_DELETE_FUNCTION;
392};
393
394#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
abstract base class for most VTK objects
Definition: vtkObject.h:60
tessellate parametric functions
parametric function for 1D interpolating splines
create an array of quadrilaterals located in a plane
represent and manipulate 3D points
Definition: vtkPoints.h:40
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
3D widget for manipulating a spline
virtual void SetEnabled(int)
Methods that satisfy the superclass' API.
vtkProperty * LineProperty
vtkActor ** Handle
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
void EraseHandle(const int &)
vtkProperty * HandleProperty
void GetHandlePosition(int handle, double xyz[3])
void SetClosed(int closed)
Control whether the spline is open or closed.
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the position of the spline handles.
void SetProjectionNormalToZAxes()
virtual void SizeHandles()
void OnRightButtonDown()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkProperty * SelectedHandleProperty
vtkSphereSource ** HandleGeometry
void Spin(double *p1, double *p2, double *vpn)
void SetProjectionPosition(double position)
Set the position of spline handles and points in terms of a plane's position.
void OnRightButtonUp()
virtual void SetNumberOfHandles(int npts)
Set/Get the number of handles for this widget.
int HighlightHandle(vtkProp *prop)
virtual void SetSelectedLineProperty(vtkProperty *)
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the spline.
void CreateDefaultProperties()
void CalculateCentroid()
void SetResolution(int resolution)
Set/Get the number of line segments representing the spline for this widget.
vtkActor * CurrentHandle
void SetHandlePosition(int handle, double xyz[3])
void MovePoint(double *p1, double *p2)
void Scale(double *p1, double *p2, int X, int Y)
void OnLeftButtonUp()
void InsertHandleOnLine(double *pos)
vtkParametricSpline * ParametricSpline
double GetSummedLength()
Get the approximate vs.
virtual void PlaceWidget(double bounds[6])
This method is used to initially place the widget.
void SetProjectionNormalToXAxes()
void InitializeHandles(vtkPoints *points)
Convenience method to allocate and set the handles from a vtkPoints instance.
vtkCellPicker * LinePicker
vtkProperty * SelectedLineProperty
void ProjectPointsToOrthoPlane()
void SetProjectionNormalToYAxes()
vtkPlaneSource * PlaneSource
virtual void SetParametricSpline(vtkParametricSpline *)
Set the parametric spline object.
vtkParametricFunctionSource * ParametricFunctionSource
vtkTransform * Transform
virtual void SetLineProperty(vtkProperty *)
Set/Get the line properties.
virtual void SetHandleProperty(vtkProperty *)
Set/Get the handle properties (the spheres are the handles).
void BuildRepresentation()
void SetProjectionNormalToOblique()
static void ProcessEventsHandler(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void ProjectPointsToObliquePlane()
static vtkSplineWidget * New()
Instantiate the object.
void Translate(double *p1, double *p2)
void OnLeftButtonDown()
void ProjectPointsToPlane()
void OnMiddleButtonUp()
void OnMiddleButtonDown()
void HighlightLine(int highlight)
double * GetHandlePosition(int handle)
vtkCellPicker * HandlePicker
virtual void SetSelectedHandleProperty(vtkProperty *)
void SetPlaneSource(vtkPlaneSource *plane)
Set up a reference to a vtkPlaneSource that could be from another widget object, e....
int IsClosed()
Convenience method to determine whether the spline is closed in a geometric sense.
vtkActor * LineActor
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
@ resolution
Definition: vtkX3D.h:466
@ points
Definition: vtkX3D.h:446
@ position
Definition: vtkX3D.h:261
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_PROJECTION_YZ
#define VTK_PROJECTION_OBLIQUE