2015-08-28 04:45:18 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-08-28 04:45:18 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-08-28 04:45:18 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-08-28 04:45:18 -05:00
|
|
|
// 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"
|
|
|
|
|
2018-03-07 07:25:12 -06:00
|
|
|
#include "Rim3dView.h"
|
2019-10-22 04:08:44 -05:00
|
|
|
#include "RimGridView.h"
|
2015-12-02 08:07:12 -06:00
|
|
|
#include "RimProject.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2018-03-07 07:25:12 -06:00
|
|
|
#include "RimSimWellInViewCollection.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
|
|
|
|
2018-11-30 05:53:46 -06:00
|
|
|
#include "Riu3dSelectionManager.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2019-05-27 09:13:41 -05:00
|
|
|
#include "RiuPlotMainWindowTools.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
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature" );
|
2015-08-28 04:45:18 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
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
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
|
|
|
|
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
|
2017-04-25 09:12:22 -05:00
|
|
|
int branchIndex;
|
2019-09-06 03:40:57 -05:00
|
|
|
return ( caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>() != nullptr ||
|
|
|
|
caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>() != nullptr ||
|
|
|
|
RicWellLogTools::selectedSimulationWell( &branchIndex ) != nullptr ) &&
|
|
|
|
caseAvailable();
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-08-28 04:45:18 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
|
2017-02-07 02:34:11 -06:00
|
|
|
|
2019-09-11 05:51:25 -05:00
|
|
|
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlot>();
|
2018-08-22 05:04:42 -05:00
|
|
|
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellLogPlotTrack )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-10-09 02:21:28 -05:00
|
|
|
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
2015-09-21 07:24:29 -05:00
|
|
|
else
|
|
|
|
{
|
2019-09-11 05:51:25 -05:00
|
|
|
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
|
|
|
|
int branchIndex = -1;
|
|
|
|
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
|
2019-10-22 04:08:44 -05:00
|
|
|
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
2019-09-06 03:40:57 -05:00
|
|
|
bool useBranchDetection = true;
|
|
|
|
RimSimWellInViewCollection* simWellColl = nullptr;
|
|
|
|
if ( simWell )
|
2017-12-07 07:51:58 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
simWell->firstAncestorOrThisOfTypeAsserted( simWellColl );
|
2017-12-07 07:51:58 -06:00
|
|
|
useBranchDetection = simWellColl->isAutoDetectingBranches;
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellPath || simWell )
|
2015-09-21 07:24:29 -05:00
|
|
|
{
|
2020-02-12 04:43:15 -06:00
|
|
|
RimWellLogTrack* newWellLogPlotTrack =
|
|
|
|
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( true, "", wellLogPlot );
|
2019-09-11 05:51:25 -05:00
|
|
|
if ( wellPath )
|
|
|
|
{
|
|
|
|
newWellLogPlotTrack->setFormationWellPath( wellPath );
|
|
|
|
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newWellLogPlotTrack->setFormationSimWellName( simWell->name() );
|
|
|
|
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
|
|
|
|
newWellLogPlotTrack->setFormationBranchIndex( branchIndex );
|
|
|
|
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
|
|
|
|
}
|
|
|
|
|
2019-10-09 02:21:28 -05:00
|
|
|
RimCase* ownerCase = nullptr;
|
2019-09-11 05:51:25 -05:00
|
|
|
if ( view )
|
|
|
|
{
|
2019-10-09 02:21:28 -05:00
|
|
|
ownerCase = view->ownerCase();
|
2019-09-11 05:51:25 -05:00
|
|
|
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
|
|
|
|
}
|
2017-12-07 07:51:58 -06:00
|
|
|
|
2019-11-29 08:38:37 -06:00
|
|
|
RicWellLogTools::addWellLogExtractionCurve( newWellLogPlotTrack,
|
|
|
|
ownerCase,
|
|
|
|
view,
|
|
|
|
wellPath,
|
|
|
|
simWell,
|
|
|
|
branchIndex,
|
|
|
|
useBranchDetection );
|
2015-09-21 07:24:29 -05:00
|
|
|
}
|
|
|
|
}
|
2019-05-27 09:13:41 -05:00
|
|
|
RiuPlotMainWindowTools::refreshToolbars();
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-08-28 04:45:18 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::setupActionLook( QAction* actionToSetup )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "New Well Log Extraction Curve" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
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;
|
2020-05-12 02:50:38 -05:00
|
|
|
RimProject::current()->allCases( cases );
|
2015-09-25 09:45:38 -05:00
|
|
|
|
2018-03-07 07:25:12 -06:00
|
|
|
return !cases.empty();
|
2015-09-25 07:48:31 -05:00
|
|
|
}
|