Summary Multiplot: sync plot selection in tree with view (#8788)

* Make sure the subplot selected in the tree is shown in the multiplot viewer. 
* Clean up multiplot toolbar handling a bit
* Remove old summary plot toolbar.
This commit is contained in:
jonjenssen
2022-04-07 16:24:27 +02:00
committed by GitHub
parent 3590c52cdc
commit d156160daf
27 changed files with 78 additions and 228 deletions

View File

@@ -663,6 +663,24 @@ void RiuMultiPlotBook::changeCurrentPage( int pageNumber )
if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::scrollToPlot( RiuPlotWidget* plotWidget )
{
int pageNum = 0;
for ( auto& page : m_pages )
{
if ( page->indexOfPlotWidget( plotWidget ) >= 0 )
{
changeCurrentPage( pageNum );
return;
}
pageNum++;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -84,6 +84,8 @@ public:
void renderTo( QPaintDevice* painter );
void scrollToPlot( RiuPlotWidget* plotWidget );
void goToNextPage();
void goToPrevPage();
void goToLastPage();

View File

@@ -196,7 +196,6 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose()
cleanUpTemporaryWidgets();
m_wellLogPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->clear();
m_multiPlotToolBarEditor->clear();
setWindowTitle( "Plots - ResInsight" );
@@ -429,9 +428,6 @@ void RiuPlotMainWindow::createToolBars()
m_wellLogPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Well Log Plot", this );
m_wellLogPlotToolBarEditor->hide();
m_summaryPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Summary Plot", this );
m_summaryPlotToolBarEditor->hide();
m_multiPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Multi Plot", this );
m_multiPlotToolBarEditor->hide();
@@ -691,9 +687,8 @@ void RiuPlotMainWindow::updateMultiPlotToolBar()
RimMultiPlot* plotWindow = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
if ( plotWindow )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = { plotWindow->pagePreviewField(),
plotWindow->columnCountField(),
plotWindow->rowsPerPageField() };
std::vector<caf::PdmFieldHandle*> toolBarFields = plotWindow->fieldsToShowInToolbar();
m_multiPlotToolBarEditor->setFields( toolBarFields );
m_multiPlotToolBarEditor->updateUi();
m_multiPlotToolBarEditor->show();
@@ -706,61 +701,6 @@ void RiuPlotMainWindow::updateMultiPlotToolBar()
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
{
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_activePlotViewWindow.p() );
std::vector<caf::PdmFieldHandle*> toolBarFields;
if ( summaryMultiPlot )
{
toolBarFields = summaryMultiPlot->fieldsToShowInToolbar();
}
else if ( summaryPlot )
{
toolBarFields = summaryPlot->fieldsToShowInToolbar();
}
if ( toolBarFields.size() > 0 )
{
QString keyword;
if ( !m_summaryPlotToolBarEditor->isEditorDataValid( toolBarFields ) )
{
keyword = m_summaryPlotToolBarEditor->keywordForFocusWidget();
m_summaryPlotToolBarEditor->setFields( toolBarFields );
}
m_summaryPlotToolBarEditor->updateUi( caf::PdmUiToolBarEditor::uiEditorConfigName() );
m_summaryPlotToolBarEditor->show();
m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword( keyword );
}
else
{
m_summaryPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->hide();
}
refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::setFocusToLineEditInSummaryToolBar()
{
if ( m_summaryPlotToolBarEditor )
{
m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword(
RimSummaryPlotFilterTextCurveSetEditor::curveFilterFieldKeyword() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -901,7 +841,6 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
}
updateWellLogPlotToolBar();
updateSummaryPlotToolBar();
updateMultiPlotToolBar();
}
@@ -1005,20 +944,17 @@ void RiuPlotMainWindow::selectedObjectsChanged()
if ( firstSelectedObject )
{
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( summaryPlot );
if ( summaryPlot )
RimSummaryMultiPlot* multiSummaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot );
if ( multiSummaryPlot )
{
updateSummaryPlotToolBar();
}
else
{
RimSummaryMultiPlot* multiSummaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot );
if ( multiSummaryPlot )
updateMultiPlotToolBar();
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( summaryPlot );
if ( summaryPlot )
{
updateSummaryPlotToolBar();
updateMultiPlotToolBar();
multiSummaryPlot->makeSureIsVisible( summaryPlot );
}
}
}

View File

@@ -85,8 +85,6 @@ public:
void updateWellLogPlotToolBar();
void updateMultiPlotToolBar();
void updateSummaryPlotToolBar( bool forceUpdateUi = false );
void setFocusToLineEditInSummaryToolBar();
RicSummaryPlotEditorDialog* summaryCurveCreatorDialog( bool createIfNotPresent );
RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog( bool createIfNotPresent );
@@ -136,7 +134,6 @@ private:
std::unique_ptr<caf::PdmUiToolBarEditor> m_wellLogPlotToolBarEditor;
std::unique_ptr<caf::PdmUiToolBarEditor> m_multiPlotToolBarEditor;
std::unique_ptr<caf::PdmUiToolBarEditor> m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiPropertyView> m_pdmUiPropertyView;
std::unique_ptr<caf::PdmUiPropertyView> m_summaryPlotManagerView;

View File

@@ -94,7 +94,6 @@ void RiuPlotMainWindowTools::refreshToolbars()
if ( mpw )
{
mpw->updateSummaryPlotToolBar();
mpw->updateWellLogPlotToolBar();
mpw->updateMultiPlotToolBar();
}