|
46 | 46 | QgsSettings,
|
47 | 47 | QgsVectorFileWriter,
|
48 | 48 | QgsProcessingUtils,
|
49 |
| - QgsProcessingParameterDefinition) |
| 49 | + QgsProcessingParameterDefinition, |
| 50 | + QgsProcessingOutputRasterLayer, |
| 51 | + QgsProcessingOutputVectorLayer, |
| 52 | + QgsProcessingOutputHtml, |
| 53 | + QgsProcessingOutputNumber, |
| 54 | + QgsProcessingOutputString, |
| 55 | + QgsProcessingOutputFolder) |
50 | 56 |
|
51 | 57 |
|
52 | 58 | def _expressionContext(alg):
|
@@ -393,36 +399,42 @@ def getOutputFromString(s):
|
393 | 399 | return clazz(*params)
|
394 | 400 | else:
|
395 | 401 | tokens = s.split("=")
|
| 402 | + if not tokens[1].lower()[:len('output')] == 'output': |
| 403 | + return None |
| 404 | + |
| 405 | + name = tokens[0] |
| 406 | + description = tokens[0] |
| 407 | + |
396 | 408 | token = tokens[1].strip()[len('output') + 1:]
|
397 | 409 | out = None
|
398 | 410 |
|
399 |
| - if token.lower().strip().startswith('raster'): |
400 |
| - out = OutputRaster() |
401 |
| - elif token.lower().strip() == 'vector': |
402 |
| - out = OutputVector() |
403 |
| - elif token.lower().strip() == 'vector point': |
404 |
| - out = OutputVector(datatype=[dataobjects.TYPE_VECTOR_POINT]) |
405 |
| - elif token.lower().strip() == 'vector line': |
406 |
| - out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_LINE]) |
407 |
| - elif token.lower().strip() == 'vector polygon': |
408 |
| - out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_POLYGON]) |
409 |
| - elif token.lower().strip().startswith('table'): |
410 |
| - out = OutputTable() |
411 |
| - elif token.lower().strip().startswith('html'): |
412 |
| - out = OutputHTML() |
413 |
| - elif token.lower().strip().startswith('file'): |
414 |
| - out = OutputFile() |
415 |
| - ext = token.strip()[len('file') + 1:] |
416 |
| - if ext: |
417 |
| - out.ext = ext |
418 |
| - elif token.lower().strip().startswith('directory'): |
419 |
| - out = OutputDirectory() |
420 |
| - elif token.lower().strip().startswith('number'): |
421 |
| - out = OutputNumber() |
422 |
| - elif token.lower().strip().startswith('string'): |
423 |
| - out = OutputString() |
424 |
| - elif token.lower().strip().startswith('extent'): |
425 |
| - out = OutputExtent() |
| 411 | + if token.lower().strip().startswith('outputraster'): |
| 412 | + out = QgsProcessingOutputRasterLayer(name, description) |
| 413 | + elif token.lower().strip() == 'outputvector': |
| 414 | + out = QgsProcessingOutputVectorLayer(name, description) |
| 415 | +# elif token.lower().strip() == 'vector point': |
| 416 | +# out = OutputVector(datatype=[dataobjects.TYPE_VECTOR_POINT]) |
| 417 | +# elif token.lower().strip() == 'vector line': |
| 418 | +# out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_LINE]) |
| 419 | +# elif token.lower().strip() == 'vector polygon': |
| 420 | +# out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_POLYGON]) |
| 421 | +# elif token.lower().strip().startswith('table'): |
| 422 | +# out = OutputTable() |
| 423 | + elif token.lower().strip().startswith('outputhtml'): |
| 424 | + out = QgsProcessingOutputHtml(name, description) |
| 425 | +# elif token.lower().strip().startswith('file'): |
| 426 | +# out = OutputFile() |
| 427 | +# ext = token.strip()[len('file') + 1:] |
| 428 | +# if ext: |
| 429 | +# out.ext = ext |
| 430 | + elif token.lower().strip().startswith('outputfolder'): |
| 431 | + out = QgsProcessingOutputFolder(name, description) |
| 432 | + elif token.lower().strip().startswith('outputnumber'): |
| 433 | + out = QgsProcessingOutputNumber(name, description) |
| 434 | + elif token.lower().strip().startswith('outputstring'): |
| 435 | + out = QgsProcessingOutputString(name, description) |
| 436 | +# elif token.lower().strip().startswith('extent'): |
| 437 | +# out = OutputExtent() |
426 | 438 |
|
427 | 439 | return out
|
428 | 440 | except:
|
|
0 commit comments