camptocamp / cgxp

22 stars 22 forks source link

Make a layer id attribute available in all tree nodes #1050

Closed asaunier closed 8 years ago

asaunier commented 8 years ago

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.

sbrunner commented 8 years ago

I don't like to have a group ID in a value names layers_id ...

svakom commented 8 years ago

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"?

sbrunner commented 8 years ago

Or simply 'id' ?

svakom commented 8 years ago

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.

asaunier commented 8 years ago

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?).

sbrunner commented 8 years ago

For me that looks good like it :-)