2015-08-28 11:45:18 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2015-08-28 11:45:18 +02: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 10:40:57 +02:00
|
|
|
//
|
2015-08-28 11:45:18 +02: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 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-08-28 11:45:18 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2015-09-18 17:29:17 +02:00
|
|
|
#include "RicNewWellLogFileCurveFeature.h"
|
2015-08-28 11:45:18 +02:00
|
|
|
|
2015-09-21 14:02:33 +02:00
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
2018-06-26 10:12:49 +02:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
|
#include "RicWellLogTools.h"
|
2015-09-15 18:21:38 +02:00
|
|
|
|
2018-06-26 10:12:49 +02:00
|
|
|
#include "RimTools.h"
|
2015-09-21 14:02:33 +02:00
|
|
|
#include "RimWellLogFile.h"
|
2015-10-16 16:58:49 +02:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2016-06-27 11:07:01 +02:00
|
|
|
#include "RimWellLogFileCurve.h"
|
|
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-21 14:02:33 +02:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
#include "RimWellPathCollection.h"
|
2015-08-28 11:45:18 +02:00
|
|
|
|
2018-06-26 10:12:49 +02:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2017-10-09 14:30:27 +02:00
|
|
|
|
2015-08-28 11:45:18 +02:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
2015-08-31 02:06:37 +02:00
|
|
|
#include <vector>
|
2015-09-03 10:55:54 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewWellLogFileCurveFeature, "RicNewWellLogFileCurveFeature" );
|
2015-08-28 11:45:18 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-28 11:45:18 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 17:29:17 +02:00
|
|
|
bool RicNewWellLogFileCurveFeature::isCommandEnabled()
|
2015-08-28 11:45:18 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
|
|
|
|
|
return ( caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>() != nullptr &&
|
|
|
|
|
wellLogFilesAvailable() ) ||
|
|
|
|
|
RicWellLogTools::selectedWellPathWithLogFile() != nullptr;
|
2015-08-28 11:45:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-28 11:45:18 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RicNewWellLogFileCurveFeature::onActionTriggered( bool isChecked )
|
2015-08-28 11:45:18 +02:00
|
|
|
{
|
2018-08-22 12:04:42 +02:00
|
|
|
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( wellLogPlotTrack )
|
2015-08-28 11:45:18 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RicWellLogTools::addFileCurve( wellLogPlotTrack );
|
2015-08-28 11:45:18 +02:00
|
|
|
}
|
2015-09-21 14:02:33 +02:00
|
|
|
else
|
|
|
|
|
{
|
2017-10-09 14:30:27 +02:00
|
|
|
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( wellPath )
|
2015-09-21 14:02:33 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
|
|
|
|
RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve( newWellLogPlotTrack );
|
|
|
|
|
plotCurve->setWellPath( wellPath );
|
2017-10-24 08:18:03 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( wellPath->wellLogFiles().size() == 1 )
|
2017-10-24 08:18:03 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
plotCurve->setWellLogFile( wellPath->wellLogFiles().front() );
|
2017-10-24 08:18:03 +02:00
|
|
|
}
|
2015-09-21 14:02:33 +02:00
|
|
|
plotCurve->updateConnectedEditors();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-28 11:45:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-08-28 11:45:18 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RicNewWellLogFileCurveFeature::setupActionLook( QAction* actionToSetup )
|
2015-08-28 11:45:18 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
|
|
|
|
actionToSetup->setText( "New Well Log LAS Curve" );
|
2015-08-28 11:45:18 +02:00
|
|
|
}
|
|
|
|
|
|
2015-09-25 17:52:03 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-09-25 17:52:03 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-15 13:04:57 +01:00
|
|
|
bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable()
|
2015-09-25 17:52:03 +02:00
|
|
|
{
|
2018-06-26 10:12:49 +02:00
|
|
|
auto wellPathCollection = RimTools::wellPathCollection();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( wellPathCollection )
|
2015-09-25 17:52:03 +02:00
|
|
|
{
|
2020-10-06 15:00:39 +02:00
|
|
|
for ( auto wellPath : wellPathCollection->wellPaths() )
|
2015-09-25 17:52:03 +02:00
|
|
|
{
|
2020-10-06 15:00:39 +02:00
|
|
|
if ( !wellPath->wellLogFiles().empty() )
|
2015-09-25 17:52:03 +02:00
|
|
|
{
|
2017-10-19 16:12:22 +02:00
|
|
|
return true;
|
2015-09-25 17:52:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|