VTK  9.7.1
vtkContourWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
117 #ifndef vtkContourWidget_h
118 #define vtkContourWidget_h
119 
120 #include "vtkAbstractWidget.h"
121 #include "vtkInteractionWidgetsModule.h" // For export macro
122 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
123 
124 VTK_ABI_NAMESPACE_BEGIN
126 class vtkPolyData;
127 class vtkIdList;
128 
129 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkContourWidget : public vtkAbstractWidget
130 {
131 public:
135  static vtkContourWidget* New();
136 
138 
142  void PrintSelf(ostream& os, vtkIndent indent) override;
144 
150  void SetEnabled(int) override;
151 
158  {
159  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
160  }
161 
166  {
167  return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);
168  }
169 
173  void CreateDefaultRepresentation() override;
174 
178  void CloseLoop();
179 
181 
184  vtkSetMacro(WidgetState, int);
186 
188 
191  vtkGetMacro(WidgetState, int);
193 
195 
199  void SetAllowNodePicking(vtkTypeBool);
200  vtkGetMacro(AllowNodePicking, vtkTypeBool);
201  vtkBooleanMacro(AllowNodePicking, vtkTypeBool);
203 
205 
212  vtkSetMacro(FollowCursor, vtkTypeBool);
213  vtkGetMacro(FollowCursor, vtkTypeBool);
214  vtkBooleanMacro(FollowCursor, vtkTypeBool);
216 
218 
228  vtkSetMacro(ContinuousDraw, vtkTypeBool);
229  vtkGetMacro(ContinuousDraw, vtkTypeBool);
230  vtkBooleanMacro(ContinuousDraw, vtkTypeBool);
232 
241  virtual void Initialize(vtkPolyData* poly, int state = 1, vtkIdList* idList = nullptr);
242  virtual void Initialize() { this->Initialize(nullptr); }
243 
244  // The state of the widget
245 
246  enum
247  {
250  Manipulate
251  };
252 
253 protected:
255  ~vtkContourWidget() override;
256 
263 
264  // Callback interface to capture events when
265  // placing the widget.
266  static void SelectAction(vtkAbstractWidget*);
267  static void AddFinalPointAction(vtkAbstractWidget*);
268  static void MoveAction(vtkAbstractWidget*);
269  static void EndSelectAction(vtkAbstractWidget*);
270  static void DeleteAction(vtkAbstractWidget*);
271  static void TranslateContourAction(vtkAbstractWidget*);
272  static void ScaleContourAction(vtkAbstractWidget*);
273  static void ResetAction(vtkAbstractWidget*);
274 
275  // Internal helper methods
276  void SelectNode();
277  void AddNode();
278 
279 private:
280  vtkContourWidget(const vtkContourWidget&) = delete;
281  void operator=(const vtkContourWidget&) = delete;
282 };
283 
284 VTK_ABI_NAMESPACE_END
285 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
vtkTypeBool ContinuousDraw
void SetRepresentation(vtkContourRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
represent the vtkContourWidget
vtkWidgetRepresentation * WidgetRep
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeBool AllowNodePicking
vtkTypeBool FollowCursor
vtkContourRepresentation * GetContourRepresentation()
Return the representation as a vtkContourRepresentation.
a simple class to control print indentation
Definition: vtkIndent.h:28
list of point or cell ids
Definition: vtkIdList.h:25
define the API for widget / widget representation
create a contour with a set of points
void SetEnabled(int) override
Methods for activating this widget.
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Initialize()