VTK  9.3.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 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkPolyLineSource;
29 
30 class VTKINTERACTIONWIDGETS_EXPORT vtkPolyLineRepresentation : public vtkCurveRepresentation
31 {
32 public:
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 
76 protected:
78  ~vtkPolyLineRepresentation() override;
79 
80  // The poly line source
82 
86  int InsertHandleOnLine(double* pos) override;
87 
91  void ClearHandles();
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 
117 private:
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 
126 VTK_ABI_NAMESPACE_END
127 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
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:40
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:79
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
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:28
create a poly line from a list of input points