VTK
vtkBrokenLineWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBrokenLineWidget.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=========================================================================*/
85#ifndef vtkBrokenLineWidget_h
86#define vtkBrokenLineWidget_h
87
88#include "vtkInteractionWidgetsModule.h" // For export macro
89#include "vtk3DWidget.h"
90
91class vtkActor;
92class vtkCellPicker;
93class vtkLineSource;
94class vtkPlaneSource;
95class vtkPoints;
96class vtkPolyData;
98class vtkProp;
99class vtkProperty;
100class vtkSphereSource;
101class vtkTransform;
102
103#define VTK_PROJECTION_YZ 0
104#define VTK_PROJECTION_XZ 1
105#define VTK_PROJECTION_XY 2
106#define VTK_PROJECTION_OBLIQUE 3
107
108class VTKINTERACTIONWIDGETS_EXPORT vtkBrokenLineWidget : public vtk3DWidget
109{
110public:
115
117 void PrintSelf(ostream& os, vtkIndent indent);
118
120
123 virtual void SetEnabled(int);
124 virtual void PlaceWidget(double bounds[6]);
126 {this->Superclass::PlaceWidget();}
127 void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
128 double zmin, double zmax)
129 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
131
133
141 vtkSetMacro(ProjectToPlane,int);
142 vtkGetMacro(ProjectToPlane,int);
143 vtkBooleanMacro(ProjectToPlane,int);
145
151
152 vtkSetClampMacro(ProjectionNormal,int,VTK_PROJECTION_YZ,VTK_PROJECTION_OBLIQUE);
153 vtkGetMacro(ProjectionNormal,int);
155 { this->SetProjectionNormal(0); }
157 { this->SetProjectionNormal(1); }
159 { this->SetProjectionNormal(2); }
161 { this->SetProjectionNormal(3); }
162
164
172 vtkGetMacro(ProjectionPosition, double);
174
183
185
190 vtkGetObjectMacro(HandleProperty, vtkProperty);
192 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
194
196
201 vtkGetObjectMacro(LineProperty, vtkProperty);
203 vtkGetObjectMacro(SelectedLineProperty, vtkProperty);
205
207
210 virtual void SetNumberOfHandles(int npts);
211 vtkGetMacro(NumberOfHandles, int);
213
215
219 void SetHandlePosition(int handle, double x, double y, double z);
220 void SetHandlePosition(int handle, double xyz[3]);
221 void GetHandlePosition(int handle, double xyz[3]);
222 double* GetHandlePosition(int handle);
224
229
235
237
241 vtkSetClampMacro(ProcessEvents, int, 0, 1);
242 vtkGetMacro(ProcessEvents, int);
243 vtkBooleanMacro( ProcessEvents, int );
245
247
251 vtkSetClampMacro(HandleSizeFactor, double, 0., 100.);
252 vtkGetMacro(HandleSizeFactor, double);
254
255protected:
258
259 // Manage the state of the widget
260 int State;
262 {
263 Start=0,
269 Outside
270 };
271
272 //handles the events
273 static void ProcessEventsHandler(vtkObject* object,
274 unsigned long event,
275 void* clientdata,
276 void* calldata);
277
278 // ProcessEventsHandler() dispatches to these methods.
286
287 // Controlling vars
292
293 // Projection capabilities
297
298 // The broken line
302 void HighlightLine(int highlight);
305
306 // Glyphs representing hot spots (e.g., handles)
310 int HighlightHandle(vtkProp *prop); //returns handle index or -1 on fail
311 virtual void SizeHandles();
312 void InsertHandleOnLine(double* pos);
313 void EraseHandle(const int&);
314
315 // Do the picking
320
321 // Register internal Pickers within PickingManager
322 virtual void RegisterPickers();
323
324 // Methods to manipulate the broken line.
325 void MovePoint(double *p1, double *p2);
326 void Scale(double *p1, double *p2, int X, int Y);
327 void Translate(double *p1, double *p2);
328 void Spin(double *p1, double *p2, double *vpn);
329
330 // Transform the control points (used for spinning)
332
333 // Properties used to control the appearance of selected objects and
334 // the manipulator in general.
340
341 // For efficient spinning
342 double Centroid[3];
345
346 // Handle sizing factor
348
349private:
350 vtkBrokenLineWidget(const vtkBrokenLineWidget&) VTK_DELETE_FUNCTION;
351 void operator=(const vtkBrokenLineWidget&) VTK_DELETE_FUNCTION;
352};
353
354#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
3D widget for manipulating a broken line
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
double GetSummedLength()
Get the summed lengths of the individual straight line segments.
void EraseHandle(const int &)
void InsertHandleOnLine(double *pos)
int HighlightHandle(vtkProp *prop)
double * GetHandlePosition(int handle)
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
vtkProperty * SelectedLineProperty
vtkProperty * HandleProperty
static void ProcessEventsHandler(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkPolyDataMapper * LineMapper
vtkSphereSource ** HandleGeometry
virtual void SetSelectedLineProperty(vtkProperty *)
virtual void SetHandleProperty(vtkProperty *)
Set/Get the handle properties (the spheres are the handles).
void SetHandlePosition(int handle, double x, double y, double z)
Set/Get the position of the broken line handles.
void InitializeHandles(vtkPoints *points)
Convenience method to allocate and set the handles from a vtkPoints instance.
vtkPlaneSource * PlaneSource
void ProjectPointsToObliquePlane()
void SetPlaneSource(vtkPlaneSource *plane)
Set up a reference to a vtkPlaneSource that could be from another widget object, e....
void SetProjectionPosition(double position)
Set the position of broken line handles and points in terms of a plane's position.
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the broken line.
void GetHandlePosition(int handle, double xyz[3])
virtual void SetSelectedHandleProperty(vtkProperty *)
void Spin(double *p1, double *p2, double *vpn)
static vtkBrokenLineWidget * New()
Instantiate the object.
void Translate(double *p1, double *p2)
vtkLineSource * LineSource
void CreateDefaultProperties()
void SetHandlePosition(int handle, double xyz[3])
void HighlightLine(int highlight)
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
virtual void SetNumberOfHandles(int npts)
Set/Get the number of handles for this widget.
void Scale(double *p1, double *p2, int X, int Y)
void ProjectPointsToOrthoPlane()
virtual void SizeHandles()
vtkCellPicker * HandlePicker
virtual void SetLineProperty(vtkProperty *)
Set/Get the line properties.
void MovePoint(double *p1, double *p2)
vtkCellPicker * LinePicker
virtual void SetEnabled(int)
Methods that satisfy the superclass' API.
virtual void PlaceWidget(double bounds[6])
This method is used to initially place the widget.
vtkProperty * SelectedHandleProperty
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
abstract base class for most VTK objects
Definition: vtkObject.h:60
create an array of quadrilaterals located in a plane
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
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
@ points
Definition: vtkX3D.h:446
@ position
Definition: vtkX3D.h:261
#define VTK_PROJECTION_YZ
#define VTK_PROJECTION_OBLIQUE
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.