mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1727 Summary Plot: Add Reload option for group and for individual summary cases
This commit is contained in:
@@ -48,6 +48,7 @@ ${CEE_CURRENT_LIST_DIR}RicCloseSourSimDataFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
|
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicReloadSummaryCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.h
|
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicCloseSourSimDataFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicCloseSourSimDataFeature.cpp
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicReloadSummaryCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
105
ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp
Normal file
105
ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicReloadSummaryCaseFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicReloadSummaryCaseFeature, "RicReloadSummaryCaseFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicReloadSummaryCaseFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> caseSelection = selectedSummaryCases();
|
||||||
|
|
||||||
|
return (caseSelection.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicReloadSummaryCaseFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
CVF_ASSERT(project);
|
||||||
|
|
||||||
|
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||||
|
CVF_ASSERT(mainPlotColl);
|
||||||
|
|
||||||
|
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||||
|
CVF_ASSERT(summaryPlotColl);
|
||||||
|
|
||||||
|
std::vector<RimSummaryCase*> caseSelection = selectedSummaryCases();
|
||||||
|
for (RimSummaryCase* summaryCase : caseSelection)
|
||||||
|
{
|
||||||
|
summaryCase->reloadCase();
|
||||||
|
|
||||||
|
RiaLogging::info(QString("Reloaded data for %1").arg(summaryCase->summaryHeaderFilename()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots)
|
||||||
|
{
|
||||||
|
summaryPlot->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicReloadSummaryCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("Reload");
|
||||||
|
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimSummaryCase*> RicReloadSummaryCaseFeature::selectedSummaryCases()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> caseSelection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&caseSelection);
|
||||||
|
|
||||||
|
std::vector<RimSummaryCaseCollection*> collectionSelection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&collectionSelection);
|
||||||
|
|
||||||
|
for (auto sumColl : collectionSelection)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < sumColl->summaryCaseCount(); i++)
|
||||||
|
{
|
||||||
|
caseSelection.push_back(sumColl->summaryCase(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseSelection;
|
||||||
|
}
|
||||||
38
ApplicationCode/Commands/RicReloadSummaryCaseFeature.h
Normal file
38
ApplicationCode/Commands/RicReloadSummaryCaseFeature.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class RimSummaryCase;
|
||||||
|
|
||||||
|
class RicReloadSummaryCaseFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered(bool isChecked);
|
||||||
|
virtual void setupActionLook(QAction* actionToSetup);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::vector<RimSummaryCase*> selectedSummaryCases();
|
||||||
|
};
|
||||||
@@ -445,6 +445,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicExportCarfin";
|
commandIds << "RicExportCarfin";
|
||||||
commandIds << "RicCloseSummaryCaseFeature";
|
commandIds << "RicCloseSummaryCaseFeature";
|
||||||
commandIds << "RicCloseSummaryCaseCollectionFeature";
|
commandIds << "RicCloseSummaryCaseCollectionFeature";
|
||||||
|
commandIds << "RicReloadSummaryCaseFeature";
|
||||||
|
|
||||||
|
|
||||||
// Fracture commands
|
// Fracture commands
|
||||||
|
|||||||
@@ -59,6 +59,16 @@ void RimSummaryCase::loadCase()
|
|||||||
if (m_summaryCaseData.isNull()) m_summaryCaseData = new RigSummaryCaseData(this->summaryHeaderFilename());
|
if (m_summaryCaseData.isNull()) m_summaryCaseData = new RigSummaryCaseData(this->summaryHeaderFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCase::reloadCase()
|
||||||
|
{
|
||||||
|
if (m_summaryCaseData.notNull())
|
||||||
|
{
|
||||||
|
m_summaryCaseData->openOrReloadCase(this->summaryHeaderFilename());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
void updateOptionSensitivity();
|
void updateOptionSensitivity();
|
||||||
|
|
||||||
void loadCase();
|
void loadCase();
|
||||||
|
void reloadCase();
|
||||||
RigSummaryCaseData* caseData();
|
RigSummaryCaseData* caseData();
|
||||||
|
|
||||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
|
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
|
||||||
|
|||||||
@@ -29,16 +29,7 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigSummaryCaseData::RigSummaryCaseData(const QString& summaryHeaderFileName)
|
RigSummaryCaseData::RigSummaryCaseData(const QString& summaryHeaderFileName)
|
||||||
{
|
{
|
||||||
std::string headerFileName;
|
openOrReloadCase(summaryHeaderFileName);
|
||||||
std::vector<std::string> dataFileNames;
|
|
||||||
std::string nativeSumHeadFileName = QDir::toNativeSeparators(summaryHeaderFileName).toStdString();
|
|
||||||
RifEclipseSummaryTools::findSummaryFiles(nativeSumHeadFileName, &headerFileName, &dataFileNames);
|
|
||||||
|
|
||||||
m_summaryFileReader = new RifReaderEclipseSummary();
|
|
||||||
if (!m_summaryFileReader->open(headerFileName, dataFileNames))
|
|
||||||
{
|
|
||||||
m_summaryFileReader = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -49,6 +40,31 @@ RigSummaryCaseData::~RigSummaryCaseData()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigSummaryCaseData::openOrReloadCase(const QString& summaryHeaderFileName)
|
||||||
|
{
|
||||||
|
std::string headerFileName;
|
||||||
|
std::vector<std::string> dataFileNames;
|
||||||
|
std::string nativeSumHeadFileName = QDir::toNativeSeparators(summaryHeaderFileName).toStdString();
|
||||||
|
RifEclipseSummaryTools::findSummaryFiles(nativeSumHeadFileName, &headerFileName, &dataFileNames);
|
||||||
|
|
||||||
|
if (m_summaryFileReader.isNull())
|
||||||
|
{
|
||||||
|
m_summaryFileReader = new RifReaderEclipseSummary();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_summaryFileReader->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_summaryFileReader->open(headerFileName, dataFileNames))
|
||||||
|
{
|
||||||
|
m_summaryFileReader = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ public:
|
|||||||
explicit RigSummaryCaseData(const QString& summaryHeaderFileName );
|
explicit RigSummaryCaseData(const QString& summaryHeaderFileName );
|
||||||
~RigSummaryCaseData();
|
~RigSummaryCaseData();
|
||||||
|
|
||||||
|
void openOrReloadCase(const QString& summaryHeaderFileName);
|
||||||
|
|
||||||
RifReaderEclipseSummary* summaryReader();
|
RifReaderEclipseSummary* summaryReader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<RifReaderEclipseSummary> m_summaryFileReader;
|
cvf::ref<RifReaderEclipseSummary> m_summaryFileReader;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user