VTK  9.0.1
vtkContourWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContourWidget.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 =========================================================================*/
126 #ifndef vtkContourWidget_h
127 #define vtkContourWidget_h
128 
129 #include "vtkAbstractWidget.h"
130 #include "vtkInteractionWidgetsModule.h" // For export macro
131 
133 class vtkPolyData;
134 class vtkIdList;
135 
136 class VTKINTERACTIONWIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
137 {
138 public:
142  static vtkContourWidget* New();
143 
145 
149  void PrintSelf(ostream& os, vtkIndent indent) override;
151 
157  void SetEnabled(int) override;
158 
165  {
166  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
167  }
168 
173  {
174  return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);
175  }
176 
180  void CreateDefaultRepresentation() override;
181 
185  void CloseLoop();
186 
188 
191  vtkSetMacro(WidgetState, int);
193 
195 
198  vtkGetMacro(WidgetState, int);
200 
202 
206  void SetAllowNodePicking(vtkTypeBool);
207  vtkGetMacro(AllowNodePicking, vtkTypeBool);
208  vtkBooleanMacro(AllowNodePicking, vtkTypeBool);
210 
212 
219  vtkSetMacro(FollowCursor, vtkTypeBool);
220  vtkGetMacro(FollowCursor, vtkTypeBool);
221  vtkBooleanMacro(FollowCursor, vtkTypeBool);
223 
225 
235  vtkSetMacro(ContinuousDraw, vtkTypeBool);
236  vtkGetMacro(ContinuousDraw, vtkTypeBool);
237  vtkBooleanMacro(ContinuousDraw, vtkTypeBool);
239 
248  virtual void Initialize(vtkPolyData* poly, int state = 1, vtkIdList* idList = nullptr);
249  virtual void Initialize() { this->Initialize(nullptr); }
250 
251  // The state of the widget
252 
253  enum
254  {
257  Manipulate
258  };
259 
260 protected:
262  ~vtkContourWidget() override;
263 
270 
271  // Callback interface to capture events when
272  // placing the widget.
273  static void SelectAction(vtkAbstractWidget*);
274  static void AddFinalPointAction(vtkAbstractWidget*);
275  static void MoveAction(vtkAbstractWidget*);
276  static void EndSelectAction(vtkAbstractWidget*);
277  static void DeleteAction(vtkAbstractWidget*);
278  static void TranslateContourAction(vtkAbstractWidget*);
279  static void ScaleContourAction(vtkAbstractWidget*);
280  static void ResetAction(vtkAbstractWidget*);
281 
282  // Internal helper methods
283  void SelectNode();
284  void AddNode();
285 
286 private:
287  vtkContourWidget(const vtkContourWidget&) = delete;
288  void operator=(const vtkContourWidget&) = delete;
289 };
290 
291 #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:84
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
represent the vtkContourWidget
vtkWidgetRepresentation * WidgetRep
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeBool AllowNodePicking
vtkTypeBool FollowCursor
vtkContourRepresentation * GetContourRepresentation()
Return the representation as a vtkContourRepresentation.
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
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()