VTK  9.1.20211115
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 =========================================================================*/
29 #ifndef vtkPolyLineRepresentation_h
30 #define vtkPolyLineRepresentation_h
31 
32 #include "vtkCurveRepresentation.h"
33 #include "vtkInteractionWidgetsModule.h" // For export macro
34 
35 class vtkPolyLineSource;
37 
38 class VTKINTERACTIONWIDGETS_EXPORT vtkPolyLineRepresentation : public vtkCurveRepresentation
39 {
40 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
53  void GetPolyData(vtkPolyData* pd) override;
54 
58  void SetNumberOfHandles(int npts) override;
59 
64 
69  double GetSummedLength() override;
70 
78 
82  void BuildRepresentation() override;
83 
84 protected:
87 
88  // The poly line source
90 
94  int InsertHandleOnLine(double* pos) override;
95 
99  void ClearHandles();
100 
105  void AllocateHandles(int npts);
106 
110  void CreateDefaultHandles(int npts);
111 
118  void ReconfigureHandles(int npts);
119 
120  // Specialized methods to access handles
121  vtkActor* GetHandleActor(int index) override;
123  virtual int GetHandleIndex(vtkProp* prop) override;
124 
125 private:
127  void operator=(const vtkPolyLineRepresentation&) = delete;
128 
129  // Glyphs representing hot spots (e.g., handles)
130  std::vector<vtkSmartPointer<vtkPointHandleSource>> PointHandles;
131  std::vector<vtkSmartPointer<vtkActor>> HandleActors;
132 };
133 
134 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkWidgetRepresentation base class for a widget that represents an 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:113
handle source used to represent points.
represent and manipulate 3D points
Definition: vtkPoints.h:143
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:194
vtkWidgetRepresentation for a poly line.
vtkHandleSource * GetHandleSource(int index) override
virtual int GetHandleIndex(vtkProp *prop) override
returns handle index or -1 on fail
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.
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:76
@ points
Definition: vtkX3D.h:452
@ index
Definition: vtkX3D.h:252