mirror of
https://github.com/qgis/QGIS.git
synced 2025-05-02 00:05:04 -04:00
Start restoring creation of outputs from string
This commit is contained in:
parent
f13920bb19
commit
df329bceab
@ -46,7 +46,13 @@ from qgis.core import (QgsExpressionContext,
|
|||||||
QgsSettings,
|
QgsSettings,
|
||||||
QgsVectorFileWriter,
|
QgsVectorFileWriter,
|
||||||
QgsProcessingUtils,
|
QgsProcessingUtils,
|
||||||
QgsProcessingParameterDefinition)
|
QgsProcessingParameterDefinition,
|
||||||
|
QgsProcessingOutputRasterLayer,
|
||||||
|
QgsProcessingOutputVectorLayer,
|
||||||
|
QgsProcessingOutputHtml,
|
||||||
|
QgsProcessingOutputNumber,
|
||||||
|
QgsProcessingOutputString,
|
||||||
|
QgsProcessingOutputFolder)
|
||||||
|
|
||||||
|
|
||||||
def _expressionContext(alg):
|
def _expressionContext(alg):
|
||||||
@ -393,36 +399,42 @@ def getOutputFromString(s):
|
|||||||
return clazz(*params)
|
return clazz(*params)
|
||||||
else:
|
else:
|
||||||
tokens = s.split("=")
|
tokens = s.split("=")
|
||||||
|
if not tokens[1].lower()[:len('output')] == 'output':
|
||||||
|
return None
|
||||||
|
|
||||||
|
name = tokens[0]
|
||||||
|
description = tokens[0]
|
||||||
|
|
||||||
token = tokens[1].strip()[len('output') + 1:]
|
token = tokens[1].strip()[len('output') + 1:]
|
||||||
out = None
|
out = None
|
||||||
|
|
||||||
if token.lower().strip().startswith('raster'):
|
if token.lower().strip().startswith('outputraster'):
|
||||||
out = OutputRaster()
|
out = QgsProcessingOutputRasterLayer(name, description)
|
||||||
elif token.lower().strip() == 'vector':
|
elif token.lower().strip() == 'outputvector':
|
||||||
out = OutputVector()
|
out = QgsProcessingOutputVectorLayer(name, description)
|
||||||
elif token.lower().strip() == 'vector point':
|
# elif token.lower().strip() == 'vector point':
|
||||||
out = OutputVector(datatype=[dataobjects.TYPE_VECTOR_POINT])
|
# out = OutputVector(datatype=[dataobjects.TYPE_VECTOR_POINT])
|
||||||
elif token.lower().strip() == 'vector line':
|
# elif token.lower().strip() == 'vector line':
|
||||||
out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_LINE])
|
# out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_LINE])
|
||||||
elif token.lower().strip() == 'vector polygon':
|
# elif token.lower().strip() == 'vector polygon':
|
||||||
out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_POLYGON])
|
# out = OutputVector(datatype=[OutputVector.TYPE_VECTOR_POLYGON])
|
||||||
elif token.lower().strip().startswith('table'):
|
# elif token.lower().strip().startswith('table'):
|
||||||
out = OutputTable()
|
# out = OutputTable()
|
||||||
elif token.lower().strip().startswith('html'):
|
elif token.lower().strip().startswith('outputhtml'):
|
||||||
out = OutputHTML()
|
out = QgsProcessingOutputHtml(name, description)
|
||||||
elif token.lower().strip().startswith('file'):
|
# elif token.lower().strip().startswith('file'):
|
||||||
out = OutputFile()
|
# out = OutputFile()
|
||||||
ext = token.strip()[len('file') + 1:]
|
# ext = token.strip()[len('file') + 1:]
|
||||||
if ext:
|
# if ext:
|
||||||
out.ext = ext
|
# out.ext = ext
|
||||||
elif token.lower().strip().startswith('directory'):
|
elif token.lower().strip().startswith('outputfolder'):
|
||||||
out = OutputDirectory()
|
out = QgsProcessingOutputFolder(name, description)
|
||||||
elif token.lower().strip().startswith('number'):
|
elif token.lower().strip().startswith('outputnumber'):
|
||||||
out = OutputNumber()
|
out = QgsProcessingOutputNumber(name, description)
|
||||||
elif token.lower().strip().startswith('string'):
|
elif token.lower().strip().startswith('outputstring'):
|
||||||
out = OutputString()
|
out = QgsProcessingOutputString(name, description)
|
||||||
elif token.lower().strip().startswith('extent'):
|
# elif token.lower().strip().startswith('extent'):
|
||||||
out = OutputExtent()
|
# out = OutputExtent()
|
||||||
|
|
||||||
return out
|
return out
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user