#pragma once#include"vtkAbstractWidget.h"classvtkContourRepresentation;classvtkPolyData;classvtkPointPlacer;classvtkRenderer;namespaceshapeworks{classViewer;classStudioSphereRepresentation;classPaintWidget:publicvtkAbstractWidget{public:// Description:// Instantiate this class.staticPaintWidget*New();// Description:// Standard methods for a VTK class.vtkTypeMacro(PaintWidget,vtkAbstractWidget);voidPrintSelf(ostream&os,vtkIndentindent);// Description:// Set / get the Point Placer. The point placer is// responsible for converting display coordinates into// world coordinates according to some constraints, and// for validating world positions.// void SetPointPlacer( vtkPointPlacer * );vtkSetMacro(PointPlacer,vtkPointPlacer*);vtkGetMacro(PointPlacer,vtkPointPlacer*);vtkSetMacro(Renderer,vtkRenderer*);vtkGetMacro(Renderer,vtkRenderer*);voidset_viewer(Viewer*viewer);// Description:// The method for activiating and deactiviating this widget. This method// must be overridden because it is a composite widget and does more than// its superclasses' vtkAbstractWidget::SetEnabled() method.virtualvoidSetEnabled(int);// Description:// Specify an instance of vtkWidgetRepresentation used to represent this// widget in the scene. Note that the representation is a subclass of vtkProp// so it can be added to the renderer independent of the widget.voidSetRepresentation(vtkContourRepresentation*r){this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}// Description:// Create the default widget representation if one is not set.voidCreateDefaultRepresentation();voidupdate_position();// Description:// Initialize the contour widget from a user supplied set of points. The// state of the widget decides if you are still defining the widget, or// if you've finished defining (added the last point) are manipulating// it. Note that if the polydata supplied is closed, the state will be// set to manipulate.// State: Define = 0, Manipulate = 1.virtualvoidInitialize(vtkPolyData*poly,intstate=1);virtualvoidInitialize(){this->Initialize(NULL);}voidset_brush_size(doublesize);doubleget_brush_size();voidset_brush_color(floatr,floatg,floatb);protected:PaintWidget();~PaintWidget();// The state of the widget// BTXenum{Start,Paint,Erase};// ETXintWidgetState;vtkPointPlacer*PointPlacer;vtkRenderer*Renderer;// Callback interface to capture events when// placing the widget.staticvoidStartPaintAction(vtkAbstractWidget*w);staticvoidEndPaintAction(vtkAbstractWidget*w);staticvoidStartEraseAction(vtkAbstractWidget*w);staticvoidEndEraseAction(vtkAbstractWidget*w);staticvoidMoveAction(vtkAbstractWidget*w);staticvoidLeaveAction(vtkAbstractWidget*w);staticvoidKeyPressAction(vtkAbstractWidget*w);booluse_point_placer(doubledisplayPos[2],intnewState);voidset_cursor(intrequestedShape);StudioSphereRepresentation*sphere_cursor_;boolmouse_in_window_;Viewer*viewer_;private:PaintWidget(constPaintWidget&);// Not implementedvoidoperator=(constPaintWidget&);// Not implemented};}// namespace shapeworks