VTK  9.4.20250102
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26
27VTK_ABI_NAMESPACE_BEGIN
30
31class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkPolyLineRepresentation
33{
34public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
47 void GetPolyData(vtkPolyData* pd) override;
48
52 void SetNumberOfHandles(int npts) override;
53
58
63 double GetSummedLength() override;
64
71 void InitializeHandles(vtkPoints* points) override;
72
76 void BuildRepresentation() override;
77
78protected:
81
82 // The poly line source
84
88 int InsertHandleOnLine(double* pos) override;
89
94
99 void AllocateHandles(int npts);
100
104 void CreateDefaultHandles(int npts);
105
112 void ReconfigureHandles(int npts);
113
114 // Specialized methods to access handles
115 vtkActor* GetHandleActor(int index) override;
116 vtkHandleSource* GetHandleSource(int index) override;
117 int GetHandleIndex(vtkProp* prop) override;
118
119private:
121 void operator=(const vtkPolyLineRepresentation&) = delete;
122
123 // Glyphs representing hot spots (e.g., handles)
124 std::vector<vtkSmartPointer<vtkPointHandleSource>> PointHandles;
125 std::vector<vtkSmartPointer<vtkActor>> HandleActors;
126};
127
128VTK_ABI_NAMESPACE_END
129#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
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:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
handle source used to represent points.
represent and manipulate 3D points
Definition vtkPoints.h:139
concrete dataset represents vertices, lines, polygons, and triangle strips
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:66
#define VTK_MARSHALAUTO