VTK  9.2.6
vtkSeedRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSeedRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkSeedRepresentation_h
32 #define vtkSeedRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkHandleList;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
41 {
42 public:
46  static vtkSeedRepresentation* New();
47 
49 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
63  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
64  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
65  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
66  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
68 
72  int GetNumberOfSeeds();
73 
82  void SetHandleRepresentation(vtkHandleRepresentation* handle);
83 
89  vtkHandleRepresentation* GetHandleRepresentation(unsigned int num);
90 
92 
95  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; };
97 
99 
104  vtkSetClampMacro(Tolerance, int, 1, 100);
105  vtkGetMacro(Tolerance, int);
107 
108  // Used to communicate about the state of the representation
109  enum
110  {
111  Outside = 0,
112  NearSeed
113  };
114 
116 
120  virtual int GetActiveHandle();
121  virtual void SetActiveHandle(int handleId);
122  // Returns the id of the seed created, -1 on failure. e is the display position.
123  virtual int CreateHandle(double e[2]);
124  // Delete last handle created
125  virtual void RemoveLastHandle();
126  // Delete the currently active handle
127  virtual void RemoveActiveHandle();
129 
133  virtual void RemoveHandle(int n);
134 
136 
139  void BuildRepresentation() override;
140  int ComputeInteractionState(int X, int Y, int modify = 0) override;
141  void GetActors(vtkPropCollection*) override;
143 
144 protected:
146  ~vtkSeedRepresentation() override;
147 
148  // The handle and the rep used to close the handles
150  vtkHandleList* Handles;
151 
152  // Selection tolerance for the handles
154 
155  // The active seed (handle) based on the last ComputeInteractionState()
157 
158 private:
160  void operator=(const vtkSeedRepresentation&) = delete;
161 };
162 
163 #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:39
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