VTK  9.7.1
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
19 #ifndef vtkSeedRepresentation_h
20 #define vtkSeedRepresentation_h
21 
22 #include "vtkInteractionWidgetsModule.h" // For export macro
24 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkHandleList;
29 
30 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkSeedRepresentation
32 {
33 public:
37  static vtkSeedRepresentation* New();
38 
40 
44  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
54  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
55  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
56  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
57  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
59 
63  int GetNumberOfSeeds();
64 
73  void SetHandleRepresentation(vtkHandleRepresentation* handle);
74 
80  vtkHandleRepresentation* GetHandleRepresentation(unsigned int num);
81 
83 
86  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; }
88 
90 
95  vtkSetClampMacro(Tolerance, int, 1, 100);
96  vtkGetMacro(Tolerance, int);
98 
99  // Used to communicate about the state of the representation
100  enum
101  {
102  Outside = 0,
103  NearSeed
104  };
105 
107 
111  virtual int GetActiveHandle();
112  virtual void SetActiveHandle(int handleId);
113  // Returns the id of the seed created, -1 on failure. e is the display position.
114  virtual int CreateHandle(double e[2]);
115  // Delete last handle created
116  virtual void RemoveLastHandle();
117  // Delete the currently active handle
118  virtual void RemoveActiveHandle();
120 
124  virtual void RemoveHandle(int n);
125 
127 
130  void BuildRepresentation() override;
131  int ComputeInteractionState(int X, int Y, int modify = 0) override;
132  void GetActors(vtkPropCollection*) override;
134 
135 protected:
137  ~vtkSeedRepresentation() override;
138 
139  // The handle and the rep used to close the handles
141  vtkHandleList* Handles;
142 
143  // Selection tolerance for the handles
145 
146  // The active seed (handle) based on the last ComputeInteractionState()
148 
149 private:
151  void operator=(const vtkSeedRepresentation&) = delete;
152 };
153 
154 VTK_ABI_NAMESPACE_END
155 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
an ordered list of Props
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkHandleRepresentation * GetHandleRepresentation()
Returns the model HandleRepresentation.
#define VTK_MARSHALAUTO
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkHandleRepresentation * HandleRepresentation
represent the vtkSeedWidget