REDcatch / Volume_calculation_for_QGIS3

GNU General Public License v3.0
8 stars 7 forks source link

Shouldn't it refer to layers with a unique handle rather than by name? #8

Open AlisterH opened 2 years ago

AlisterH commented 2 years ago

If a project has two vector layers with the same name, this plugin lists both of them, but gives the same results regardless of which one is selected. I guess the code should be changed to refer to the layer by its unique handle rather than by name. I didn't test what happens if you have two different raster layers with the same name.

distbug commented 2 years ago

That is true, however, we do or did not think that this is a common use case. Is this a common use case for you ? We could change it, but we'd need more demand for it first.

AlisterH commented 2 years ago

I can only speak for myself, but I almost always have multiple layers with the same name, particularly raster layers.

This is because I tend to work with a lot of temporary layers created by various processing algorithms, so they all just have default names like OUTPUT. Eventually I save permanent copies of some of the layers, but I don't want to keep most of them, so it is easier to create them as temporary layers than it is to initially save them all as 'permanent' outputs and then go through later manually deleting the ones I don't need.

I guess in terms of this plugin the simple use case is something like this:

distbug commented 2 years ago

If you want you can open a pull-request for this change. As far as I can see this would mostly involve switching out the calls for the map layers while presenting the layer name to the user with its unique handle also being tracked/saved.