VTK  9.3.0
vtkPolyLineRepresentation.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
20#ifndef vtkPolyLineRepresentation_h
21#define vtkPolyLineRepresentation_h
22
24#include "vtkInteractionWidgetsModule.h" // For export macro
25
26VTK_ABI_NAMESPACE_BEGIN
29
30class VTKINTERACTIONWIDGETS_EXPORT vtkPolyLineRepresentation : public vtkCurveRepresentation
31{
32public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
45 void GetPolyData(vtkPolyData* pd) override;
46
50 void SetNumberOfHandles(int npts) override;
51
56
61 double GetSummedLength() override;
62
69 void InitializeHandles(vtkPoints* points) override;
70
74 void BuildRepresentation() override;
75
76protected:
79
80 // The poly line source
82
86 int InsertHandleOnLine(double* pos) override;
87
92
97 void AllocateHandles(int npts);
98
102 void CreateDefaultHandles(int npts);
103
110 void ReconfigureHandles(int npts);
111
112 // Specialized methods to access handles
113 vtkActor* GetHandleActor(int index) override;
114 vtkHandleSource* GetHandleSource(int index) override;
115 int GetHandleIndex(vtkProp* prop) override;
116
117private:
119 void operator=(const vtkPolyLineRepresentation&) = delete;
120
121 // Glyphs representing hot spots (e.g., handles)
122 std::vector<vtkSmartPointer<vtkPointHandleSource>> PointHandles;
123 std::vector<vtkSmartPointer<vtkActor>> HandleActors;
124};
125
126VTK_ABI_NAMESPACE_END
127#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
base class for a widget that represents a curve that connects control points.
dynamic, self-adjusting array of double
interface that can be inherited to define handler sources for any kind of interaction.
a simple class to control print indentation
Definition vtkIndent.h:29
Allocate and hold a VTK object.
Definition vtkNew.h:51
handle source used to represent points.
represent and manipulate 3D points
Definition vtkPoints.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
vtkWidgetRepresentation for a poly line.
vtkHandleSource * GetHandleSource(int index) override
void BuildRepresentation() override
Build the representation for the poly line.
void GetPolyData(vtkPolyData *pd) override
Grab the polydata (including points) that defines the poly line.
static vtkPolyLineRepresentation * New()
void SetNumberOfHandles(int npts) override
Set the number of handles for this widget.
void AllocateHandles(int npts)
Allocate/Reallocate the handles according to npts.
void CreateDefaultHandles(int npts)
Create npts default handles.
double GetSummedLength() override
Get the true length of the poly line.
vtkNew< vtkPolyLineSource > PolyLineSource
vtkDoubleArray * GetHandlePositions() override
Get the positions of the handles.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ReconfigureHandles(int npts)
Recreate the handles according to a number of points equal to npts.
~vtkPolyLineRepresentation() override
void InitializeHandles(vtkPoints *points) override
Convenience method to allocate and set the handles from a vtkPoints instance.
int GetHandleIndex(vtkProp *prop) override
returns handle index or -1 on fail
vtkActor * GetHandleActor(int index) override
void ClearHandles()
Delete all the handles.
int InsertHandleOnLine(double *pos) override
Specialized method to insert a handle on the poly line.
create a poly line from a list of input points
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43