VTK  9.3.20240327
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 
70 
74  void BuildRepresentation() override;
75 
76 protected:
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;
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
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
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
handle source used to represent points.
represent and manipulate 3D points
Definition: vtkPoints.h:138
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
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.
vtkActor * GetHandleActor(int index) override
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
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.
vtkDoubleArray * GetHandlePositions() override
Get the positions of the handles.
int GetHandleIndex(vtkProp *prop) override
returns handle index or -1 on fail
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:65
@ points
Definition: vtkX3D.h:446
@ index
Definition: vtkX3D.h:246