VTK  9.3.20231205
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 
64 VTK_ABI_NAMESPACE_BEGIN
65 class vtkHandleList;
67 
68 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
69 {
70 public:
75 
77 
81  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
85 
91  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
92  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
93  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
94  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
96 
101 
111 
118 
120 
123  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; }
125 
127 
132  vtkSetClampMacro(Tolerance, int, 1, 100);
133  vtkGetMacro(Tolerance, int);
135 
136  // Used to communicate about the state of the representation
137  enum
138  {
139  Outside = 0,
140  NearSeed
141  };
142 
144 
148  virtual int GetActiveHandle();
149  virtual void SetActiveHandle(int handleId);
150  // Returns the id of the seed created, -1 on failure. e is the display position.
151  virtual int CreateHandle(double e[2]);
152  // Delete last handle created
153  virtual void RemoveLastHandle();
154  // Delete the currently active handle
155  virtual void RemoveActiveHandle();
157 
161  virtual void RemoveHandle(int n);
162 
164 
167  void BuildRepresentation() override;
168  int ComputeInteractionState(int X, int Y, int modify = 0) override;
169  void GetActors(vtkPropCollection*) override;
171 
172 protected:
175 
176  // The handle and the rep used to close the handles
178  vtkHandleList* Handles;
179 
180  // Selection tolerance for the handles
182 
183  // The active seed (handle) based on the last ComputeInteractionState()
185 
186 private:
188  void operator=(const vtkSeedRepresentation&) = delete;
189 };
190 
191 VTK_ABI_NAMESPACE_END
192 #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