qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

Vertex tool not working when rule based style contains rules with expressions #29820

Open qgib opened 5 years ago

qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen) Original Redmine Issue: 22006 Affected QGIS version: 3.6.2 Redmine category:digitising


I have a project with numerous layers. On a line or polygon shapefile layer without style, it woks fine, however, if I use the same shapefile and it has style associated with it (once it has been saved), the vertex editor does not work. Reproducible on my project with all shapefiles.


qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


Just to clarify, this is rule based styles/symbology

qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


Peter Cornelissen wrote:

I have a project with numerous layers. On a line or polygon shapefile layer without style, it woks fine, however, if I use the same shapefile and it has style associated with it (once it has been saved), the vertex editor does not work. Reproducible on my project with all shapefiles.

I can't replicate here could you attach a sample project+data?


qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


I've attached a LDF, hopefully that has all you need. I tried loading this into a new project and I still get the same problem.



qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


Sorry, that's a bit over complicated, attached is a simplified version with the same shapefile but one with style the other without.



qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


Peter Cornelissen wrote:

Sorry, that's a bit over complicated, attached is a simplified version with the same shapefile but one with style the other without.

hard to try replicate wothout the actual data, can you attach a simple project+sample data/style?


qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


Hi

I've attached the necessary project files as requested, but what I have discovered by putting this example together is that it is the use of attributes in the rule-based style that causes the problem. I use attributes as I repeat the style dozens of times in the various Plans and do not want to have to have to create a different style file for each.

Thanks, Peter



qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


for some reason in your project the decimal separator in the vertex editor shows as "," even if is all set to english in my pc (so to use the "." instead).

Using a locale that uses commas as separator is known to make the editor not working, see:

https://issues.qgis.org/issues/21867


qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


If I understood this correctly, I had to change the QGIS locale by opening the Settings -> Options dialog and in the General tab 'Override system locale' and select English United Kingdom. I made the change, restarted QGIS. If that's the case, as far as I can tell the error is still there. Works fine without the attributes, but not with them. If there is anything else I am supposed to change, please let me know.


qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


Peter Cornelissen wrote:

If I understood this correctly, I had to change the QGIS locale by opening the Settings -> Options dialog and in the General tab 'Override system locale' and select English United Kingdom. I made the change, restarted QGIS. If that's the case, as far as I can tell the error is still there. Works fine without the attributes, but not with them. If there is anything else I am supposed to change, please let me know.

do you still the comma as decimal separator in the vertex editor?


qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


Sorry, I should have checked before, but the decimal separator is '.' (see attached) and as I hadn't checked before making the change, I reverted to system locale and that is also '.' (i.e. no sign of a comma). As I can't get the tool or editor to work on the style with attributes, I can't obviously see what the result is there. Unfortunately, I don't think this issue is not related to the system locale issue, it must be something to do with the use of the attribute in the style rule expression.



qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


Something else that may be significant I have just discovered is that if I add a new line using the 'Add Line Feature' tool, to the same layer which is using the attribute style, I can use the vertex editor on that new line, but only until I save and close the project. Once I do that and open it again, I can no longer edit the line.

qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


Peter Cornelissen wrote:

Sorry, I should have checked before, but the decimal separator is '.' (see attached) and as I hadn't checked before making the change, I reverted to system locale and that is also '.' (i.e. no sign of a comma). As I can't get the tool or editor to work on the style with attributes, I can't obviously see what the result is there. Unfortunately, I don't think this issue is not related to the system locale issue, it must be something to do with the use of the attribute in the style rule expression.

on a clean/new qgis profile I can edit your project/lines with the vertex editor without issues, please give it a try.

qgib commented 5 years ago

Author Name: Peter Cornelissen (Peter Cornelissen)


I have now tried that and unfortunately, on the style using attributes, I still cannot edit the vertex.

gioman commented 3 years ago

I edited the title to be more clear. The issue is still valid on the latest master.

The necessary project/data is attached in this ticket.

In the sample project the problem is visible in the layer "Plan1809 Lines" which has a rule based symbology with rules with filters like

attribute($currentfeature, left(@layer_name,8)) = 'Y' AND Type = 'Chalk'

With rules/filters like that the node tools and the vertex editor do not work at all. Curiously if a rule "ELSE" is added then it all works as expected.

roya0045 commented 3 years ago

I always get this itermittently, and yes the else statement change the behaviour of all layers suddenly. I might try to find out what is wrong.

roya0045 commented 3 years ago

@gioman you said you can reproduce this reliably with the provided data?

gioman commented 3 years ago

@gioman you said you can reproduce this reliably with the provided data?

@roya0045 yes

roya0045 commented 3 years ago

Also affect other tools such as select, but not identify...

roya0045 commented 3 years ago

I forgot to mention, adding an else solves this as it provide a fallback. Removing the else disables this, though the else must be visible. I know this is related to how tools interact with rendering and the identify tool has a distinct logic.

roya0045 commented 2 years ago

I have a theory, to perform the testing the maprendercontext is used, the expression context stored in the renderer from the mapsetting in the evaluation might be insufficient ( that would be why this https://github.com/qgis/QGIS/blob/5c354305931ea50d55fbf22fe4afa196db808c97/src/core/vector/qgsvectorlayerrenderer.cpp#L142 is require when doing rendering and not hittesting ) Adding this to the rendercontext may be sufficient to evaluate properly the expressions.Adding it to this https://github.com/qgis/QGIS/blob/22c16f206778b80571479985e59f44c34b1ae0a7/src/core/qgssnappingutils.cpp#L485 may be sufficient.

My local build stop giving property to existing windows and just stop reponding so testing might be harduous or slow. I'll see what I can do.

roya0045 commented 2 years ago

@nyalldawson do you think the proposed fix would solve it? It tried testing it but my new build is clearly cursed (saved projects just load blanks, gpkg are not supported, and other weird things)

roya0045 commented 2 years ago

ok, not enough to fix this.

CreaTechJulius commented 3 months ago

I had the same bug, when using rule-based labeling and could resolve it by adding an ELSE rule (without symbol)

grafik