2015-08-28 04:45:18 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-09-18 02:07:06 -05:00
|
|
|
#include "RicNewWellLogCurveExtractionFeature.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2015-09-21 07:24:29 -05:00
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
2017-10-09 07:30:27 -05:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
#include "RicWellLogTools.h"
|
2015-09-15 11:21:38 -05:00
|
|
|
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RigWellLogCurveData.h"
|
|
|
|
|
2015-12-02 08:07:12 -06:00
|
|
|
#include "RimProject.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2015-12-02 08:07:12 -06:00
|
|
|
#include "RimView.h"
|
2015-09-03 03:55:54 -05:00
|
|
|
#include "RimWellLogExtractionCurve.h"
|
2015-12-02 08:07:12 -06:00
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-21 07:24:29 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2015-09-03 03:55:54 -05:00
|
|
|
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "RiuMainPlotWindow.h"
|
2017-10-09 07:30:27 -05:00
|
|
|
#include "RiuSelectionManager.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include <vector>
|
2015-09-03 03:55:54 -05:00
|
|
|
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2015-09-18 02:07:06 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
|
2015-08-28 04:45:18 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2017-02-07 02:34:11 -06:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
2017-10-10 04:18:35 -05:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return false;
|
2017-04-25 09:12:22 -05:00
|
|
|
int branchIndex;
|
2017-10-09 07:30:27 -05:00
|
|
|
return (RicWellLogTools::selectedWellLogPlotTrack() != nullptr || RicWellLogTools::selectedWellPath() != nullptr || RicWellLogTools::selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2017-02-07 02:34:11 -06:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
|
|
|
|
|
2017-10-09 07:30:27 -05:00
|
|
|
RimWellLogTrack* wellLogPlotTrack = RicWellLogTools::selectedWellLogPlotTrack();
|
2015-09-18 05:29:23 -05:00
|
|
|
if (wellLogPlotTrack)
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2017-10-09 07:30:27 -05:00
|
|
|
RicWellLogTools::addExtractionCurve(wellLogPlotTrack, nullptr, nullptr, nullptr, -1);
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
2015-09-21 07:24:29 -05:00
|
|
|
else
|
|
|
|
{
|
2017-10-09 07:30:27 -05:00
|
|
|
RimWellPath* wellPath = RicWellLogTools::selectedWellPath();
|
2017-04-25 09:12:22 -05:00
|
|
|
int branchIndex = -1;
|
2017-10-13 02:29:42 -05:00
|
|
|
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell(&branchIndex);
|
2017-04-25 09:12:22 -05:00
|
|
|
if (wellPath || simWell)
|
2015-09-21 07:24:29 -05:00
|
|
|
{
|
2015-11-04 08:57:06 -06:00
|
|
|
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
2017-10-09 07:30:27 -05:00
|
|
|
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
|
2015-12-02 08:07:12 -06:00
|
|
|
|
2017-09-23 01:47:04 -05:00
|
|
|
plotCurve->loadDataAndUpdate(true);
|
2015-12-03 00:26:19 -06:00
|
|
|
|
2017-10-09 07:30:27 -05:00
|
|
|
RimWellLogPlot* plot = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
wellLogPlotTrack->firstAncestorOrThisOfType(plot);
|
2015-12-03 00:26:19 -06:00
|
|
|
if (plot && plotCurve->curveData())
|
2015-12-02 08:07:12 -06:00
|
|
|
{
|
|
|
|
plot->setDepthUnit(plotCurve->curveData()->depthUnit());
|
|
|
|
}
|
2015-12-03 00:26:19 -06:00
|
|
|
|
2015-09-21 07:24:29 -05:00
|
|
|
plotCurve->updateConnectedEditors();
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup)
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2015-09-18 02:07:06 -05:00
|
|
|
actionToSetup->setText("New Well Log Extraction Curve");
|
2016-11-17 10:37:01 -06:00
|
|
|
actionToSetup->setIcon(QIcon(":/WellLogCurve16x16.png"));
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-10-09 07:30:27 -05:00
|
|
|
bool RicNewWellLogCurveExtractionFeature::caseAvailable()
|
2015-09-25 07:48:31 -05:00
|
|
|
{
|
2015-09-25 09:45:38 -05:00
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
RiaApplication::instance()->project()->allCases(cases);
|
|
|
|
|
|
|
|
return cases.size() > 0;
|
2015-09-25 07:48:31 -05:00
|
|
|
}
|