Skip to content

Commit

Permalink
Convert cross plots into summary plots
Browse files Browse the repository at this point in the history
Hide cross plot collection from GUI
  • Loading branch information
magnesj committed Sep 20, 2023
1 parent f3ea5b3 commit ab3fd29
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
49 changes: 43 additions & 6 deletions ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "RimMainPlotCollection.h"

#include "RiaPlotCollectionScheduler.h"
#include "RiaSummaryDefines.h"

#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"

Expand All @@ -42,6 +43,8 @@
#include "RimStimPlanModelPlotCollection.h"
#include "RimSummaryAddress.h"
#include "RimSummaryCrossPlotCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryDataSourceStepping.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlotCollection.h"
Expand Down Expand Up @@ -176,17 +179,51 @@ RimMainPlotCollection* RimMainPlotCollection::current()
//--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::initAfterRead()
{
std::vector<RimSummaryPlot*> plotsToMove;
for ( auto singlePlot : m_summaryPlotCollection_OBSOLETE()->plots() )
{
plotsToMove.push_back( singlePlot );
std::vector<RimSummaryPlot*> plotsToMove;
for ( auto singlePlot : m_summaryPlotCollection_OBSOLETE()->plots() )
{
plotsToMove.push_back( singlePlot );
}

for ( auto singlePlot : plotsToMove )
{
m_summaryPlotCollection_OBSOLETE()->removePlot( singlePlot );

RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlotNoAutoSettings( singlePlot );
}
}

for ( auto singlePlot : plotsToMove )
// Move cross plots into summary plot collection
auto crossPlots = m_summaryCrossPlotCollection_OBSOLETE->plots();
if ( !crossPlots.empty() )
{
m_summaryPlotCollection_OBSOLETE()->removePlot( singlePlot );
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 );

RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlotNoAutoSettings( singlePlot );
// 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 );

if ( curve->summaryCaseX() != nullptr ) curve->setAxisTypeX( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR );

summaryPlot->insertCurve( curve, size_t( 999 ) );
}

delete crossPlot;
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions ApplicationLibCode/ProjectDataModel/RimProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,11 +1422,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
uiTreeOrdering.add( m_mainPlotCollection->correlationPlotCollection() );
}

if ( m_mainPlotCollection->summaryCrossPlotCollection() )
{
uiTreeOrdering.add( m_mainPlotCollection->summaryCrossPlotCollection() );
}

if ( m_mainPlotCollection->summaryTableCollection() )
{
uiTreeOrdering.add( m_mainPlotCollection->summaryTableCollection() );
Expand Down

0 comments on commit ab3fd29

Please sign in to comment.