Bug report #289

GRASS Edit: don't force category 0 if none specified

Added by Redmine Admin about 18 years ago. Updated about 15 years ago.

Status:Closed
Priority:Low
Assignee:Lorenzo Masini
Category:GRASS
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:10348

Description

When I digitize a Grass vector in QGIS and add a feature using the 'next not used' category mode, the first category used is '1'. But, if I digitize a feature in 'no category' mode, add after that add a 'new' category in the Grass 'attributes window', the category added is '0'.

In both cases category '0' should be used as the first one.

Maciek

History

#1 Updated by Redmine Admin about 18 years ago

Moreover

As I said: if I add a feature using 'no category' mode, and then add category manually it's '0'

But when I do the same again, again category '0' is used!

Maciek

#2 Updated by leolami - over 16 years ago

Hi Maciek,
I think this behavior of QGIS is not a problem. When you add a 'new' category in 'no category' mode QGIS show you that it put the value 0 at the cat in the Grass 'attributes window' but if doesn't do it. This because GRASS manages only integer and positive category values.

If you are agree I suggest to close this bug.

Regards
Leonardo

#3 Updated by Maciej Sieczka - over 16 years ago

Replying to [comment:3 leolami]:

When you add a 'new' category in 'no category' mode QGIS show you that it put the value 0
at the cat in the Grass 'attributes window' but if doesn't do it.

This because GRASS manages only integer and positive category values.

We were both partly in error:

1. Your error: GRASS does support category number 0. See Radim's note r1.

2. Mine: I didn't consider that GRASS Edit will silently assume category=0 when the "Category" dialog is empty. And that's the culprit.

The whole bug is this:

1. If category "Mode" is set to "No category", the "New" button in "Edit attributes" tool of GRASS Edit should be disabled - because the user can't specify the category (the dialog is greyed out) in this mode.

2. In "Manual entry" "Mode", if the "Category" dialog is empty, the "New" button in "Edit attributes" tool of GRASS Edit should be disabled too.

In short words - don't force category '0' (just like you would not force any other value) if the user did not explicitly put it the "Category" dialog.

To consider: since GRASS supports category 0, I wonder if GRASS Edit should not start at category '0' in "Next not used" "Mode", instead of '1' in like it does now. On the other hand, as some GRASS modules are buggy that they still assume the first possible category to be '1', such a "correction" in QGIS GRASS Edit might be not a good idea. Probably better leave this as it is for now, but fix the bug described above.

r1http://sourceforge.net/mailarchive/message.php?msg_name=340505ef0601170244n1b5fe25bhd0a3eba7342b78d4%40mail.gmail.com

#4 Updated by leolami - over 16 years ago

Hi Maciek,
I see the Radim note and I agree on start at category '0' in "Next not used" "Mode", instead of '1'.
But, like you say, some GRASS modules still assume the first possible category to be '1' and this can creates problems.

Are you agree if we move it from bug to defect?

Regards
Leonardo

#5 Updated by Maciej Sieczka - over 16 years ago

Leonardo

I'll repeat - I don't think GRASS Edit should default to '0' as the initial category instead of '1', yet. It is something to consider in future depending on how category 0 vs 1 are handled in GRASS in future. That's one issue.

The other issue is that there is a major bug in GRASS Edit related to category handling:

1. If category "Mode" is set to "No category", the "New" button in "Edit attributes" tool of GRASS Edit should be disabled - because the user can't specify the category (the dialog is greyed out) in this mode.

2. In "Manual entry" "Mode", if the "Category" dialog is empty, the "New" button in "Edit attributes" tool of GRASS Edit should be disabled too - because the user haven't specified the category yet, thus GRASS Edit can't know what the "New" category shall be.

This is a bug, a rather big one.

#6 Updated by Lorenzo Masini about 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Changed the behavior of the attribute editor as suggested by msieczka.

Fixed in 60a8f73b (SVN r11332).

Also available in: Atom PDF