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 =========================================================================*/
129 #ifndef vtkContourWidget_h
130 #define vtkContourWidget_h
131 
132 #include "vtkAbstractWidget.h"
133 #include "vtkInteractionWidgetsModule.h" // For export macro
134 
136 class vtkPolyData;
137 class vtkIdList;
138 
139 class VTKINTERACTIONWIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
140 {
141 public:
145  static vtkContourWidget* New();
146 
148 
152  void PrintSelf(ostream& os, vtkIndent indent) override;
154 
160  void SetEnabled(int) override;
161 
168  {
169  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
170  }
171 
176  {
177  return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);
178  }
179 
183  void CreateDefaultRepresentation() override;
184 
188  void CloseLoop();
189 
191 
194  vtkSetMacro(WidgetState, int);
196 
198 
201  vtkGetMacro(WidgetState, int);
203 
205 
209  void SetAllowNodePicking(vtkTypeBool);
210  vtkGetMacro(AllowNodePicking, vtkTypeBool);
211  vtkBooleanMacro(AllowNodePicking, vtkTypeBool);
213 
215 
222  vtkSetMacro(FollowCursor, vtkTypeBool);
223  vtkGetMacro(FollowCursor, vtkTypeBool);
224  vtkBooleanMacro(FollowCursor, vtkTypeBool);
226 
228 
238  vtkSetMacro(ContinuousDraw, vtkTypeBool);
239  vtkGetMacro(ContinuousDraw, vtkTypeBool);
240  vtkBooleanMacro(ContinuousDraw, vtkTypeBool);
242 
251  virtual void Initialize(vtkPolyData* poly, int state = 1, vtkIdList* idList = nullptr);
252  virtual void Initialize() { this->Initialize(nullptr); }
253 
254  // The state of the widget
255 
256  enum
257  {
260  Manipulate
261  };
262 
263 protected:
265  ~vtkContourWidget() override;
266 
273 
274  // Callback interface to capture events when
275  // placing the widget.
276  static void SelectAction(vtkAbstractWidget*);
277  static void AddFinalPointAction(vtkAbstractWidget*);
278  static void MoveAction(vtkAbstractWidget*);
279  static void EndSelectAction(vtkAbstractWidget*);
280  static void DeleteAction(vtkAbstractWidget*);
281  static void TranslateContourAction(vtkAbstractWidget*);
282  static void ScaleContourAction(vtkAbstractWidget*);
283  static void ResetAction(vtkAbstractWidget*);
284 
285  // Internal helper methods
286  void SelectNode();
287  void AddNode();
288 
289 private:
290  vtkContourWidget(const vtkContourWidget&) = delete;
291  void operator=(const vtkContourWidget&) = delete;
292 };
293 
294 #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()