VTK  9.7.1
vtkSplineRepresentation.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
19 #ifndef vtkSplineRepresentation_h
20 #define vtkSplineRepresentation_h
21 
23 #include "vtkInteractionWidgetsModule.h" // For export macro
24 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
28 
29 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkSplineRepresentation
31 {
32 public:
33  static vtkSplineRepresentation* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
41  void SetNumberOfHandles(int npts) override;
42 
46  void SetParametricSpline(vtkParametricSpline* spline) override;
47 
54  void InitializeHandles(vtkPoints* points) override;
55 
62  void BuildRepresentation() override;
63 
64 protected:
66  ~vtkSplineRepresentation() override;
67 
71  int InsertHandleOnLine(double* pos) override;
72 
76  void ClearHandles();
77 
82  void AllocateHandles(int npts);
83 
87  void CreateDefaultHandles(int npts);
88 
95  void ReconfigureHandles(int npts);
96 
97  // Specialized methods to access handles
98  vtkActor* GetHandleActor(int index) override;
99  vtkHandleSource* GetHandleSource(int index) override;
100  int GetHandleIndex(vtkProp* prop) override;
101 
102 private:
104  void operator=(const vtkSplineRepresentation&) = delete;
105 
106  void RebuildRepresentation();
107 
108  // Glyphs representing hot spots (e.g., handles)
109  std::vector<vtkSmartPointer<vtkPointHandleSource>> PointHandles;
110  std::vector<vtkSmartPointer<vtkActor>> HandleActors;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
representation for a spline.
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.
abstract representation for a spline.
virtual void SetParametricSpline(vtkParametricSpline *spline)
Set the parametric spline object.
interface that can be inherited to define handler sources for any kind of interaction.
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkHandleSource * GetHandleSource(int index)=0
parametric function for 1D interpolating splines
a simple class to control print indentation
Definition: vtkIndent.h:28
void BuildRepresentation() override=0
These are methods that satisfy vtkWidgetRepresentation API.
handle source used to represent points.
virtual vtkActor * GetHandleActor(int index)=0
virtual int InsertHandleOnLine(double *pos)=0
Returns the position of insertion or -1 on fail.
#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