mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1728 Add close summary command. Dependent curves yet not deleted
This commit is contained in:
parent
f2b26be5d8
commit
946351c853
@ -6,6 +6,7 @@ endif()
|
|||||||
|
|
||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
|
||||||
@ -68,6 +69,7 @@ endif()
|
|||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
|
||||||
|
83
ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp
Normal file
83
ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicCloseSummaryCaseFeature.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicCloseSummaryCaseFeature, "RicCloseSummaryCaseFeature");
|
||||||
|
|
||||||
|
|
||||||
|
void RicCloseSummaryCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("Close Summary Plot");
|
||||||
|
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicCloseSummaryCaseFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return selectedSummaryCase() != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCase* RicCloseSummaryCaseFeature::selectedSummaryCase() const
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
|
||||||
|
if (selection.size() > 0)
|
||||||
|
{
|
||||||
|
return selection[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicCloseSummaryCaseFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
assert(selection.size() > 0);
|
||||||
|
|
||||||
|
for (RimSummaryCase* summaryCase : selection)
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* summaryCaseCollection = NULL;
|
||||||
|
summaryCase->firstAncestorOrThisOfType(summaryCaseCollection);
|
||||||
|
CVF_ASSERT(summaryCaseCollection);
|
||||||
|
|
||||||
|
summaryCaseCollection->deleteCase(summaryCase);
|
||||||
|
delete summaryCase;
|
||||||
|
summaryCaseCollection->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
}
|
20
ApplicationCode/Commands/RicCloseSummaryCaseFeature.h
Normal file
20
ApplicationCode/Commands/RicCloseSummaryCaseFeature.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
#include "vector"
|
||||||
|
|
||||||
|
class RimSummaryCase;
|
||||||
|
|
||||||
|
class RicCloseSummaryCaseFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered(bool isChecked);
|
||||||
|
virtual void setupActionLook(QAction* actionToSetup);
|
||||||
|
private:
|
||||||
|
RimSummaryCase* selectedSummaryCase() const;
|
||||||
|
};
|
||||||
|
|
@ -443,6 +443,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicWellPathImportCompletionsFileFeature";
|
commandIds << "RicWellPathImportCompletionsFileFeature";
|
||||||
commandIds << "RicFlyToObjectFeature";
|
commandIds << "RicFlyToObjectFeature";
|
||||||
commandIds << "RicExportCarfin";
|
commandIds << "RicExportCarfin";
|
||||||
|
commandIds << "RicCloseSummaryCaseFeature";
|
||||||
|
|
||||||
|
|
||||||
// Fracture commands
|
// Fracture commands
|
||||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
RimSummaryCase* summaryCase(size_t idx);
|
RimSummaryCase* summaryCase(size_t idx);
|
||||||
size_t summaryCaseCount();
|
size_t summaryCaseCount();
|
||||||
|
|
||||||
void createSummaryCasesFromRelevantEclipseResultCases();
|
void createSummaryCasesFromRelevantEclipseResultCases();
|
||||||
RimSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
|
RimSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
|
||||||
RimSummaryCase* createAndAddSummaryCaseFromFileName(const QString& fileName);
|
RimSummaryCase* createAndAddSummaryCaseFromFileName(const QString& fileName);
|
||||||
|
@ -195,7 +195,7 @@ RimSummaryCurve::~RimSummaryCurve()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
|
void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
|
||||||
{
|
{
|
||||||
m_summaryCase = sumCase;
|
m_summaryCase = sumCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -504,10 +504,17 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|||||||
|
|
||||||
if(changedField == &m_uiFilterResultSelection)
|
if(changedField == &m_uiFilterResultSelection)
|
||||||
{
|
{
|
||||||
if (0 <= m_uiFilterResultSelection() && static_cast<size_t>(m_uiFilterResultSelection()) < summaryReader()->allResultAddresses().size())
|
if (summaryReader())
|
||||||
{
|
{
|
||||||
m_curveVariable->setAddress(summaryReader()->allResultAddresses()[m_uiFilterResultSelection()]);
|
if (0 <= m_uiFilterResultSelection() && static_cast<size_t>(m_uiFilterResultSelection()) < summaryReader()->allResultAddresses().size())
|
||||||
}
|
{
|
||||||
|
m_curveVariable->setAddress(summaryReader()->allResultAddresses()[m_uiFilterResultSelection()]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_curveVariable->setAddress(RifEclipseSummaryAddress());
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_curveVariable->setAddress(RifEclipseSummaryAddress());
|
m_curveVariable->setAddress(RifEclipseSummaryAddress());
|
||||||
|
Loading…
Reference in New Issue
Block a user