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 class vtkIdList;
00136 
00137 class VTK_WIDGETS_EXPORT vtkContourWidget : public vtkAbstractWidget
00138 {
00139 public:
00141   static vtkContourWidget *New();
00142 
00144 
00145   vtkTypeMacro(vtkContourWidget,vtkAbstractWidget);
00146   void PrintSelf(ostream& os, vtkIndent indent);
00148 
00152   virtual void SetEnabled(int);
00153 
00155 
00158   void SetRepresentation(vtkContourRepresentation *r)
00159     {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
00161 
00163 
00164   vtkContourRepresentation *GetContourRepresentation()
00165     {return reinterpret_cast<vtkContourRepresentation*>(this->WidgetRep);}
00167 
00169   void CreateDefaultRepresentation();
00170 
00172   void CloseLoop();
00173 
00175 
00176   vtkSetMacro(WidgetState,int);
00178 
00180 
00181   vtkGetMacro(WidgetState,int);
00183 
00185 
00188   void SetAllowNodePicking(int );
00189   vtkGetMacro( AllowNodePicking, int );
00190   vtkBooleanMacro( AllowNodePicking, int );
00192 
00194 
00199   vtkSetMacro( FollowCursor, int );
00200   vtkGetMacro( FollowCursor, int );
00201   vtkBooleanMacro( FollowCursor, int );
00203 
00205 
00213   vtkSetMacro( ContinuousDraw, int );
00214   vtkGetMacro( ContinuousDraw, int );
00215   vtkBooleanMacro( ContinuousDraw, int );
00217 
00219 
00224   virtual void Initialize( vtkPolyData * poly, int state = 1, vtkIdList *idList = NULL );
00225   virtual void Initialize()
00226     {this->Initialize(NULL);}
00228 
00229   // The state of the widget
00230   //BTX
00231   enum {Start,Define,Manipulate};
00232   //ETX
00233 
00234 protected:
00235   vtkContourWidget();
00236   ~vtkContourWidget();
00237 
00238   int WidgetState;
00239   int CurrentHandle;
00240   int AllowNodePicking;
00241   int FollowCursor;
00242   int ContinuousDraw;
00243   int ContinuousActive;
00244 
00245   // Callback interface to capture events when
00246   // placing the widget.
00247   static void SelectAction(vtkAbstractWidget*);
00248   static void AddFinalPointAction(vtkAbstractWidget*);
00249   static void MoveAction(vtkAbstractWidget*);
00250   static void EndSelectAction(vtkAbstractWidget*);
00251   static void DeleteAction(vtkAbstractWidget*);
00252   static void TranslateContourAction(vtkAbstractWidget*);
00253   static void ScaleContourAction(vtkAbstractWidget*);
00254   static void ResetAction(vtkAbstractWidget*);
00255 
00256   // Internal helper methods
00257   void SelectNode();
00258   void AddNode();
00259 
00260 private:
00261   vtkContourWidget(const vtkContourWidget&);  //Not implemented
00262   void operator=(const vtkContourWidget&);  //Not implemented
00263 };
00264 
00265 #endif