mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 17:02:13 -05:00
#4087 Ensemble : When importing and ensemble, show by default an ensemble plot
This commit is contained in:
1 parent
3acd426ead
commit
ba91122ba6
5 files changed
+172
-112
No files matched your search
@@ -1,17 +1,17 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2016- Statoil ASA
|
// Copyright (C) 2016- Statoil ASA
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
// 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.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -21,11 +21,12 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaPreferences.h"
|
#include "RiaPreferences.h"
|
||||||
|
|
||||||
#include "RicImportSummaryCasesFeature.h"
|
|
||||||
#include "RicCreateSummaryCaseCollectionFeature.h"
|
#include "RicCreateSummaryCaseCollectionFeature.h"
|
||||||
|
#include "RicImportSummaryCasesFeature.h"
|
||||||
|
|
||||||
#include "RifSummaryCaseRestartSelector.h"
|
#include "RifSummaryCaseRestartSelector.h"
|
||||||
|
|
||||||
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimGridSummaryCase.h"
|
#include "RimGridSummaryCase.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
@@ -33,24 +34,24 @@
|
|||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
#include "RimSummaryPlotCollection.h"
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindow.h"
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
|
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicImportEnsembleFeature, "RicImportEnsembleFeature");
|
CAF_CMD_SOURCE_INIT(RicImportEnsembleFeature, "RicImportEnsembleFeature");
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicImportEnsembleFeature::isCommandEnabled()
|
bool RicImportEnsembleFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
@@ -58,14 +59,15 @@ bool RicImportEnsembleFeature::isCommandEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
|
void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
QString pathCacheName = "ENSEMBLE_FILES";
|
QString pathCacheName = "ENSEMBLE_FILES";
|
||||||
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble", pathCacheName);
|
QStringList fileNames =
|
||||||
|
RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble", pathCacheName);
|
||||||
|
|
||||||
if (fileNames.isEmpty()) return;
|
if (fileNames.isEmpty()) return;
|
||||||
|
|
||||||
QString ensembleName = askForEnsembleName();
|
QString ensembleName = askForEnsembleName();
|
||||||
@@ -75,13 +77,11 @@ void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
|
|||||||
RicImportSummaryCasesFeature::createSummaryCasesFromFiles(fileNames, &cases, true);
|
RicImportSummaryCasesFeature::createSummaryCasesFromFiles(fileNames, &cases, true);
|
||||||
|
|
||||||
RicImportSummaryCasesFeature::addSummaryCases(cases);
|
RicImportSummaryCasesFeature::addSummaryCases(cases);
|
||||||
auto newGroup = RicCreateSummaryCaseCollectionFeature::groupSummaryCases(cases, ensembleName, true);
|
RimSummaryCaseCollection* ensemble = RicCreateSummaryCaseCollectionFeature::groupSummaryCases(cases, ensembleName, true);
|
||||||
|
|
||||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
if (ensemble)
|
||||||
if (mainPlotWindow && newGroup)
|
|
||||||
{
|
{
|
||||||
mainPlotWindow->selectAsCurrentItem(newGroup);
|
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(ensemble);
|
||||||
mainPlotWindow->updateSummaryPlotToolBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RimCase*> allCases;
|
std::vector<RimCase*> allCases;
|
||||||
@@ -94,7 +94,7 @@ void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportEnsembleFeature::setupActionLook(QAction* actionToSetup)
|
void RicImportEnsembleFeature::setupActionLook(QAction* actionToSetup)
|
||||||
{
|
{
|
||||||
@@ -103,13 +103,14 @@ void RicImportEnsembleFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RicImportEnsembleFeature::askForEnsembleName()
|
QString RicImportEnsembleFeature::askForEnsembleName()
|
||||||
{
|
{
|
||||||
RimProject* project = RiaApplication::instance()->project();
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
|
std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
|
||||||
int ensembleCount = std::count_if(groups.begin(), groups.end(), [](RimSummaryCaseCollection* group) { return group->isEnsemble(); });
|
int ensembleCount =
|
||||||
|
std::count_if(groups.begin(), groups.end(), [](RimSummaryCaseCollection* group) { return group->isEnsemble(); });
|
||||||
ensembleCount += 1;
|
ensembleCount += 1;
|
||||||
|
|
||||||
QInputDialog dialog;
|
QInputDialog dialog;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2016- Statoil ASA
|
// Copyright (C) 2016- Statoil ASA
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
// 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.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "RifSummaryCaseRestartSelector.h"
|
#include "RifSummaryCaseRestartSelector.h"
|
||||||
|
|
||||||
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimGridSummaryCase.h"
|
#include "RimGridSummaryCase.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
@@ -35,11 +36,13 @@
|
|||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
#include "RimSummaryPlotCollection.h"
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindow.h"
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
|
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
@@ -51,15 +54,14 @@
|
|||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicImportSummaryCasesFeature, "RicImportSummaryCasesFeature");
|
CAF_CMD_SOURCE_INIT(RicImportSummaryCasesFeature, "RicImportSummaryCasesFeature");
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RicImportSummaryCasesFeature::m_pathFilter = "*";
|
QString RicImportSummaryCasesFeature::m_pathFilter = "*";
|
||||||
QString RicImportSummaryCasesFeature::m_fileNameFilter = "*";
|
QString RicImportSummaryCasesFeature::m_fileNameFilter = "*";
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicImportSummaryCasesFeature::isCommandEnabled()
|
bool RicImportSummaryCasesFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
@@ -67,22 +69,27 @@ bool RicImportSummaryCasesFeature::isCommandEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
|
void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
QString pathCacheName = "INPUT_FILES";
|
QString pathCacheName = "INPUT_FILES";
|
||||||
QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases", pathCacheName);
|
QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases", pathCacheName);
|
||||||
|
|
||||||
std::vector<RimSummaryCase*> cases;
|
std::vector<RimSummaryCase*> cases;
|
||||||
if (!fileNames.isEmpty()) createSummaryCasesFromFiles(fileNames, &cases);
|
if (!fileNames.isEmpty()) createSummaryCasesFromFiles(fileNames, &cases);
|
||||||
|
|
||||||
addSummaryCases(cases);
|
addSummaryCases(cases);
|
||||||
|
if (!cases.empty())
|
||||||
|
{
|
||||||
|
createNewPlot(cases.front());
|
||||||
|
}
|
||||||
|
|
||||||
addCasesToGroupIfRelevant(cases);
|
addCasesToGroupIfRelevant(cases);
|
||||||
|
|
||||||
for (const auto& rimCase : cases) RiaApplication::instance()->addToRecentFiles(rimCase->summaryHeaderFilename());
|
for (const auto& rimCase : cases)
|
||||||
|
RiaApplication::instance()->addToRecentFiles(rimCase->summaryHeaderFilename());
|
||||||
|
|
||||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||||
if (mainPlotWindow && !cases.empty())
|
if (mainPlotWindow && !cases.empty())
|
||||||
@@ -102,7 +109,7 @@ void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportSummaryCasesFeature::setupActionLook(QAction* actionToSetup)
|
void RicImportSummaryCasesFeature::setupActionLook(QAction* actionToSetup)
|
||||||
{
|
{
|
||||||
@@ -111,17 +118,22 @@ void RicImportSummaryCasesFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStringList& fileNames, std::vector<RimSummaryCase*>* newCases)
|
bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStringList& fileNames,
|
||||||
|
std::vector<RimSummaryCase*>* newCases)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
|
||||||
std::vector<RimSummaryCase*> temp;
|
std::vector<RimSummaryCase*> temp;
|
||||||
std::vector<RimSummaryCase*>* cases = newCases ? newCases : &temp;
|
std::vector<RimSummaryCase*>* cases = newCases ? newCases : &temp;
|
||||||
if (createSummaryCasesFromFiles(fileNames, cases))
|
if (createSummaryCasesFromFiles(fileNames, cases))
|
||||||
{
|
{
|
||||||
addSummaryCases(*cases);
|
addSummaryCases(*cases);
|
||||||
|
if (!cases->empty())
|
||||||
|
{
|
||||||
|
createNewPlot(cases->back());
|
||||||
|
}
|
||||||
|
|
||||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||||
if (mainPlotWindow && !cases->empty())
|
if (mainPlotWindow && !cases->empty())
|
||||||
@@ -145,20 +157,21 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStri
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles(const QStringList& fileNames,
|
bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles(const QStringList& fileNames,
|
||||||
std::vector<RimSummaryCase*>* newCases,
|
std::vector<RimSummaryCase*>* newCases,
|
||||||
bool ensembleOrGroup)
|
bool ensembleOrGroup)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
RimProject* proj = app->project();
|
RimProject* proj = app->project();
|
||||||
RimSummaryCaseMainCollection* sumCaseColl = proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
RimSummaryCaseMainCollection* sumCaseColl =
|
||||||
|
proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||||
|
|
||||||
if (newCases) newCases->clear();
|
if (newCases) newCases->clear();
|
||||||
if (!sumCaseColl) return false;
|
if (!sumCaseColl) return false;
|
||||||
|
|
||||||
RifSummaryCaseRestartSelector fileSelector;
|
RifSummaryCaseRestartSelector fileSelector;
|
||||||
fileSelector.setEnsembleOrGroupMode(ensembleOrGroup);
|
fileSelector.setEnsembleOrGroupMode(ensembleOrGroup);
|
||||||
fileSelector.determineFilesToImportFromSummaryFiles(fileNames);
|
fileSelector.determineFilesToImportFromSummaryFiles(fileNames);
|
||||||
|
|
||||||
@@ -181,25 +194,21 @@ bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles(const QStringList
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportSummaryCasesFeature::addSummaryCases(const std::vector<RimSummaryCase*> cases)
|
void RicImportSummaryCasesFeature::addSummaryCases(const std::vector<RimSummaryCase*> cases)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
RimProject* proj = app->project();
|
RimProject* proj = app->project();
|
||||||
RimSummaryCaseMainCollection* sumCaseColl = proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
RimSummaryCaseMainCollection* sumCaseColl =
|
||||||
|
proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||||
sumCaseColl->addCases(cases);
|
sumCaseColl->addCases(cases);
|
||||||
|
|
||||||
if (!cases.empty())
|
|
||||||
{
|
|
||||||
RicNewSummaryCurveFeature::createNewPlot(proj->mainPlotCollection->summaryPlotCollection(), cases.front());
|
|
||||||
}
|
|
||||||
|
|
||||||
sumCaseColl->updateAllRequiredEditors();
|
sumCaseColl->updateAllRequiredEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases)
|
void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases)
|
||||||
{
|
{
|
||||||
@@ -207,8 +216,8 @@ void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vector<R
|
|||||||
|
|
||||||
if (selectedColl.size() == 1)
|
if (selectedColl.size() == 1)
|
||||||
{
|
{
|
||||||
RimSummaryCaseCollection* coll = selectedColl.front();
|
RimSummaryCaseCollection* coll = selectedColl.front();
|
||||||
RimSummaryCaseMainCollection* mainColl;
|
RimSummaryCaseMainCollection* mainColl;
|
||||||
coll->firstAncestorOrThisOfType(mainColl);
|
coll->firstAncestorOrThisOfType(mainColl);
|
||||||
|
|
||||||
if (mainColl)
|
if (mainColl)
|
||||||
@@ -224,23 +233,30 @@ void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vector<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportSummaryCasesFeature::createNewPlot(RimSummaryCase* summaryCase)
|
||||||
|
{
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
RimProject* proj = app->project();
|
||||||
|
|
||||||
|
RicNewSummaryCurveFeature::createNewPlot(proj->mainPlotCollection->summaryPlotCollection(), summaryCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle,
|
QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle,
|
||||||
const QString& pathCacheName)
|
const QString& pathCacheName)
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
QString defaultDir = app->lastUsedDialogDirectory(pathCacheName);
|
QString defaultDir = app->lastUsedDialogDirectory(pathCacheName);
|
||||||
|
|
||||||
RicFileHierarchyDialogResult result = RicFileHierarchyDialog::runRecursiveSearchDialog(nullptr,
|
RicFileHierarchyDialogResult result = RicFileHierarchyDialog::runRecursiveSearchDialog(
|
||||||
dialogTitle,
|
nullptr, dialogTitle, defaultDir, m_pathFilter, m_fileNameFilter, QStringList(".SMSPEC"));
|
||||||
defaultDir,
|
|
||||||
m_pathFilter,
|
|
||||||
m_fileNameFilter,
|
|
||||||
QStringList(".SMSPEC"));
|
|
||||||
|
|
||||||
// Remember filters
|
// Remember filters
|
||||||
m_pathFilter = result.pathFilter;
|
m_pathFilter = result.pathFilter;
|
||||||
m_fileNameFilter = result.fileNameFilter;
|
m_fileNameFilter = result.fileNameFilter;
|
||||||
|
|
||||||
if (!result.ok) return QStringList();
|
if (!result.ok) return QStringList();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
static bool createSummaryCasesFromFiles(const QStringList& fileName, std::vector<RimSummaryCase*>* newCases, bool ensembleOrGroup = false);
|
static bool createSummaryCasesFromFiles(const QStringList& fileName, std::vector<RimSummaryCase*>* newCases, bool ensembleOrGroup = false);
|
||||||
static void addSummaryCases(const std::vector<RimSummaryCase*> cases);
|
static void addSummaryCases(const std::vector<RimSummaryCase*> cases);
|
||||||
static void addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases);
|
static void addCasesToGroupIfRelevant(const std::vector<RimSummaryCase*> cases);
|
||||||
|
static void createNewPlot(RimSummaryCase* summaryCase);
|
||||||
|
|
||||||
static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle, const QString& pathCacheName);
|
static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle, const QString& pathCacheName);
|
||||||
|
|
||||||
|
|||||||
+65
-32
@@ -1,17 +1,17 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2016- Statoil ASA
|
// Copyright (C) 2016- Statoil ASA
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
// 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.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -21,17 +21,17 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaColorTables.h"
|
#include "RiaColorTables.h"
|
||||||
|
|
||||||
|
#include "RiaSummaryTools.h"
|
||||||
|
#include "RimEnsembleCurveSet.h"
|
||||||
|
#include "RimEnsembleCurveSetCollection.h"
|
||||||
|
#include "RimEnsembleCurveSetColorManager.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RiaSummaryTools.h"
|
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
#include "RimSummaryPlotCollection.h"
|
#include "RimSummaryPlotCollection.h"
|
||||||
#include "RimEnsembleCurveSet.h"
|
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
|
||||||
#include "RimEnsembleCurveSetColorManager.h"
|
|
||||||
|
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
@@ -43,11 +43,60 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicNewSummaryEnsembleCurveSetFeature, "RicNewSummaryEnsembleCurveSetFeature");
|
CAF_CMD_SOURCE_INIT(RicNewSummaryEnsembleCurveSetFeature, "RicNewSummaryEnsembleCurveSetFeature");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimEnsembleCurveSet* RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(RimSummaryPlot* plot,
|
||||||
|
RimSummaryCaseCollection* ensemble)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(plot && ensemble);
|
||||||
|
|
||||||
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
CVF_ASSERT(project);
|
||||||
|
|
||||||
|
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
||||||
|
|
||||||
|
// Use same counting as RicNewSummaryCurveFeature::onActionTriggered
|
||||||
|
auto colorIndex = plot->singleColorCurveCount();
|
||||||
|
curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex));
|
||||||
|
curveSet->legendConfig()->setColorRange(
|
||||||
|
RimEnsembleCurveSetColorManager::cycledEnsembleColorRange(static_cast<int>(colorIndex)));
|
||||||
|
|
||||||
|
curveSet->setSummaryCaseCollection(ensemble);
|
||||||
|
curveSet->setSummaryAddress(RifEclipseSummaryAddress::fieldAddress("FOPT"));
|
||||||
|
|
||||||
|
plot->ensembleCurveSetCollection()->addCurveSet(curveSet);
|
||||||
|
|
||||||
|
return curveSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble)
|
||||||
|
{
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
RimProject* proj = app->project();
|
||||||
|
|
||||||
|
RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection();
|
||||||
|
RimSummaryPlot* plot = summaryPlotCollection->createSummaryPlotWithAutoTitle();
|
||||||
|
|
||||||
|
RimEnsembleCurveSet* curveSet = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(plot, ensemble);
|
||||||
|
plot->loadDataAndUpdate();
|
||||||
|
summaryPlotCollection->updateConnectedEditors();
|
||||||
|
|
||||||
|
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||||
|
if (mainPlotWindow)
|
||||||
|
{
|
||||||
|
mainPlotWindow->selectAsCurrentItem(curveSet);
|
||||||
|
mainPlotWindow->updateSummaryPlotToolBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicNewSummaryEnsembleCurveSetFeature::isCommandEnabled()
|
bool RicNewSummaryEnsembleCurveSetFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
@@ -55,7 +104,7 @@ bool RicNewSummaryEnsembleCurveSetFeature::isCommandEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
|
void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
@@ -65,30 +114,14 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
|
|||||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||||
if (plot)
|
if (plot)
|
||||||
{
|
{
|
||||||
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
auto ensemble = project->summaryGroups().back();
|
||||||
|
|
||||||
// Use same counting as RicNewSummaryCurveFeature::onActionTriggered
|
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(ensemble);
|
||||||
auto colorIndex = plot->singleColorCurveCount();
|
|
||||||
curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex));
|
|
||||||
curveSet->legendConfig()->setColorRange(RimEnsembleCurveSetColorManager::cycledEnsembleColorRange(static_cast<int>(colorIndex)));
|
|
||||||
|
|
||||||
if (!project->summaryGroups().empty())
|
|
||||||
{
|
|
||||||
curveSet->setSummaryCaseCollection(project->summaryGroups().back());
|
|
||||||
}
|
|
||||||
|
|
||||||
plot->ensembleCurveSetCollection()->addCurveSet(curveSet);
|
|
||||||
plot->updateConnectedEditors();
|
|
||||||
|
|
||||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(curveSet);
|
|
||||||
|
|
||||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
|
||||||
mainPlotWindow->updateSummaryPlotToolBar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewSummaryEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetup)
|
void RicNewSummaryEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetup)
|
||||||
{
|
{
|
||||||
@@ -97,13 +130,13 @@ void RicNewSummaryEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetu
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryPlot* RicNewSummaryEnsembleCurveSetFeature::selectedSummaryPlot() const
|
RimSummaryPlot* RicNewSummaryEnsembleCurveSetFeature::selectedSummaryPlot() const
|
||||||
{
|
{
|
||||||
RimSummaryPlot* sumPlot = nullptr;
|
RimSummaryPlot* sumPlot = nullptr;
|
||||||
|
|
||||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||||
if (selObj)
|
if (selObj)
|
||||||
{
|
{
|
||||||
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
||||||
|
|||||||
+16
-7
@@ -1,17 +1,17 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2016- Statoil ASA
|
// Copyright (C) 2016- Statoil ASA
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
// 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.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -23,18 +23,27 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
|
class RimEnsembleCurveSet;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RicNewSummaryEnsembleCurveSetFeature : public caf::CmdFeature
|
class RicNewSummaryEnsembleCurveSetFeature : public caf::CmdFeature
|
||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides
|
// Overrides
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered(bool isChecked) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static RimEnsembleCurveSet* addDefaultCurveSet(RimSummaryPlot* plot, RimSummaryCaseCollection* ensemble);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RimSummaryPlot* selectedSummaryPlot() const;
|
RimSummaryPlot* selectedSummaryPlot() const;
|
||||||
|
|||||||
Reference in new issue
Block a user