本文整理汇总了Python中processing.core.parameters.ParameterMultipleInput类的典型用法代码示例。如果您正苦于以下问题:Python ParameterMultipleInput类的具体用法?Python ParameterMultipleInput怎么用?Python ParameterMultipleInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParameterMultipleInput类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetAsStringWhenVector
def testGetAsStringWhenVector(self):
parameter = ParameterMultipleInput('myName', 'myDesc', datatype=dataobjects.TYPE_VECTOR_ANY)
# With Path
self.assertEqual(parameter.getAsString('/some/path'), '/some/path')
# With Layer
layer = QgsVectorLayer('/path/to/myVector.shp', 'myVector', 'memory')
self.assertEqual(parameter.getAsString(layer), '/path/to/myVector.shp')
示例2: testGetAsStringWhenRaster
def testGetAsStringWhenRaster(self):
parameter = ParameterMultipleInput('myName', 'myDesc', datatype=dataobjects.TYPE_RASTER)
# With Path
self.assertEqual(parameter.getAsString('/some/path'), '/some/path')
# With Layer
layer = QgsRasterLayer('/path/to/myRaster.tif', 'myRaster')
self.assertEqual(parameter.getAsString(layer), '/path/to/myRaster.tif')
示例3: testGetAsStringWhenVector
def testGetAsStringWhenVector(self):
parameter = ParameterMultipleInput("myName", "myDesc", datatype=ParameterMultipleInput.TYPE_VECTOR_ANY)
# With Path
self.assertEqual(parameter.getAsString("/some/path"), "/some/path")
# With Layer
layer = QgsVectorLayer("/path/to/myVector.shp", "myVector", "memory")
self.assertEqual(parameter.getAsString(layer), "/path/to/myVector.shp")
示例4: testGetAsStringWhenRaster
def testGetAsStringWhenRaster(self):
parameter = ParameterMultipleInput("myName", "myDesc", datatype=ParameterMultipleInput.TYPE_RASTER)
# With Path
self.assertEqual(parameter.getAsString("/some/path"), "/some/path")
# With Layer
layer = QgsRasterLayer("/path/to/myRaster.tif", "myRaster")
self.assertEqual(parameter.getAsString(layer), "/path/to/myRaster.tif")
示例5: testScriptCode
def testScriptCode(self):
parameter = ParameterMultipleInput('myName', 'myDescription')
code = parameter.getAsScriptCode()
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterMultipleInput)
parameter.optional = True
code = parameter.getAsScriptCode()
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterMultipleInput)
self.assertTrue(result.optional)
示例6: testMultipleInput
def testMultipleInput(self):
parameter = ParameterMultipleInput("myName", "myDesc", optional=True)
self.assertTrue(parameter.setMinNumInputs(1))
parameter = ParameterMultipleInput("myName", "myDesc", optional=False)
self.assertFalse(parameter.setMinNumInputs(0))
parameter.setMinNumInputs(2)
self.assertTrue(parameter.setValue(["myLayerFile.shp", "myLayerFile2.shp"]))
parameter.setMinNumInputs(3)
self.assertFalse(parameter.setValue(["myLayerFile.shp", "myLayerFile2.shp"]))
示例7: testOptional
def testOptional(self):
parameter = ParameterMultipleInput("myName", "myDesc", optional=True)
self.assertTrue(parameter.setValue("myLayerFile.shp"))
self.assertEqual(parameter.value, "myLayerFile.shp")
self.assertTrue(parameter.setValue(None))
self.assertEqual(parameter.value, None)
parameter = ParameterMultipleInput("myName", "myDesc", optional=False)
self.assertFalse(parameter.setValue(None))
self.assertEqual(parameter.value, None)
self.assertTrue(parameter.setValue("myLayerFile.shp"))
self.assertEqual(parameter.value, "myLayerFile.shp")
self.assertFalse(parameter.setValue(None))
self.assertEqual(parameter.value, "myLayerFile.shp")
示例8: testGetAsStringWhenFile
def testGetAsStringWhenFile(self):
parameter = ParameterMultipleInput('myName', 'myDesc', datatype=dataobjects.TYPE_FILE)
self.assertEqual(parameter.getAsString('/some/path'), '/some/path')
示例9: testGetAsStringWhenFile
def testGetAsStringWhenFile(self):
parameter = ParameterMultipleInput("myName", "myDesc", datatype=ParameterMultipleInput.TYPE_FILE)
self.assertEqual(parameter.getAsString("/some/path"), "/some/path")