#8405 Source Stepping on multiple graphs

- add copy paste of plots into multi summary plot
- improve data source stepping for multi plot
- improve auto generated plot name, graph name and curve name
Fixes by clang-format

Improve readability
This commit is contained in:
Magne Sjaastad
2022-01-06 15:18:09 +01:00
parent 0fbd668569
commit 7db24e9353
29 changed files with 1269 additions and 460 deletions

View File

@@ -19,10 +19,14 @@
#include "RicPasteSummaryPlotFeature.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
#include "RimMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmDocument.h"
#include "cafPdmObjectGroup.h"
@@ -39,8 +43,21 @@ CAF_CMD_SOURCE_INIT( RicPasteSummaryPlotFeature, "RicPasteSummaryPlotFeature" );
//--------------------------------------------------------------------------------------------------
void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( RimSummaryPlot* sourcePlot )
{
RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlotCollection*>();
auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimMultiPlot*>();
if ( multiPlot )
{
auto plots = RicSummaryPlotBuilder::duplicatePlots( { sourcePlot } );
RicSummaryPlotBuilder::appendPlotsToMultiPlot( multiPlot, plots );
multiPlot->loadDataAndUpdate();
// No main window has focus after paste operation, set focus to main plot window
RiuPlotMainWindowTools::showPlotMainWindow();
return;
}
RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlotCollection*>();
if ( plotColl )
{
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>(
@@ -72,6 +89,9 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled()
if ( !destinationObject ) return false;
auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimMultiPlot*>();
if ( multiPlot ) return true;
RimSummaryPlotCollection* plotColl = nullptr;
destinationObject->firstAncestorOrThisOfType( plotColl );
if ( !plotColl )