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 10:29:17 -05:00
|
|
|
#include "RicNewWellLogFileCurveFeature.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2015-09-21 07:02:33 -05:00
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
2018-06-26 03:12:49 -05:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
#include "RicWellLogTools.h"
|
2015-09-15 11:21:38 -05:00
|
|
|
|
2018-06-26 03:12:49 -05:00
|
|
|
#include "RimTools.h"
|
2015-09-21 07:02:33 -05:00
|
|
|
#include "RimWellLogFile.h"
|
2015-10-16 09:58:49 -05:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimWellLogFileCurve.h"
|
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-21 07:02:33 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2018-06-26 03:12:49 -05:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2017-10-09 07:30:27 -05:00
|
|
|
|
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( RicNewWellLogFileCurveFeature, "RicNewWellLogFileCurveFeature" );
|
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 10:29:17 -05:00
|
|
|
bool RicNewWellLogFileCurveFeature::isCommandEnabled()
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
|
|
|
|
return ( caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>() != nullptr &&
|
|
|
|
wellLogFilesAvailable() ) ||
|
|
|
|
RicWellLogTools::selectedWellPathWithLogFile() != nullptr;
|
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 RicNewWellLogFileCurveFeature::onActionTriggered( bool isChecked )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2018-08-22 05:04:42 -05:00
|
|
|
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellLogPlotTrack )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RicWellLogTools::addFileCurve( wellLogPlotTrack );
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
2015-09-21 07:02:33 -05:00
|
|
|
else
|
|
|
|
{
|
2017-10-09 07:30:27 -05:00
|
|
|
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellPath )
|
2015-09-21 07:02:33 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
|
|
|
RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve( newWellLogPlotTrack );
|
|
|
|
plotCurve->setWellPath( wellPath );
|
2017-10-24 01:18:03 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellPath->wellLogFiles().size() == 1 )
|
2017-10-24 01:18:03 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
plotCurve->setWellLogFile( wellPath->wellLogFiles().front() );
|
2017-10-24 01:18:03 -05:00
|
|
|
}
|
2015-09-21 07:02:33 -05:00
|
|
|
plotCurve->updateConnectedEditors();
|
|
|
|
}
|
|
|
|
}
|
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 RicNewWellLogFileCurveFeature::setupActionLook( QAction* actionToSetup )
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
|
|
|
actionToSetup->setText( "New Well Log LAS Curve" );
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
2015-09-25 10:52:03 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-25 10:52:03 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-15 07:04:57 -05:00
|
|
|
bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable()
|
2015-09-25 10:52:03 -05:00
|
|
|
{
|
2018-06-26 03:12:49 -05:00
|
|
|
auto wellPathCollection = RimTools::wellPathCollection();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellPathCollection )
|
2015-09-25 10:52:03 -05:00
|
|
|
{
|
2020-10-06 08:00:39 -05:00
|
|
|
for ( auto wellPath : wellPathCollection->wellPaths() )
|
2015-09-25 10:52:03 -05:00
|
|
|
{
|
2020-10-06 08:00:39 -05:00
|
|
|
if ( !wellPath->wellLogFiles().empty() )
|
2015-09-25 10:52:03 -05:00
|
|
|
{
|
2017-10-19 09:12:22 -05:00
|
|
|
return true;
|
2015-09-25 10:52:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|