mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8882 from OPM/append_curves
Summary Multiplot: Source Stepping append curves with performance fixes
This commit is contained in:
@@ -41,9 +41,17 @@ RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow )
|
||||
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotBookUpdate( RiuMultiPlotBook* plotBook,
|
||||
RiaDefines::MultiPlotPageUpdateType updateType )
|
||||
{
|
||||
m_plotWindowsToUpdate.push_back( plotWindow );
|
||||
if ( m_plotBooksToUpdate.count( plotBook ) == 0 )
|
||||
{
|
||||
m_plotBooksToUpdate[plotBook] = updateType;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotBooksToUpdate[plotBook] = m_plotBooksToUpdate[plotBook] | updateType;
|
||||
}
|
||||
|
||||
startTimer( 0 );
|
||||
}
|
||||
@@ -90,7 +98,7 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
|
||||
}
|
||||
m_plotWidgetsToReplot.clear();
|
||||
m_plotPagesToUpdate.clear();
|
||||
m_plotWindowsToUpdate.clear();
|
||||
m_plotBooksToUpdate.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -98,30 +106,28 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
{
|
||||
std::vector<QPointer<RiuMultiPlotBook>> plotWindowsToUpdate;
|
||||
std::map<QPointer<RiuMultiPlotBook>, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate;
|
||||
std::vector<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
|
||||
std::map<QPointer<RiuMultiPlotPage>, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate;
|
||||
|
||||
pagesToUpdate.swap( m_plotPagesToUpdate );
|
||||
plotWindowsToUpdate.swap( m_plotWindowsToUpdate );
|
||||
plotBooksToUpdate.swap( m_plotBooksToUpdate );
|
||||
plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
|
||||
|
||||
std::set<QPointer<RiuPlotWidget>> updatedPlots;
|
||||
std::set<QPointer<RiuMultiPlotBook>> updatedPlotWindows;
|
||||
std::set<QPointer<RiuPlotWidget>> updatedPlots;
|
||||
|
||||
for ( QPointer<RiuMultiPlotBook> plotWindow : plotWindowsToUpdate )
|
||||
for ( auto& [plotBook, updateType] : plotBooksToUpdate )
|
||||
{
|
||||
if ( !plotWindow.isNull() && !updatedPlotWindows.count( plotWindow ) )
|
||||
if ( plotBook.isNull() ) continue;
|
||||
|
||||
if ( ( updateType & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT )
|
||||
{
|
||||
for ( RiuMultiPlotPage* page : plotWindow->pages() )
|
||||
for ( RiuMultiPlotPage* page : plotBook->pages() )
|
||||
{
|
||||
if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page );
|
||||
}
|
||||
|
||||
const bool regeneratePages = true;
|
||||
plotWindow->performUpdate( regeneratePages );
|
||||
updatedPlotWindows.insert( plotWindow );
|
||||
}
|
||||
plotBook->performUpdate( updateType );
|
||||
}
|
||||
|
||||
for ( auto& [page, updateType] : pagesToUpdate )
|
||||
|
||||
@@ -40,7 +40,9 @@ class RiaPlotWindowRedrawScheduler : public QObject
|
||||
public:
|
||||
static RiaPlotWindowRedrawScheduler* instance();
|
||||
|
||||
void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow );
|
||||
void scheduleMultiPlotBookUpdate(
|
||||
RiuMultiPlotBook* plotWindow,
|
||||
RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL );
|
||||
void scheduleMultiPlotPageUpdate(
|
||||
RiuMultiPlotPage* plotWindow,
|
||||
RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL );
|
||||
@@ -59,9 +61,9 @@ private:
|
||||
|
||||
private:
|
||||
std::map<QPointer<RiuMultiPlotPage>, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate;
|
||||
std::map<QPointer<RiuMultiPlotBook>, RiaDefines::MultiPlotPageUpdateType> m_plotBooksToUpdate;
|
||||
|
||||
std::vector<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
|
||||
std::vector<QPointer<RiuMultiPlotBook>> m_plotWindowsToUpdate;
|
||||
std::vector<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
|
||||
|
||||
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
|
||||
};
|
||||
|
||||
@@ -57,8 +57,6 @@ void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked
|
||||
|
||||
auto selectionType = sumAddressCollections.front()->contentType();
|
||||
auto sourcePlots = summaryMultiPlot->summaryPlots();
|
||||
auto plotsForOneInstance =
|
||||
RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( sourcePlots, selectionType );
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> pdmObjects;
|
||||
for ( auto summaryAdrCollection : sumAddressCollections )
|
||||
@@ -70,8 +68,6 @@ void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked
|
||||
{
|
||||
plot->handleDroppedObjects( pdmObjects );
|
||||
}
|
||||
|
||||
summaryMultiPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataSourceSteppingTools::modifyCurrentIndex( caf::PdmValueField* valueField,
|
||||
const QList<caf::PdmOptionItemInfo>& options,
|
||||
int indexOffset )
|
||||
int indexOffset,
|
||||
bool notifyChange )
|
||||
{
|
||||
if ( valueField && !options.isEmpty() )
|
||||
{
|
||||
@@ -65,7 +66,7 @@ void RimDataSourceSteppingTools::modifyCurrentIndex( caf::PdmValueField*
|
||||
{
|
||||
QVariant newValue = options[nextIndex].value();
|
||||
valueField->setFromQVariant( newValue );
|
||||
valueField->uiCapability()->notifyFieldChanged( currentValue, newValue );
|
||||
if ( notifyChange ) valueField->uiCapability()->notifyFieldChanged( currentValue, newValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ class RimDataSourceSteppingTools
|
||||
public:
|
||||
static void modifyCurrentIndex( caf::PdmValueField* valueField,
|
||||
const QList<caf::PdmOptionItemInfo>& options,
|
||||
int indexOffset );
|
||||
int indexOffset,
|
||||
bool notifyChange = true );
|
||||
|
||||
static bool updateAddressIfMatching( const QVariant& oldValue,
|
||||
const QVariant& newValue,
|
||||
|
||||
@@ -176,6 +176,7 @@ QString RimMultiPlot::multiPlotTitle() const
|
||||
void RimMultiPlot::setMultiPlotTitle( const QString& title )
|
||||
{
|
||||
m_plotWindowTitle = title;
|
||||
if ( !m_viewer.isNull() ) m_viewer->setPlotTitle( title );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,8 +72,9 @@ public:
|
||||
virtual void removePlotNoUpdate( RimPlot* plot );
|
||||
virtual void updateAfterPlotRemove();
|
||||
|
||||
void deleteAllPlots() override;
|
||||
void updatePlots();
|
||||
void deleteAllPlots() override;
|
||||
void updatePlots();
|
||||
virtual void updatePlotWindowTitle();
|
||||
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
@@ -136,8 +137,7 @@ protected:
|
||||
void updateZoom();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
virtual void updatePlotWindowTitle();
|
||||
void onPlotAdditionOrRemoval();
|
||||
void onPlotAdditionOrRemoval();
|
||||
|
||||
bool isMouseCursorInsidePlot();
|
||||
|
||||
|
||||
@@ -131,6 +131,16 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_appendPrevPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendPrevPlot.uiCapability()->setUiIconFromResourceString( ":/AppendPrev.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_appendNextCurve, "AppendNextCurve", false, "", "", "Step Next and Add Curve to Plot" );
|
||||
m_appendNextCurve.xmlCapability()->disableIO();
|
||||
m_appendNextCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendNextCurve.uiCapability()->setUiIconFromResourceString( ":/AppendNextCurve.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_appendPrevCurve, "AppendPrevCurve", false, "", "", "Step Previous and Add Curve to Plot" );
|
||||
m_appendPrevCurve.xmlCapability()->disableIO();
|
||||
m_appendPrevCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" );
|
||||
|
||||
@@ -408,6 +418,18 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
int stepDirection = -1;
|
||||
appendSubPlotByStepping( stepDirection );
|
||||
}
|
||||
else if ( changedField == &m_appendNextCurve )
|
||||
{
|
||||
m_appendNextCurve = false;
|
||||
int stepDirection = 1;
|
||||
appendCurveByStepping( stepDirection );
|
||||
}
|
||||
else if ( changedField == &m_appendPrevCurve )
|
||||
{
|
||||
m_appendPrevCurve = false;
|
||||
int stepDirection = -1;
|
||||
appendCurveByStepping( stepDirection );
|
||||
}
|
||||
else if ( changedField == &m_autoAdjustAppearance )
|
||||
{
|
||||
checkAndApplyAutoAppearance();
|
||||
@@ -526,6 +548,9 @@ std::vector<caf::PdmFieldHandle*> RimSummaryMultiPlot::fieldsToShowInToolbar()
|
||||
toolBarFields.push_back( &m_appendPrevPlot );
|
||||
toolBarFields.push_back( &m_appendNextPlot );
|
||||
|
||||
toolBarFields.push_back( &m_appendPrevCurve );
|
||||
toolBarFields.push_back( &m_appendNextCurve );
|
||||
|
||||
auto multiFields = RimMultiPlot::fieldsToShowInToolbar();
|
||||
toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) );
|
||||
|
||||
@@ -1069,6 +1094,44 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction )
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::appendCurveByStepping( int direction )
|
||||
{
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> addresses;
|
||||
|
||||
for ( auto curve : plot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
|
||||
{
|
||||
auto address = curve->summaryAddressY();
|
||||
auto sumCase = curve->summaryCaseY();
|
||||
address = m_sourceStepping->stepAddress( address, direction );
|
||||
addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCase->caseId() ) );
|
||||
}
|
||||
|
||||
for ( auto curveSet : plot->curveSets() )
|
||||
{
|
||||
auto address = curveSet->summaryAddress();
|
||||
auto sumEns = curveSet->summaryCaseCollection();
|
||||
address = m_sourceStepping->stepAddress( address, direction );
|
||||
addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEns->ensembleId() ) );
|
||||
}
|
||||
|
||||
plot->handleDroppedObjects( addresses );
|
||||
|
||||
for ( auto adr : addresses )
|
||||
{
|
||||
delete adr;
|
||||
}
|
||||
}
|
||||
|
||||
m_sourceStepping->updateStepIndex( direction );
|
||||
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
|
||||
void removePlotNoUpdate( RimPlot* plot ) override;
|
||||
void updateAfterPlotRemove() override;
|
||||
void updatePlotWindowTitle() override;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar() override;
|
||||
|
||||
@@ -118,13 +119,13 @@ private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void populateNameHelper( RimSummaryPlotNameHelper* nameHelper );
|
||||
|
||||
void updatePlotWindowTitle() override;
|
||||
void computeAggregatedAxisRange();
|
||||
void updateSourceStepper();
|
||||
|
||||
void duplicate();
|
||||
|
||||
void appendSubPlotByStepping( int direction );
|
||||
void appendCurveByStepping( int direction );
|
||||
|
||||
void analyzePlotsAndAdjustAppearanceSettings();
|
||||
|
||||
@@ -142,6 +143,9 @@ private:
|
||||
caf::PdmField<bool> m_appendNextPlot;
|
||||
caf::PdmField<bool> m_appendPrevPlot;
|
||||
|
||||
caf::PdmField<bool> m_appendNextCurve;
|
||||
caf::PdmField<bool> m_appendPrevCurve;
|
||||
|
||||
caf::PdmField<caf::AppEnum<AxisRangeAggregation>> m_axisRangeAggregation;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_sourceStepping;
|
||||
|
||||
@@ -2043,20 +2043,60 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
|
||||
|
||||
if ( summaryAddr->isEnsemble() )
|
||||
{
|
||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCaseCollection*>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : curveSets() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddress();
|
||||
dataVectorMap[curveAddress].insert( curve->summaryCaseCollection() );
|
||||
}
|
||||
|
||||
auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() );
|
||||
if ( ensemble )
|
||||
{
|
||||
addNewEnsembleCurveY( summaryAddr->address(), ensemble );
|
||||
newCurves++;
|
||||
RifEclipseSummaryAddress droppedAddress = summaryAddr->address();
|
||||
|
||||
bool skipAddress = false;
|
||||
|
||||
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
||||
{
|
||||
skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 );
|
||||
}
|
||||
|
||||
if ( !skipAddress )
|
||||
{
|
||||
addNewEnsembleCurveY( droppedAddress, ensemble );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
dataVectorMap[curveAddress].insert( curve->summaryCaseY() );
|
||||
}
|
||||
|
||||
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() );
|
||||
if ( summaryCase )
|
||||
{
|
||||
curves.push_back( addNewCurveY( summaryAddr->address(), summaryCase ) );
|
||||
newCurves++;
|
||||
RifEclipseSummaryAddress droppedAddress = summaryAddr->address();
|
||||
|
||||
bool skipAddress = false;
|
||||
|
||||
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
||||
{
|
||||
skipAddress = ( dataVectorMap[droppedAddress].count( summaryCase ) > 0 );
|
||||
}
|
||||
|
||||
if ( !skipAddress )
|
||||
{
|
||||
curves.push_back( addNewCurveY( droppedAddress, summaryCase ) );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return { newCurves, curves };
|
||||
|
||||
@@ -516,6 +516,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
summaryMultiPlot->updatePlots();
|
||||
summaryMultiPlot->updatePlotWindowTitle();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateMultiPlotToolBar();
|
||||
}
|
||||
@@ -883,11 +884,11 @@ bool RimSummaryPlotSourceStepping::isYAxisStepping() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset )
|
||||
void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset, bool notifyChange )
|
||||
{
|
||||
bool useOptionsOnly;
|
||||
QList<caf::PdmOptionItemInfo> options = calculateValueOptions( valueField, &useOptionsOnly );
|
||||
RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset );
|
||||
RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset, notifyChange );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1285,3 +1286,15 @@ RimSummaryCaseCollection* RimSummaryPlotSourceStepping::stepEnsemble( int direct
|
||||
|
||||
return m_ensemble;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::updateStepIndex( int direction )
|
||||
{
|
||||
caf::PdmValueField* valueField = fieldToModify();
|
||||
if ( !valueField ) return;
|
||||
|
||||
bool notifyChange = false;
|
||||
modifyCurrentIndex( valueField, direction, notifyChange );
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
|
||||
RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const;
|
||||
|
||||
void updateStepIndex( int direction );
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
@@ -102,7 +104,7 @@ private:
|
||||
bool isXAxisStepping() const;
|
||||
bool isYAxisStepping() const;
|
||||
|
||||
void modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset );
|
||||
void modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset, bool notifyChange = true );
|
||||
|
||||
std::vector<RimSummaryCase*> summaryCasesForSourceStepping();
|
||||
|
||||
|
||||
@@ -218,19 +218,6 @@ void RiuMultiPlotBook::removeAllPlots()
|
||||
void RiuMultiPlotBook::setPlotTitle( const QString& plotTitle )
|
||||
{
|
||||
m_plotTitle = plotTitle;
|
||||
for ( int i = 0; i < m_pages.size(); ++i )
|
||||
{
|
||||
int pageIndex = i + 1;
|
||||
int pageCount = (int)m_pages.size();
|
||||
if ( pageCount > pageIndex )
|
||||
{
|
||||
m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( i + 1 ).arg( m_pages.size() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pages[i]->setPlotTitle( QString( "%1" ).arg( m_plotTitle ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -266,6 +253,7 @@ void RiuMultiPlotBook::scheduleTitleUpdate()
|
||||
{
|
||||
page->scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::TITLE );
|
||||
}
|
||||
scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::TITLE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -333,9 +321,9 @@ void RiuMultiPlotBook::setPagePreviewModeEnabled( bool previewMode )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotBook::scheduleUpdate()
|
||||
void RiuMultiPlotBook::scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate )
|
||||
{
|
||||
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotWindowUpdate( this );
|
||||
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotBookUpdate( this, whatToUpdate );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -410,8 +398,8 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event )
|
||||
{
|
||||
m_goToPageAfterUpdate = true;
|
||||
QWidget::showEvent( event );
|
||||
const bool regeneratePages = false;
|
||||
performUpdate( regeneratePages );
|
||||
|
||||
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
|
||||
if ( m_previewMode )
|
||||
{
|
||||
applyPagePreviewBookSize( width() );
|
||||
@@ -501,16 +489,22 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotBook::performUpdate( bool regeneratePages )
|
||||
void RiuMultiPlotBook::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate )
|
||||
{
|
||||
if ( !m_plotDefinition || !m_plotDefinition->isValid() ) return;
|
||||
|
||||
applyLook();
|
||||
if ( regeneratePages || m_pages.size() == 0 )
|
||||
if ( ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) ||
|
||||
m_pages.size() == 0 )
|
||||
{
|
||||
deleteAllPages();
|
||||
createPages();
|
||||
}
|
||||
else if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::TITLE ) == RiaDefines::MultiPlotPageUpdateType::TITLE )
|
||||
{
|
||||
updatePageTitles();
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
|
||||
RimSummaryMultiPlot* multiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_plotDefinition.p() );
|
||||
@@ -524,6 +518,27 @@ void RiuMultiPlotBook::performUpdate( bool regeneratePages )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotBook::updatePageTitles()
|
||||
{
|
||||
if ( m_pages.isEmpty() ) return;
|
||||
|
||||
if ( m_pages.size() > 1 )
|
||||
{
|
||||
for ( int i = 0; i < m_pages.size(); ++i )
|
||||
{
|
||||
int pageNumber = i + 1;
|
||||
m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pages[0]->setPlotTitle( QString( "%1" ).arg( m_plotTitle ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -603,14 +618,8 @@ void RiuMultiPlotBook::createPages()
|
||||
}
|
||||
|
||||
// Set page numbers in title when there's more than one page
|
||||
if ( m_pages.size() > 1 )
|
||||
{
|
||||
for ( int i = 0; i < m_pages.size(); ++i )
|
||||
{
|
||||
int pageNumber = i + 1;
|
||||
m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) );
|
||||
}
|
||||
}
|
||||
updatePageTitles();
|
||||
|
||||
adjustBookFrame();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
bool pagePreviewModeEnabled() const;
|
||||
void setPagePreviewModeEnabled( bool previewMode );
|
||||
|
||||
void scheduleUpdate();
|
||||
void scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate = RiaDefines::MultiPlotPageUpdateType::ALL );
|
||||
void scheduleReplotOfAllPlots();
|
||||
|
||||
void renderTo( QPaintDevice* painter );
|
||||
@@ -123,6 +123,8 @@ protected:
|
||||
|
||||
const QList<QPointer<RiuMultiPlotPage>>& pages() const;
|
||||
|
||||
void updatePageTitles();
|
||||
|
||||
private:
|
||||
RiuMultiPlotPage* createPage();
|
||||
void deleteAllPages();
|
||||
@@ -131,7 +133,7 @@ private:
|
||||
void changeCurrentPage( int pageNumber );
|
||||
|
||||
private slots:
|
||||
virtual void performUpdate( bool regeneratePages );
|
||||
virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType updateType );
|
||||
|
||||
protected:
|
||||
friend class RiaPlotWindowRedrawScheduler;
|
||||
|
||||
@@ -84,14 +84,7 @@ void RiuSummaryMultiPlotBook::createPages()
|
||||
}
|
||||
|
||||
// Set page numbers in title when there's more than one page
|
||||
if ( m_pages.size() > 1 )
|
||||
{
|
||||
for ( int i = 0; i < m_pages.size(); ++i )
|
||||
{
|
||||
int pageNumber = i + 1;
|
||||
m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) );
|
||||
}
|
||||
}
|
||||
updatePageTitles();
|
||||
adjustBookFrame();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user