00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 #ifndef VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H 00024 #define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H 00025 00026 #include "VTKViewer.h" 00027 00028 #include <vtkUnstructuredGridToUnstructuredGridFilter.h> 00029 00030 #include <set> 00031 #include <map> 00032 #include <vector> 00033 00034 #ifdef WIN32 00035 #pragma warning ( disable:4251 ) 00036 #endif 00037 00044 class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter 00045 { 00046 public: 00048 vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridToUnstructuredGridFilter ); 00049 00051 static VTKViewer_ExtractUnstructuredGrid *New(); 00052 00053 enum EExtraction{ eCells, ePoints}; 00055 void SetModeOfExtraction(EExtraction theExtractionMode){ 00056 myExtractionMode = theExtractionMode; Modified(); 00057 } 00059 EExtraction GetModeOfExtraction(){ return myExtractionMode;} 00060 00061 enum EChanging{ ePassAll, eAdding, eRemoving}; 00063 void SetModeOfChanging(EChanging theChangeMode){ 00064 myChangeMode = theChangeMode; 00065 Modified(); 00066 } 00068 EChanging GetModeOfChanging(){ return myChangeMode;} 00069 00071 void RegisterCell(vtkIdType theCellId); 00073 int IsCellsRegistered() { return !myCellIds.empty();} 00075 void ClearRegisteredCells() { 00076 myCellIds.clear(); 00077 Modified(); 00078 } 00079 00081 void RegisterCellsWithType(vtkIdType theCellType); 00083 int IsCellsWithTypeRegistered() { return !myCellTypes.empty();} 00085 void ClearRegisteredCellsWithType() { 00086 myCellTypes.clear(); 00087 Modified(); 00088 } 00089 00091 int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();} 00092 00094 void SetStoreMapping(int theStoreMapping); 00096 int GetStoreMapping(){ return myStoreMapping;} 00097 00099 vtkIdType GetInputId(int theOutId) const; 00101 vtkIdType GetOutputId(int theInId) const; 00102 00103 typedef std::vector<vtkIdType> TVectorId; 00104 typedef std::map<vtkIdType,vtkIdType> TMapId; 00105 00106 protected: 00107 VTKViewer_ExtractUnstructuredGrid(); 00108 ~VTKViewer_ExtractUnstructuredGrid(); 00109 00111 // not ported yet to the new executive-based pipeline architecture. 00112 // see http://www.vtk.org/cgi-bin/viewcvs.cgi/Filtering/vtkUnstructuredGridToUnstructuredGridFilter.h?rev=1.19&view=log 00113 // virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00114 virtual void Execute(); 00115 00116 EExtraction myExtractionMode; 00117 00118 EChanging myChangeMode; 00119 typedef std::set<vtkIdType> TSetId; 00120 TSetId myCellIds; 00121 TSetId myCellTypes; 00122 00123 bool myStoreMapping; 00124 TVectorId myOut2InId; 00125 TMapId myIn2OutId; 00126 00127 private: 00129 VTKViewer_ExtractUnstructuredGrid(const VTKViewer_ExtractUnstructuredGrid&); 00131 void operator=(const VTKViewer_ExtractUnstructuredGrid&); 00132 }; 00133 00134 #ifdef WIN32 00135 #pragma warning ( default:4251 ) 00136 #endif 00137 00138 #endif