2015-09-15 08:23:25 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-09-15 08:23:25 -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-09-15 08:23:25 -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-09-15 08:23:25 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicAddWellLogToPlotFeature.h"
|
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
2015-09-15 11:21:38 -05:00
|
|
|
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimProject.h"
|
2015-09-16 09:06:06 -05:00
|
|
|
#include "RimWellLogFile.h"
|
2015-09-18 02:16:59 -05:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
#include "RimWellLogFileCurve.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
#include "RimWellLogPlotCollection.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2018-02-27 08:21:14 -06:00
|
|
|
#include "RiuPlotMainWindowTools.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2015-09-15 11:07:53 -05:00
|
|
|
#include "RigWellLogFile.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
#include "RiuQwtPlotWidget.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature" );
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-15 08:23:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicAddWellLogToPlotFeature::isCommandEnabled()
|
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
|
2015-09-15 08:23:25 -05:00
|
|
|
return selection.size() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-15 08:23:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( selection.size() < 1 ) return;
|
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2015-11-04 08:57:06 -06:00
|
|
|
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
2019-10-11 08:54:19 -05:00
|
|
|
plot->addPlot( plotTrack );
|
|
|
|
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++ )
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
RimWellLogFileChannel* wellLog = selection[wlIdx];
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2018-02-18 11:56:43 -06:00
|
|
|
RimWellPath* wellPath = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
wellLog->firstAncestorOrThisOfType( wellPath );
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2018-02-18 11:56:43 -06:00
|
|
|
RimWellLogFile* wellLogFile = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
wellLog->firstAncestorOrThisOfType( wellLogFile );
|
|
|
|
if ( wellLogFile )
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
|
|
|
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setColor( curveColor );
|
2017-02-10 01:39:25 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
plotTrack->addCurve( curve );
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2017-11-15 09:17:55 -06:00
|
|
|
RigWellLogFile* wellLogDataFile = wellLogFile->wellLogFileData();
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( wellLogDataFile );
|
2015-09-21 03:10:25 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wlIdx == 0 )
|
2015-12-02 08:07:12 -06:00
|
|
|
{
|
|
|
|
// Initialize plot with depth unit from the first log file
|
2019-09-06 03:40:57 -05:00
|
|
|
plot->setDepthUnit( wellLogDataFile->depthUnit() );
|
2015-12-02 08:07:12 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setWellPath( wellPath );
|
|
|
|
curve->setWellLogChannelName( wellLog->name() );
|
|
|
|
curve->setWellLogFile( wellLogFile );
|
2015-09-15 08:58:22 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->loadDataAndUpdate( true );
|
|
|
|
}
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
2019-10-11 08:54:19 -05:00
|
|
|
plot->updateLayout();
|
2015-09-15 11:07:53 -05:00
|
|
|
|
2018-02-27 08:21:14 -06:00
|
|
|
RiuPlotMainWindowTools::showPlotMainWindow();
|
2022-08-18 05:37:51 -05:00
|
|
|
RiuPlotMainWindowTools::onObjectAppended( plot, plotTrack );
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-15 08:23:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicAddWellLogToPlotFeature::setupActionLook( QAction* actionToSetup )
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Add To New Plot" );
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-15 08:23:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> RicAddWellLogToPlotFeature::selectedWellLogs()
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection;
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &selection );
|
2015-09-15 08:23:25 -05:00
|
|
|
return selection;
|
|
|
|
}
|