2017-01-13 06:32:02 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 "RicShowWellAllocationPlotFeature.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2017-03-01 06:23:16 -06:00
|
|
|
#include "RimEclipseResultCase.h"
|
2017-01-13 06:32:02 -06:00
|
|
|
#include "RimFlowPlotCollection.h"
|
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimProject.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2017-03-01 06:23:16 -06:00
|
|
|
#include "RimView.h"
|
2017-01-13 06:32:02 -06:00
|
|
|
#include "RimWellAllocationPlot.h"
|
|
|
|
|
|
|
|
#include "RiuMainPlotWindow.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
|
|
|
|
{
|
2017-10-13 02:29:42 -05:00
|
|
|
std::vector<RimSimWellInView*> collection;
|
2017-03-14 07:15:00 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&collection);
|
2017-03-01 06:23:16 -06:00
|
|
|
|
2017-03-14 07:15:00 -05:00
|
|
|
if (collection.size() > 0)
|
2017-03-01 06:23:16 -06:00
|
|
|
{
|
2017-03-14 07:15:00 -05:00
|
|
|
return true;
|
2017-03-01 06:23:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2017-01-13 06:32:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2017-10-13 02:29:42 -05:00
|
|
|
std::vector<RimSimWellInView*> collection;
|
2017-01-13 06:32:02 -06:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&collection);
|
|
|
|
|
|
|
|
if (collection.size() > 0)
|
|
|
|
{
|
2017-10-13 03:16:01 -05:00
|
|
|
RimSimWellInView* simWell = collection[0];
|
2017-01-13 06:32:02 -06:00
|
|
|
|
|
|
|
if (RiaApplication::instance()->project())
|
|
|
|
{
|
|
|
|
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
|
|
|
if (flowPlotColl)
|
|
|
|
{
|
2017-10-13 03:16:01 -05:00
|
|
|
flowPlotColl->defaultWellAllocPlot()->setFromSimulationWell(simWell);
|
2017-03-28 16:35:53 -05:00
|
|
|
flowPlotColl->defaultWellAllocPlot()->updateConnectedEditors();
|
2017-01-13 06:32:02 -06:00
|
|
|
|
|
|
|
// Make sure the summary plot window is created and visible
|
|
|
|
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
2017-03-28 16:35:53 -05:00
|
|
|
plotwindow->selectAsCurrentItem(flowPlotColl->defaultWellAllocPlot());
|
2017-01-13 06:32:02 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2017-02-21 03:31:39 -06:00
|
|
|
actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
|
2017-03-06 13:08:25 -06:00
|
|
|
actionToSetup->setText("Plot Well Allocation");
|
2017-01-13 06:32:02 -06:00
|
|
|
}
|