mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
fix crash if MDAL not available
This commit is contained in:
parent
4113fdc58c
commit
083cb88c60
@ -58,8 +58,11 @@ void QgsTinMeshCreationAlgorithm::initAlgorithm( const QVariantMap &configuratio
|
||||
Q_UNUSED( configuration );
|
||||
addParameter( new QgsProcessingParameterTinInputLayers( QStringLiteral( "SOURCE_DATA" ), QObject::tr( "Input layers" ) ) );
|
||||
|
||||
const QList<QgsMeshDriverMetadata> &driverList =
|
||||
QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "mdal" ) )->meshDriversMetadata();
|
||||
QgsProviderMetadata *meta = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "mdal" ) );
|
||||
|
||||
QList<QgsMeshDriverMetadata> driverList;
|
||||
if ( meta )
|
||||
driverList = meta->meshDriversMetadata();
|
||||
|
||||
for ( const QgsMeshDriverMetadata &driverMeta : driverList )
|
||||
if ( driverMeta.capabilities() & QgsMeshDriverMetadata::CanWriteMeshData )
|
||||
@ -180,3 +183,14 @@ void QgsTinMeshCreationAlgorithm::addZValueDataset( const QString &fileName, con
|
||||
int datasetGroupIndex = tempLayer->datasetGroupCount() - 1;
|
||||
tempLayer->saveDataset( fileName, datasetGroupIndex, driver );
|
||||
}
|
||||
|
||||
bool QgsTinMeshCreationAlgorithm::canExecute( QString *errorMessage ) const
|
||||
{
|
||||
if ( mAvailableFormat.count() == 0 )
|
||||
{
|
||||
*errorMessage = QObject::tr( "MDAL not available" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class QgsTinMeshCreationAlgorithm: public QgsProcessingAlgorithm
|
||||
QString shortHelpString() const override;
|
||||
QString name() const override;
|
||||
QString displayName() const override;
|
||||
bool canExecute( QString *errorMessage ) const override;
|
||||
|
||||
protected:
|
||||
QgsProcessingAlgorithm *createInstance() const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user