Skip to content
Permalink
Browse files

add feedback

  • Loading branch information
vcloarec authored and PeterPetrik committed Nov 10, 2020
1 parent 4f6e6df commit a96268482c871ea30be13c4d83850a2d2176091b
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/analysis/processing/qgsalgorithmexportmesh.cpp
@@ -1253,6 +1253,8 @@ bool QgsMeshExportCrossSection::prepareAlgorithm( const QVariantMap &parameters,

QVariantMap QgsMeshExportCrossSection::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
if ( feedback )
feedback->setProgress( 0 );
//First, if present, average 3D staked dataset value to 2D face value
const QgsMesh3dAveragingMethod *avgMethod = mLayerRendererSettings.averagingMethod();
for ( DataGroup &dataGroup : mDataPerGroup )
@@ -1282,6 +1284,8 @@ QVariantMap QgsMeshExportCrossSection::processAlgorithm( const QVariantMap &para
header << datagroup.metadata.name();
textStream << header.join( ',' ) << QStringLiteral( "\n" );

int featCount = featureSource->featureCount();
int featCounter = 0;
QgsFeatureIterator featIt = featureSource->getFeatures();
QgsFeature feat;
while ( featIt.nextFeature( feat ) )
@@ -1344,6 +1348,13 @@ QVariantMap QgsMeshExportCrossSection::processAlgorithm( const QVariantMap &para

offset += resolution;
}

if ( feedback )
{
feedback->setProgress( 100 * featCounter / featCount );
if ( feedback->isCanceled() )
return QVariantMap();
}
}

file.close();
@@ -1553,6 +1564,8 @@ bool QgsMeshExportTimeSeries::prepareAlgorithm( const QVariantMap &parameters, Q

QVariantMap QgsMeshExportTimeSeries::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
if ( feedback )
feedback->setProgress( 0 );
//First, if present, average 3D staked dataset value to 2D face value
const QgsMesh3dAveragingMethod *avgMethod = mLayerRendererSettings.averagingMethod();

@@ -1585,6 +1598,8 @@ QVariantMap QgsMeshExportTimeSeries::processAlgorithm( const QVariantMap &parame

textStream << header.join( ',' ) << QStringLiteral( "\n" );

int featCount = featureSource->featureCount();
int featCounter = 0;
QgsFeatureIterator featIt = featureSource->getFeatures();
QgsFeature feat;
while ( featIt.nextFeature( feat ) )
@@ -1680,6 +1695,13 @@ QVariantMap QgsMeshExportTimeSeries::processAlgorithm( const QVariantMap &parame
textStream << textLine.join( ',' ) << QStringLiteral( "\n" );
}
}
featCounter++;
if ( feedback )
{
feedback->setProgress( 100 * featCounter / featCount );
if ( feedback->isCanceled() )
return QVariantMap();
}
}

file.close();

0 comments on commit a962684

Please sign in to comment.
You can’t perform that action at this time.