当前位置: 首页>>代码示例>>Python>>正文


Python Algorithm.setName方法代码示例

本文整理汇总了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
开发者ID:JanisE,项目名称:QGIS,代码行数:27,代码来源:ModelerParametersDialog.py

示例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
开发者ID:,项目名称:,代码行数:28,代码来源:

示例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
开发者ID:rskelly,项目名称:QGIS,代码行数:28,代码来源:ModelerParametersDialog.py

示例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
开发者ID:redwoodxiao,项目名称:QGIS,代码行数:26,代码来源:CalculatorModelerAlgorithm.py


注:本文中的processing.modeler.ModelerAlgorithm.Algorithm.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。