VTK  9.1.0
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 =========================================================================*/
67 #ifndef vtkSeedRepresentation_h
68 #define vtkSeedRepresentation_h
69 
70 #include "vtkInteractionWidgetsModule.h" // For export macro
72 
73 class vtkHandleList;
75 
76 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
77 {
78 public:
83 
85 
89  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
93 
99  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
100  virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3]);
101  virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
102  virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3]);
104 
109 
119 
126 
128 
131  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; };
133 
135 
140  vtkSetClampMacro(Tolerance, int, 1, 100);
141  vtkGetMacro(Tolerance, int);
143 
144  // Used to communicate about the state of the representation
145  enum
146  {
147  Outside = 0,
148  NearSeed
149  };
150 
152 
156  virtual int GetActiveHandle();
157  virtual void SetActiveHandle(int handleId);
158  // Returns the id of the seed created, -1 on failure. e is the display position.
159  virtual int CreateHandle(double e[2]);
160  // Delete last handle created
161  virtual void RemoveLastHandle();
162  // Delete the currently active handle
163  virtual void RemoveActiveHandle();
165 
169  virtual void RemoveHandle(int n);
170 
172 
175  void BuildRepresentation() override;
176  int ComputeInteractionState(int X, int Y, int modify = 0) override;
178 
179 protected:
182 
183  // The handle and the rep used to close the handles
185  vtkHandleList* Handles;
186 
187  // Selection tolerance for the handles
189 
190  // The active seed (handle) based on the last ComputeInteractionState()
192 
193 private:
195  void operator=(const vtkSeedRepresentation&) = delete;
196 };
197 
198 #endif
vtkWidgetRepresentation.h
vtkSeedRepresentation::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkSeedRepresentation::GetSeedDisplayPosition
virtual void GetSeedDisplayPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
vtkSeedRepresentation::~vtkSeedRepresentation
~vtkSeedRepresentation() override
vtkSeedRepresentation::GetNumberOfSeeds
int GetNumberOfSeeds()
Return the number of seeds (or handles) that have been created.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:56
vtkSeedRepresentation::GetSeedWorldPosition
virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
vtkSeedRepresentation::BuildRepresentation
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkSeedRepresentation::SetActiveHandle
virtual void SetActiveHandle(int handleId)
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkSeedRepresentation::SetSeedDisplayPosition
virtual void SetSeedDisplayPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
vtkSeedRepresentation::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation()
Returns the model HandleRepresentation.
Definition: vtkSeedRepresentation.h:131
vtkSeedRepresentation::Handles
vtkHandleList * Handles
Definition: vtkSeedRepresentation.h:185
vtkSeedRepresentation::vtkSeedRepresentation
vtkSeedRepresentation()
vtkSeedRepresentation::SetSeedWorldPosition
virtual void SetSeedWorldPosition(unsigned int seedNum, double pos[3])
Methods to Set/Get the coordinates of seed points defining this representation.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkSeedRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkSeedRepresentation.h:184
vtkSeedRepresentation::CreateHandle
virtual int CreateHandle(double e[2])
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkSeedRepresentation::New
static vtkSeedRepresentation * New()
Instantiate class.
vtkSeedRepresentation::ActiveHandle
int ActiveHandle
Definition: vtkSeedRepresentation.h:191
vtkSeedRepresentation::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation(unsigned int num)
Get the handle representations used for a particular seed.
vtkSeedRepresentation::GetActiveHandle
virtual int GetActiveHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkSeedRepresentation::RemoveHandle
virtual void RemoveHandle(int n)
Remove the nth handle.
vtkSeedRepresentation
represent the vtkSeedWidget
Definition: vtkSeedRepresentation.h:77
vtkSeedRepresentation::RemoveLastHandle
virtual void RemoveLastHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkSeedRepresentation::SetHandleRepresentation
void SetHandleRepresentation(vtkHandleRepresentation *handle)
This method is used to specify the type of handle representation to use for the internal vtkHandleWid...
vtkSeedRepresentation::RemoveActiveHandle
virtual void RemoveActiveHandle()
These are methods specific to vtkSeedRepresentation and which are invoked from vtkSeedWidget.
vtkSeedRepresentation::Tolerance
int Tolerance
Definition: vtkSeedRepresentation.h:188
vtkSeedRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.