mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-27 16:18:44 -06:00
* Use vector name as axis object text, avoid identifier text * Select the plot clicked at in the Project Tree * Make sure RFT plots are updated when summary case and ensemble is changed * Make sure all plots are updated for multiselect and toggle statistics * Allow paste of plot on top level plot collection * Allow multiple top level plots as destination for Append operations
97 lines
3.7 KiB
C++
97 lines
3.7 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2022 Equinor ASA
|
|
//
|
|
// 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.
|
|
//
|
|
// 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.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RicAppendSummaryPlotsForSummaryCasesFeature.h"
|
|
|
|
#include "RicAppendSummaryPlotsForObjectsFeature.h"
|
|
|
|
#include "RimSummaryCase.h"
|
|
#include "RimSummaryEnsemble.h"
|
|
#include "RimSummaryMultiPlot.h"
|
|
|
|
#include "RiuDockWidgetTools.h"
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
#include <QAction>
|
|
|
|
CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForSummaryCasesFeature, "RicAppendSummaryPlotsForSummaryCasesFeature" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled() const
|
|
{
|
|
auto cases = selectedCases();
|
|
auto ensembles = selectedEnsembles();
|
|
|
|
return !( cases.empty() && ensembles.empty() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicAppendSummaryPlotsForSummaryCasesFeature::onActionTriggered( bool isChecked )
|
|
{
|
|
auto cases = selectedCases();
|
|
auto ensembles = selectedEnsembles();
|
|
|
|
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
|
|
for ( auto item : selectedTreeViewItems )
|
|
{
|
|
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
|
|
if ( !summaryMultiPlot ) continue;
|
|
|
|
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, cases, ensembles );
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicAppendSummaryPlotsForSummaryCasesFeature::setupActionLook( QAction* actionToSetup )
|
|
{
|
|
QString objectType = "Cases";
|
|
|
|
auto text = QString( "Append Plots For " ) + objectType;
|
|
actionToSetup->setText( text );
|
|
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<RimSummaryCase*> RicAppendSummaryPlotsForSummaryCasesFeature::selectedCases()
|
|
{
|
|
std::vector<RimSummaryCase*> objects;
|
|
caf::SelectionManager::instance()->objectsByType( &objects );
|
|
|
|
return objects;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<RimSummaryEnsemble*> RicAppendSummaryPlotsForSummaryCasesFeature::selectedEnsembles()
|
|
{
|
|
std::vector<RimSummaryEnsemble*> objects;
|
|
caf::SelectionManager::instance()->objectsByType( &objects );
|
|
|
|
return objects;
|
|
}
|