#1263 Flow : Command : Show Contributing Wells command present when applicable

This commit is contained in:
Magne Sjaastad 2017-03-01 13:23:16 +01:00
parent e41979563b
commit 4559b9f31a
2 changed files with 36 additions and 2 deletions

View File

@ -18,6 +18,10 @@
#include "RicShowContributingWellsFeature.h"
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimView.h"
#include "cafCmdFeatureManager.h"
#include <QAction>
@ -29,7 +33,21 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe
//--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFeature::isCommandEnabled()
{
return true;
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimEclipseResultCase* eclCase = nullptr;
activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size() > 0)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------

View File

@ -20,10 +20,12 @@
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
#include "RimFlowPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimView.h"
#include "RimWellAllocationPlot.h"
#include "RiuMainPlotWindow.h"
@ -39,7 +41,21 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot
//--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{
return true;
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimEclipseResultCase* eclCase = nullptr;
activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size() > 0)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------