Skip to content

Commit

Permalink
add mesh layer
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCaha committed Oct 23, 2024
1 parent eae1ba0 commit 5f56704
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/processing/tests/AlgorithmsTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
QgsCoordinateReferenceSystem,
QgsFeatureRequest,
QgsMapLayer,
QgsMeshLayer,
QgsProject,
QgsApplication,
QgsProcessingContext,
Expand Down Expand Up @@ -145,6 +146,9 @@ def check_algorithm(self, name, defs):

print('Running alg: "{}"'.format(defs['algorithm']))
alg = QgsApplication.processingRegistry().createAlgorithmById(defs['algorithm'])
if alg is None:
print('Algorithm not found: {}'.format(defs['algorithm']))
return

parameters = {}
if isinstance(params, list):
Expand Down Expand Up @@ -217,7 +221,7 @@ def load_param(self, param, id=None):
parameter based on its key `type` and return the appropriate parameter to pass to the algorithm.
"""
try:
if param['type'] in ('vector', 'raster', 'table'):
if param['type'] in ('vector', 'raster', 'table', 'mesh'):
return self.load_layer(id, param).id()
elif param['type'] == 'vrtlayers':
vals = []
Expand Down Expand Up @@ -320,6 +324,8 @@ def load_layer(self, id, param):
options = QgsRasterLayer.LayerOptions()
options.loadDefaultStyle = False
lyr = QgsRasterLayer(filepath, param['name'], 'gdal', options)
elif param['type'] == 'mesh':
lyr = QgsMeshLayer(filepath, param['name'], "mdal")

self.assertTrue(lyr.isValid(), f'Could not load layer "{filepath}" from param {param}')
QgsProject.instance().addMapLayer(lyr)
Expand Down

0 comments on commit 5f56704

Please sign in to comment.