Summary Multi Plot : Improve default behaviour (#8885)

* Summary Multi Plot : Improve default behaviour

- Perform zoom when stepping to next item
- Set defaults for range aggregation and source stepping dimension based on content when creating a multi summary plot

* Plot Axis Appearance : Do not use bold for text configuration

* Improve how scale factor for legend values are computed

* Improve defaults for range aggregation and step dimension

* Reorder Capability : Get UI item before reordering is issued

Get UI item before reordering is issued, as this operation will invalidate the tree model
This commit is contained in:
Magne Sjaastad 2022-05-06 12:09:55 +02:00 committed by GitHub
parent 74075cc9ab
commit 74ace7ea44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 105 additions and 20 deletions

View File

@ -453,15 +453,18 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con
RimProject* project = RimProject::current();
auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection();
auto* plotWindow = new RimSummaryMultiPlot();
plotWindow->setAsPlotMdiWindow();
plotCollection->addSummaryMultiPlot( plotWindow );
auto* summaryMultiPlot = new RimSummaryMultiPlot();
summaryMultiPlot->setAsPlotMdiWindow();
plotCollection->addSummaryMultiPlot( summaryMultiPlot );
appendPlotsToSummaryMultiPlot( plotWindow, plots );
appendPlotsToSummaryMultiPlot( summaryMultiPlot, plots );
summaryMultiPlot->setDefaultRangeAggregationSteppingDimension();
summaryMultiPlot->zoomAll();
plotCollection->updateAllRequiredEditors();
plotWindow->loadDataAndUpdate();
plotWindow->updateAllRequiredEditors();
summaryMultiPlot->loadDataAndUpdate();
summaryMultiPlot->updateAllRequiredEditors();
if ( !plots.empty() )
{
@ -469,10 +472,10 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow );
RiuPlotMainWindowTools::selectAsCurrentItem( summaryMultiPlot );
}
return plotWindow;
return summaryMultiPlot;
}
//--------------------------------------------------------------------------------------------------

View File

@ -452,17 +452,25 @@ void RimPlotAxisProperties::setVisible( bool visible )
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::computeAndSetScaleFactor()
{
int exponent = std::log10( visibleRangeMax() );
while ( exponent > 0 && ( exponent % 3 ) != 0 )
{
exponent--;
}
auto maxAbsValue = std::max( std::fabs( visibleRangeMax() ), std::fabs( visibleRangeMin() ) );
int exponent = std::floor( std::log10( maxAbsValue ) );
if ( exponent > 0 )
{
scaleFactor = std::pow( 10, exponent );
while ( exponent > -20 && ( exponent % 3 ) != 0 )
{
exponent--;
}
}
else
{
while ( exponent < 1 && ( exponent % 3 ) != 0 )
{
exponent++;
}
}
scaleFactor = std::pow( 10, exponent );
}
//--------------------------------------------------------------------------------------------------

View File

@ -639,6 +639,68 @@ void RimSummaryMultiPlot::zoomAll()
syncAxisRanges();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension()
{
RiaSummaryAddressAnalyzer analyzer;
for ( auto p : summaryPlots() )
{
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( p );
analyzer.appendAddresses( addresses );
}
auto rangeAggregation = AxisRangeAggregation::SUB_PLOTS;
if ( !analyzer.wellNames().empty() )
{
rangeAggregation = AxisRangeAggregation::WELLS;
}
else if ( !analyzer.groupNames().empty() )
{
rangeAggregation = AxisRangeAggregation::SUB_PLOTS;
}
else if ( !analyzer.regionNumbers().empty() )
{
rangeAggregation = AxisRangeAggregation::REGIONS;
}
else if ( !analyzer.aquifers().empty() )
{
rangeAggregation = AxisRangeAggregation::SUB_PLOTS;
}
else if ( !analyzer.blocks().empty() )
{
rangeAggregation = AxisRangeAggregation::SUB_PLOTS;
}
auto stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY;
if ( analyzer.wellNames().size() == 1 )
{
stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL;
}
else if ( analyzer.groupNames().size() == 1 )
{
stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP;
}
else if ( analyzer.regionNumbers().size() == 1 )
{
stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION;
}
else if ( analyzer.aquifers().size() == 1 )
{
stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER;
}
else if ( analyzer.blocks().size() == 1 )
{
stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK;
}
m_axisRangeAggregation = rangeAggregation;
m_sourceStepping->setStepDimension( stepDimension );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -101,6 +101,7 @@ public:
void zoomAll() override;
void setDefaultRangeAggregationSteppingDimension();
void checkAndApplyAutoAppearance();
void keepVisiblePageAfterUpdate( bool keepPage );

View File

@ -132,10 +132,12 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
m_axisProperties->setNameAndAxis( axisTitle, axis.axis(), axis.index() );
plotWidget->setAxisTitleText( axis, axisTitle );
bool titleBold = false;
plotWidget->setAxisFontsAndAlignment( axis,
m_axisProperties->titleFontSize(),
m_axisProperties->valuesFontSize(),
true,
titleBold,
titleAlignment );
plotWidget->setAxisTitleEnabled( axis, true );
}

View File

@ -517,6 +517,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
{
summaryMultiPlot->updatePlots();
summaryMultiPlot->updatePlotWindowTitle();
summaryMultiPlot->zoomAll();
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
mainPlotWindow->updateMultiPlotToolBar();
}
@ -1214,6 +1215,14 @@ RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceSteppi
return m_stepDimension();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotSourceStepping::setStepDimension( SourceSteppingDimension dimension )
{
m_stepDimension = dimension;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -74,6 +74,7 @@ public:
void syncWithStepper( RimSummaryPlotSourceStepping* other );
RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const;
void setStepDimension( RimSummaryPlotSourceStepping::SourceSteppingDimension dimension );
void updateStepIndex( int direction );

View File

@ -274,7 +274,9 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event,
const PdmUiTreeViewItemAttribute::Tag* tag;
if ( tagClicked( mouseEvent->pos(), option.rect, itemIndex, &tag ) )
{
auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex );
auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex );
auto parentIndex = itemIndex.parent();
auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex );
auto* uiObjectHandle = dynamic_cast<PdmUiObjectHandle*>( uiItem );
if ( uiObjectHandle )
@ -290,9 +292,6 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event,
}
}
auto parentIndex = itemIndex.parent();
auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex );
m_treeView->updateSubTree( parentUiItem );
m_treeView->selectAsCurrentItem( uiItem );