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 =========================================================================*/
28 #ifndef vtkSeedRepresentation_h
29 #define vtkSeedRepresentation_h
30 
31 #include "vtkInteractionWidgetsModule.h" // For export macro
33 
34 class vtkHandleList;
36 
37 
38 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
39 {
40 public:
44  static vtkSeedRepresentation *New();
45 
47 
51  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
53 
55 
61  virtual void GetSeedWorldPosition( unsigned int seedNum, double pos[3] );
62  virtual void SetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
63  virtual void GetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
65 
69  int GetNumberOfSeeds();
70 
79  void SetHandleRepresentation( vtkHandleRepresentation *handle );
80 
86  vtkHandleRepresentation *GetHandleRepresentation( unsigned int num );
87 
89 
93  {
94  return this->HandleRepresentation;
95  };
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  // Returns the id of the seed created, -1 on failure. e is the display position.
122  virtual int CreateHandle( double e[2] );
123  // Delete last handle created
124  virtual void RemoveLastHandle();
125  // Delete the currently active handle
126  virtual void RemoveActiveHandle();
128 
132  virtual void RemoveHandle( int n );
133 
135 
138  void BuildRepresentation() VTK_OVERRIDE;
139  int ComputeInteractionState( int X, int Y, int modify = 0 ) VTK_OVERRIDE;
141 
142 protected:
144  ~vtkSeedRepresentation() VTK_OVERRIDE;
145 
146  // The handle and the rep used to close the handles
147  vtkHandleRepresentation *HandleRepresentation;
148  vtkHandleList *Handles;
149 
150  // Selection tolerance for the handles
151  int Tolerance;
152 
153  // The active seed (handle) based on the last ComputeInteractionState()
154  int ActiveHandle;
155 
156 private:
157  vtkSeedRepresentation(const vtkSeedRepresentation&) VTK_DELETE_FUNCTION;
158  void operator=(const vtkSeedRepresentation&) VTK_DELETE_FUNCTION;
159 };
160 
161 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
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:33
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...
represent the vtkSeedWidget