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.12k stars 2.93k forks source link

Digitizing mode is geometry type agnostic #51014

Open GCouet opened 1 year ago

GCouet commented 1 year ago

What is the bug or the crash?

With the relatively new digitizing mode, QGIS doesn't adapt to the current geometry type. Whenever the digitizing mode is switched automatically by QGIS by using the Shape Digitizing toolbar, it will stay in that mode regardless of the layers the user will work on later.

This forces users to click an additional button, in the form of the dropdown arrow to be able to select another mode (or a custom shortcut if they have set it up) everytime they have to, for example, switch from digitizing a rectangle on one polygon layer to digitizing a line on a linestring layer.

Steps to reproduce the issue

digitize_awkward

Versions

QGIS version | 3.28.0-Firenze | QGIS code revision | ed3ad0430f3

Supported QGIS version

New profile

Additional context

This really feels like a regression to me, or at least a downgrade in efficiency. I understand the purpose of the refactoring, but it introduced several button clicks for basic digitizing unless modifying the user profile by adding custom shortcuts.

Potential solutions:

roya0045 commented 1 year ago

Already discussed in #49541 might have been fixed by #50691 , though unsure if a ptach will be made until the next realease, to fill the gap.

agiudiceandrea commented 1 year ago

@roya0045, #50691 has been already merged in QGIS 3.28.1. The behaviour described by @GCouet occurs also in QGIS 3.28.1 (although the buttons are in different toolbars) and it is different from the behavior of the digitizing tool before #46687. Maybe @3nids knows if this was an intended behaviour change or an oversight.

Just to clarify: it seems to me the different behaviour is not about the "geometry agnosticism" of the digitizing tool, but it is about the fact that before #46687 the digitizing tool mode was reset when the edit mode was switched off, while after #46687 the digitizing tool mode was not reset when the edit mode was switched off.

roya0045 commented 1 year ago

@roya0045, #50691 has been already merged in QGIS 3.28.1. The behaviour described by @GCouet occurs also in QGIS 3.28.1 (although the buttons are in different toolbars) and it is different from the behavior of the digitizing tool before #46687. Maybe @3nids knows if this was an intended behaviour change or an oversight.

Just to clarify: it seems to me the different behaviour is not about the "geometry agnosticism" of the digitizing tool, but it is about the fact that before #46687 the digitizing tool mode was reset when the edit mode was switched off, while after #46687 the digitizing tool mode was not reset when the edit mode was switched off.

Honestly if this wasn't an oversight this is a horrible choice. Now the question is: should it reset on change of layer, should it change on a change of geometry type or keep a registry matching digitizing type to geometry type and simply reuse the last good setting.

I think that keeping a registry per geometry type(only line and polygon) would be the best option as it doesn't change much, but you don't have unexpected results when a switching to a line layer and generating invalid geometries.

agiudiceandrea commented 1 year ago

Gentle ping @3nids.

3nids commented 1 year ago

The digitizing mode is both geometry and layer agnostic in its current implementation. To make it simple, the idea behind this is that the shapes are available for both line and geometry layers.

If I translate well your proposal, this means defining a preferred mode as segment digitizing for line layers.

I'm just afraid it would break others' workflow: Let's say you are drawing circles on both line and polygon layers and you are switching from one layer to another. Then with your approach you'll have to switch back to shape digitising each time.

The only solution I see would be the possibility to define a preferred mode for any layer, so that when switching to this layer it would also switch the mode. While this is feasible, this will bring a bit of UX for setting the preference. I am not sure this is worth it.

Again, the idea was to decouple what you are drawing from the the source you are writing to.

roya0045 commented 1 year ago

@3nids What I had in mind to make things more simple is to save the last mode used for polygon and line layers separately and just reload or edit that during a session. This way if you draw squares with your polygon layer but want to only draw segments or curves with your line layers you won't have to change anything. Selecting a polygon layer would load the last polygon digitizing setting (or default) and same for linear layers (instead of staying in shape mode).

You only need to change the mode once for each type of layer but it doesn't create any confusion. Currently when drawing shapes with a polygon and switching to lines, I sometimes get invalid geometries (granted this may be fixed now) or squares.

GCouet commented 1 year ago

@3nids To be frank, I really wonder what is the most used method of digitizing on different geometry types because I have been doing manual digitizing for years and using closed shapes on line layers is something I honestly have never done or even considered. I have never been required to capture shapes on line layers. That's what's puzzling me in your argument.

If we take one example, I often have to digitize building footprints, and I definitely use 3-point rectangles for that. Even for irregular polygons, if they are all orthogonal, I will use snapping and 3p rectangles then merge them later. It's definitely faster. I can understand the mode being locked in, this is actually good.

As soon as I have to switch to a line layer though, I have no clue what the justification is for the mode to stay locked into shape. As far as I know for most users, closed shapes are overhwhelmingly going to be captured on polygon layers. It's just begging for a topological mess otherwise.

It really does act like a regression when I'm jumping from geometry type to the other and each time I have to hunt for a button on a toolbar to switch digitizing mode. @roya0045 has a good suggestion, IMO.

edit: I just opened QGIS in a fresh empty projet, I created a temp linestring layer, and upon clicking on add line feature, the digitizing mode defaulted to shape mode/rectangle from extent (carried over from a previous session). This makes no sense.

3nids commented 1 year ago

I totally get the usability point of view, you're right. One thing to consider is that shapes are not limited to closed geometries, you also have the arcs in it, and potentially more in the future. But I am fine with switching from shape to.... segment? the last used mode other than shape? when switching from a poylgon to a line layer. I will take care of this before next release.

GCouet commented 1 year ago

Yeah, that would make quickly switching from one type to the other more natural.

As I said higher up, if there was simple default hotkeys, like there is for stream digitizing, to switch from one mode to the other, it would probably make the changes more fluid. I mentioned making shape mode a toggle, this could work like with stream digitizing.

Thanks for the attention to this issue!

roya0045 commented 1 year ago

I totally get the usability point of view, you're right.

One thing to consider is that shapes are not limited to closed geometries, you also have the arcs in it, and potentially more in the future.

But I am fine with switching from shape to.... segment? the last used mode other than shape? when switching from a poylgon to a line layer.

I will take care of this before next release.

Just an option for the implementation: store a ´last mode used' and load/write it when the layer geometry type is not the same and isn't a point ( or is a line or poly)

Should be easier to maintain and would be stored in the widget per instance.

And have segment be the default value.

agiudiceandrea commented 1 year ago

What would happen for point layers? I think "segment" mode doesn't make much sense for point layers.

roya0045 commented 1 year ago

What would happen for point layers? I think "segment" mode doesn't make much sense for point layers.

The widget is disabled for point layer as there is only one mode. That's why the issue is only present when switching from poly to line and the opposite.

agiudiceandrea commented 1 year ago

It seems to me the button is not disabled for point layers and the "Digitize with Segment" mode (which doesn't make much sense for point layers IMHO) is active, while it is not possible to select other modes. image

When a mode other than "Digitize with Segment" is active (because it was previously activated for a line or polygon layer), the button is greyed out, but the mode displayed in the button icon and tool tip is not correct

image