本文整理汇总了Python中processing.core.QGisLayers.QGisLayers.getVectorLayers方法的典型用法代码示例。如果您正苦于以下问题:Python QGisLayers.getVectorLayers方法的具体用法?Python QGisLayers.getVectorLayers怎么用?Python QGisLayers.getVectorLayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.QGisLayers.QGisLayers
的用法示例。
在下文中一共展示了QGisLayers.getVectorLayers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setValue
# 需要导入模块: from processing.core.QGisLayers import QGisLayers [as 别名]
# 或者: from processing.core.QGisLayers.QGisLayers import getVectorLayers [as 别名]
def setValue(self, obj):
self.exported = None
if obj == None:
if self.optional:
self.value = None
return True
else:
return False
if isinstance(obj, QgsVectorLayer):
self.value = unicode(obj.source())
return True
else:
self.value = unicode(obj)
layers = QGisLayers.getVectorLayers(self.shapetype)
for layer in layers:
if layer.name() == self.value or layer.source() == self.value:
self.value = unicode(layer.source())
return True
return os.path.exists(self.value)
示例2: getAsString
# 需要导入模块: from processing.core.QGisLayers import QGisLayers [as 别名]
# 或者: from processing.core.QGisLayers.QGisLayers import getVectorLayers [as 别名]
def getAsString(self,value):
if self.datatype == ParameterMultipleInput.TYPE_RASTER:
if isinstance(value, QgsRasterLayer):
return unicode(value.dataProvider().dataSourceUri())
else:
s = unicode(value)
layers = QGisLayers.getRasterLayers()
for layer in layers:
if layer.name() == s:
return unicode(layer.dataProvider().dataSourceUri())
return s
else:
if isinstance(value, QgsVectorLayer):
return unicode(value.source())
else:
s = unicode(value)
layers = QGisLayers.getVectorLayers(self.datatype)
for layer in layers:
if layer.name() == s:
return unicode(layer.source())
return s
示例3: getWidgetFromParameter
# 需要导入模块: from processing.core.QGisLayers import QGisLayers [as 别名]
# 或者: from processing.core.QGisLayers.QGisLayers import getVectorLayers [as 别名]
def getWidgetFromParameter(self, param):
if isinstance(param, ParameterRaster):
layers = QGisLayers.getRasterLayers()
items = []
if (param.optional):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((self.getExtendedLayerName(layer), layer))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterVector):
if self.somethingDependsOnThisParameter(param) or self.alg.allowOnlyOpenedLayers:
item = QtGui.QComboBox()
layers = QGisLayers.getVectorLayers(param.shapetype)
if (param.optional):
item.addItem(self.NOT_SELECTED, None)
for layer in layers:
item.addItem(self.getExtendedLayerName(layer), layer)
item.currentIndexChanged.connect(self.updateDependentFields)
item.name = param.name
else:
layers = QGisLayers.getVectorLayers(param.shapetype)
items = []
if (param.optional):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((self.getExtendedLayerName(layer), layer))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterTable):
if self.somethingDependsOnThisParameter(param):
item = QtGui.QComboBox()
layers = QGisLayers.getTables()
if (param.optional):
item.addItem(self.NOT_SELECTED, None)
for layer in layers:
item.addItem(layer.name(), layer)
item.currentIndexChanged.connect(self.updateDependentFields)
item.name = param.name
else:
layers = QGisLayers.getTables()
items = []
if (param.optional):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((layer.name(), layer))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterBoolean):
item = QtGui.QComboBox()
item.addItem("Yes")
item.addItem("No")
if param.default:
item.setCurrentIndex(0)
else:
item.setCurrentIndex(1)
elif isinstance(param, ParameterTableField):
item = QtGui.QComboBox()
if param.parent in self.dependentItems:
items = self.dependentItems[param.parent]
else:
items = []
self.dependentItems[param.parent] = items
items.append(param.name)
parent = self.alg.getParameterFromName(param.parent)
if isinstance(parent, ParameterVector):
layers = QGisLayers.getVectorLayers(parent.shapetype)
else:
layers = QGisLayers.getTables()
if len(layers)>0:
item.addItems(self.getFields(layers[0], param.datatype))
elif isinstance(param, ParameterSelection):
item = QtGui.QComboBox()
item.addItems(param.options)
item.setCurrentIndex(param.default)
elif isinstance(param, ParameterFixedTable):
item = FixedTablePanel(param)
elif isinstance(param, ParameterRange):
item = RangePanel(param)
elif isinstance(param, ParameterFile):
item = FileSelectionPanel(param.isFolder)
elif isinstance(param, ParameterMultipleInput):
if param.datatype == ParameterMultipleInput.TYPE_RASTER:
options = QGisLayers.getRasterLayers()
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
options = QGisLayers.getVectorLayers()
else:
options = QGisLayers.getVectorLayers(param.datatype)
opts = []
for opt in options:
opts.append(self.getExtendedLayerName(opt))
item = MultipleInputPanel(opts)
elif isinstance(param, ParameterNumber):
item = NumberInputPanel(param.default, param.isInteger)
elif isinstance(param, ParameterExtent):
item = ExtentSelectionPanel(self.parent, self.alg, param.default)
elif isinstance(param, ParameterCrs):
item = CrsSelectionPanel(param.default)
elif isinstance(param, ParameterString):
if param.multiline:
verticalLayout = QtGui.QVBoxLayout()
verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
textEdit = QtGui.QPlainTextEdit()
#.........这里部分代码省略.........