updateplanecallback.h

00001 /*************************************************************************************
00002  * MechSys - A C++ library to simulate (Continuum) Mechanical Systems                *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>       *
00004  * Copyright (C) 2005 Raul Dario Durand Farfan  <raul.durand at gmail.com>           *
00005  *                                                                                   *
00006  * This file is part of MechSys.                                                     *
00007  *                                                                                   *
00008  * MechSys is free software; you can redistribute it and/or modify it under the      *
00009  * terms of the GNU General Public License as published by the Free Software         *
00010  * Foundation; either version 2 of the License, or (at your option) any later        *
00011  * version.                                                                          *
00012  *                                                                                   *
00013  * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY        *
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   *
00015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.          *
00016  *                                                                                   *
00017  * You should have received a copy of the GNU General Public License along with      *
00018  * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
00019  * Fifth Floor, Boston, MA 02110-1301, USA                                           *
00020  *************************************************************************************/
00021 
00022 #ifndef MECHSYS_UPDATEPLANECALLBACK_H
00023 #define MECHSYS_UPDATEPLANECALLBACK_H
00024 
00025 // VTK
00026 #include "vtkCommand.h"
00027 #include "vtkPlane.h"
00028 #include "vtkObject.h"
00029 #include "vtkImplicitPlaneWidget2.h"
00030 #include "vtkImplicitPlaneRepresentation.h"
00031 
00032 class UpdatePlaneCallBack : public vtkCommand
00033 {
00034 public:
00035     // Constructor
00036     UpdatePlaneCallBack() : _plane(NULL), _actor(NULL) {}
00037 
00038     // Methods
00039     void SetPlane(vtkPlane * ThePlane) { _plane = ThePlane; }
00040     void SetActor(vtkActor * TheActor) { _actor = TheActor; }
00041     virtual void Execute(vtkObject * Caller, unsigned long eventId, void *)
00042     {
00043         vtkImplicitPlaneWidget2        * wid = reinterpret_cast<vtkImplicitPlaneWidget2*>        (Caller);
00044         vtkImplicitPlaneRepresentation * rep = reinterpret_cast<vtkImplicitPlaneRepresentation*> (wid->GetRepresentation());
00045         rep -> GetPlane(_plane);
00046         if (_actor!=NULL) _actor->VisibilityOn();
00047     }
00048 
00049     // Static
00050     static UpdatePlaneCallBack * New() { return new UpdatePlaneCallBack; }
00051 
00052 private:
00053     // Data
00054     vtkPlane * _plane;
00055     vtkActor * _actor;
00056 
00057 }; // class UpdatePlaneCallBack
00058 
00059 #endif // MECHSYS_UPDATEPLANECALLBACK_H
00060 
00061 // vim:fdm=marker

Generated on Wed Jan 24 15:56:28 2007 for MechSys by  doxygen 1.4.7