mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2819 Ensemble curves. Distinguish between summary case group and ensemble
This commit is contained in:
@@ -67,6 +67,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowGridStatisticsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicFileHierarchyDialog.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportEnsembleFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryGroupFeature.h
|
||||
)
|
||||
|
||||
|
||||
@@ -132,6 +133,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowGridStatisticsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicFileHierarchyDialog.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportEnsembleFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryGroupFeature.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ CAF_CMD_SOURCE_INIT(RicCreateSummaryCaseCollectionFeature, "RicCreateSummaryCase
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateSummaryCaseCollectionFeature::groupSummaryCases(std::vector<RimSummaryCase*> cases, const QString& groupName)
|
||||
void RicCreateSummaryCaseCollectionFeature::groupSummaryCases(std::vector<RimSummaryCase*> cases, const QString& groupName, bool isEnsemble)
|
||||
{
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection = nullptr;
|
||||
if (!cases.empty())
|
||||
{
|
||||
cases[0]->firstAncestorOrThisOfTypeAsserted(summaryCaseMainCollection);
|
||||
|
||||
summaryCaseMainCollection->addCaseCollection(cases, groupName);
|
||||
summaryCaseMainCollection->addCaseCollection(cases, groupName, isEnsemble);
|
||||
summaryCaseMainCollection->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
@@ -92,5 +92,5 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateSummaryCaseCollectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Group Summary Cases");
|
||||
actionToSetup->setIcon(QIcon(":/SummaryEnsemble16x16.png"));
|
||||
actionToSetup->setIcon(QIcon(":/SummaryGroup16x16.png"));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class RicCreateSummaryCaseCollectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
static void groupSummaryCases(std::vector<RimSummaryCase*> cases, const QString& groupName);
|
||||
static void groupSummaryCases(std::vector<RimSummaryCase*> cases, const QString& groupName, bool isEnsemble = false);
|
||||
|
||||
private:
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
@@ -125,7 +125,7 @@ void RicDeleteSummaryCaseCollectionFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSummaryCaseCollectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete Summary Case Group");
|
||||
actionToSetup->setText("Delete Summary Case Group/Ensemble");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
@@ -74,7 +75,7 @@ void RicImportEnsembleFeature::onActionTriggered(bool isChecked)
|
||||
validateEnsembleCases(cases);
|
||||
|
||||
RicImportSummaryCasesFeature::addSummaryCases(cases);
|
||||
RicCreateSummaryCaseCollectionFeature::groupSummaryCases(cases, ensembleName);
|
||||
RicCreateSummaryCaseCollectionFeature::groupSummaryCases(cases, ensembleName, true);
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||
if (mainPlotWindow && !cases.empty())
|
||||
@@ -162,13 +163,15 @@ bool RicImportEnsembleFeature::validateEnsembleCases(std::vector<RimSummaryCase*
|
||||
QString RicImportEnsembleFeature::askForEnsembleName()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
int groupCount = (int)project->summaryGroups().size() + 1;
|
||||
std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
|
||||
int ensembleCount = std::count_if(groups.begin(), groups.end(), [](RimSummaryCaseCollection* group) { return group->isEnsemble(); });
|
||||
ensembleCount += 1;
|
||||
|
||||
QInputDialog dialog;
|
||||
dialog.setInputMode(QInputDialog::TextInput);
|
||||
dialog.setWindowTitle("Ensemble Name");
|
||||
dialog.setLabelText("Ensemble Name");
|
||||
dialog.setTextValue(QString("Ensemble %1").arg(groupCount));
|
||||
dialog.setTextValue(QString("Ensemble %1").arg(ensembleCount));
|
||||
dialog.resize(300, 50);
|
||||
dialog.exec();
|
||||
return dialog.result() == QDialog::Accepted ? dialog.textValue() : QString("");
|
||||
|
||||
98
ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp
Normal file
98
ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportSummaryGroupFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicImportSummaryCasesFeature.h"
|
||||
#include "RicCreateSummaryCaseCollectionFeature.h"
|
||||
|
||||
#include "RifSummaryCaseRestartSelector.h"
|
||||
|
||||
#include "RimGridSummaryCase.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportSummaryGroupFeature, "RicImportSummaryGroupFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportSummaryGroupFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportSummaryGroupFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
RicImportSummaryCasesFeature::createSummaryCasesFromFiles(fileNames, &cases);
|
||||
|
||||
RicImportSummaryCasesFeature::addSummaryCases(cases);
|
||||
RicCreateSummaryCaseCollectionFeature::groupSummaryCases(cases, "", false);
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||
if (mainPlotWindow && !cases.empty())
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(cases.back());
|
||||
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
std::vector<RimCase*> allCases;
|
||||
app->project()->allCases(allCases);
|
||||
|
||||
if (allCases.size() == 0)
|
||||
{
|
||||
RiuMainWindow::instance()->close();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportSummaryGroupFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/SummaryGroup16x16.png"));
|
||||
actionToSetup->setText("Import Summary Case Group");
|
||||
}
|
||||
45
ApplicationCode/Commands/RicImportSummaryGroupFeature.h
Normal file
45
ApplicationCode/Commands/RicImportSummaryGroupFeature.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimSummaryCase;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportSummaryGroupFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New Summary Ensemble Curve Set");
|
||||
actionToSetup->setText("New Ensemble Curve Set");
|
||||
actionToSetup->setIcon(QIcon(":/EnsembleCurveSet16x16.png"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user