本文整理汇总了Python中processing.modeler.ModelerAlgorithm.Algorithm.setName方法的典型用法代码示例。如果您正苦于以下问题:Python Algorithm.setName方法的具体用法?Python Algorithm.setName怎么用?Python Algorithm.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.modeler.ModelerAlgorithm.Algorithm
的用法示例。
在下文中一共展示了Algorithm.setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createAlgorithm
# 需要导入模块: from processing.modeler.ModelerAlgorithm import Algorithm [as 别名]
# 或者: from processing.modeler.ModelerAlgorithm.Algorithm import setName [as 别名]
def createAlgorithm(self):
alg = Algorithm(self._alg.commandLineName())
alg.setName(self.model)
alg.description = self.descriptionBox.text()
params = self._alg.parameters
outputs = self._alg.outputs
for param in params:
if param.hidden:
continue
if not self.setParamValue(alg, param, self.valueItems[param.name]):
return None
for output in outputs:
if not output.hidden:
name = unicode(self.valueItems[output.name].text())
if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
alg.outputs[output.name] = ModelerOutput(name)
selectedOptions = self.dependenciesPanel.selectedoptions
availableDependencies = self.getAvailableDependencies()
self.dependencies = []
for selected in selectedOptions:
s = availableDependencies[selected]
alg.dependencies.append(s)
return alg
示例2: createAlgorithm
# 需要导入模块: from processing.modeler.ModelerAlgorithm import Algorithm [as 别名]
# 或者: from processing.modeler.ModelerAlgorithm.Algorithm import setName [as 别名]
def createAlgorithm(self):
alg = Algorithm(self._alg.commandLineName())
alg.setName(self.model)
alg.description = self.descriptionBox.text()
params = self._alg.parameters
outputs = self._alg.outputs
for param in params:
if param.hidden:
continue
if not self.setParamValue(alg, param, self.wrappers[param.name]):
self.bar.pushMessage("Error", "Wrong or missing value for parameter '%s'" % param.description,
level=QgsMessageBar.WARNING)
return None
for output in outputs:
if not output.hidden:
name = str(self.valueItems[output.name].text())
if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
alg.outputs[output.name] = ModelerOutput(name)
selectedOptions = self.dependenciesPanel.selectedoptions
availableDependencies = self.getAvailableDependencies()
for selected in selectedOptions:
alg.dependencies.append(availableDependencies[selected].name)
self._alg.processBeforeAddingToModeler(alg, self.model)
return alg
示例3: createAlgorithm
# 需要导入模块: from processing.modeler.ModelerAlgorithm import Algorithm [as 别名]
# 或者: from processing.modeler.ModelerAlgorithm.Algorithm import setName [as 别名]
def createAlgorithm(self):
alg = Algorithm(self._alg.id())
alg.setName(self.model)
alg.description = self.descriptionBox.text()
params = self._alg.parameterDefinitions()
outputs = self._alg.outputs
for param in params:
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
continue
if not param.checkValueIsAcceptable(self.wrappers[param.name()].value):
self.bar.pushMessage("Error", "Wrong or missing value for parameter '%s'" % param.description(),
level=QgsMessageBar.WARNING)
return None
for output in outputs:
if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
name = str(self.valueItems[output.name()].text())
if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
alg.outputs[output.name()] = ModelerOutput(name)
selectedOptions = self.dependenciesPanel.selectedoptions
availableDependencies = self.getAvailableDependencies() # spellok
for selected in selectedOptions:
alg.dependencies.append(availableDependencies[selected].name) # spellok
self._alg.processBeforeAddingToModeler(alg, self.model)
return alg
示例4: createAlgorithm
# 需要导入模块: from processing.modeler.ModelerAlgorithm import Algorithm [as 别名]
# 或者: from processing.modeler.ModelerAlgorithm.Algorithm import setName [as 别名]
def createAlgorithm(self):
alg = Algorithm('modelertools:calculator')
alg.setName(self.model)
alg.description = self.tr('Calculator', 'CalculatorModelerParametersDialog')
formula = self.formulaText.text()
alg.params[FORMULA] = formula
for i in xrange(AVAILABLE_VARIABLES):
paramname = NUMBER + unicode(i)
alg.params[paramname] = None
numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber)
used = []
for i in range(len(numbers)):
if unicode(chr(i + 97)) in formula:
used.append(numbers[i])
for i, variable in enumerate(used):
paramname = NUMBER + unicode(i)
alg.params[paramname] = variable
# TODO check formula is correct
return alg