From ed5f49bd6d16347b8980073407120efc6424dd86 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Sep 2023 10:41:41 +0200 Subject: [PATCH] Create one multi plot per cross plot --- .../RimMainPlotCollection.cpp | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index 05c40e75af..c39cd23da0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -196,35 +196,31 @@ void RimMainPlotCollection::initAfterRead() // Move cross plots into summary plot collection auto crossPlots = m_summaryCrossPlotCollection_OBSOLETE->plots(); - if ( !crossPlots.empty() ) + for ( auto crossPlot : crossPlots ) { + m_summaryCrossPlotCollection_OBSOLETE->removePlot( crossPlot ); + auto* summaryMultiPlot = new RimSummaryMultiPlot; summaryMultiPlot->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( m_summaryMultiPlotCollection->multiPlots().size() + 1 ) ); summaryMultiPlot->setAsPlotMdiWindow(); m_summaryMultiPlotCollection->addSummaryMultiPlot( summaryMultiPlot ); - for ( auto crossPlot : crossPlots ) - { - m_summaryCrossPlotCollection_OBSOLETE->removePlot( crossPlot ); - summaryMultiPlot->addPlot( crossPlot ); - - // We want to convert RimSummaryCrossPlot into a RimSummaryPlot. The cross plot is derived from RimSummaryPlot, but we need to - // create a new RimSummaryPlot to be able to store the PDM object as a RimSummaryPlot instead of RimSummaryCrossPlot - auto summaryPlot = new RimSummaryPlot; - summaryMultiPlot->addPlot( summaryPlot ); - - for ( auto curve : crossPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) - { - crossPlot->removeCurve( curve ); + // We want to convert RimSummaryCrossPlot into a RimSummaryPlot. The cross plot is derived from RimSummaryPlot, but we need to + // create a new RimSummaryPlot to be able to store the PDM object as a RimSummaryPlot instead of RimSummaryCrossPlot + auto summaryPlot = new RimSummaryPlot; + summaryMultiPlot->addPlot( summaryPlot ); - if ( curve->summaryCaseX() != nullptr ) curve->setAxisTypeX( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ); + for ( auto curve : crossPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + crossPlot->removeCurve( curve ); - summaryPlot->insertCurve( curve, std::numeric_limits::max() ); - summaryPlot->findOrAssignPlotAxisX( curve ); - } + if ( curve->summaryCaseX() != nullptr ) curve->setAxisTypeX( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ); - delete crossPlot; + summaryPlot->insertCurve( curve, std::numeric_limits::max() ); + summaryPlot->findOrAssignPlotAxisX( curve ); } + + delete crossPlot; } }