Closed asaunier closed 8 years ago
I don't like to have a group ID in a value names layers_id ...
Thanks @sbrunner that's @asaunier writing. Well I wanted to use a single attribute name since it's always the same info (id of the tree item). But you're right.
We could use a "group_id" attribute for groups and "layer_id" for layers. Or "node_id" for all items whatever the node type. But maybe we would have backward compatibility problems with code already using "layer_id"?
Or simply 'id' ?
If possible that would definitely be fine indeed. But isn't it already used? As for now, it seems we have some OL object ids in node.attributes.id.
I have just updated the PR so that "group_id" is used for groups (and layer_id for layers).
I may also rename the attribute to "node_id" or even "id" but I'm afraid of backward compatibility problems and of conflicts with OpenLayers ids (really important?).
For me that looks good like it :-)
As for now, the layer id (from the DB) is only available for the layertree leaves (layers with no children) whereas it could be useful for layergroups as well, for instance to open a custom metadata window using this id.
This PR generalizes the "layer_id" attribute for all layertree nodes.