2017-12-12 06:22:16 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-12-12 06:22:16 -06: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
|
|
|
//
|
2017-12-12 06:22:16 -06: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>
|
2017-12-12 06:22:16 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicDuplicateSummaryPlotFeature.h"
|
|
|
|
|
|
|
|
#include "RiaSummaryTools.h"
|
|
|
|
|
|
|
|
#include "RicPasteSummaryPlotFeature.h"
|
|
|
|
|
|
|
|
#include "RimSummaryPlot.h"
|
|
|
|
#include "RimSummaryPlotCollection.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManagerTools.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cvfAssert.h"
|
2017-12-12 06:22:16 -06:00
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicDuplicateSummaryPlotFeature, "RicDuplicateSummaryPlotFeature" );
|
2017-12-12 06:22:16 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicDuplicateSummaryPlotFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
RimSummaryPlotCollection* sumPlotColl = nullptr;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
|
|
|
if ( selObj )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
sumPlotColl = RiaSummaryTools::parentSummaryPlotCollection( selObj );
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( sumPlotColl ) return true;
|
2017-12-12 06:22:16 -06:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicDuplicateSummaryPlotFeature::onActionTriggered( bool isChecked )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
|
|
|
std::vector<RimSummaryPlot*> selectedObjects = caf::selectedObjectsByType<RimSummaryPlot*>();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( selectedObjects.size() == 1 )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( selectedObjects[0] );
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicDuplicateSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Duplicate Summary Plot" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|