#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 "RicShowContributingWellsFeature.h"
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimView.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include <QAction> #include <QAction>
@ -28,9 +32,23 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFeature::isCommandEnabled() bool RicShowContributingWellsFeature::isCommandEnabled()
{
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 true;
} }
}
return false;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -20,10 +20,12 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RimFlowPlotCollection.h" #include "RimFlowPlotCollection.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimView.h"
#include "RimWellAllocationPlot.h" #include "RimWellAllocationPlot.h"
#include "RiuMainPlotWindow.h" #include "RiuMainPlotWindow.h"
@ -38,9 +40,23 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled() bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{
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 true;
} }
}
return false;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///