2017-09-27 12:39:28 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2017-11-02 10:00:27 +01:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 13:17:36 +02:00
|
|
|
//
|
2017-09-27 12:39:28 +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 13:17:36 +02:00
|
|
|
//
|
2017-09-27 12:39:28 +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 13:17:36 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-09-27 12:39:28 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "RicNewRftPlotFeature.h"
|
|
|
|
|
|
2023-11-03 14:25:52 +01:00
|
|
|
#include "RicCreateRftPlotsFeature.h"
|
|
|
|
|
|
2017-11-02 10:00:27 +01:00
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
|
#include "RimRftPlotCollection.h"
|
2017-10-13 09:29:42 +02:00
|
|
|
#include "RimSimWellInView.h"
|
2017-09-27 12:39:28 +02:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
|
2017-10-19 09:09:22 +02:00
|
|
|
#include "cafSelectionManagerTools.h"
|
2017-09-27 12:39:28 +02:00
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2019-09-06 13:17:36 +02:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
|
2017-09-27 12:39:28 +02:00
|
|
|
|
2017-10-06 07:41:48 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
///
|
2017-10-06 07:41:48 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-06-26 14:28:46 +02:00
|
|
|
bool RicNewRftPlotFeature::isCommandEnabled() const
|
2017-09-27 12:39:28 +02:00
|
|
|
{
|
2023-11-03 14:25:52 +01:00
|
|
|
auto* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection>();
|
2019-09-06 13:17:36 +02:00
|
|
|
if ( simWell ) return true;
|
|
|
|
|
|
|
|
|
|
if ( selectedWellName().isEmpty() )
|
2017-10-05 16:25:04 +02:00
|
|
|
{
|
2017-11-02 10:00:27 +01:00
|
|
|
return false;
|
2017-10-05 16:25:04 +02:00
|
|
|
}
|
2017-11-02 10:00:27 +01:00
|
|
|
|
|
|
|
|
return true;
|
2017-09-27 12:39:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
///
|
2017-09-27 12:39:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
|
2017-09-27 12:39:28 +02:00
|
|
|
{
|
2022-08-19 05:30:25 -07:00
|
|
|
RimRftPlotCollection* rftPlotColl = RimMainPlotCollection::current()->rftPlotCollection();
|
2019-09-06 13:17:36 +02:00
|
|
|
if ( rftPlotColl )
|
2017-09-27 12:39:28 +02:00
|
|
|
{
|
2017-11-02 10:00:27 +01:00
|
|
|
QString wellName = selectedWellName();
|
2017-09-29 11:24:18 +02:00
|
|
|
|
2023-11-03 14:25:52 +01:00
|
|
|
RicCreateRftPlotsFeature::appendRftPlotForWell( wellName, rftPlotColl );
|
2017-09-27 12:39:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
///
|
2017-09-27 12:39:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
|
2017-09-27 12:39:28 +02:00
|
|
|
{
|
2019-09-06 13:17:36 +02:00
|
|
|
actionToSetup->setText( "New RFT Plot" );
|
|
|
|
|
actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
|
2017-09-27 12:39:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 13:17:36 +02:00
|
|
|
///
|
2017-09-27 12:39:28 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-02 10:00:27 +01:00
|
|
|
QString RicNewRftPlotFeature::selectedWellName()
|
2017-09-27 12:39:28 +02:00
|
|
|
{
|
2023-11-03 14:25:52 +01:00
|
|
|
auto* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView>();
|
2019-09-06 13:17:36 +02:00
|
|
|
if ( simWell ) return simWell->name();
|
2017-09-27 12:39:28 +02:00
|
|
|
|
2023-11-03 14:25:52 +01:00
|
|
|
auto* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath>();
|
2019-09-06 13:17:36 +02:00
|
|
|
if ( rimWellPath ) return rimWellPath->name();
|
2017-09-27 12:39:28 +02:00
|
|
|
|
2023-11-03 14:25:52 +01:00
|
|
|
return {};
|
2017-09-27 12:39:28 +02:00
|
|
|
}
|