VTK  9.7.1
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 
23 #include "vtkCurveRepresentation.h"
24 #include "vtkInteractionWidgetsModule.h" // For export macro
25 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkPolyLineSource;
30 
31 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkPolyLineRepresentation
32  : public vtkCurveRepresentation
33 {
34 public:
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 
78 protected:
80  ~vtkPolyLineRepresentation() override;
81 
82  // The poly line source
84 
88  int InsertHandleOnLine(double* pos) override;
89 
93  void ClearHandles();
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 
119 private:
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 
128 VTK_ABI_NAMESPACE_END
129 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
base class for a widget that represents a curve that connects control points.
virtual void GetPolyData(vtkPolyData *pd)=0
Grab the polydata (including points) that defines the interpolating curve.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
virtual void InitializeHandles(vtkPoints *points)=0
Convenience method to allocate and set the handles from a vtkPoints instance.
virtual double GetSummedLength()=0
Get the approximate vs.
interface that can be inherited to define handler sources for any kind of interaction.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkWidgetRepresentation for a poly line.
virtual int GetHandleIndex(vtkProp *prop)=0
returns handle index or -1 on fail
virtual void SetNumberOfHandles(int npts)=0
Set/Get the number of handles for this widget.
dynamic, self-adjusting array of double
virtual vtkHandleSource * GetHandleSource(int index)=0
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void BuildRepresentation() override=0
These are methods that satisfy vtkWidgetRepresentation API.
handle source used to represent points.
virtual vtkDoubleArray * GetHandlePositions()=0
Set/Get the position of the handles.
virtual vtkActor * GetHandleActor(int index)=0
virtual int InsertHandleOnLine(double *pos)=0
Returns the position of insertion or -1 on fail.
vtkNew< vtkPolyLineSource > PolyLineSource
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:30
create a poly line from a list of input points