VTK  9.0.20200604
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 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
38 {
39 public:
43  static vtkSeedRepresentation* New();
44 
46 
50  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
60  virtual void GetSeedWorldPosition(unsigned int seedNum, double pos[3]);
61  virtual void SetSeedWorldPosition(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 
92  vtkHandleRepresentation* GetHandleRepresentation() { return this->HandleRepresentation; };
94 
96 
101  vtkSetClampMacro(Tolerance, int, 1, 100);
102  vtkGetMacro(Tolerance, int);
104 
105  // Used to communicate about the state of the representation
106  enum
107  {
108  Outside = 0,
109  NearSeed
110  };
111 
113 
117  virtual int GetActiveHandle();
118  virtual void SetActiveHandle(int handleId);
119  // Returns the id of the seed created, -1 on failure. e is the display position.
120  virtual int CreateHandle(double e[2]);
121  // Delete last handle created
122  virtual void RemoveLastHandle();
123  // Delete the currently active handle
124  virtual void RemoveActiveHandle();
126 
130  virtual void RemoveHandle(int n);
131 
133 
136  void BuildRepresentation() override;
137  int ComputeInteractionState(int X, int Y, int modify = 0) override;
139 
140 protected:
142  ~vtkSeedRepresentation() override;
143 
144  // The handle and the rep used to close the handles
146  vtkHandleList* Handles;
147 
148  // Selection tolerance for the handles
150 
151  // The active seed (handle) based on the last ComputeInteractionState()
153 
154 private:
156  void operator=(const vtkSeedRepresentation&) = delete;
157 };
158 
159 #endif
vtkWidgetRepresentation.h
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkSeedRepresentation::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation()
Returns the model HandleRepresentation.
Definition: vtkSeedRepresentation.h:92
vtkSeedRepresentation::Handles
vtkHandleList * Handles
Definition: vtkSeedRepresentation.h:146
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSeedRepresentation::HandleRepresentation
vtkHandleRepresentation * HandleRepresentation
Definition: vtkSeedRepresentation.h:145
vtkSeedRepresentation::ActiveHandle
int ActiveHandle
Definition: vtkSeedRepresentation.h:152
vtkSeedRepresentation
represent the vtkSeedWidget
Definition: vtkSeedRepresentation.h:37
vtkSeedRepresentation::Tolerance
int Tolerance
Definition: vtkSeedRepresentation.h:149
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.