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
126 #ifndef vtkContourWidget_h
127 #define vtkContourWidget_h
128 
129 #include "vtkAbstractWidget.h"
130 #include "vtkInteractionWidgetsModule.h" // For export macro
131 
132 VTK_ABI_NAMESPACE_BEGIN
134 class vtkPolyData;
135 class vtkIdList;
136 
137 class VTKINTERACTIONWIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
138 {
139 public:
144 
146 
150  void PrintSelf(ostream& os, vtkIndent indent) override;
152 
158  void SetEnabled(int) override;
159 
166  {
167  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
168  }
169 
174  {
175  return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);
176  }
177 
182 
186  void CloseLoop();
187 
189 
192  vtkSetMacro(WidgetState, int);
194 
196 
199  vtkGetMacro(WidgetState, int);
201 
203 
208  vtkGetMacro(AllowNodePicking, vtkTypeBool);
209  vtkBooleanMacro(AllowNodePicking, vtkTypeBool);
211 
213 
220  vtkSetMacro(FollowCursor, vtkTypeBool);
221  vtkGetMacro(FollowCursor, vtkTypeBool);
222  vtkBooleanMacro(FollowCursor, vtkTypeBool);
224 
226 
236  vtkSetMacro(ContinuousDraw, vtkTypeBool);
237  vtkGetMacro(ContinuousDraw, vtkTypeBool);
238  vtkBooleanMacro(ContinuousDraw, vtkTypeBool);
240 
249  virtual void Initialize(vtkPolyData* poly, int state = 1, vtkIdList* idList = nullptr);
250  virtual void Initialize() { this->Initialize(nullptr); }
251 
252  // The state of the widget
253 
254  enum
255  {
258  Manipulate
259  };
260 
261 protected:
263  ~vtkContourWidget() override;
264 
271 
272  // Callback interface to capture events when
273  // placing the widget.
282 
283  // Internal helper methods
284  void SelectNode();
285  void AddNode();
286 
287 private:
288  vtkContourWidget(const vtkContourWidget&) = delete;
289  void operator=(const vtkContourWidget&) = delete;
290 };
291 
292 VTK_ABI_NAMESPACE_END
293 #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:32
a simple class to control print indentation
Definition: vtkIndent.h:38
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64