1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
20 #define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
22 #include "VTKViewer.h"
24 #include <vtkUnstructuredGridToUnstructuredGridFilter.h>
31 #pragma warning ( disable:4251 )
34 /*! \class vtkUnstructuredGridToUnstructuredGridFilter
35 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
37 /*! \class vtkUnstructuredGridToUnstructuredGridFilter
38 * \brief For more information see VTK documentation.
40 class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter
44 vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridToUnstructuredGridFilter );
46 //! \brief Construct with all types of clipping turned off.
47 static VTKViewer_ExtractUnstructuredGrid *New();
49 enum EExtraction{ eCells, ePoints};
50 //! Sets mode of extraction to \a theExtractionMode
51 void SetModeOfExtraction(EExtraction theExtractionMode){
52 myExtractionMode = theExtractionMode; Modified();
54 //! Get Extraction mode (Return: \a myExtractionMode field)
55 EExtraction GetModeOfExtraction(){ return myExtractionMode;}
57 enum EChanging{ ePassAll, eAdding, eRemoving};
58 //! Sets mode of changing to \a theChangeMode
59 void SetModeOfChanging(EChanging theChangeMode){
60 myChangeMode = theChangeMode;
63 //! Return \a myChangeMode field
64 EChanging GetModeOfChanging(){ return myChangeMode;}
66 //! Add cell id to \a myCellIds std::set
67 void RegisterCell(vtkIdType theCellId);
68 //! Check if myCellIds is empty.
69 int IsCellsRegistered() { return !myCellIds.empty();}
70 //! Remove the cell from the output
71 void ClearRegisteredCells() {
76 //! Add cell type to \a myCellTypes std::set
77 void RegisterCellsWithType(vtkIdType theCellType);
78 //! Check if myCellTypes is empty.
79 int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
80 //! Remove every cells with the type from the output
81 void ClearRegisteredCellsWithType() {
86 //! \brief Do the filter do some real work
87 int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();}
89 //! \brief Do it keep the mapping between input's and output's UnstructuredGrid
90 void SetStoreMapping(int theStoreMapping);
91 //! Get \a myStoreMapping
92 int GetStoreMapping(){ return myStoreMapping;}
94 //! Gets the input id by output id.
95 vtkIdType GetInputId(int theOutId) const;
96 //! Gets the output id by input id.
97 vtkIdType GetOutputId(int theInId) const;
99 typedef std::vector<vtkIdType> TVectorId;
100 typedef std::map<vtkIdType,vtkIdType> TMapId;
103 VTKViewer_ExtractUnstructuredGrid();
104 ~VTKViewer_ExtractUnstructuredGrid();
106 //! Main method, which calculate output
107 // not ported yet to the new executive-based pipeline architecture.
108 // see http://www.vtk.org/cgi-bin/viewcvs.cgi/Filtering/vtkUnstructuredGridToUnstructuredGridFilter.h?rev=1.19&view=log
109 // virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
110 virtual void Execute();
112 EExtraction myExtractionMode;
114 EChanging myChangeMode;
115 typedef std::set<vtkIdType> TSetId;
120 TVectorId myOut2InId;
125 VTKViewer_ExtractUnstructuredGrid(const VTKViewer_ExtractUnstructuredGrid&);
127 void operator=(const VTKViewer_ExtractUnstructuredGrid&);
131 #pragma warning ( default:4251 )