mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
#3725 exportSnapshots : Add optional prefix
This commit is contained in:
parent
651084420c
commit
8a3907e531
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight 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 General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -31,27 +31,29 @@
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportSnapshots, "exportSnapshots");
|
||||
|
||||
namespace caf {
|
||||
template<>
|
||||
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
||||
{
|
||||
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
||||
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
||||
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
||||
setDefault(RicfExportSnapshots::ALL);
|
||||
}
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
|
||||
{
|
||||
addItem(RicfExportSnapshots::ALL, "ALL", "All");
|
||||
addItem(RicfExportSnapshots::VIEWS, "VIEWS", "Views");
|
||||
addItem(RicfExportSnapshots::PLOTS, "PLOTS", "Plots");
|
||||
setDefault(RicfExportSnapshots::ALL);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSnapshots::RicfExportSnapshots()
|
||||
{
|
||||
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
||||
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
|
||||
RICF_InitField(&m_prefix, "prefix", QString(), "Prefix", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSnapshots::execute()
|
||||
{
|
||||
@ -67,11 +69,11 @@ void RicfExportSnapshots::execute()
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
||||
}
|
||||
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
|
||||
{
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir);
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(absolutePathToSnapshotDir, m_prefix);
|
||||
}
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
|
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight 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 General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -48,4 +48,5 @@ public:
|
||||
|
||||
private:
|
||||
caf::PdmField<SnapshotsTypeEnum> m_type;
|
||||
};
|
||||
caf::PdmField<QString> m_prefix;
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QString snapshotFolderName)
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(const QString& snapshotFolderName, const QString& prefix)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@ -91,6 +91,11 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QStrin
|
||||
if (viewWindow->isMdiWindow() && viewWindow->viewWidget())
|
||||
{
|
||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(viewWindow);
|
||||
if (!prefix.isEmpty())
|
||||
{
|
||||
fileName = prefix + fileName;
|
||||
}
|
||||
|
||||
fileName.replace(" ", "_");
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
|
@ -32,7 +32,7 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature
|
||||
public:
|
||||
static void saveAllPlots();
|
||||
|
||||
static void exportSnapshotOfAllPlotsIntoFolder(QString snapshotFolderName);
|
||||
static void exportSnapshotOfAllPlotsIntoFolder(const QString& snapshotFolderName, const QString& prefix = "");
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
@ -70,7 +70,7 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QString snapshotFolderName)
|
||||
void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(const QString& snapshotFolderName, const QString& prefix)
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
@ -114,6 +114,10 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QStrin
|
||||
viewer->repaint();
|
||||
|
||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName(riv);
|
||||
if (!prefix.isEmpty())
|
||||
{
|
||||
fileName = prefix + fileName;
|
||||
}
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
|
||||
|
@ -32,7 +32,7 @@ class RicSnapshotAllViewsToFileFeature : public caf::CmdFeature
|
||||
public:
|
||||
static void saveAllViews();
|
||||
|
||||
static void exportSnapshotOfAllViewsIntoFolder(QString snapshotFolderName);
|
||||
static void exportSnapshotOfAllViewsIntoFolder(const QString& snapshotFolderName, const QString& prefix = "");
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
Loading…
Reference in New Issue
Block a user