mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4025 Show delayed action progress bar during contour map generation
This commit is contained in:
parent
72e9683ac9
commit
0fd51b2088
@ -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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
{ // Step 1: generate results. About 30% of the time.
|
||||
if (m_contourMapProjection->isChecked())
|
||||
{
|
||||
m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep());
|
||||
}
|
||||
updateLegends();
|
||||
|
||||
appendPickPointVisToModel();
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user