add more feedback cancellation and fix doc

This commit is contained in:
vcloarec 2020-08-27 18:07:25 -04:00
parent 0f70883b6d
commit abd5fad9dd
3 changed files with 17 additions and 2 deletions

View File

@ -228,7 +228,7 @@ Creates a new instance of the raster data provider.
const QString &driverName,
const QgsCoordinateReferenceSystem &crs ) const;
%Docstring
Creates mesh data source (depending of the provider)
Creates mesh data source, that is the mesh frame stored in file, memory or with other way (depending of the provider)
.. versionadded:: 3.16
%End

View File

@ -85,6 +85,9 @@ bool QgsTinMeshCreationAlgorithm::prepareAlgorithm( const QVariantMap &parameter
for ( const QVariant &layer : layersList )
{
if ( feedback && feedback->isCanceled() )
return false;
if ( layer.type() != QVariant::Map )
continue;
const QVariantMap layerMap = layer.toMap();
@ -112,6 +115,7 @@ bool QgsTinMeshCreationAlgorithm::prepareAlgorithm( const QVariantMap &parameter
if ( mVerticesLayer.isEmpty() && mBreakLinesLayer.isEmpty() )
return false;
return true;
}
@ -124,10 +128,21 @@ QVariantMap QgsTinMeshCreationAlgorithm::processAlgorithm( const QVariantMap &pa
triangulation.setCrs( destinationCrs );
for ( Layer &l : mVerticesLayer )
{
if ( feedback && feedback->isCanceled() )
break;
triangulation.addVertices( l.fit, l.attributeIndex, l.transform, feedback, l.featureCount );
}
for ( Layer &l : mBreakLinesLayer )
{
if ( feedback && feedback->isCanceled() )
break;
triangulation.addBreakLines( l.fit, l.attributeIndex, l.transform, feedback, l.featureCount );
}
if ( feedback && feedback->isCanceled() )
return QVariantMap();
const QString fileName = parameterAsFile( parameters, QStringLiteral( "OUTPUT_MESH" ), context );
int driverIndex = parameterAsEnum( parameters, QStringLiteral( "MESH_FORMAT" ), context );

View File

@ -292,7 +292,7 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
const QStringList &createOptions = QStringList() ) SIP_FACTORY;
/**
* Creates mesh data source (depending of the provider)
* Creates mesh data source, that is the mesh frame stored in file, memory or with other way (depending of the provider)
* \since QGIS 3.16
*/
virtual bool createMeshData(