本文整理汇总了Python中processing.gui.DestinationSelectionPanel.DestinationSelectionPanel.setValue方法的典型用法代码示例。如果您正苦于以下问题:Python DestinationSelectionPanel.setValue方法的具体用法?Python DestinationSelectionPanel.setValue怎么用?Python DestinationSelectionPanel.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gui.DestinationSelectionPanel.DestinationSelectionPanel
的用法示例。
在下文中一共展示了DestinationSelectionPanel.setValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testVectorDestination
# 需要导入模块: from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel [as 别名]
# 或者: from processing.gui.DestinationSelectionPanel.DestinationSelectionPanel import setValue [as 别名]
def testVectorDestination(self):
param = QgsProcessingParameterVectorDestination('test')
alg = QgsApplication.processingRegistry().createAlgorithmById('native:centroids')
panel = DestinationSelectionPanel(param, alg)
panel.setValue(QgsProcessing.TEMPORARY_OUTPUT)
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.sink.staticValue(), QgsProcessing.TEMPORARY_OUTPUT)
panel.setValue('''ogr:dbname='/me/a.gpkg' table="d" (geom) sql=''')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), '''ogr:dbname='/me/a.gpkg' table="d" (geom) sql=''')
panel.setValue('''postgis:dbname='oraclesux' host=10.1.1.221 port=5432 user='qgis' password='qgis' table="stufff"."output" (the_geom) sql=''')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), '''postgis:dbname='oraclesux' host=10.1.1.221 port=5432 user='qgis' password='qgis' table="stufff"."output" (the_geom) sql=''')
panel.setValue('/home/me/test.shp')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), '/home/me/test.shp')
ProcessingConfig.setSettingValue(ProcessingConfig.OUTPUT_FOLDER, testDataPath)
panel.setValue('test.shp')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), os.path.join(testDataPath, 'test.shp'))
示例2: testFileDestination
# 需要导入模块: from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel [as 别名]
# 或者: from processing.gui.DestinationSelectionPanel.DestinationSelectionPanel import setValue [as 别名]
def testFileDestination(self):
param = QgsProcessingParameterFileDestination('test')
alg = QgsApplication.processingRegistry().createAlgorithmById('native:centroids')
panel = DestinationSelectionPanel(param, alg)
panel.setValue('/home/me/test.tif')
v = panel.getValue()
self.assertEqual(v, '/home/me/test.tif')
ProcessingConfig.setSettingValue(ProcessingConfig.OUTPUT_FOLDER, testDataPath)
panel.setValue('test.tif')
v = panel.getValue()
self.assertEqual(v, os.path.join(testDataPath, 'test.tif'))
示例3: testRasterDestination
# 需要导入模块: from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel [as 别名]
# 或者: from processing.gui.DestinationSelectionPanel.DestinationSelectionPanel import setValue [as 别名]
def testRasterDestination(self):
param = QgsProcessingParameterRasterDestination('test')
alg = QgsApplication.processingRegistry().algorithmById('native:centroids')
panel = DestinationSelectionPanel(param, alg)
panel.setValue('/home/me/test.tif')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), '/home/me/test.tif')
ProcessingConfig.setSettingValue(ProcessingConfig.OUTPUT_FOLDER, testDataPath)
panel.setValue('test.tif')
v = panel.getValue()
self.assertIsInstance(v, QgsProcessingOutputLayerDefinition)
self.assertEqual(v.createOptions, {'fileEncoding': 'System'})
self.assertEqual(v.sink.staticValue(), os.path.join(testDataPath, 'test.tif'))