From: YOANN AUDOUIN Date: Tue, 13 Apr 2021 12:24:00 +0000 (+0200) Subject: Issues/Warnings detected by Paraview 5.9 in some plugins X-Git-Tag: V9_7_0rc2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e8fcc7983f67ab45ad8978c61d9fd54979720b1;p=tools%2Fparavisaddons_common.git Issues/Warnings detected by Paraview 5.9 in some plugins --- diff --git a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/CMakeLists.txt b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/CMakeLists.txt index d5c5fc4..a5ea190 100644 --- a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/CMakeLists.txt +++ b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/CMakeLists.txt @@ -19,7 +19,7 @@ set(classes vtkElectromagnetismRotation - vtkPVMetaDataInformation + vtkPVMetaDataInformationERIO ) vtk_module_add_module(ElectromagnetismRotationIO diff --git a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.cxx b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.cxx deleted file mode 100644 index 975fa12..0000000 --- a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.cxx +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D -// -// 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, 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 -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay - -#include "vtkPVMetaDataInformation.h" - -#include "vtkAlgorithm.h" -#include "vtkAlgorithmOutput.h" -#include "vtkClientServerStream.h" -#include "vtkExecutive.h" -#include "vtkDataObject.h" -#include "vtkGenericDataObjectReader.h" -#include "vtkGenericDataObjectWriter.h" -#include "vtkInformationDataObjectMetaDataKey.h" -#include "vtkInformation.h" -#include "vtkObjectFactory.h" - -#include "MEDCouplingRefCountObject.hxx" - -#include - -vtkStandardNewMacro(vtkPVMetaDataInformation); -vtkCxxSetObjectMacro(vtkPVMetaDataInformation, InformationData, vtkDataObject); - -static vtkInformationDataObjectMetaDataKey* GetMEDReaderMetaDataIfAny() -{ - static const char ZE_KEY[] = "vtkMEDReader::META_DATA"; - MEDCoupling::GlobalDict* gd(MEDCoupling::GlobalDict::GetInstance()); - if (!gd->hasKey(ZE_KEY)) - return 0; - std::string ptSt(gd->value(ZE_KEY)); - void* pt(0); - std::istringstream iss(ptSt); - iss >> pt; - return reinterpret_cast(pt); -} - -//---------------------------------------------------------------------------- -vtkPVMetaDataInformation::vtkPVMetaDataInformation() -{ - this->InformationData = NULL; -} - -//---------------------------------------------------------------------------- -vtkPVMetaDataInformation::~vtkPVMetaDataInformation() -{ - this->SetInformationData(NULL); -} - -//---------------------------------------------------------------------------- -void vtkPVMetaDataInformation::CopyFromObject(vtkObject* obj) -{ - this->SetInformationData(NULL); - - vtkAlgorithmOutput* algOutput = vtkAlgorithmOutput::SafeDownCast(obj); - if (!algOutput) - { - vtkAlgorithm* alg = vtkAlgorithm::SafeDownCast(obj); - if (alg) - { - algOutput = alg->GetOutputPort(0); - } - - } - if (!algOutput) - { - vtkErrorMacro("Information can only be gathered from a vtkAlgorithmOutput."); - return; - } - - vtkAlgorithm* reader = algOutput->GetProducer(); - vtkInformation* info = reader->GetExecutive()->GetOutputInformation( - algOutput->GetIndex()); - - if (info && info->Has(GetMEDReaderMetaDataIfAny())) - { - this->SetInformationData(vtkDataObject::SafeDownCast(info->Get(GetMEDReaderMetaDataIfAny()))); - } -} - -//---------------------------------------------------------------------------- -void vtkPVMetaDataInformation::CopyToStream(vtkClientServerStream* css) -{ - css->Reset(); - if (!this->InformationData) - { - *css << vtkClientServerStream::Reply - << vtkClientServerStream::InsertArray( - static_cast(NULL), 0) - << vtkClientServerStream::End; - return; - } - - vtkDataObject* clone = this->InformationData->NewInstance(); - clone->ShallowCopy(this->InformationData); - - vtkGenericDataObjectWriter* writer = vtkGenericDataObjectWriter::New(); - writer->SetFileTypeToBinary(); - writer->WriteToOutputStringOn(); - writer->SetInputData(clone); - writer->Write(); - - *css << vtkClientServerStream::Reply - << vtkClientServerStream::InsertArray( - writer->GetBinaryOutputString(), - writer->GetOutputStringLength()) - << vtkClientServerStream::End; - writer->RemoveAllInputs(); - writer->Delete(); - clone->Delete(); -} - -//---------------------------------------------------------------------------- -void vtkPVMetaDataInformation::CopyFromStream(const vtkClientServerStream* css) -{ - this->SetInformationData(0); - vtkTypeUInt32 length; - if (css->GetArgumentLength(0, 0, &length) && length > 0) - { - unsigned char* raw_data = new unsigned char[length]; - css->GetArgument(0, 0, raw_data, length); - vtkGenericDataObjectReader* reader = vtkGenericDataObjectReader::New(); - reader->SetBinaryInputString(reinterpret_cast(raw_data), length); - reader->ReadFromInputStringOn(); - delete []raw_data; - reader->Update(); - this->SetInformationData(reader->GetOutput()); - reader->Delete(); - } -} - -void vtkPVMetaDataInformation::AddInformation(vtkPVInformation*) -{ -} - -//---------------------------------------------------------------------------- -void vtkPVMetaDataInformation::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os, indent); - os << indent << "InformationData: " << this->InformationData << endl; -} diff --git a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.h b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.h deleted file mode 100644 index b2f3133..0000000 --- a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformation.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D -// -// 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, 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 -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay - -#ifndef __vtkPVMetaDataInformation_h -#define __vtkPVMetaDataInformation_h - -#include "vtkPVInformation.h" - -class vtkDataObject; -class vtkInformationDataObjectKey; - -class VTK_EXPORT vtkPVMetaDataInformation : public vtkPVInformation -{ -public: - static vtkPVMetaDataInformation* New(); - vtkTypeMacro(vtkPVMetaDataInformation, vtkPVInformation); - void PrintSelf(ostream& os, vtkIndent indent); - - // Description: - // Transfer information about a single object into this object. - virtual void CopyFromObject(vtkObject*); - - //BTX - // Description: - // Manage a serialized version of the information. - virtual void CopyToStream(vtkClientServerStream*); - virtual void CopyFromStream(const vtkClientServerStream*); - virtual void AddInformation(vtkPVInformation*); - //ETX - - // Description: - // Returns the Information Data. - vtkGetObjectMacro(InformationData, vtkDataObject); - -//BTX -protected: - vtkPVMetaDataInformation(); - ~vtkPVMetaDataInformation(); - void SetInformationData(vtkDataObject*); - vtkDataObject* InformationData; - -private: - vtkPVMetaDataInformation(const vtkPVMetaDataInformation&); // Not implemented - void operator=(const vtkPVMetaDataInformation&); // Not implemented -//ETX -}; - -#endif diff --git a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.cxx b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.cxx new file mode 100644 index 0000000..7457418 --- /dev/null +++ b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.cxx @@ -0,0 +1,157 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D +// +// 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, 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay + +#include "vtkPVMetaDataInformationERIO.h" + +#include "vtkAlgorithm.h" +#include "vtkAlgorithmOutput.h" +#include "vtkClientServerStream.h" +#include "vtkExecutive.h" +#include "vtkDataObject.h" +#include "vtkGenericDataObjectReader.h" +#include "vtkGenericDataObjectWriter.h" +#include "vtkInformationDataObjectMetaDataKey.h" +#include "vtkInformation.h" +#include "vtkObjectFactory.h" + +#include "MEDCouplingRefCountObject.hxx" + +#include + +vtkStandardNewMacro(vtkPVMetaDataInformationERIO); +vtkCxxSetObjectMacro(vtkPVMetaDataInformationERIO, InformationData, vtkDataObject); + +static vtkInformationDataObjectMetaDataKey* GetMEDReaderMetaDataIfAny() +{ + static const char ZE_KEY[] = "vtkMEDReader::META_DATA"; + MEDCoupling::GlobalDict* gd(MEDCoupling::GlobalDict::GetInstance()); + if (!gd->hasKey(ZE_KEY)) + return 0; + std::string ptSt(gd->value(ZE_KEY)); + void* pt(0); + std::istringstream iss(ptSt); + iss >> pt; + return reinterpret_cast(pt); +} + +//---------------------------------------------------------------------------- +vtkPVMetaDataInformationERIO::vtkPVMetaDataInformationERIO() +{ + this->InformationData = NULL; +} + +//---------------------------------------------------------------------------- +vtkPVMetaDataInformationERIO::~vtkPVMetaDataInformationERIO() +{ + this->SetInformationData(NULL); +} + +//---------------------------------------------------------------------------- +void vtkPVMetaDataInformationERIO::CopyFromObject(vtkObject* obj) +{ + this->SetInformationData(NULL); + + vtkAlgorithmOutput* algOutput = vtkAlgorithmOutput::SafeDownCast(obj); + if (!algOutput) + { + vtkAlgorithm* alg = vtkAlgorithm::SafeDownCast(obj); + if (alg) + { + algOutput = alg->GetOutputPort(0); + } + + } + if (!algOutput) + { + vtkErrorMacro("Information can only be gathered from a vtkAlgorithmOutput."); + return; + } + + vtkAlgorithm* reader = algOutput->GetProducer(); + vtkInformation* info = reader->GetExecutive()->GetOutputInformation( + algOutput->GetIndex()); + + if (info && info->Has(GetMEDReaderMetaDataIfAny())) + { + this->SetInformationData(vtkDataObject::SafeDownCast(info->Get(GetMEDReaderMetaDataIfAny()))); + } +} + +//---------------------------------------------------------------------------- +void vtkPVMetaDataInformationERIO::CopyToStream(vtkClientServerStream* css) +{ + css->Reset(); + if (!this->InformationData) + { + *css << vtkClientServerStream::Reply + << vtkClientServerStream::InsertArray( + static_cast(NULL), 0) + << vtkClientServerStream::End; + return; + } + + vtkDataObject* clone = this->InformationData->NewInstance(); + clone->ShallowCopy(this->InformationData); + + vtkGenericDataObjectWriter* writer = vtkGenericDataObjectWriter::New(); + writer->SetFileTypeToBinary(); + writer->WriteToOutputStringOn(); + writer->SetInputData(clone); + writer->Write(); + + *css << vtkClientServerStream::Reply + << vtkClientServerStream::InsertArray( + writer->GetBinaryOutputString(), + writer->GetOutputStringLength()) + << vtkClientServerStream::End; + writer->RemoveAllInputs(); + writer->Delete(); + clone->Delete(); +} + +//---------------------------------------------------------------------------- +void vtkPVMetaDataInformationERIO::CopyFromStream(const vtkClientServerStream* css) +{ + this->SetInformationData(0); + vtkTypeUInt32 length; + if (css->GetArgumentLength(0, 0, &length) && length > 0) + { + unsigned char* raw_data = new unsigned char[length]; + css->GetArgument(0, 0, raw_data, length); + vtkGenericDataObjectReader* reader = vtkGenericDataObjectReader::New(); + reader->SetBinaryInputString(reinterpret_cast(raw_data), length); + reader->ReadFromInputStringOn(); + delete []raw_data; + reader->Update(); + this->SetInformationData(reader->GetOutput()); + reader->Delete(); + } +} + +void vtkPVMetaDataInformationERIO::AddInformation(vtkPVInformation*) +{ +} + +//---------------------------------------------------------------------------- +void vtkPVMetaDataInformationERIO::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os, indent); + os << indent << "InformationData: " << this->InformationData << endl; +} diff --git a/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.h b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.h new file mode 100644 index 0000000..76db423 --- /dev/null +++ b/src/ElectromagnetismRotation/plugin/ElectromagnetismRotationIO/vtkPVMetaDataInformationERIO.h @@ -0,0 +1,65 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D +// +// 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, 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay + +#ifndef __vtkPVMetaDataInformationERIO_h +#define __vtkPVMetaDataInformationERIO_h + +#include "vtkPVInformation.h" + +class vtkDataObject; +class vtkInformationDataObjectKey; + +class VTK_EXPORT vtkPVMetaDataInformationERIO : public vtkPVInformation +{ +public: + static vtkPVMetaDataInformationERIO* New(); + vtkTypeMacro(vtkPVMetaDataInformationERIO, vtkPVInformation); + void PrintSelf(ostream& os, vtkIndent indent); + + // Description: + // Transfer information about a single object into this object. + virtual void CopyFromObject(vtkObject*); + + //BTX + // Description: + // Manage a serialized version of the information. + virtual void CopyToStream(vtkClientServerStream*); + virtual void CopyFromStream(const vtkClientServerStream*); + virtual void AddInformation(vtkPVInformation*); + //ETX + + // Description: + // Returns the Information Data. + vtkGetObjectMacro(InformationData, vtkDataObject); + +//BTX +protected: + vtkPVMetaDataInformationERIO(); + ~vtkPVMetaDataInformationERIO(); + void SetInformationData(vtkDataObject*); + vtkDataObject* InformationData; + +private: + vtkPVMetaDataInformationERIO(const vtkPVMetaDataInformationERIO&); // Not implemented + void operator=(const vtkPVMetaDataInformationERIO&); // Not implemented +//ETX +}; + +#endif diff --git a/src/ElectromagnetismRotation/plugin/ParaViewPlugin/pqElectroRotationGroupWidget.cxx b/src/ElectromagnetismRotation/plugin/ParaViewPlugin/pqElectroRotationGroupWidget.cxx index 0ee85e5..6dbcb6b 100644 --- a/src/ElectromagnetismRotation/plugin/ParaViewPlugin/pqElectroRotationGroupWidget.cxx +++ b/src/ElectromagnetismRotation/plugin/ParaViewPlugin/pqElectroRotationGroupWidget.cxx @@ -21,7 +21,7 @@ #include "pqElectroRotationGroupWidget.h" #include "vtkElectromagnetismRotation.h" -#include "vtkPVMetaDataInformation.h" +#include "vtkPVMetaDataInformationERIO.h" #include "pqTreeWidget.h" #include "pqTreeWidgetItemObject.h" @@ -51,7 +51,7 @@ pqElectroRotationGroupWidget::~pqElectroRotationGroupWidget() void pqElectroRotationGroupWidget::loadTreeWidgetItems() { // Recover Graph - vtkPVMetaDataInformation *info(vtkPVMetaDataInformation::New()); + vtkPVMetaDataInformationERIO *info(vtkPVMetaDataInformationERIO::New()); this->proxy()->GatherInformation(info); vtkGraph* graph = vtkGraph::SafeDownCast(info->GetInformationData()); if(!graph) @@ -152,7 +152,7 @@ void pqElectroRotationGroupWidget::loadTreeWidgetItems() // Tooltip grpItem->setData(0, Qt::ToolTipRole, name); - + grpItem->setData(0, Qt::DecorationRole, QPixmap(":/ParaViewResources/Icons/pqCellData16.png")); } } diff --git a/src/ElectromagnetismStreamTraceur/plugin/filters.xml b/src/ElectromagnetismStreamTraceur/plugin/filters.xml index e3cbb89..68d2af8 100644 --- a/src/ElectromagnetismStreamTraceur/plugin/filters.xml +++ b/src/ElectromagnetismStreamTraceur/plugin/filters.xml @@ -58,25 +58,6 @@ the streamlines will be generated. - - - - - - - - - - - - - - - - - - - @@ -199,6 +180,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/ElectromagnetismVecteur/plugin/VecteurFilters/vtkElectromagnetismVecteur.h b/src/ElectromagnetismVecteur/plugin/VecteurFilters/vtkElectromagnetismVecteur.h index 47f9824..9cceb17 100644 --- a/src/ElectromagnetismVecteur/plugin/VecteurFilters/vtkElectromagnetismVecteur.h +++ b/src/ElectromagnetismVecteur/plugin/VecteurFilters/vtkElectromagnetismVecteur.h @@ -61,14 +61,15 @@ public: vtkSetClampMacro(MaximumNumberOfSamplePoints, int, 1, VTK_INT_MAX); vtkGetMacro(MaximumNumberOfSamplePoints, int); + static const char *GetColorArrayName(); + + protected: vtkElectromagnetismVecteur(); ~vtkElectromagnetismVecteur() override = default; int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; - static const char *GetColorArrayName(); - double ScaleFactor; int GlyphMode; diff --git a/src/ElectromagnetismVecteur/plugin/filters.xml b/src/ElectromagnetismVecteur/plugin/filters.xml index 9877144..35edcf1 100644 --- a/src/ElectromagnetismVecteur/plugin/filters.xml +++ b/src/ElectromagnetismVecteur/plugin/filters.xml @@ -31,12 +31,6 @@ - - - - - - @@ -122,7 +116,7 @@ Every Nth Point. value="1" /> - + - -