sgridoutline.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_SGRIDOUTLINE_H
00022 #define VTKWRAP_SGRIDOUTLINE_H
00023 
00024 #include "vtkStructuredGrid.h"
00025 #include "vtkStructuredGridOutlineFilter.h"
00026 #include "vtkPolyDataMapper.h"
00027 #include "vtkActor.h"
00028 #include "vtkProperty.h"
00029 
00030 class SGridOutline
00031 {
00032     friend std::ostream & operator<< (std::ostream & os, SGridOutline const & sgo);
00033 public:
00034     SGridOutline(vtkStructuredGrid * SGrid)
00035     {
00036         _outline        = vtkStructuredGridOutlineFilter ::New();
00037         _outline_mapper = vtkPolyDataMapper              ::New();
00038         _outline_actor  = vtkActor                       ::New();
00039         _outline        -> SetInput                      (SGrid);
00040         _outline_mapper -> SetInputConnection            (_outline->GetOutputPort());
00041         _outline_actor  -> SetMapper                     (_outline_mapper);
00042         _outline_actor  -> GetProperty                   () -> SetColor(0,0,1); 
00043     }
00044     ~SGridOutline()
00045     {
00046         _outline        -> Delete();
00047         _outline_mapper -> Delete();
00048         _outline_actor  -> Delete();
00049     }
00050     vtkActor * GetActor() { return _outline_actor; }
00051 private:
00052     vtkStructuredGridOutlineFilter * _outline;
00053     vtkPolyDataMapper              * _outline_mapper;
00054     vtkActor                       * _outline_actor;
00055 }; // class SGridOutline
00056 
00057 std::ostream & operator<< (std::ostream & os, SGridOutline const & sgo)
00058 {
00059     sgo._outline->Print(os);
00060     return os;
00061 }
00062 
00063 #endif // VTKWRAP_SGRIDOUTLINE_H
00064 
00065 // vim:fdm=marker

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