def assign_layer_colors():
"""
Assign all the colors for each layer up front so we can use
it though the application.
"""
import itertools
colors = itertools.cycle(range(11, curses.COLORS - 10))
layercolormapping.clear()
root = QgsProject.instance().layerTreeRoot()
layers = [node.layer() for node in root.findLayers()]
for layer in reversed(layers):
if not layer.type() == QgsMapLayer.VectorLayer:
continue
layercolormapping[layer.id()] = colors.next()
评论列表
文章目录