本文整理汇总了Python中processing.script.ScriptAlgorithm.ScriptAlgorithm.provider方法的典型用法代码示例。如果您正苦于以下问题:Python ScriptAlgorithm.provider方法的具体用法?Python ScriptAlgorithm.provider怎么用?Python ScriptAlgorithm.provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.script.ScriptAlgorithm.ScriptAlgorithm
的用法示例。
在下文中一共展示了ScriptAlgorithm.provider方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAlgorithmFromHookFile
# 需要导入模块: from processing.script.ScriptAlgorithm import ScriptAlgorithm [as 别名]
# 或者: from processing.script.ScriptAlgorithm.ScriptAlgorithm import provider [as 别名]
def getAlgorithmFromHookFile(self, hookFile):
if hookFile.endswith('py'):
script = ScriptAlgorithm(hookFile)
script.provider = Providers.providers['script']
return script
elif hookFile.endswith('model'):
model = ModelerAlgorithm()
model.openModel(hookFile)
model.provider = Providers.providers['model']
return model
else:
raise Exception ("Wrong hook file")
示例2: getAlgorithmFromHookFile
# 需要导入模块: from processing.script.ScriptAlgorithm import ScriptAlgorithm [as 别名]
# 或者: from processing.script.ScriptAlgorithm.ScriptAlgorithm import provider [as 别名]
def getAlgorithmFromHookFile(self, hookFile):
if hookFile.endswith("py"):
script = ScriptAlgorithm(hookFile)
script.provider = ModelerUtils.providers["script"]
return script
elif hookFile.endswith("model"):
model = ModelerAlgorithm()
model.openModel(hookFile)
model.provider = ModelerUtils.providers["model"]
return model
else:
raise Exception("Wrong hook file")
示例3: runAlgorithm
# 需要导入模块: from processing.script.ScriptAlgorithm import ScriptAlgorithm [as 别名]
# 或者: from processing.script.ScriptAlgorithm.ScriptAlgorithm import provider [as 别名]
def runAlgorithm(self):
if self.algType == self.SCRIPT_PYTHON:
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
alg.provider = Providers.providers["script"]
if self.algType == self.SCRIPT_R:
alg = RAlgorithm(None, unicode(self.editor.text()))
alg.provider = Providers.providers["r"]
dlg = alg.getCustomParametersDialog()
if not dlg:
dlg = ParametersDialog(alg)
canvas = iface.mapCanvas()
prevMapTool = canvas.mapTool()
dlg.show()
dlg.exec_()
if canvas.mapTool() != prevMapTool:
try:
canvas.mapTool().reset()
except:
pass
canvas.setMapTool(prevMapTool)