diff --git a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp index 033a149c11..5f96433b0c 100644 --- a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp @@ -34,6 +34,7 @@ #include "cafContourLines.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiTreeOrdering.h" +#include "cafProgressInfo.h" #include "cvfArray.h" #include "cvfCellRange.h" @@ -98,20 +99,31 @@ RimContourMapProjection::RimContourMapProjection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimContourMapProjection::~RimContourMapProjection() {} +RimContourMapProjection::~RimContourMapProjection() +{ +} //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimContourMapProjection::generateResultsIfNecessary(int timeStep) { + caf::ProgressInfo progress(100, "Generate Results", true); + updateGridInformation(); + progress.setProgress(10); if (gridMappingNeedsUpdating() || mapCellVisibilityNeedsUpdating()) { clearResults(); m_projected3dGridIndices = generateGridMapping(); + progress.setProgress(20); m_mapCellVisibility = getMapCellVisibility(); + progress.setProgress(30); + } + else + { + progress.setProgress(30); } if (resultVariableChanged()) @@ -124,8 +136,10 @@ void RimContourMapProjection::generateResultsIfNecessary(int timeStep) { clearGeometry(); m_aggregatedResults = generateResults(timeStep); + progress.setProgress(80); generateVertexResults(); } + progress.setProgress(100); m_currentResultTimestep = timeStep; } @@ -134,11 +148,15 @@ void RimContourMapProjection::generateResultsIfNecessary(int timeStep) //-------------------------------------------------------------------------------------------------- void RimContourMapProjection::generateGeometryIfNecessary() { + caf::ProgressInfo progress(100, "Generate Geometry", true); + if (geometryNeedsUpdating()) { generateContourPolygons(); + progress.setProgress(25); generateTrianglesWithVertexValues(); } + progress.setProgress(100); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseContourMapView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseContourMapView.cpp index 88a774f5af..b4021791f0 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseContourMapView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseContourMapView.cpp @@ -34,7 +34,9 @@ #include "RimGridCollection.h" #include "RimSimWellInViewCollection.h" #include "RimScaleLegendConfig.h" + #include "cafPdmUiTreeOrdering.h" +#include "cafProgressInfo.h" #include "cvfCamera.h" #include "cvfModelBasicList.h" @@ -237,23 +239,32 @@ void RimEclipseContourMapView::updateCurrentTimeStep() //-------------------------------------------------------------------------------------------------- void RimEclipseContourMapView::updateGeometry() { + caf::ProgressInfo progress(100, "Generate Contour Map", true); + this->updateVisibleGeometriesAndCellColors(); - if (m_contourMapProjection->isChecked()) - { - m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep()); + { // Step 1: generate results and some minor updates. About 30% of the time. + if (m_contourMapProjection->isChecked()) + { + m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep()); + } + progress.setProgress(30); } updateLegends(); // To make sure the scalar mappers are set up correctly - appendWellsAndFracturesToModel(); - createContourMapGeometry(); - appendContourMapProjectionToModel(); - appendContourLinesToModel(); - - appendPickPointVisToModel(); + { // Step 2: generate geometry. Takes about 60% of the time. + createContourMapGeometry(); + progress.setProgress(90); + } + { // Step 3: generate drawables. Takes about 10% of the time. + appendContourMapProjectionToModel(); + appendContourLinesToModel(); + appendPickPointVisToModel(); + progress.setProgress(100); + } m_overlayInfoConfig()->update3DInfo(); } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechContourMapView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechContourMapView.cpp index f7a5bd68fb..50f0200eb8 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechContourMapView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechContourMapView.cpp @@ -29,7 +29,9 @@ #include "RimScaleLegendConfig.h" #include "RimSimWellInViewCollection.h" #include "RimViewNameConfig.h" + #include "cafPdmUiTreeOrdering.h" +#include "cafProgressInfo.h" #include "cvfCamera.h" #include "cvfModelBasicList.h" @@ -245,18 +247,29 @@ void RimGeoMechContourMapView::updateCurrentTimeStep() //-------------------------------------------------------------------------------------------------- void RimGeoMechContourMapView::updateGeometry() { - if (m_contourMapProjection->isChecked()) - { - m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep()); - } - updateLegends(); + caf::ProgressInfo progress(100, "Generate Contour Map", true); - createContourMapGeometry(); - appendContourMapProjectionToModel(); - appendContourLinesToModel(); - - appendPickPointVisToModel(); + { // Step 1: generate results. About 30% of the time. + if (m_contourMapProjection->isChecked()) + { + m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep()); + } + updateLegends(); + progress.setProgress(30); + } + + { // Step 2: generate geometry. Takes about 60% of the time. + createContourMapGeometry(); + progress.setProgress(90); + } + + { // Step 3: generate drawables. About 10% of the time. + appendContourMapProjectionToModel(); + appendContourLinesToModel(); + appendPickPointVisToModel(); + progress.setProgress(100); + } m_overlayInfoConfig->update3DInfo(); } diff --git a/Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp b/Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp index 2eb855f639..f65691167c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp @@ -99,9 +99,9 @@ namespace caf { /// If you do not need a title for a particular level, simply pass "" and it will be ignored. /// \sa setProgressDescription //-------------------------------------------------------------------------------------------------- - ProgressInfo::ProgressInfo(size_t maxProgressValue, const QString& title) + ProgressInfo::ProgressInfo(size_t maxProgressValue, const QString& title, bool delayShowingProgress) { - ProgressInfoStatic::start(maxProgressValue, title); + ProgressInfoStatic::start(maxProgressValue, title, delayShowingProgress); if (qApp) { @@ -448,7 +448,7 @@ namespace caf { //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - void ProgressInfoStatic::start(size_t maxProgressValue, const QString& title) + void ProgressInfoStatic::start(size_t maxProgressValue, const QString& title, bool delayShowingProgress) { if (!isUpdatePossible()) return; @@ -462,7 +462,14 @@ namespace caf { progressDialog()->setMinimum(0); progressDialog()->setWindowTitle(title); progressDialog()->setCancelButton(nullptr); - progressDialog()->show(); + if (delayShowingProgress) + { + progressDialog()->setMinimumDuration(1000); + } + else + { + progressDialog()->show(); + } } maxProgressStack_v.push_back(maxProgressValue); diff --git a/Fwk/AppFwk/cafUserInterface/cafProgressInfo.h b/Fwk/AppFwk/cafUserInterface/cafProgressInfo.h index fd58b0131c..9cdfcfc494 100644 --- a/Fwk/AppFwk/cafUserInterface/cafProgressInfo.h +++ b/Fwk/AppFwk/cafUserInterface/cafProgressInfo.h @@ -46,7 +46,7 @@ namespace caf { class ProgressInfo { public: - ProgressInfo(size_t maxProgressValue, const QString& title); + ProgressInfo(size_t maxProgressValue, const QString& title, bool delayShowingProgress = false); ~ProgressInfo(); void setProgressDescription(const QString& description); @@ -61,7 +61,7 @@ public: class ProgressInfoStatic { public: - static void start(size_t maxProgressValue, const QString& title); + static void start(size_t maxProgressValue, const QString& title, bool delayShowingProgress); static void setProgressDescription(const QString& description); static void setProgress(size_t progressValue);