VTK  9.3.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 
123 VTK_ABI_NAMESPACE_BEGIN
125 class vtkPolyData;
126 class vtkIdList;
127 
128 class VTKINTERACTIONWIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
129 {
130 public:
134  static vtkContourWidget* New();
135 
137 
141  void PrintSelf(ostream& os, vtkIndent indent) override;
143 
149  void SetEnabled(int) override;
150 
157  {
158  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
159  }
160 
165  {
166  return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);
167  }
168 
172  void CreateDefaultRepresentation() override;
173 
177  void CloseLoop();
178 
180 
183  vtkSetMacro(WidgetState, int);
185 
187 
190  vtkGetMacro(WidgetState, int);
192 
194 
198  void SetAllowNodePicking(vtkTypeBool);
199  vtkGetMacro(AllowNodePicking, vtkTypeBool);
200  vtkBooleanMacro(AllowNodePicking, vtkTypeBool);
202 
204 
211  vtkSetMacro(FollowCursor, vtkTypeBool);
212  vtkGetMacro(FollowCursor, vtkTypeBool);
213  vtkBooleanMacro(FollowCursor, vtkTypeBool);
215 
217 
227  vtkSetMacro(ContinuousDraw, vtkTypeBool);
228  vtkGetMacro(ContinuousDraw, vtkTypeBool);
229  vtkBooleanMacro(ContinuousDraw, vtkTypeBool);
231 
240  virtual void Initialize(vtkPolyData* poly, int state = 1, vtkIdList* idList = nullptr);
241  virtual void Initialize() { this->Initialize(nullptr); }
242 
243  // The state of the widget
244 
245  enum
246  {
249  Manipulate
250  };
251 
252 protected:
254  ~vtkContourWidget() override;
255 
262 
263  // Callback interface to capture events when
264  // placing the widget.
265  static void SelectAction(vtkAbstractWidget*);
266  static void AddFinalPointAction(vtkAbstractWidget*);
267  static void MoveAction(vtkAbstractWidget*);
268  static void EndSelectAction(vtkAbstractWidget*);
269  static void DeleteAction(vtkAbstractWidget*);
270  static void TranslateContourAction(vtkAbstractWidget*);
271  static void ScaleContourAction(vtkAbstractWidget*);
272  static void ResetAction(vtkAbstractWidget*);
273 
274  // Internal helper methods
275  void SelectNode();
276  void AddNode();
277 
278 private:
279  vtkContourWidget(const vtkContourWidget&) = delete;
280  void operator=(const vtkContourWidget&) = delete;
281 };
282 
283 VTK_ABI_NAMESPACE_END
284 #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:79
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:22
define the API for widget / widget representation
create a contour with a set of points
void SetEnabled(int) override
Methods for activating this widget.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Initialize()