VTK  9.2.6
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=========================================================================*/
84
85#ifndef vtkBrokenLineWidget_h
86#define vtkBrokenLineWidget_h
87
88#include "vtk3DWidget.h"
89#include "vtkInteractionWidgetsModule.h" // For export macro
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) override;
118
120
123 void SetEnabled(int) override;
124 void PlaceWidget(double bounds[6]) override;
125 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
127 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
128 {
129 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
130 }
131
132
134
144 vtkBooleanMacro(ProjectToPlane, vtkTypeBool);
146
152
154 vtkGetMacro(ProjectionNormal, int);
159
161
168 void SetProjectionPosition(double position);
169 vtkGetMacro(ProjectionPosition, double);
171
180
182
187 vtkGetObjectMacro(HandleProperty, vtkProperty);
191
193
198 vtkGetObjectMacro(LineProperty, vtkProperty);
202
204
207 virtual void SetNumberOfHandles(int npts);
208 vtkGetMacro(NumberOfHandles, int);
210
212
216 void SetHandlePosition(int handle, double x, double y, double z);
217 void SetHandlePosition(int handle, double xyz[3]);
218 void GetHandlePosition(int handle, double xyz[3]);
219 double* GetHandlePosition(int handle);
221
226
232
234
238 vtkSetClampMacro(ProcessEvents, vtkTypeBool, 0, 1);
240 vtkBooleanMacro(ProcessEvents, vtkTypeBool);
242
244
248 vtkSetClampMacro(HandleSizeFactor, double, 0., 100.);
249 vtkGetMacro(HandleSizeFactor, double);
251
252protected:
255
256 // Manage the state of the widget
257 int State;
268
269 // handles the events
271 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
272
273 // ProcessEventsHandler() dispatches to these methods.
281
282 // Controlling vars
287
288 // Projection capabilities
292
293 // The broken line
297 void HighlightLine(int highlight);
300
301 // Glyphs representing hot spots (e.g., handles)
305 int HighlightHandle(vtkProp* prop); // returns handle index or -1 on fail
306 void SizeHandles() override;
307 void InsertHandleOnLine(double* pos);
308 void EraseHandle(const int&);
309
310 // Do the picking
315
316 // Register internal Pickers within PickingManager
317 void RegisterPickers() override;
318
319 // Methods to manipulate the broken line.
320 void MovePoint(double* p1, double* p2);
321 void Scale(double* p1, double* p2, int X, int Y);
322 void Translate(double* p1, double* p2);
323 void Spin(double* p1, double* p2, double* vpn);
324
325 // Transform the control points (used for spinning)
327
328 // Properties used to control the appearance of selected objects and
329 // the manipulator in general.
335
336 // For efficient spinning
337 double Centroid[3];
340
341 // Handle sizing factor
343
344private:
346 void operator=(const vtkBrokenLineWidget&) = delete;
347};
348
349#endif
virtual void PlaceWidget(double bounds[6])=0
This method is used to initially place the widget.
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:46
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)
Set/Get the position of the broken line handles.
vtkProperty * SelectedLineProperty
virtual void SetProjectionNormal(int)
static void ProcessEventsHandler(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkPolyDataMapper * LineMapper
vtkSphereSource ** HandleGeometry
virtual void SetSelectedLineProperty(vtkProperty *)
Set/Get the line properties.
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()
~vtkBrokenLineWidget() override
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])
Set/Get the position of the broken line handles.
virtual void SetSelectedHandleProperty(vtkProperty *)
Set/Get the handle properties (the spheres are the handles).
void Spin(double *p1, double *p2, double *vpn)
static vtkBrokenLineWidget * New()
Instantiate the object.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetEnabled(int) override
Methods that satisfy the superclass' API.
void Translate(double *p1, double *p2)
void CreateDefaultProperties()
void SetHandlePosition(int handle, double xyz[3])
Set/Get the position of the broken line handles.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void HighlightLine(int highlight)
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
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()
void PlaceWidget() override
Methods that satisfy the superclass' API.
vtkCellPicker * HandlePicker
virtual void SetLineProperty(vtkProperty *)
Set/Get the line properties.
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
void MovePoint(double *p1, double *p2)
void SizeHandles() override
vtkProperty * SelectedHandleProperty
ray-cast cell picker for all kinds of Prop3Ds
a simple class to control print indentation
Definition vtkIndent.h:34
create a line defined by two end points
create an array of quadrilaterals located in a plane
represent and manipulate 3D points
Definition vtkPoints.h:34
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
represent surface properties of a geometric object
Definition vtkProperty.h:62
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_PROJECTION_YZ
#define VTK_PROJECTION_OBLIQUE