VTK  9.2.6
vtkPolyLineRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPolyLineRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
32 #ifndef vtkPolyLineRepresentation_h
33 #define vtkPolyLineRepresentation_h
34 
35 #include "vtkCurveRepresentation.h"
36 #include "vtkInteractionWidgetsModule.h" // For export macro
37 
38 class vtkPolyLineSource;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkPolyLineRepresentation : public vtkCurveRepresentation
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
56  void GetPolyData(vtkPolyData* pd) override;
57 
61  void SetNumberOfHandles(int npts) override;
62 
67 
72  double GetSummedLength() override;
73 
80  void InitializeHandles(vtkPoints* points) override;
81 
85  void BuildRepresentation() override;
86 
87 protected:
89  ~vtkPolyLineRepresentation() override;
90 
91  // The poly line source
93 
97  int InsertHandleOnLine(double* pos) override;
98 
102  void ClearHandles();
103 
108  void AllocateHandles(int npts);
109 
113  void CreateDefaultHandles(int npts);
114 
121  void ReconfigureHandles(int npts);
122 
123  // Specialized methods to access handles
124  vtkActor* GetHandleActor(int index) override;
125  vtkHandleSource* GetHandleSource(int index) override;
126  virtual int GetHandleIndex(vtkProp* prop) override;
127 
128 private:
130  void operator=(const vtkPolyLineRepresentation&) = delete;
131 
132  // Glyphs representing hot spots (e.g., handles)
133  std::vector<vtkSmartPointer<vtkPointHandleSource>> PointHandles;
134  std::vector<vtkSmartPointer<vtkActor>> HandleActors;
135 };
136 
137 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkWidgetRepresentation base class for a widget that represents an 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:51
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:90
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:39
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:39
create a poly line from a list of input points