diff --git a/ApplicationCode/Application/CMakeLists_files.cmake b/ApplicationCode/Application/CMakeLists_files.cmake index 0554e64e36..308f8074cb 100644 --- a/ApplicationCode/Application/CMakeLists_files.cmake +++ b/ApplicationCode/Application/CMakeLists_files.cmake @@ -6,21 +6,25 @@ endif() set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RiaApplication.h +${CEE_CURRENT_LIST_DIR}RiaCompletionTypeCalculationScheduler.h ${CEE_CURRENT_LIST_DIR}RiaDefines.h ${CEE_CURRENT_LIST_DIR}RiaPreferences.h ${CEE_CURRENT_LIST_DIR}RiaPorosityModel.h ${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.h ${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.h +${CEE_CURRENT_LIST_DIR}RiaViewRedrawScheduler.h ) set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RiaApplication.cpp +${CEE_CURRENT_LIST_DIR}RiaCompletionTypeCalculationScheduler.cpp ${CEE_CURRENT_LIST_DIR}RiaDefines.cpp ${CEE_CURRENT_LIST_DIR}RiaMain.cpp ${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp ${CEE_CURRENT_LIST_DIR}RiaPorosityModel.cpp ${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.cpp ${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.cpp +${CEE_CURRENT_LIST_DIR}RiaViewRedrawScheduler.cpp ) list(APPEND CODE_HEADER_FILES @@ -34,6 +38,8 @@ ${SOURCE_GROUP_SOURCE_FILES} set (QT_MOC_HEADERS ${QT_MOC_HEADERS} ${CEE_CURRENT_LIST_DIR}RiaApplication.h +${CEE_CURRENT_LIST_DIR}RiaCompletionTypeCalculationScheduler.h +${CEE_CURRENT_LIST_DIR}RiaViewRedrawScheduler.h ) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index cd1b93099d..804820e5c6 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" +#include "RiaArgumentParser.h" #include "RiaBaseDefs.h" #include "RiaImageCompareReporter.h" #include "RiaImageFileCompare.h" @@ -29,7 +30,7 @@ #include "RiaProjectModifier.h" #include "RiaSocketServer.h" #include "RiaVersionInfo.h" -#include "RiaArgumentParser.h" +#include "RiaViewRedrawScheduler.h" #include "RigGridManager.h" #include "RigEclipseCaseData.h" @@ -227,9 +228,6 @@ RiaApplication::RiaApplication(int& argc, char** argv) // instead of using the application font m_standardFont = new caf::FixedAtlasFont(caf::FixedAtlasFont::POINT_SIZE_8); - m_resViewUpdateTimer = nullptr; - m_recalculateCompletionTypeTimer = nullptr; - m_runningRegressionTests = false; m_runningWorkerProcess = false; @@ -970,7 +968,7 @@ void RiaApplication::closeProject() { RiuMainWindow* mainWnd = RiuMainWindow::instance(); - clearViewsScheduledForUpdate(); + RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate(); terminateProcess(); @@ -2221,21 +2219,6 @@ cvf::Font* RiaApplication::customFont() return m_customFont.p(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::clearViewsScheduledForUpdate() -{ - if (m_resViewUpdateTimer) - { - while (m_resViewUpdateTimer->isActive()) - { - QCoreApplication::processEvents(); - } - } - m_resViewsToUpdate.clear(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2308,136 +2291,6 @@ QString RiaApplication::commandLineParameterHelp() const */ } -//-------------------------------------------------------------------------------------------------- -/// Schedule a creation of the Display model and redraw of the reservoir view -/// The redraw will happen as soon as the event loop is entered -//-------------------------------------------------------------------------------------------------- -void RiaApplication::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate) -{ - m_resViewsToUpdate.push_back(resViewToUpdate); - - if (!m_resViewUpdateTimer) - { - m_resViewUpdateTimer = new QTimer(this); - connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateScheduledDisplayModels())); - } - - if (!m_resViewUpdateTimer->isActive()) - { - m_resViewUpdateTimer->setSingleShot(true); - m_resViewUpdateTimer->start(0); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::scheduleRecalculateCompletionTypeAndRedrawAllViews() -{ - for (RimEclipseCase* eclipseCase : project()->activeOilField()->analysisModels->cases()) - { - m_eclipseCasesToRecalculate.push_back(eclipseCase); - } - - if (!m_recalculateCompletionTypeTimer) - { - m_recalculateCompletionTypeTimer = new QTimer(this); - m_recalculateCompletionTypeTimer->setSingleShot(true); - connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecalculateCompletionType())); - } - - m_recalculateCompletionTypeTimer->start(1500); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase) -{ - m_eclipseCasesToRecalculate.push_back(eclipseCase); - - - if (!m_recalculateCompletionTypeTimer) - { - m_recalculateCompletionTypeTimer = new QTimer(this); - m_recalculateCompletionTypeTimer->setSingleShot(true); - connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecalculateCompletionType())); - } - - m_recalculateCompletionTypeTimer->start(500); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::slotUpdateScheduledDisplayModels() -{ - // Compress to remove duplicates - // and update dependent views after independent views - - std::set independent3DViewsToUpdate; - std::set dependent3DViewsToUpdate; - - for (size_t i = 0; i < m_resViewsToUpdate.size(); ++i) - { - if (!m_resViewsToUpdate[i]) continue; - - if (m_resViewsToUpdate[i]->viewController()) - dependent3DViewsToUpdate.insert(m_resViewsToUpdate[i]); - else - independent3DViewsToUpdate.insert(m_resViewsToUpdate[i]); - } - - for (std::set::iterator it = independent3DViewsToUpdate.begin(); it != independent3DViewsToUpdate.end(); ++it ) - { - if (*it) - { - (*it)->createDisplayModelAndRedraw(); - } - } - - for (std::set::iterator it = dependent3DViewsToUpdate.begin(); it != dependent3DViewsToUpdate.end(); ++it) - { - if (*it) - { - (*it)->createDisplayModelAndRedraw(); - } - } - - m_resViewsToUpdate.clear(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::slotRecalculateCompletionType() -{ - std::set uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end()); - - Rim3dView* activeView = RiaApplication::instance()->activeReservoirView(); - QModelIndex mi = RiuMainWindow::instance()->projectTreeView()->treeView()->currentIndex(); - - for (RimEclipseCase* eclipseCase : uniqueCases) - { - eclipseCase->recalculateCompletionTypeAndRedrawAllViews(); - } - - m_eclipseCasesToRecalculate.clear(); - - // Recalculation of completion type causes active view to be set to potentially a different view - // Also current index in project tree is changed. Restore both to initial state. - - if (activeView && activeView->viewer()) - { - RiaApplication::instance()->setActiveReservoirView(activeView); - RiuMainWindow::instance()->setActiveViewer(activeView->viewer()->layoutWidget()); - } - - if (mi.isValid()) - { - RiuMainWindow::instance()->projectTreeView()->treeView()->setCurrentIndex(mi); - } -} //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/Application/RiaApplication.h b/ApplicationCode/Application/RiaApplication.h index 780cc10b48..aeaf2cde29 100644 --- a/ApplicationCode/Application/RiaApplication.h +++ b/ApplicationCode/Application/RiaApplication.h @@ -105,10 +105,6 @@ public: RimViewWindow* activePlotWindow() const; - void scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate); - void scheduleRecalculateCompletionTypeAndRedrawAllViews(); - void scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase); - RimProject* project(); void createMockModel(); @@ -205,7 +201,6 @@ public: static std::vector readFileListFromTextFile(QString listFileName); - void clearViewsScheduledForUpdate(); private: @@ -224,29 +219,19 @@ private: void regressionTestConfigureProject(); static QSize regressionDefaultImageSize(); + friend RiaArgumentParser; void setHelpText(const QString& helpText); private slots: void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); - void slotUpdateScheduledDisplayModels(); - void slotRecalculateCompletionType(); - // Friend classes required to have access to slotUpdateScheduledDisplayModels - // As snapshots are produced fast in sequence, the feature must have access to force redraw - // of scheduled redraws - friend class Rim3dView; - friend class RicExportMultipleSnapshotsFeature; - friend class RiaArgumentParser; + private: caf::PdmPointer m_activeReservoirView; caf::PdmPointer m_project; - std::vector > m_resViewsToUpdate; - QTimer* m_resViewUpdateTimer; - std::vector > m_eclipseCasesToRecalculate; - QTimer* m_recalculateCompletionTypeTimer; RiaSocketServer* m_socketServer; diff --git a/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.cpp new file mode 100644 index 0000000000..c0a6d10800 --- /dev/null +++ b/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.cpp @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaCompletionTypeCalculationScheduler.h" +#include "RimEclipseCase.h" +#include "RimEclipseCaseCollection.h" +#include "RiaApplication.h" +#include "RimOilField.h" +#include "RimProject.h" + +#include +#include +#include "QAbstractItemModel" +#include "RiuMainWindow.h" +#include "cafPdmUiTreeView.h" +#include +#include "Rim3dView.h" +#include "RiuViewer.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaCompletionTypeCalculationScheduler* RiaCompletionTypeCalculationScheduler::instance() +{ + static RiaCompletionTypeCalculationScheduler theInstance; + + return &theInstance; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews() +{ + for (RimEclipseCase* eclipseCase : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases()) + { + m_eclipseCasesToRecalculate.push_back(eclipseCase); + } + + if (!m_recalculateCompletionTypeTimer) + { + m_recalculateCompletionTypeTimer = new QTimer(this); + m_recalculateCompletionTypeTimer->setSingleShot(true); + connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecalculateCompletionType())); + } + + m_recalculateCompletionTypeTimer->start(1500); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase) +{ + m_eclipseCasesToRecalculate.push_back(eclipseCase); + + + if (!m_recalculateCompletionTypeTimer) + { + m_recalculateCompletionTypeTimer = new QTimer(this); + m_recalculateCompletionTypeTimer->setSingleShot(true); + connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecalculateCompletionType())); + } + + m_recalculateCompletionTypeTimer->start(1500); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType() +{ + std::set uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end()); + + Rim3dView* activeView = RiaApplication::instance()->activeReservoirView(); + QModelIndex mi = RiuMainWindow::instance()->projectTreeView()->treeView()->currentIndex(); + + for (RimEclipseCase* eclipseCase : uniqueCases) + { + eclipseCase->recalculateCompletionTypeAndRedrawAllViews(); + } + + m_eclipseCasesToRecalculate.clear(); + + // Recalculation of completion type causes active view to be set to potentially a different view + // Also current index in project tree is changed. Restore both to initial state. + + if (activeView && activeView->viewer()) + { + RiaApplication::instance()->setActiveReservoirView(activeView); + RiuMainWindow::instance()->setActiveViewer(activeView->viewer()->layoutWidget()); + } + + if (mi.isValid()) + { + RiuMainWindow::instance()->projectTreeView()->treeView()->setCurrentIndex(mi); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaCompletionTypeCalculationScheduler::~RiaCompletionTypeCalculationScheduler() +{ + delete m_recalculateCompletionTypeTimer; +} diff --git a/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.h b/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.h new file mode 100644 index 0000000000..256b864c53 --- /dev/null +++ b/ApplicationCode/Application/RiaCompletionTypeCalculationScheduler.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include "cafPdmPointer.h" + +class QTimer; +class RimEclipseCase; + + +class RiaCompletionTypeCalculationScheduler : public QObject +{ + Q_OBJECT; +public: + static RiaCompletionTypeCalculationScheduler* instance(); + void scheduleRecalculateCompletionTypeAndRedrawAllViews(); + void scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase); + +private slots: + void slotRecalculateCompletionType(); + +private: + RiaCompletionTypeCalculationScheduler() : m_recalculateCompletionTypeTimer(nullptr) {} + ~RiaCompletionTypeCalculationScheduler(); + + RiaCompletionTypeCalculationScheduler(const RiaCompletionTypeCalculationScheduler& o) = delete; + void operator=(const RiaCompletionTypeCalculationScheduler& o) = delete; + + std::vector > m_eclipseCasesToRecalculate; + QTimer* m_recalculateCompletionTypeTimer; +}; + + diff --git a/ApplicationCode/Application/RiaViewRedrawScheduler.cpp b/ApplicationCode/Application/RiaViewRedrawScheduler.cpp new file mode 100644 index 0000000000..4262ea9814 --- /dev/null +++ b/ApplicationCode/Application/RiaViewRedrawScheduler.cpp @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaViewRedrawScheduler.h" +#include "Rim3dView.h" + +#include +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaViewRedrawScheduler* RiaViewRedrawScheduler::instance() +{ + static RiaViewRedrawScheduler theInstance; + + return &theInstance; +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaViewRedrawScheduler::clearViewsScheduledForUpdate() +{ + if (m_resViewUpdateTimer) + { + while (m_resViewUpdateTimer->isActive()) + { + QCoreApplication::processEvents(); + } + } + m_resViewsToUpdate.clear(); +} + + +//-------------------------------------------------------------------------------------------------- +/// Schedule a creation of the Display model and redraw of the reservoir view +/// The redraw will happen as soon as the event loop is entered +//-------------------------------------------------------------------------------------------------- +void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate) +{ + m_resViewsToUpdate.push_back(resViewToUpdate); + + if (!m_resViewUpdateTimer) + { + m_resViewUpdateTimer = new QTimer(this); + connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateScheduledDisplayModels())); + } + + if (!m_resViewUpdateTimer->isActive()) + { + m_resViewUpdateTimer->setSingleShot(true); + m_resViewUpdateTimer->start(0); + } +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaViewRedrawScheduler::slotUpdateScheduledDisplayModels() +{ + // Compress to remove duplicates + // and update dependent views after independent views + + std::set independent3DViewsToUpdate; + std::set dependent3DViewsToUpdate; + + for (size_t i = 0; i < m_resViewsToUpdate.size(); ++i) + { + if (!m_resViewsToUpdate[i]) continue; + + if (m_resViewsToUpdate[i]->viewController()) + dependent3DViewsToUpdate.insert(m_resViewsToUpdate[i]); + else + independent3DViewsToUpdate.insert(m_resViewsToUpdate[i]); + } + + for (std::set::iterator it = independent3DViewsToUpdate.begin(); it != independent3DViewsToUpdate.end(); ++it ) + { + if (*it) + { + (*it)->createDisplayModelAndRedraw(); + } + } + + for (std::set::iterator it = dependent3DViewsToUpdate.begin(); it != dependent3DViewsToUpdate.end(); ++it) + { + if (*it) + { + (*it)->createDisplayModelAndRedraw(); + } + } + + m_resViewsToUpdate.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaViewRedrawScheduler::~RiaViewRedrawScheduler() +{ + delete m_resViewUpdateTimer; +} diff --git a/ApplicationCode/Application/RiaViewRedrawScheduler.h b/ApplicationCode/Application/RiaViewRedrawScheduler.h new file mode 100644 index 0000000000..52b4246b63 --- /dev/null +++ b/ApplicationCode/Application/RiaViewRedrawScheduler.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include "cafPdmPointer.h" + +class QTimer; +class Rim3dView; + + +class RiaViewRedrawScheduler : public QObject +{ + Q_OBJECT; +public: + static RiaViewRedrawScheduler* instance(); + void scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate); + void clearViewsScheduledForUpdate(); + +public slots: + void slotUpdateScheduledDisplayModels(); + +private: + RiaViewRedrawScheduler() : m_resViewUpdateTimer(nullptr) {} + ~RiaViewRedrawScheduler(); + + RiaViewRedrawScheduler(const RiaViewRedrawScheduler& o) = delete; + void operator=(const RiaViewRedrawScheduler& o) = delete; + + std::vector > m_resViewsToUpdate; + QTimer* m_resViewUpdateTimer; +}; + + diff --git a/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp index 91098d0d63..ef6ae4eaff 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportMultipleSnapshotsFeature.cpp @@ -19,6 +19,7 @@ #include "RicExportMultipleSnapshotsFeature.h" #include "RiaApplication.h" +#include "RiaViewRedrawScheduler.h" #include "RicSnapshotViewToFileFeature.h" @@ -229,7 +230,7 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(Rim3dView* // Force update of scheduled display models modifying the time step // This is required due to visualization structures updated by the update functions, // and this is not triggered by changing time step only - RiaApplication::instance()->slotUpdateScheduledDisplayModels(); + RiaViewRedrawScheduler::instance()->slotUpdateScheduledDisplayModels(); viewer->setCurrentFrame(i); viewer->animationControl()->setCurrentFrameOnly(i); diff --git a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index b1f81b4a08..6f56ebdf5e 100644 --- a/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RiaLogging.h" +#include "RiaViewRedrawScheduler.h" #include "RimMainPlotCollection.h" #include "RimProject.h" @@ -110,7 +111,7 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QStrin RiuViewer* viewer = riv->viewer(); mainWnd->setActiveViewer(viewer->layoutWidget()); - RiaApplication::instance()->clearViewsScheduledForUpdate(); + RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate(); //riv->updateCurrentTimeStepAndRedraw(); riv->createDisplayModelAndRedraw(); diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.cpp b/ApplicationCode/ProjectDataModel/Rim3dView.cpp index 75930a9963..3cffac7562 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dView.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaPreferences.h" +#include "RiaViewRedrawScheduler.h" #include "Rim3dOverlayInfoConfig.h" #include "RimCellRangeFilterCollection.h" @@ -317,7 +318,7 @@ QImage Rim3dView::snapshotWindowContent() if (m_viewer) { // Force update of scheduled display models before snapshotting - RiaApplication::instance()->slotUpdateScheduledDisplayModels(); + RiaViewRedrawScheduler::instance()->slotUpdateScheduledDisplayModels(); m_viewer->repaint(); @@ -332,7 +333,7 @@ QImage Rim3dView::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void Rim3dView::scheduleCreateDisplayModelAndRedraw() { - RiaApplication::instance()->scheduleDisplayModelUpdateAndRedraw(this); + RiaViewRedrawScheduler::instance()->scheduleDisplayModelUpdateAndRedraw(this); if (this->isMasterView()) { RimViewLinker* viewLinker = this->assosiatedViewLinker(); diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.h b/ApplicationCode/ProjectDataModel/Rim3dView.h index 9134c8cda9..4c92412123 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationCode/ProjectDataModel/Rim3dView.h @@ -182,21 +182,6 @@ protected: virtual void resetLegendsInViewer() = 0; virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) = 0; - - // Overridden PdmObject methods: - - virtual caf::PdmFieldHandle* userDescriptionField() override { return &name; } - virtual void setupBeforeSave() override; - virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - - // Overridden ViewWindow methods: - - virtual QWidget* createViewWidget(QWidget* mainWindowParent) override; - virtual void updateViewWidgetAfterCreation() override; - virtual void updateMdiWindowTitle() override; - virtual void deleteViewWidget() override; - virtual QWidget* viewWidget() override; protected: // Fields caf::PdmField m_currentTimeStep; @@ -219,6 +204,23 @@ protected: private: RimViewLinker* viewLinkerIfMasterView() const; + // Overridden PdmObject methods: + + virtual caf::PdmFieldHandle* userDescriptionField() override { return &name; } + virtual void setupBeforeSave() override; +protected: + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + +private: + // Overridden ViewWindow methods: + + virtual QWidget* createViewWidget(QWidget* mainWindowParent) override; + virtual void updateViewWidgetAfterCreation() override; + virtual void updateMdiWindowTitle() override; + virtual void deleteViewWidget() override; + virtual QWidget* viewWidget() override; + // Implementation of RiuViewerToViewInterface virtual cvf::Color3f backgroundColor() const override { return m_backgroundColor();} diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 34cedabbc3..5f3418a677 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -80,6 +80,7 @@ #include #include +#include "RiaCompletionTypeCalculationScheduler.h" CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject"); @@ -788,7 +789,7 @@ bool RimProject::showPlotWindow() const void RimProject::reloadCompletionTypeResultsInAllViews() { createDisplayModelAndRedrawAllViews(); - RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews(); + RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews(); } //-------------------------------------------------------------------------------------------------- @@ -955,7 +956,7 @@ void RimProject::reloadCompletionTypeResultsForEclipseCase(RimEclipseCase* eclip views[viewIdx]->scheduleCreateDisplayModelAndRedraw(); } - RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedrawEclipseCase(eclipseCase); + RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawEclipseCase(eclipseCase); } //--------------------------------------------------------------------------------------------------