mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1288 Added RicSelectViewUI and harmonized features
This commit is contained in:
parent
40a5f8dc02
commit
2ed5ff7fb7
@ -11,6 +11,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
|
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -20,8 +21,10 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
${SOURCE_GROUP_HEADER_FILES}
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
)
|
)
|
||||||
|
132
ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp
Normal file
132
ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicSelectViewUI.h"
|
||||||
|
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RicSelectViewUI, "RicSelectViewUI");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RicSelectViewUI::RicSelectViewUI()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("RicSelectViewUI", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_selectedView, "MasterView", "Select view", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_createNewView, "CreateNewView", false, "Create New View", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_newViewName, "NewViewName", QString("ShowContributingWells"), "New View Name", "", "", "");
|
||||||
|
|
||||||
|
m_currentView = nullptr;
|
||||||
|
m_currentCase = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSelectViewUI::setView(RimEclipseView* currentView)
|
||||||
|
{
|
||||||
|
m_currentView = currentView;
|
||||||
|
|
||||||
|
m_currentView->firstAncestorOrThisOfTypeAsserted(m_currentCase);
|
||||||
|
|
||||||
|
m_selectedView = m_currentView;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSelectViewUI::setCase(RimEclipseResultCase* currentCase)
|
||||||
|
{
|
||||||
|
m_currentCase = currentCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimEclipseView* RicSelectViewUI::selectedView() const
|
||||||
|
{
|
||||||
|
return m_selectedView();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicSelectViewUI::createNewView() const
|
||||||
|
{
|
||||||
|
return m_createNewView;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicSelectViewUI::newViewName() const
|
||||||
|
{
|
||||||
|
return m_newViewName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
|
if (fieldNeedingOptions == &m_selectedView)
|
||||||
|
{
|
||||||
|
QIcon icon;
|
||||||
|
if (m_currentCase)
|
||||||
|
{
|
||||||
|
icon = m_currentCase->uiCapability()->uiIcon();
|
||||||
|
for (RimView* v : m_currentCase->views())
|
||||||
|
{
|
||||||
|
QString displayName = m_currentCase->caseUserDescription() + ": " + v->name;
|
||||||
|
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(displayName, v, false, icon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSelectViewUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
if (m_currentCase && m_currentCase->views().size() == 0)
|
||||||
|
{
|
||||||
|
m_createNewView = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_createNewView)
|
||||||
|
{
|
||||||
|
m_newViewName.uiCapability()->setUiReadOnly(false);
|
||||||
|
m_selectedView.uiCapability()->setUiReadOnly(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_newViewName.uiCapability()->setUiReadOnly(true);
|
||||||
|
m_selectedView.uiCapability()->setUiReadOnly(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
58
ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h
Normal file
58
ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
class RimEclipseView;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicSelectViewUI : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RicSelectViewUI();
|
||||||
|
|
||||||
|
void setView(RimEclipseView* currentView);
|
||||||
|
void setCase(RimEclipseResultCase* currentCase);
|
||||||
|
|
||||||
|
RimEclipseView* selectedView() const;
|
||||||
|
bool createNewView() const;
|
||||||
|
QString newViewName() const;
|
||||||
|
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmPtrField<RimEclipseView*> m_selectedView;
|
||||||
|
caf::PdmField<bool> m_createNewView;
|
||||||
|
caf::PdmField<QString> m_newViewName;
|
||||||
|
|
||||||
|
RimEclipseView* m_currentView;
|
||||||
|
RimEclipseResultCase* m_currentCase;
|
||||||
|
};
|
||||||
|
|
@ -20,9 +20,13 @@
|
|||||||
|
|
||||||
#include "RicShowContributingWellsFeatureImpl.h"
|
#include "RicShowContributingWellsFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "RimEclipseView.h"
|
||||||
#include "RimEclipseWell.h"
|
#include "RimEclipseWell.h"
|
||||||
|
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
@ -55,7 +59,10 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
|
|||||||
RimEclipseView* eclipseView = nullptr;
|
RimEclipseView* eclipseView = nullptr;
|
||||||
well->firstAncestorOrThisOfTypeAsserted(eclipseView);
|
well->firstAncestorOrThisOfTypeAsserted(eclipseView);
|
||||||
|
|
||||||
RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(eclipseView, well->name());
|
RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(eclipseView, well->name(), eclipseView->currentTimeStep());
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->setExpanded(eclipseView, true);
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(eclipseView);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
@ -40,15 +40,13 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName)
|
void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep)
|
||||||
{
|
{
|
||||||
CAF_ASSERT(selectedWell);
|
CAF_ASSERT(viewToModify);
|
||||||
|
|
||||||
RimEclipseView* eclipseView = viewToModify;
|
|
||||||
|
|
||||||
RimEclipseWell* selectedWell = nullptr;
|
RimEclipseWell* selectedWell = nullptr;
|
||||||
|
|
||||||
for (RimEclipseWell* w : eclipseView->wellCollection()->wells())
|
for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
|
||||||
{
|
{
|
||||||
if (w->name() == wellName)
|
if (w->name() == wellName)
|
||||||
{
|
{
|
||||||
@ -62,34 +60,32 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
|
|||||||
selectedWell->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
|
selectedWell->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
|
||||||
|
|
||||||
// Use the active flow diag solutions, or the first one as default
|
// Use the active flow diag solutions, or the first one as default
|
||||||
RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution();
|
RimFlowDiagSolution* flowDiagSolution = viewToModify->cellResult()->flowDiagSolution();
|
||||||
if (!flowDiagSolution)
|
if (!flowDiagSolution)
|
||||||
{
|
{
|
||||||
std::vector<RimFlowDiagSolution*> flowSolutions = eclipseResultCase->flowDiagSolutions();
|
flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
|
||||||
if (flowSolutions.size()) flowDiagSolution = flowSolutions.front();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CAF_ASSERT(flowDiagSolution);
|
CAF_ASSERT(flowDiagSolution);
|
||||||
|
|
||||||
int timeStep = eclipseView->currentTimeStep();
|
|
||||||
|
|
||||||
RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep);
|
RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep);
|
||||||
|
|
||||||
if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER))
|
if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
eclipseView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
viewToModify->setCurrentTimeStep(timeStep);
|
||||||
eclipseView->cellResult()->setResultVariable("MaxFractionTracer");
|
viewToModify->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
||||||
|
viewToModify->cellResult()->setResultVariable("MaxFractionTracer");
|
||||||
|
viewToModify->cellResult()->setFlowSolution(flowDiagSolution);
|
||||||
|
|
||||||
switch (tracerStatus)
|
switch (tracerStatus)
|
||||||
{
|
{
|
||||||
case RimFlowDiagSolution::PRODUCER:
|
case RimFlowDiagSolution::PRODUCER:
|
||||||
eclipseView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
|
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
|
||||||
break;
|
break;
|
||||||
case RimFlowDiagSolution::INJECTOR:
|
case RimFlowDiagSolution::INJECTOR:
|
||||||
eclipseView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
|
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -97,12 +93,12 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
eclipseView->cellResult()->loadDataAndUpdate();
|
viewToModify->cellResult()->loadDataAndUpdate();
|
||||||
eclipseView->cellResult()->updateConnectedEditors();
|
viewToModify->cellResult()->updateConnectedEditors();
|
||||||
|
|
||||||
std::vector<QString> tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->wellResults(), timeStep);
|
std::vector<QString> tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->wellResults(), timeStep);
|
||||||
|
|
||||||
for (RimEclipseWell* w : eclipseView->wellCollection()->wells())
|
for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
|
||||||
{
|
{
|
||||||
if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end()
|
if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end()
|
||||||
|| selectedWell->name() == w->name())
|
|| selectedWell->name() == w->name())
|
||||||
@ -118,7 +114,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
|
|||||||
// Disable all existing property filters, and
|
// Disable all existing property filters, and
|
||||||
// create a new property filter based on TOF for current well
|
// create a new property filter based on TOF for current well
|
||||||
|
|
||||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = eclipseView->eclipsePropertyFilterCollection();
|
RimEclipsePropertyFilterCollection* propertyFilterCollection = viewToModify->eclipsePropertyFilterCollection();
|
||||||
|
|
||||||
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
|
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
|
||||||
{
|
{
|
||||||
@ -128,7 +124,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
|
|||||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||||
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
|
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
|
||||||
|
|
||||||
propertyFilter->resultDefinition()->setEclipseCase(eclipseView->eclipseCase());
|
propertyFilter->resultDefinition()->setEclipseCase(viewToModify->eclipseCase());
|
||||||
propertyFilter->resultDefinition()->setTofAndSelectTracer(selectedWell->name());
|
propertyFilter->resultDefinition()->setTofAndSelectTracer(selectedWell->name());
|
||||||
propertyFilter->resultDefinition()->loadDataAndUpdate();
|
propertyFilter->resultDefinition()->loadDataAndUpdate();
|
||||||
|
|
||||||
@ -136,41 +132,11 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimE
|
|||||||
|
|
||||||
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
|
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
|
||||||
|
|
||||||
eclipseView->faultCollection()->showFaultCollection = false;
|
viewToModify->faultCollection()->showFaultCollection = false;
|
||||||
eclipseView->faultCollection()->updateConnectedEditors();
|
viewToModify->faultCollection()->updateConnectedEditors();
|
||||||
|
|
||||||
eclipseView->scheduleCreateDisplayModelAndRedraw();
|
viewToModify->updateCurrentTimeStepAndRedraw();
|
||||||
|
viewToModify->scheduleCreateDisplayModelAndRedraw();
|
||||||
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
|
|
||||||
feature->actionTriggered(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<QString> RicShowContributingWellsFeatureImpl::contributingTracers(RimEclipseWell* well)
|
|
||||||
{
|
|
||||||
CAF_ASSERT(well);
|
|
||||||
|
|
||||||
RimEclipseView* eclipseView = nullptr;
|
|
||||||
well->firstAncestorOrThisOfTypeAsserted(eclipseView);
|
|
||||||
|
|
||||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
|
||||||
well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
|
|
||||||
|
|
||||||
// Use the active flow diag solutions, or the first one as default
|
|
||||||
RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution();
|
|
||||||
if (!flowDiagSolution)
|
|
||||||
{
|
|
||||||
std::vector<RimFlowDiagSolution*> flowSolutions = eclipseResultCase->flowDiagSolutions();
|
|
||||||
if (flowSolutions.size()) flowDiagSolution = flowSolutions.front();
|
|
||||||
}
|
|
||||||
|
|
||||||
CAF_ASSERT(flowDiagSolution);
|
|
||||||
|
|
||||||
int timeStep = eclipseView->currentTimeStep();
|
|
||||||
|
|
||||||
return findContributingTracerNames(flowDiagSolution, well->wellResults(), timeStep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -33,10 +33,9 @@ class RigSingleWellResultsData;
|
|||||||
class RicShowContributingWellsFeatureImpl
|
class RicShowContributingWellsFeatureImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName);
|
static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<QString> contributingTracers(RimEclipseWell* well);
|
|
||||||
static std::vector<QString> findContributingTracerNames(
|
static std::vector<QString> findContributingTracerNames(
|
||||||
const RimFlowDiagSolution* flowDiagSolution,
|
const RimFlowDiagSolution* flowDiagSolution,
|
||||||
const RigSingleWellResultsData* wellResults,
|
const RigSingleWellResultsData* wellResults,
|
||||||
|
@ -20,20 +20,20 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimDefines.h"
|
#include "RicSelectViewUI.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RicShowContributingWellsFeatureImpl.h"
|
||||||
#include "RimEclipsePropertyFilter.h"
|
|
||||||
#include "RimEclipsePropertyFilterCollection.h"
|
#include "RimEclipseResultCase.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimEclipseWell.h"
|
#include "RimFlowDiagSolution.h"
|
||||||
#include "RimEclipseWellCollection.h"
|
|
||||||
#include "RimWellAllocationPlot.h"
|
#include "RimWellAllocationPlot.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include "cafCmdFeatureManager.h"
|
#include "cafCmdFeatureManager.h"
|
||||||
#include "RimFlowDiagSolution.h"
|
#include "cafPdmUiPropertyViewDialog.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
|
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
|
||||||
|
|
||||||
@ -42,12 +42,6 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
|
||||||
if (!wellAllocationPlot) return false;
|
|
||||||
|
|
||||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
|
||||||
if (!activeView) return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,81 +53,77 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||||
if (!wellAllocationPlot) return;
|
if (!wellAllocationPlot) return;
|
||||||
|
|
||||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
RimEclipseResultCase* parentEclipseCase = nullptr;
|
||||||
if (!activeView) return;
|
wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(parentEclipseCase);
|
||||||
|
|
||||||
int timeStep = wellAllocationPlot->timeStep();
|
RimEclipseView* viewToManipulate = nullptr;
|
||||||
QString wellName = wellAllocationPlot->wellName();
|
|
||||||
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
|
|
||||||
RimFlowDiagSolution* flowSolution = wellAllocationPlot->flowDiagSolution();
|
|
||||||
|
|
||||||
if ( !flowSolution ) return;
|
|
||||||
|
|
||||||
RimFlowDiagSolution::TracerStatusType tracerStatus = flowSolution->tracerStatusInTimeStep(wellName, timeStep);
|
|
||||||
|
|
||||||
if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER) ) return;
|
|
||||||
|
|
||||||
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
|
||||||
activeView->cellResult()->setResultVariable("MaxFractionTracer");
|
|
||||||
|
|
||||||
switch (tracerStatus)
|
|
||||||
{
|
{
|
||||||
case RimFlowDiagSolution::PRODUCER:
|
RimEclipseView* viewForSameResultCase = nullptr;
|
||||||
activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
|
|
||||||
break;
|
|
||||||
case RimFlowDiagSolution::INJECTOR:
|
|
||||||
activeView->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||||
CVF_ASSERT(false);
|
if (activeView)
|
||||||
break;
|
|
||||||
}
|
|
||||||
activeView->setCurrentTimeStep(timeStep);
|
|
||||||
activeView->cellResult()->loadDataAndUpdate();
|
|
||||||
|
|
||||||
activeView->cellResult()->updateConnectedEditors();
|
|
||||||
|
|
||||||
|
|
||||||
for ( RimEclipseWell* well : activeView->wellCollection()->wells() )
|
|
||||||
{
|
|
||||||
if ( std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|
|
||||||
|| wellAllocationPlot->wellName() == well->name() )
|
|
||||||
{
|
{
|
||||||
well->showWell = true;
|
RimEclipseResultCase* activeViewParent = nullptr;
|
||||||
|
activeView->firstAncestorOrThisOfTypeAsserted(activeViewParent);
|
||||||
|
|
||||||
|
if (activeViewParent == parentEclipseCase)
|
||||||
|
{
|
||||||
|
viewForSameResultCase = activeView;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (parentEclipseCase->views().size() > 0)
|
||||||
|
{
|
||||||
|
viewForSameResultCase = dynamic_cast<RimEclipseView*>(parentEclipseCase->views()[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RicSelectViewUI featureUi;
|
||||||
|
if (viewForSameResultCase)
|
||||||
|
{
|
||||||
|
featureUi.setView(viewForSameResultCase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
well->showWell = false;
|
featureUi.setCase(parentEclipseCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Show Contributing Wells in View", "");
|
||||||
|
propertyDialog.resize(QSize(400, 200));
|
||||||
|
|
||||||
|
if (propertyDialog.exec() != QDialog::Accepted) return;
|
||||||
|
|
||||||
|
if (featureUi.createNewView())
|
||||||
|
{
|
||||||
|
RimEclipseView* createdView = parentEclipseCase->createAndAddReservoirView();
|
||||||
|
createdView->name = featureUi.newViewName();
|
||||||
|
|
||||||
|
// Must be run before buildViewItems, as wells are created in this function
|
||||||
|
createdView->loadDataAndUpdate();
|
||||||
|
parentEclipseCase->updateConnectedEditors();
|
||||||
|
|
||||||
|
viewToManipulate = createdView;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewToManipulate = featureUi.selectedView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable all existing property filters, and
|
CAF_ASSERT(viewToManipulate);
|
||||||
// create a new property filter based on TOF for current well
|
|
||||||
|
|
||||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
|
int timeStep = wellAllocationPlot->timeStep();
|
||||||
|
QString wellName = wellAllocationPlot->wellName();
|
||||||
|
|
||||||
for ( RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters() )
|
RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(viewToManipulate, wellName, timeStep);
|
||||||
{
|
|
||||||
f->isActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
|
||||||
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
|
|
||||||
|
|
||||||
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
|
|
||||||
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
|
|
||||||
propertyFilter->resultDefinition()->loadDataAndUpdate();
|
|
||||||
|
|
||||||
propertyFilterCollection->updateConnectedEditors();
|
|
||||||
|
|
||||||
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
|
|
||||||
|
|
||||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
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);
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(viewToManipulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user