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


Python DestinationSelectionPanel.setValue方法代码示例

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

示例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'))
开发者ID:FERRATON,项目名称:QGIS,代码行数:15,代码来源:GuiTest.py

示例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'))
开发者ID:borysiasty,项目名称:QGIS,代码行数:19,代码来源:GuiTest.py


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