hedgehog.h

00001 /***********************************************************************************
00002  * VTKwrap - Simple VTK wrappers                                                   *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>     *
00004  *                                                                                 *
00005  * This file is part of VTKwrap.                                                   *
00006  *                                                                                 *
00007  * VTKwrap is free software; you can redistribute it and/or modify it under        *
00008  * the  terms of the GNU General Public License as published by the Free Software  *
00009  * Foundation; either version 2 of the License, or (at your option) any later      *
00010  * version.                                                                        *
00011  *                                                                                 *
00012  * VTKwrap is distributed in the hope that it will be useful, but WITHOUT ANY      *
00013  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
00014  * PARTICULAR PURPOSE. See the GNU General Public License for more details.        *
00015  *                                                                                 *
00016  * You should have received a copy of the GNU General Public License along with    *
00017  * VTKwrap; if not, write to the Free Software Foundation, Inc., 51 Franklin       *
00018  * Street, Fifth Floor, Boston, MA 02110-1301, USA                                 *
00019  ***********************************************************************************/
00020 
00021 #ifndef VTKWRAP_HEDGEHOG_H
00022 #define VTKWRAP_HEDGEHOG_H
00023 
00024 #include "vtkStructuredGrid.h"
00025 #include "vtkHedgeHog.h"
00026 #include "vtkPolyDataMapper.h"
00027 #include "vtkActor.h"
00028 #include "vtkProperty.h"
00029 
00030 class HedgeHog // Porco-espinho
00031 {
00032     friend std::ostream & operator<< (std::ostream & os, HedgeHog const & hh);
00033 public:
00034     HedgeHog(vtkStructuredGrid * SGrid, double ScaleFactor=0.1)
00035     {
00036         _hedgehog        = vtkHedgeHog         ::New();
00037         _hedgehog_mapper = vtkPolyDataMapper   ::New();
00038         _hedgehog_actor  = vtkActor            ::New();
00039         _hedgehog        -> SetInput           (SGrid);
00040         _hedgehog        -> SetScaleFactor     (ScaleFactor);
00041         _hedgehog_mapper -> SetInputConnection (_hedgehog->GetOutputPort());
00042         _hedgehog_actor  -> SetMapper          (_hedgehog_mapper);
00043         _hedgehog_actor  -> GetProperty        () -> SetColor(0,0,0);   
00044     }
00045     ~HedgeHog()
00046     {
00047         _hedgehog        -> Delete();
00048         _hedgehog_mapper -> Delete();
00049         _hedgehog_actor  -> Delete();
00050     }
00051     vtkActor * GetActor() { return _hedgehog_actor; }
00052 private:
00053     vtkHedgeHog       * _hedgehog;
00054     vtkPolyDataMapper * _hedgehog_mapper;
00055     vtkActor          * _hedgehog_actor;
00056 }; // class HedgeHog
00057 
00058 std::ostream & operator<< (std::ostream & os, HedgeHog const & hh)
00059 {
00060     hh._hedgehog->Print(os);
00061     return os;
00062 }
00063 
00064 #endif // VTKWRAP_HEDGEHOG_H
00065 
00066 // vim:fdm=marker

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