X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_ExtractUnstructuredGrid.h;h=897de6f556600abf212e96e8aeff2bed42fee6a4;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=a820bd25ba95abbb856b87c13e4ee20e80a9cd0e;hpb=232b55569765049c7d1cceb5096a45f8584c9369;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h index a820bd25b..897de6f55 100755 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h @@ -1,42 +1,51 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H #define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H #include "VTKViewer.h" -#include +#include #include #include #include -/*! \class vtkUnstructuredGridToUnstructuredGridFilter + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! \class vtkUnstructuredGridAlgorithm * \brief For more information see VTK documentation */ -/*! \class vtkUnstructuredGridToUnstructuredGridFilter +/*! \class vtkUnstructuredGridAlgorithm * \brief For more information see VTK documentation. */ -class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter +class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridAlgorithm { public: //! VTK type macros. - vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridToUnstructuredGridFilter ); + vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridAlgorithm ); //! \brief Construct with all types of clipping turned off. static VTKViewer_ExtractUnstructuredGrid *New(); @@ -44,7 +53,7 @@ public: enum EExtraction{ eCells, ePoints}; //! Sets mode of extraction to \a theExtractionMode void SetModeOfExtraction(EExtraction theExtractionMode){ - myExtractionMode = theExtractionMode; Modified(); + if ( myExtractionMode != theExtractionMode ) { myExtractionMode = theExtractionMode; Modified(); } } //! Get Extraction mode (Return: \a myExtractionMode field) EExtraction GetModeOfExtraction(){ return myExtractionMode;} @@ -52,65 +61,63 @@ public: enum EChanging{ ePassAll, eAdding, eRemoving}; //! Sets mode of changing to \a theChangeMode void SetModeOfChanging(EChanging theChangeMode){ - myChangeMode = theChangeMode; - Modified(); + if ( myChangeMode != theChangeMode ) { myChangeMode = theChangeMode; Modified(); } } //! Return \a myChangeMode field - EChanging GetModeOfChanging(){ return myChangeMode;} + EChanging GetModeOfChanging(){ return myChangeMode; } //! Add cell id to \a myCellIds std::set void RegisterCell(vtkIdType theCellId); //! Check if myCellIds is empty. - int IsCellsRegistered() { return !myCellIds.empty();} + int IsCellsRegistered() { return !myCellIds.empty(); } //! Remove the cell from the output - void ClearRegisteredCells() { - myCellIds.clear(); - Modified(); + void ClearRegisteredCells() { + if ( !myCellIds.empty() ) { myCellIds.clear(); Modified(); } } - + //! Add cell type to \a myCellTypes std::set void RegisterCellsWithType(vtkIdType theCellType); //! Check if myCellTypes is empty. - int IsCellsWithTypeRegistered() { return !myCellTypes.empty();} + int IsCellsWithTypeRegistered() { return !myCellTypes.empty(); } //! Remove every cells with the type from the output - void ClearRegisteredCellsWithType() { - myCellTypes.clear(); - Modified(); + void ClearRegisteredCellsWithType() { + if ( !myCellTypes.empty() ) { myCellTypes.clear(); Modified(); } } //! \brief Do the filter do some real work - int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();} + int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered(); } //! \brief Do it keep the mapping between input's and output's UnstructuredGrid void SetStoreMapping(int theStoreMapping); //! Get \a myStoreMapping - int GetStoreMapping(){ return myStoreMapping;} + int GetStoreMapping(){ return myStoreMapping; } - //! Gets the input id by output id. + //! Computes a map out IDs to in IDs. Call it before GetInputId()!!! + void BuildOut2InMap(); + //! Gets the input id by output id. Call BuildOut2InMap() before vtkIdType GetInputId(int theOutId) const; //! Gets the output id by input id. - vtkIdType GetOutputId(int theInId) const; + //vtkIdType GetOutputId(int theInId) const; - typedef std::vector TVectorId; + typedef std::vector TVectorId; typedef std::map TMapId; + typedef std::set TSetId; protected: VTKViewer_ExtractUnstructuredGrid(); ~VTKViewer_ExtractUnstructuredGrid(); - //! Main method, which calculate output - void Execute(); + virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); EExtraction myExtractionMode; EChanging myChangeMode; - typedef std::set TSetId; TSetId myCellIds; TSetId myCellTypes; - bool myStoreMapping; + bool myStoreMapping, myPassAll; TVectorId myOut2InId; - TMapId myIn2OutId; + //TMapId myIn2OutId; private: //! Not implemented. @@ -119,4 +126,8 @@ private: void operator=(const VTKViewer_ExtractUnstructuredGrid&); }; +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + #endif