Create cross plot menu from list of addresses in preferences

This commit is contained in:
Magne Sjaastad
2023-10-09 13:26:14 +02:00
parent ececc3ae47
commit 51fe80b897
15 changed files with 467 additions and 72 deletions

View File

@@ -156,6 +156,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitFieldNoDefault( &m_xAddressSelector, "XAddressSelector", "" );
m_xAddressSelector = new RimSummaryAddressSelector;
m_xAddressSelector->setAxisOrientation( RimPlotAxisProperties::Orientation::HORIZONTAL );
m_xAddressSelector->setShowResampling( false );
m_xAddressSelector.uiCapability()->setUiTreeHidden( true );
m_xAddressSelector.uiCapability()->setUiTreeChildrenHidden( true );
@@ -481,6 +482,27 @@ RiaDefines::HorizontalAxisType RimEnsembleCurveSet::xAxisType() const
return m_xAxisType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSet::findOrAssignBottomAxisX( RiuPlotAxis plotAxis )
{
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
if ( !plot ) return;
if ( auto axis = plot->axisPropertiesForPlotAxis( plotAxis ) )
{
m_xAddressSelector->setPlotAxisProperties( axis );
}
else
{
RimPlotAxisProperties* newPlotAxisProperties = plot->addNewAxisProperties( plotAxis, "Bottom Axis" );
plot->updateConnectedEditors();
m_xAddressSelector->setPlotAxisProperties( newPlotAxisProperties );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -771,25 +793,14 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
if ( !m_xAddressSelector->ensemble() )
{
m_xAddressSelector->setEnsemble( summaryCaseCollection() );
}
if ( !m_xAddressSelector->summaryAddress().isValid() )
{
m_xAddressSelector->setAddress( summaryAddressY() );
}
if ( !m_xAddressSelector->plotAxisProperties() )
{
RiuPlotAxis plotAxis = RiuPlotAxis::defaultBottomForSummaryVectors();
if ( auto axis = plot->axisPropertiesForPlotAxis( plotAxis ) )
{
m_xAddressSelector->setPlotAxisProperties( axis );
}
else
{
RimPlotAxisProperties* newPlotAxisProperties =
plot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Bottom Axis" );
plot->updateConnectedEditors();
m_xAddressSelector->setPlotAxisProperties( newPlotAxisProperties );
}
}
findOrAssignBottomAxisX( RiuPlotAxis::defaultBottomForSummaryVectors() );
}
plot->updateAxes();
plot->updatePlotTitle();
@@ -1053,6 +1064,9 @@ void RimEnsembleCurveSet::childFieldChangedByUi( const caf::PdmFieldHandle* chan
{
multiPlot->updatePlotTitles();
}
// Trigger update, as the axis object name might have changed. Will update the axis object of the curve set.
updateConnectedEditors();
}
}
@@ -1068,7 +1082,13 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
curveDataGroup->add( &m_resampling );
if ( !isXAxisSummaryVector() )
{
// Resampling is automatic for cross plot curves
curveDataGroup->add( &m_resampling );
}
curveDataGroup->add( &m_yPlotAxisProperties );
}