VTK
dox/Widgets/vtkContourWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkContourWidget.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00128 #ifndef __vtkContourWidget_h
00129 #define __vtkContourWidget_h
00130 
00131 #include "vtkAbstractWidget.h"
00132 
00133 class vtkContourRepresentation;
00134 class vtkPolyData;
00135 
00136 class VTK_WIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
00137 {
00138 public:
00140   static vtkContourWidget *New();
00141 
00143 
00144   vtkTypeMacro(vtkContourWidget,vtkAbstractWidget);
00145   void PrintSelf(ostream& os, vtkIndent indent);
00147 
00151   virtual void SetEnabled(int);
00152 
00154 
00157   void SetRepresentation(vtkContourRepresentation *r)
00158     {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
00160 
00162 
00163   vtkContourRepresentation *GetContourRepresentation()
00164     {return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);}
00166 
00168   void CreateDefaultRepresentation();
00169 
00171   void CloseLoop();
00172 
00174 
00175   vtkSetMacro(WidgetState,int);
00177 
00179 
00180   vtkGetMacro(WidgetState,int);
00182 
00184 
00187   void SetAllowNodePicking(int );
00188   vtkGetMacro( AllowNodePicking, int );
00189   vtkBooleanMacro( AllowNodePicking, int );
00191 
00193 
00198   vtkSetMacro( FollowCursor, int );
00199   vtkGetMacro( FollowCursor, int );
00200   vtkBooleanMacro( FollowCursor, int );
00202 
00204 
00212   vtkSetMacro( ContinuousDraw, int );
00213   vtkGetMacro( ContinuousDraw, int );
00214   vtkBooleanMacro( ContinuousDraw, int );
00216 
00218 
00223   virtual void Initialize( vtkPolyData * poly, int state = 1 );
00224   virtual void Initialize()
00225     {this->Initialize(NULL);}
00227 
00228 protected:
00229   vtkContourWidget();
00230   ~vtkContourWidget();
00231 
00232   // The state of the widget
00233 //BTX
00234   enum {Start,Define,Manipulate};
00235 //ETX
00236 
00237   int WidgetState;
00238   int CurrentHandle;
00239   int AllowNodePicking;
00240   int FollowCursor;
00241   int ContinuousDraw;
00242   int ContinuousActive;
00243 
00244   // Callback interface to capture events when
00245   // placing the widget.
00246   static void SelectAction(vtkAbstractWidget*);
00247   static void AddFinalPointAction(vtkAbstractWidget*);
00248   static void MoveAction(vtkAbstractWidget*);
00249   static void EndSelectAction(vtkAbstractWidget*);
00250   static void DeleteAction(vtkAbstractWidget*);
00251   static void TranslateContourAction(vtkAbstractWidget*);
00252   static void ScaleContourAction(vtkAbstractWidget*);
00253   static void ResetAction(vtkAbstractWidget*);
00254 
00255   // Internal helper methods
00256   void SelectNode();
00257   void AddNode();
00258 
00259 private:
00260   vtkContourWidget(const vtkContourWidget&);  //Not implemented
00261   void operator=(const vtkContourWidget&);  //Not implemented
00262 };
00263 
00264 #endif