mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1377 Add view selection to Show Region button in flow characteristics plot
This commit is contained in:
@@ -32,6 +32,7 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
|
||||||
|
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.h
|
||||||
|
|
||||||
# General delete of any object in a child array field
|
# General delete of any object in a child array field
|
||||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
|
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
|
||||||
@@ -72,6 +73,7 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
|
||||||
|
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.cpp
|
||||||
|
|
||||||
# General delete of any object in a child array field
|
# General delete of any object in a child array field
|
||||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
|
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RicSelectViewUI.h"
|
#include "RicSelectOrCreateViewFeatureImpl.h"
|
||||||
|
|
||||||
#include "RigFlowDiagResultAddress.h"
|
#include "RigFlowDiagResultAddress.h"
|
||||||
#include "RigSingleWellResultsData.h"
|
#include "RigSingleWellResultsData.h"
|
||||||
@@ -41,84 +41,13 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
#include "cafCmdFeatureManager.h"
|
#include "cafCmdFeatureManager.h"
|
||||||
#include "cafPdmUiPropertyViewDialog.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
|
RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
|
||||||
{
|
{
|
||||||
const QString lastUsedViewKey("lastUsedViewKey");
|
RimEclipseView* viewToManipulate = RicSelectOrCreateViewFeatureImpl::showViewSelection(eclipseResultCase, "lastUsedWellAllocationView", "Show Contributing Wells in View");
|
||||||
|
|
||||||
RimEclipseView* defaultSelectedView = nullptr;
|
|
||||||
{
|
|
||||||
QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
|
|
||||||
RimEclipseView* lastUsedView = dynamic_cast<RimEclipseView*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
|
|
||||||
if (lastUsedView)
|
|
||||||
{
|
|
||||||
RimEclipseResultCase* lastUsedViewResultCase = nullptr;
|
|
||||||
lastUsedView->firstAncestorOrThisOfTypeAsserted(lastUsedViewResultCase);
|
|
||||||
|
|
||||||
if (lastUsedViewResultCase == eclipseResultCase)
|
|
||||||
{
|
|
||||||
defaultSelectedView = lastUsedView;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defaultSelectedView)
|
|
||||||
{
|
|
||||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
|
||||||
if (activeView)
|
|
||||||
{
|
|
||||||
RimEclipseResultCase* activeViewResultCase = nullptr;
|
|
||||||
activeView->firstAncestorOrThisOfTypeAsserted(activeViewResultCase);
|
|
||||||
|
|
||||||
if (activeViewResultCase == eclipseResultCase)
|
|
||||||
{
|
|
||||||
defaultSelectedView = activeView;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (eclipseResultCase->views().size() > 0)
|
|
||||||
{
|
|
||||||
defaultSelectedView = dynamic_cast<RimEclipseView*>(eclipseResultCase->views()[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RicSelectViewUI featureUi;
|
|
||||||
if (defaultSelectedView)
|
|
||||||
{
|
|
||||||
featureUi.setView(defaultSelectedView);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
featureUi.setCase(eclipseResultCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Show Contributing Wells in View", "");
|
|
||||||
propertyDialog.resize(QSize(400, 200));
|
|
||||||
|
|
||||||
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
|
|
||||||
|
|
||||||
RimEclipseView* viewToManipulate = nullptr;
|
|
||||||
if (featureUi.createNewView())
|
|
||||||
{
|
|
||||||
RimEclipseView* createdView = eclipseResultCase->createAndAddReservoirView();
|
|
||||||
createdView->name = featureUi.newViewName();
|
|
||||||
|
|
||||||
// Must be run before buildViewItems, as wells are created in this function
|
|
||||||
createdView->loadDataAndUpdate();
|
|
||||||
eclipseResultCase->updateConnectedEditors();
|
|
||||||
|
|
||||||
viewToManipulate = createdView;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewToManipulate = featureUi.selectedView();
|
|
||||||
}
|
|
||||||
|
|
||||||
CVF_ASSERT(viewToManipulate);
|
CVF_ASSERT(viewToManipulate);
|
||||||
|
|
||||||
@@ -128,11 +57,7 @@ RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimE
|
|||||||
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
|
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
|
||||||
feature->actionTriggered(false);
|
feature->actionTriggered(false);
|
||||||
|
|
||||||
RiuMainWindow::instance()->setExpanded(viewToManipulate, true);
|
RicSelectOrCreateViewFeatureImpl::focusView(viewToManipulate);
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(viewToManipulate);
|
|
||||||
|
|
||||||
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
|
|
||||||
RiaApplication::instance()->setCacheDataObject(lastUsedViewKey, refFromProjectToView);
|
|
||||||
|
|
||||||
return viewToManipulate;
|
return viewToManipulate;
|
||||||
}
|
}
|
||||||
|
|||||||
131
ApplicationCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp
Normal file
131
ApplicationCode/Commands/RicSelectOrCreateViewFeatureImpl.cpp
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicSelectOrCreateViewFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "FlowCommands/RicSelectViewUI.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiPropertyViewDialog.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
RimEclipseView* RicSelectOrCreateViewFeatureImpl::showViewSelection(RimEclipseResultCase* resultCase, const QString& lastUsedViewKey, const QString& dialogTitle)
|
||||||
|
{
|
||||||
|
RimEclipseView* defaultSelectedView = getDefaultSelectedView(resultCase, lastUsedViewKey);
|
||||||
|
|
||||||
|
RicSelectViewUI featureUi;
|
||||||
|
if (defaultSelectedView)
|
||||||
|
{
|
||||||
|
featureUi.setView(defaultSelectedView);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
featureUi.setCase(resultCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, dialogTitle, "");
|
||||||
|
propertyDialog.resize(QSize(400, 200));
|
||||||
|
|
||||||
|
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
|
||||||
|
|
||||||
|
RimEclipseView* viewToManipulate = nullptr;
|
||||||
|
if (featureUi.createNewView())
|
||||||
|
{
|
||||||
|
RimEclipseView* createdView = resultCase->createAndAddReservoirView();
|
||||||
|
createdView->name = featureUi.newViewName();
|
||||||
|
|
||||||
|
// Must be run before buildViewItems, as wells are created in this function
|
||||||
|
createdView->loadDataAndUpdate();
|
||||||
|
resultCase->updateConnectedEditors();
|
||||||
|
|
||||||
|
viewToManipulate = createdView;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewToManipulate = featureUi.selectedView();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
|
||||||
|
RiaApplication::instance()->setCacheDataObject(lastUsedViewKey, refFromProjectToView);
|
||||||
|
|
||||||
|
return viewToManipulate;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
void RicSelectOrCreateViewFeatureImpl::focusView(RimEclipseView* view)
|
||||||
|
{
|
||||||
|
RiuMainWindow::instance()->setExpanded(view, true);
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(view);
|
||||||
|
RiuMainWindow::instance()->raise();
|
||||||
|
}
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
RimEclipseView* RicSelectOrCreateViewFeatureImpl::getDefaultSelectedView(RimEclipseResultCase* resultCase, const QString& lastUsedViewKey)
|
||||||
|
{
|
||||||
|
RimEclipseView* defaultSelectedView = nullptr;
|
||||||
|
|
||||||
|
QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
|
||||||
|
RimEclipseView* lastUsedView = dynamic_cast<RimEclipseView*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
|
||||||
|
if (lastUsedView)
|
||||||
|
{
|
||||||
|
RimEclipseResultCase* lastUsedViewResultCase = nullptr;
|
||||||
|
lastUsedView->firstAncestorOrThisOfTypeAsserted(lastUsedViewResultCase);
|
||||||
|
|
||||||
|
if (lastUsedViewResultCase == resultCase)
|
||||||
|
{
|
||||||
|
defaultSelectedView = lastUsedView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defaultSelectedView)
|
||||||
|
{
|
||||||
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||||
|
if (activeView)
|
||||||
|
{
|
||||||
|
RimEclipseResultCase* activeViewResultCase = nullptr;
|
||||||
|
activeView->firstAncestorOrThisOfTypeAsserted(activeViewResultCase);
|
||||||
|
|
||||||
|
if (activeViewResultCase == resultCase)
|
||||||
|
{
|
||||||
|
defaultSelectedView = activeView;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (resultCase->views().size() > 0)
|
||||||
|
{
|
||||||
|
defaultSelectedView = dynamic_cast<RimEclipseView*>(resultCase->views()[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultSelectedView;
|
||||||
|
}
|
||||||
39
ApplicationCode/Commands/RicSelectOrCreateViewFeatureImpl.h
Normal file
39
ApplicationCode/Commands/RicSelectOrCreateViewFeatureImpl.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <QString>
|
||||||
|
|
||||||
|
class RimEclipseView;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicSelectOrCreateViewFeatureImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static RimEclipseView* showViewSelection(RimEclipseResultCase* resultCase, const QString& lastUsedViewKey, const QString& dialogTitle);
|
||||||
|
static void focusView(RimEclipseView* view);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static RimEclipseView* getDefaultSelectedView(RimEclipseResultCase* resultCase, const QString& lastUsedViewKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -25,8 +25,11 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimEclipsePropertyFilter.h"
|
||||||
|
#include "RimEclipsePropertyFilterCollection.h"
|
||||||
|
|
||||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||||
|
#include "RicSelectOrCreateViewFeatureImpl.h"
|
||||||
|
|
||||||
#include "RiuFlowCharacteristicsPlot.h"
|
#include "RiuFlowCharacteristicsPlot.h"
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
@@ -368,7 +371,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
{
|
{
|
||||||
if (m_cellSelection() != RigFlowDiagResults::CELLS_ACTIVE)
|
if (m_cellSelection() != RigFlowDiagResults::CELLS_ACTIVE)
|
||||||
{
|
{
|
||||||
RimEclipseView* view = m_case->createAndAddReservoirView();
|
RimEclipseView* view = RicSelectOrCreateViewFeatureImpl::showViewSelection(m_case, "FlowCharacteristicsLastUsedView", "Show Region in View");
|
||||||
|
|
||||||
view->cellResult()->setResultType(RiaDefines::FLOW_DIAGNOSTICS);
|
view->cellResult()->setResultType(RiaDefines::FLOW_DIAGNOSTICS);
|
||||||
view->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION);
|
view->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION);
|
||||||
@@ -407,13 +410,17 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(timeStep);
|
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(timeStep);
|
||||||
|
|
||||||
view->setCurrentTimeStep(timeStep);
|
view->setCurrentTimeStep(timeStep);
|
||||||
|
|
||||||
|
for (RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters())
|
||||||
|
{
|
||||||
|
f->isActive = false;
|
||||||
|
}
|
||||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(view->eclipsePropertyFilterCollection());
|
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(view->eclipsePropertyFilterCollection());
|
||||||
|
|
||||||
view->loadDataAndUpdate();
|
view->loadDataAndUpdate();
|
||||||
m_case->updateConnectedEditors();
|
m_case->updateConnectedEditors();
|
||||||
|
|
||||||
RiuMainWindow::instance()->raise();
|
RicSelectOrCreateViewFeatureImpl::focusView(view);
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(view);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user