Version: 9.15.0
VTKViewer_ExtractUnstructuredGrid.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
24 #define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
25 
26 #include "VTKViewer.h"
27 
28 #include <vtkUnstructuredGridAlgorithm.h>
29 
30 #include <set>
31 #include <map>
32 #include <vector>
33 
34 #ifdef WIN32
35 #pragma warning ( disable:4251 )
36 #endif
37 
45 {
46 public:
49 
50 
52 
53  enum EExtraction{ eCells, ePoints};
55  void SetModeOfExtraction(EExtraction theExtractionMode){
56  if ( myExtractionMode != theExtractionMode ) { myExtractionMode = theExtractionMode; Modified(); }
57  }
59  EExtraction GetModeOfExtraction(){ return myExtractionMode;}
60 
61  enum EChanging{ ePassAll, eAdding, eRemoving};
63  void SetModeOfChanging(EChanging theChangeMode){
64  if ( myChangeMode != theChangeMode ) { myChangeMode = theChangeMode; Modified(); }
65  }
67  EChanging GetModeOfChanging(){ return myChangeMode; }
68 
70  void RegisterCell(vtkIdType theCellId);
72  int IsCellsRegistered() { return !myCellIds.empty(); }
75  if ( !myCellIds.empty() ) { myCellIds.clear(); Modified(); }
76  }
77 
79  void RegisterCellsWithType(vtkIdType theCellType);
81  int IsCellsWithTypeRegistered() { return !myCellTypes.empty(); }
84  if ( !myCellTypes.empty() ) { myCellTypes.clear(); Modified(); }
85  }
86 
88  int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered(); }
89 
91  void SetStoreMapping(int theStoreMapping);
93  int GetStoreMapping(){ return myStoreMapping; }
94 
96  void BuildOut2InMap();
98  vtkIdType GetInputId(vtkIdType theOutId) const;
100  //vtkIdType GetOutputId(int theInId) const;
101 
102  typedef std::vector<vtkIdType> TVectorId;
103  typedef std::map<vtkIdType,vtkIdType> TMapId;
104  typedef std::set<vtkIdType> TSetId;
105 
106 protected:
109 
110  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
111 
113 
117 
118  bool myStoreMapping, myPassAll;
120  //TMapId myIn2OutId;
121 
122 private:
127 };
128 
129 #ifdef WIN32
130 #pragma warning ( default:4251 )
131 #endif
132 
133 #endif
#define VTKVIEWER_EXPORT
Definition: VTKViewer.h:33
Definition: VTKViewer_ExtractUnstructuredGrid.h:45
void SetModeOfExtraction(EExtraction theExtractionMode)
Sets mode of extraction to theExtractionMode.
Definition: VTKViewer_ExtractUnstructuredGrid.h:55
void operator=(const VTKViewer_ExtractUnstructuredGrid &)
Not implemented.
void SetModeOfChanging(EChanging theChangeMode)
Sets mode of changing to theChangeMode.
Definition: VTKViewer_ExtractUnstructuredGrid.h:63
int GetStoreMapping()
Get myStoreMapping.
Definition: VTKViewer_ExtractUnstructuredGrid.h:93
std::vector< vtkIdType > TVectorId
Gets the output id by input id.
Definition: VTKViewer_ExtractUnstructuredGrid.h:102
bool myPassAll
Definition: VTKViewer_ExtractUnstructuredGrid.h:118
EChanging myChangeMode
Definition: VTKViewer_ExtractUnstructuredGrid.h:114
EExtraction
Definition: VTKViewer_ExtractUnstructuredGrid.h:53
@ eCells
Definition: VTKViewer_ExtractUnstructuredGrid.h:53
int IsCellsWithTypeRegistered()
Check if myCellTypes is empty.
Definition: VTKViewer_ExtractUnstructuredGrid.h:81
std::map< vtkIdType, vtkIdType > TMapId
Definition: VTKViewer_ExtractUnstructuredGrid.h:103
EExtraction GetModeOfExtraction()
Get Extraction mode (Return: myExtractionMode field)
Definition: VTKViewer_ExtractUnstructuredGrid.h:59
vtkTypeMacro(VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridAlgorithm) static VTKViewer_ExtractUnstructuredGrid *New()
VTK type macros.
EChanging
Definition: VTKViewer_ExtractUnstructuredGrid.h:61
@ eAdding
Definition: VTKViewer_ExtractUnstructuredGrid.h:61
void ClearRegisteredCellsWithType()
Remove every cells with the type from the output.
Definition: VTKViewer_ExtractUnstructuredGrid.h:83
int IsChanging()
Do the filter do some real work.
Definition: VTKViewer_ExtractUnstructuredGrid.h:88
int IsCellsRegistered()
Check if myCellIds is empty.
Definition: VTKViewer_ExtractUnstructuredGrid.h:72
std::set< vtkIdType > TSetId
Definition: VTKViewer_ExtractUnstructuredGrid.h:104
EChanging GetModeOfChanging()
Return myChangeMode field.
Definition: VTKViewer_ExtractUnstructuredGrid.h:67
TSetId myCellTypes
Definition: VTKViewer_ExtractUnstructuredGrid.h:116
TVectorId myOut2InId
Definition: VTKViewer_ExtractUnstructuredGrid.h:119
EExtraction myExtractionMode
Definition: VTKViewer_ExtractUnstructuredGrid.h:112
void ClearRegisteredCells()
Remove the cell from the output.
Definition: VTKViewer_ExtractUnstructuredGrid.h:74
TSetId myCellIds
Definition: VTKViewer_ExtractUnstructuredGrid.h:115
VTKViewer_ExtractUnstructuredGrid(const VTKViewer_ExtractUnstructuredGrid &)
Not implemented.
For more information see VTK documentation