VTK  9.3.0
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:
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 
173 
177  void CloseLoop();
178 
180 
183  vtkSetMacro(WidgetState, int);
185 
187 
190  vtkGetMacro(WidgetState, int);
192 
194 
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.
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
define the API for widget / widget representation
vtkWidgetRepresentation * WidgetRep
represent the vtkContourWidget
create a contour with a set of points
static void TranslateContourAction(vtkAbstractWidget *)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
void CloseLoop()
Convenient method to close the contour loop.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for a VTK class.
vtkTypeBool FollowCursor
static void MoveAction(vtkAbstractWidget *)
static void ResetAction(vtkAbstractWidget *)
void SetRepresentation(vtkContourRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
~vtkContourWidget() override
static vtkContourWidget * New()
Instantiate this class.
vtkContourRepresentation * GetContourRepresentation()
Return the representation as a vtkContourRepresentation.
static void SelectAction(vtkAbstractWidget *)
virtual void Initialize(vtkPolyData *poly, int state=1, vtkIdList *idList=nullptr)
Initialize the contour widget from a user supplied set of points.
static void AddFinalPointAction(vtkAbstractWidget *)
static void DeleteAction(vtkAbstractWidget *)
vtkTypeBool AllowNodePicking
vtkTypeBool ContinuousDraw
static void EndSelectAction(vtkAbstractWidget *)
static void ScaleContourAction(vtkAbstractWidget *)
virtual void Initialize()
void SetAllowNodePicking(vtkTypeBool)
Set / Get the AllowNodePicking value.
void SetEnabled(int) override
The method for activating and deactivating this widget.
list of point or cell ids
Definition: vtkIdList.h:23
a simple class to control print indentation
Definition: vtkIndent.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64