-// Copyright (C) 2010-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2010-2022 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
// ParaView include
#include <pqApplicationCore.h>
#include <pqServer.h>
-#include <pqFixPathsInStateFilesBehavior.h>
+#include <vtkOutputWindow.h>
const QString PVGUI_DataModel::RESTORE_FLAG_FILE = "do_restore_paravis_references.par";
*/
namespace {
+ QStringList multiFormats()
+ {
+ static QStringList formats;
+ if ( formats.isEmpty() )
+ formats << "vtm" << "lata" << "pvd";
+ return formats;
+ }
+ void warning( const QString& message )
+ {
+ vtkOutputWindow* vtkWindow = vtkOutputWindow::GetInstance();
+ if ( vtkWindow )
+ {
+ vtkWindow->DisplayWarningText( qPrintable( message ) );
+ }
+ }
+
void processElements(QDomNode& thePropertyNode, QStringList& theFileNames,
const QString& theNewPath, bool theRestore)
{
+ QDomElement aProperty = thePropertyNode.toElement();
+ int aNbElements = aProperty.attribute("number_of_elements").toInt();
+ if ( aNbElements > 1 )
+ warning( QString("You save data file with number of entities > 1 (%1); some data may be lost!").arg(aNbElements) );
QDomNode aElementNode = thePropertyNode.firstChild();
while (aElementNode.isElement()) {
QDomElement aElement = aElementNode.toElement();
if (theNewPath.isEmpty()) {
QFileInfo aFInfo(aValue);
if (aFInfo.exists()) {
+ QString ext = aFInfo.suffix();
+ if ( multiFormats().contains(aFInfo.suffix()) )
+ warning( QString("You save data in multiple file format (%1); some data may be not saved!").arg(ext) );
theFileNames<<aValue;
aElement.setAttribute("value", aFInfo.fileName());
}
if (isMultiFile)
{
QStringList abuffer;
- abuffer.push_back(QString("def RebuildData( theStudy ):"));
+ abuffer.push_back(QString("def RebuildData():"));
QStringList lst(trace.split("\n"));
foreach(QString elem, lst)
{
processAllFilesInState(aFullPath, srcFilesEmpty, aTmpDir.toStdString().c_str(), true);
}
- pqFixPathsInStateFilesBehavior::blockDialog(true);
mod->loadParaviewState(aFullPath);
- pqFixPathsInStateFilesBehavior::blockDialog(false);
ret = true;
}
ret = true;
/*!
\brief Save data model (write ParaView pipeline to the files).
- \param listOfFiles returning list of the (temporary) files with saved data
+ \param theListOfFiles returning list of the (temporary) files with saved data
\return operation status (\c true on success and \c false on error)
*/
bool PVGUI_DataModel::save( QStringList& theListOfFiles)
\brief Save data model (write ParaView pipeline state to the files).
\param url study file path
\param study study pointer
- \param listOfFiles returning list of the (temporary) files with saved data
+ \param theListOfFiles returning list of the (temporary) files with saved data
\return operation status (\c true on success and \c false on error)
*/
-bool PVGUI_DataModel::saveAs( const QString& url, CAM_Study* study, QStringList& theListOfFiles)
+bool PVGUI_DataModel::saveAs( const QString& url, CAM_Study* /*study*/, QStringList& theListOfFiles)
{
myStudyURL = url;
return save( theListOfFiles );