00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef VTKWRAP_SGRIDISOSURF_H
00022 #define VTKWRAP_SGRIDISOSURF_H
00023
00024 #include "vtkStructuredGrid.h"
00025 #include "vtkMarchingContourFilter.h"
00026 #include "vtkPolyDataMapper.h"
00027 #include "vtkActor.h"
00028 #include "vtkProperty.h"
00029 #include "vtkLookupTable.h"
00030
00031 class SGridIsoSurf
00032 {
00033 friend std::ostream & operator<< (std::ostream & os, SGridIsoSurf const & sgiso);
00034 public:
00035 SGridIsoSurf(vtkStructuredGrid * SGrid, double f, vtkLookupTable * lt=NULL)
00036 {
00037 _isosurf = vtkMarchingContourFilter ::New();
00038 _isosurf_mapper = vtkPolyDataMapper ::New();
00039 _isosurf_actor = vtkActor ::New();
00040 _isosurf -> SetInput (SGrid);
00041 _isosurf -> SetValue (0,f);
00042 _isosurf_mapper -> SetInputConnection (_isosurf->GetOutputPort()); if (lt!=NULL)
00043 _isosurf_mapper -> SetLookupTable (lt);
00044 _isosurf_actor -> SetMapper (_isosurf_mapper);
00045
00046 }
00047 SGridIsoSurf(vtkStructuredGrid * SGrid, int nSurfs, double fMin, double fMax, vtkLookupTable * lt=NULL)
00048 {
00049 _isosurf = vtkMarchingContourFilter ::New();
00050 _isosurf_mapper = vtkPolyDataMapper ::New();
00051 _isosurf_actor = vtkActor ::New();
00052 _isosurf -> SetInput (SGrid);
00053 _isosurf -> GenerateValues (nSurfs,fMin,fMax);
00054 _isosurf_mapper -> SetInputConnection (_isosurf->GetOutputPort()); if (lt!=NULL)
00055 _isosurf_mapper -> SetLookupTable (lt);
00056 _isosurf_actor -> SetMapper (_isosurf_mapper);
00057 }
00058 ~SGridIsoSurf()
00059 {
00060 _isosurf -> Delete();
00061 _isosurf_mapper -> Delete();
00062 _isosurf_actor -> Delete();
00063 }
00064 vtkActor * GetActor() { return _isosurf_actor; }
00065 vtkMarchingContourFilter * GetIsoSurf() { return _isosurf; }
00066 private:
00067 vtkMarchingContourFilter * _isosurf;
00068 vtkPolyDataMapper * _isosurf_mapper;
00069 vtkActor * _isosurf_actor;
00070 };
00071
00072 std::ostream & operator<< (std::ostream & os, SGridIsoSurf const & sgiso)
00073 {
00074 sgiso._isosurf->Print(os);
00075 return os;
00076 }
00077
00078 #endif // VTKWRAP_SGRIDISOSURF_H
00079
00080