VTK  9.3.20240329
vtkSeedRepresentation.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
58 #ifndef vtkSeedRepresentation_h
59 #define vtkSeedRepresentation_h
60 
61 #include "vtkInteractionWidgetsModule.h" // For export macro
63 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
64 
65 VTK_ABI_NAMESPACE_BEGIN
66 class vtkHandleList;
68 
69 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkSeedRepresentation
71 {
72 public:
77 
79 
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
93  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
94  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
95  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
96  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
98 
103 
113 
120 
122 
125  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; }
127 
129 
134  vtkSetClampMacro(Tolerance, int, 1, 100);
135  vtkGetMacro(Tolerance, int);
137 
138  // Used to communicate about the state of the representation
139  enum
140  {
141  Outside = 0,
142  NearSeed
143  };
144 
146 
150  virtual int GetActiveHandle();
151  virtual void SetActiveHandle(int handleId);
152  // Returns the id of the seed created, -1 on failure. e is the display position.
153  virtual int CreateHandle(double e[2]);
154  // Delete last handle created
155  virtual void RemoveLastHandle();
156  // Delete the currently active handle
157  virtual void RemoveActiveHandle();
159 
163  virtual void RemoveHandle(int n);
164 
166 
169  void BuildRepresentation() override;
170  int ComputeInteractionState(int X, int Y, int modify = 0) override;
171  void GetActors(vtkPropCollection*) override;
173 
174 protected:
177 
178  // The handle and the rep used to close the handles
180  vtkHandleList* Handles;
181 
182  // Selection tolerance for the handles
184 
185  // The active seed (handle) based on the last ComputeInteractionState()
187 
188 private:
190  void operator=(const vtkSeedRepresentation&) = delete;
191 };
192 
193 VTK_ABI_NAMESPACE_END
194 #endif
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:108
an ordered list of Props
represent the vtkSeedWidget
virtual int CreateHandle(double e[2])
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
int GetNumberOfSeeds()
Return the number of seeds (or handles) that have been created.
~vtkSeedRepresentation() override
virtual void SetActiveHandle(int handleId)
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
virtual int GetActiveHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkHandleRepresentation * HandleRepresentation
virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
static vtkSeedRepresentation * New()
Instantiate class.
vtkHandleRepresentation * GetHandleRepresentation(unsigned int num)
Get the handle representations used for a particular seed.
virtual void RemoveLastHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
virtual void RemoveHandle(int n)
Remove the nth handle.
void SetHandleRepresentation(vtkHandleRepresentation *handle)
This method is used to specify the type of handle representation to use for the internal vtkHandleWid...
void GetActors(vtkPropCollection *) override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void RemoveActiveHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
vtkHandleRepresentation * GetHandleRepresentation()
Returns the model HandleRepresentation.
abstract class defines interface between the widget and widget representation classes
#define VTK_MARSHALAUTO