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 =========================================================================*/
70 #ifndef vtkSeedRepresentation_h
71 #define vtkSeedRepresentation_h
72 
73 #include "vtkInteractionWidgetsModule.h" // For export macro
75 
76 class vtkHandleList;
78 
79 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
80 {
81 public:
86 
88 
92  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
96 
102  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
103  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
104  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
105  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
107 
112 
122 
129 
131 
134  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; };
136 
138 
143  vtkSetClampMacro(Tolerance, int, 1, 100);
144  vtkGetMacro(Tolerance, int);
146 
147  // Used to communicate about the state of the representation
148  enum
149  {
150  Outside = 0,
151  NearSeed
152  };
153 
155 
159  virtual int GetActiveHandle();
160  virtual void SetActiveHandle(int handleId);
161  // Returns the id of the seed created, -1 on failure. e is the display position.
162  virtual int CreateHandle(double e[2]);
163  // Delete last handle created
164  virtual void RemoveLastHandle();
165  // Delete the currently active handle
166  virtual void RemoveActiveHandle();
168 
172  virtual void RemoveHandle(int n);
173 
175 
178  void BuildRepresentation() override;
179  int ComputeInteractionState(int X, int Y, int modify = 0) override;
180  void GetActors(vtkPropCollection*) override;
182 
183 protected:
186 
187  // The handle and the rep used to close the handles
189  vtkHandleList* Handles;
190 
191  // Selection tolerance for the handles
193 
194  // The active seed (handle) based on the last ComputeInteractionState()
196 
197 private:
199  void operator=(const vtkSeedRepresentation&) = delete;
200 };
201 
202 #endif
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:119
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