2017-09-27 05:39:28 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-11-02 04:00:27 -05:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 06:17:36 -05:00
|
|
|
//
|
2017-09-27 05:39:28 -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 06:17:36 -05:00
|
|
|
//
|
2017-09-27 05:39:28 -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 06:17:36 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-09-27 05:39:28 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicNewRftPlotFeature.h"
|
|
|
|
|
2017-11-02 04:00:27 -05:00
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimRftPlotCollection.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2017-10-02 02:40:33 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
2017-09-27 05:39:28 -05:00
|
|
|
#include "RimWellLogTrack.h"
|
|
|
|
#include "RimWellPath.h"
|
2017-11-02 04:00:27 -05:00
|
|
|
#include "RimWellRftPlot.h"
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2018-02-27 08:21:14 -06:00
|
|
|
#include "RiuPlotMainWindowTools.h"
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-10-19 02:09:22 -05:00
|
|
|
#include "cafSelectionManagerTools.h"
|
2017-09-27 05:39:28 -05:00
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-10-06 00:41:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
///
|
2017-10-06 00:41:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-09-27 05:39:28 -05:00
|
|
|
bool RicNewRftPlotFeature::isCommandEnabled()
|
|
|
|
{
|
2017-11-02 04:00:27 -05:00
|
|
|
RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
|
2019-09-06 06:17:36 -05:00
|
|
|
if ( simWell ) return true;
|
|
|
|
|
|
|
|
if ( selectedWellName().isEmpty() )
|
2017-10-05 09:25:04 -05:00
|
|
|
{
|
2017-11-02 04:00:27 -05:00
|
|
|
return false;
|
2017-10-05 09:25:04 -05:00
|
|
|
}
|
2017-11-02 04:00:27 -05:00
|
|
|
|
|
|
|
return true;
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
///
|
2017-09-27 05:39:28 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2022-08-19 07:30:25 -05:00
|
|
|
RimRftPlotCollection* rftPlotColl = RimMainPlotCollection::current()->rftPlotCollection();
|
2019-09-06 06:17:36 -05:00
|
|
|
if ( rftPlotColl )
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2017-11-02 04:00:27 -05:00
|
|
|
QString wellName = selectedWellName();
|
2017-09-29 04:24:18 -05:00
|
|
|
|
2017-10-17 06:22:28 -05:00
|
|
|
RimWellRftPlot* rftPlot = new RimWellRftPlot();
|
2019-10-09 02:21:28 -05:00
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
rftPlot->setSimWellOrWellPathName( wellName );
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-10-17 06:22:28 -05:00
|
|
|
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
2019-10-11 08:54:19 -05:00
|
|
|
rftPlot->addPlot( plotTrack );
|
|
|
|
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->plotCount() ) );
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
rftPlotColl->addPlot( rftPlot );
|
2019-09-17 12:07:55 -05:00
|
|
|
rftPlot->applyInitialSelections();
|
|
|
|
|
|
|
|
wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name
|
|
|
|
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
|
|
|
|
|
2020-01-16 05:32:40 -06:00
|
|
|
rftPlot->nameConfig()->setCustomName( plotName );
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-10-17 04:01:15 -05:00
|
|
|
rftPlot->loadDataAndUpdate();
|
|
|
|
rftPlotColl->updateConnectedEditors();
|
|
|
|
|
2018-02-27 08:21:14 -06:00
|
|
|
RiuPlotMainWindowTools::showPlotMainWindow();
|
2022-08-18 05:37:51 -05:00
|
|
|
RiuPlotMainWindowTools::onObjectAppended( rftPlot, plotTrack );
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
///
|
2017-09-27 05:39:28 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2019-09-06 06:17:36 -05:00
|
|
|
actionToSetup->setText( "New RFT Plot" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 06:17:36 -05:00
|
|
|
///
|
2017-09-27 05:39:28 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-02 04:00:27 -05:00
|
|
|
QString RicNewRftPlotFeature::selectedWellName()
|
2017-09-27 05:39:28 -05:00
|
|
|
{
|
2017-11-02 04:00:27 -05:00
|
|
|
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
|
2019-09-06 06:17:36 -05:00
|
|
|
if ( simWell ) return simWell->name();
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-11-02 04:00:27 -05:00
|
|
|
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
|
2019-09-06 06:17:36 -05:00
|
|
|
if ( rimWellPath ) return rimWellPath->name();
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-11-02 04:00:27 -05:00
|
|
|
return QString();
|
2017-09-27 05:39:28 -05:00
|
|
|
}
|