VTK
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 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
42 {
43 public:
47  static vtkSeedRepresentation *New();
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
64  virtual void GetSeedWorldPosition( unsigned int seedNum, double pos[3] );
65  virtual void SetSeedWorldPosition( unsigned int seedNum, double pos[3] );
66  virtual void SetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
67  virtual void GetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
69 
73  int GetNumberOfSeeds();
74 
83  void SetHandleRepresentation( vtkHandleRepresentation *handle );
84 
90  vtkHandleRepresentation *GetHandleRepresentation( unsigned int num );
91 
93 
97  {
98  return this->HandleRepresentation;
99  };
101 
103 
108  vtkSetClampMacro( Tolerance, int, 1, 100 );
109  vtkGetMacro( Tolerance, int );
111 
112  // Used to communicate about the state of the representation
113  enum
114  {
115  Outside = 0,
116  NearSeed
117  };
118 
120 
124  virtual int GetActiveHandle();
125  virtual void SetActiveHandle( int handleId );
126  // Returns the id of the seed created, -1 on failure. e is the display position.
127  virtual int CreateHandle( double e[2] );
128  // Delete last handle created
129  virtual void RemoveLastHandle();
130  // Delete the currently active handle
131  virtual void RemoveActiveHandle();
133 
137  virtual void RemoveHandle( int n );
138 
140 
143  void BuildRepresentation() override;
144  int ComputeInteractionState( int X, int Y, int modify = 0 ) override;
146 
147 protected:
149  ~vtkSeedRepresentation() override;
150 
151  // The handle and the rep used to close the handles
153  vtkHandleList *Handles;
154 
155  // Selection tolerance for the handles
157 
158  // The active seed (handle) based on the last ComputeInteractionState()
160 
161 private:
163  void operator=(const vtkSeedRepresentation&) = delete;
164 };
165 
166 #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.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkHandleRepresentation * GetHandleRepresentation()
Returns the model HandleRepresentation.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkHandleRepresentation * HandleRepresentation
represent the vtkSeedWidget