VTK  9.3.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 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkHandleList;
28 
29 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
30 {
31 public:
35  static vtkSeedRepresentation* New();
36 
38 
42  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
52  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
53  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
54  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
55  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
57 
61  int GetNumberOfSeeds();
62 
71  void SetHandleRepresentation(vtkHandleRepresentation* handle);
72 
78  vtkHandleRepresentation* GetHandleRepresentation(unsigned int num);
79 
81 
84  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; };
86 
88 
93  vtkSetClampMacro(Tolerance, int, 1, 100);
94  vtkGetMacro(Tolerance, int);
96 
97  // Used to communicate about the state of the representation
98  enum
99  {
100  Outside = 0,
101  NearSeed
102  };
103 
105 
109  virtual int GetActiveHandle();
110  virtual void SetActiveHandle(int handleId);
111  // Returns the id of the seed created, -1 on failure. e is the display position.
112  virtual int CreateHandle(double e[2]);
113  // Delete last handle created
114  virtual void RemoveLastHandle();
115  // Delete the currently active handle
116  virtual void RemoveActiveHandle();
118 
122  virtual void RemoveHandle(int n);
123 
125 
128  void BuildRepresentation() override;
129  int ComputeInteractionState(int X, int Y, int modify = 0) override;
130  void GetActors(vtkPropCollection*) override;
132 
133 protected:
135  ~vtkSeedRepresentation() override;
136 
137  // The handle and the rep used to close the handles
139  vtkHandleList* Handles;
140 
141  // Selection tolerance for the handles
143 
144  // The active seed (handle) based on the last ComputeInteractionState()
146 
147 private:
149  void operator=(const vtkSeedRepresentation&) = delete;
150 };
151 
152 VTK_ABI_NAMESPACE_END
153 #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.
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