[GRASS-dev] [GRASS GIS] #2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not screen pixels

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
------------------------------+---------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.3
Component: wxGUI | Version: svn-releasebranch70
Keywords: vector, digitize | CPU: Unspecified
Platform: Unspecified |
------------------------------+---------------------------------
Using g.gui.vdigit in trunk and in 7.0.3rc1, I only seem to be able to
define snapping distance in map units, not in screen pixels:

* Go to the digitizing parameters, 'General' tab
* Change snapping threshold to any value, choosing screen pixels as unit

=> The translation to meters below always corresponds to the exact same
number you set as threshold in screen pixels. And testing through actual
digitization shows that the snapping threshold is in map units, whichever
unit you chose in the parameters.

Setting priority to major as snapping is an important tool in topological
vector editing, but the tool remains usable.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Can anyone else confirm this issue ?
I'm still seeing it.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

In [changeset:"69578" 69578]:
{{{
#!CommitTicketReference repository="" revision="69578"
GUI/vdigit: fix snapping units, see #2848
}}}

--
Ticket URL: </ticket/2848#comment:5>
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Please test. It was only problem when using different locale.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:6 annakrat]:
> Please test. It was only problem when using different locale.

Right. It +/- works now, i.e. when I chose "screen pixels", I now get the
correct value in map units below. However, when I change the value (i.e.
the number of screen pixels), I get a wrong number below: the number of
screen pixels instead of map units. I have to switch to map units and back
to screen pixels for the depicted value in map units to be correct again.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:7 mlennert]:
> Replying to [comment:6 annakrat]:
> > Please test. It was only problem when using different locale.
>
> Right. It +/- works now, i.e. when I chose "screen pixels", I now get
the correct value in map units below. However, when I change the value
(i.e. the number of screen pixels), I get a wrong number below: the number
of screen pixels instead of map units. I have to switch to map units and
back to screen pixels for the depicted value in map units to be correct
again.

OK, I committed a new fix in r69579.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:8 annakrat]:
> Replying to [comment:7 mlennert]:
> > Replying to [comment:6 annakrat]:
> > > Please test. It was only problem when using different locale.
> >
> > Right. It +/- works now, i.e. when I chose "screen pixels", I now get
the correct value in map units below. However, when I change the value
(i.e. the number of screen pixels), I get a wrong number below: the number
of screen pixels instead of map units. I have to switch to map units and
back to screen pixels for the depicted value in map units to be correct
again.
>
> OK, I committed a new fix in r69579.

Seems to work great, now ! Thanks.

Not sure if this is mature enough to backport to release70. You're a
better judge of that.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:9 mlennert]:
> Replying to [comment:8 annakrat]:
> > Replying to [comment:7 mlennert]:
> > > Replying to [comment:6 annakrat]:
> > > > Please test. It was only problem when using different locale.
> > >
> > > Right. It +/- works now, i.e. when I chose "screen pixels", I now
get the correct value in map units below. However, when I change the value
(i.e. the number of screen pixels), I get a wrong number below: the number
of screen pixels instead of map units. I have to switch to map units and
back to screen pixels for the depicted value in map units to be correct
again.
> >
> > OK, I committed a new fix in r69579.
>
> Seems to work great, now ! Thanks.
>
> Not sure if this is mature enough to backport to release70. You're a
better judge of that.

The only problem is in the settings. The old value should be ignored and
then new value (0 or 1 is saved). You can test it by manually changing the
values in the settings file. Since you didn't report any problem with the
new patch I assume it ignores your saved settings value ("screen pixels"
or the french version), but please check, you should have now there 0 or 1
if you saved the settings.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:10 annakrat]:
> Replying to [comment:9 mlennert]:
> > Replying to [comment:8 annakrat]:
> > > Replying to [comment:7 mlennert]:
> > > > Replying to [comment:6 annakrat]:
> > > > > Please test. It was only problem when using different locale.
> > > >
> > > > Right. It +/- works now, i.e. when I chose "screen pixels", I now
get the correct value in map units below. However, when I change the value
(i.e. the number of screen pixels), I get a wrong number below: the number
of screen pixels instead of map units. I have to switch to map units and
back to screen pixels for the depicted value in map units to be correct
again.
> > >
> > > OK, I committed a new fix in r69579.
> >
> > Seems to work great, now ! Thanks.
> >
> > Not sure if this is mature enough to backport to release70. You're a
better judge of that.
>
> The only problem is in the settings. The old value should be ignored and
then new value (0 or 1 is saved). You can test it by manually changing the
values in the settings file. Since you didn't report any problem with the
new patch I assume it ignores your saved settings value ("screen pixels"
or the french version), but please check, you should have now there 0 or 1
if you saved the settings.

I'm not sure I saved these settings before. Now, I do have

{{{
vdigit;snapping;units;0;value;20
}}}

However, when I now try to open the settings dialog in the grass 7.0.5
digitizer, I get:

{{{
Traceback (most recent call last):
   File
"/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64
-pc-linux-gnu/gui/wxpython/vdigit/toolbars.py", line 528, in
OnSettings

self.settingsDialog = VDigitSettingsDialog(parent =
self.parent, giface = self._giface)
   File
"/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64
-pc-linux-gnu/gui/wxpython/vdigit/preferences.py", line 43,
in __init__

self._createGeneralPage(notebook)
   File
"/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64
-pc-linux-gnu/gui/wxpython/vdigit/preferences.py", line 168,
in _createGeneralPage

self.snappingUnit.SetStringSelection(UserSettings.Get(group
= 'vdigit', key = "snapping", subkey = 'units'))
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/_core.py", line 13002, in
SetStringSelection

return _core_.ItemContainer_SetStringSelection(*args,
**kwargs)
TypeError
:
String or Unicode type required
}}}

so there is an issue of backwards compatibility....

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:11&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

OK, try r69580. First remove the snapping record in your settings file.
Save it in trunk, and now open the dialog in older GRASS. Save it and open
it again in trunk. If there are no problems, I will backport it.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:12 annakrat]:
> OK, try r69580. First remove the snapping record in your settings file.
Save it in trunk, and now open the dialog in older GRASS. Save it and open
it again in trunk. If there are no problems, I will backport it.

This seems to work, except: when I chose map units in trunk, I get the
following in the settings file:

{{{
vdigit;snapping;units;screen pixels;value;25;unit;1
}}}

which looks a bit contradictory ('unit: 1' should be 'units: map units',
or ?).

When I open this in grass70, I get values corresponding to 25 pixels,
although the drop-down list status does not show any choice. When I then
choose pixels, I first get 25 pixels = 25 meters, but when I change the
number of pixels, the meter info is correct again.

Trying to save from grass70, nothing is saved to the settings file if I
choose map units. Choosing screen pixels, I only get:

{{{
vdigit;snapping;
}}}

in the settings file.

When I then open trunk, it gives me the default settings of 10 screen
pixels.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:13&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:13 mlennert]:
> Replying to [comment:12 annakrat]:
> > OK, try r69580. First remove the snapping record in your settings
file. Save it in trunk, and now open the dialog in older GRASS. Save it
and open it again in trunk. If there are no problems, I will backport it.
>
> This seems to work, except: when I chose map units in trunk, I get the
following in the settings file:
>
>
> {{{
> vdigit;snapping;units;screen pixels;value;25;unit;1
> }}}
>
> which looks a bit contradictory ('unit: 1' should be 'units: map units',
or ?).
>

That's correct, 'units' is the old name kept there for backwards
compatibility, 'unit' is the new one (0 is screen pixels, 1 is map units).

> When I open this in grass70, I get values corresponding to 25 pixels,
although the drop-down list status does not show any choice. When I then
choose pixels, I first get 25 pixels = 25 meters, but when I change the
number of pixels, the meter info is correct again.
>
> Trying to save from grass70, nothing is saved to the settings file if I
choose map units. Choosing screen pixels, I only get:
>
> {{{
> vdigit;snapping;
> }}}
>
> in the settings file.

It is broken in GRASS70, the point is it shouldn't give you any error
caused by the changes in the new settings file.
>
> When I then open trunk, it gives me the default settings of 10 screen
pixels.
That's correct. So I would say it behaves as I would expect.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2848#comment:14&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:14 annakrat]:
> Replying to [comment:13 mlennert]:
> > Replying to [comment:12 annakrat]:
> > > OK, try r69580. First remove the snapping record in your settings
file. Save it in trunk, and now open the dialog in older GRASS. Save it
and open it again in trunk. If there are no problems, I will backport it.
> >
> > This seems to work, except: when I chose map units in trunk, I get the
following in the settings file:
> >
> >
> > {{{
> > vdigit;snapping;units;screen pixels;value;25;unit;1
> > }}}
> >
> > which looks a bit contradictory ('unit: 1' should be 'units: map
units', or ?).
> >
>
> That's correct, 'units' is the old name kept there for backwards
compatibility, 'unit' is the new one (0 is screen pixels, 1 is map units).

Yes, I understand that, but if 1 is map units, then why does the line
contain 'units;screen pixels' and 'unit;1' ? Shouldn't it be 'units;map
units' ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:15&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:15 mlennert]:
> Replying to [comment:14 annakrat]:
> > Replying to [comment:13 mlennert]:
> > > Replying to [comment:12 annakrat]:
> > > > OK, try r69580. First remove the snapping record in your settings
file. Save it in trunk, and now open the dialog in older GRASS. Save it
and open it again in trunk. If there are no problems, I will backport it.
> > >
> > > This seems to work, except: when I chose map units in trunk, I get
the following in the settings file:
> > >
> > >
> > > {{{
> > > vdigit;snapping;units;screen pixels;value;25;unit;1
> > > }}}
> > >
> > > which looks a bit contradictory ('unit: 1' should be 'units: map
units', or ?).
> > >
> >
> > That's correct, 'units' is the old name kept there for backwards
compatibility, 'unit' is the new one (0 is screen pixels, 1 is map units).
>
> Yes, I understand that, but if 1 is map units, then why does the line
contain 'units;screen pixels' and 'unit;1' ? Shouldn't it be 'units;map
units' ?

I don't care about the value of 'units' anymore, I am not trying to set
it, I just kept them there so that the settings file can be read without
error in old versions.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2848#comment:16&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mlennert):

Replying to [comment:16 annakrat]:
> Replying to [comment:15 mlennert]:
> > Replying to [comment:14 annakrat]:
> > > Replying to [comment:13 mlennert]:
> > > > Replying to [comment:12 annakrat]:
> > > > > OK, try r69580. First remove the snapping record in your
settings file. Save it in trunk, and now open the dialog in older GRASS.
Save it and open it again in trunk. If there are no problems, I will
backport it.
> > > >
> > > > This seems to work, except: when I chose map units in trunk, I get
the following in the settings file:
> > > >
> > > >
> > > > {{{
> > > > vdigit;snapping;units;screen pixels;value;25;unit;1
> > > > }}}
> > > >
> > > > which looks a bit contradictory ('unit: 1' should be 'units: map
units', or ?).
> > > >
> > >
> > > That's correct, 'units' is the old name kept there for backwards
compatibility, 'unit' is the new one (0 is screen pixels, 1 is map units).
> >
> > Yes, I understand that, but if 1 is map units, then why does the line
contain 'units;screen pixels' and 'unit;1' ? Shouldn't it be 'units;map
units' ?
>
> I don't care about the value of 'units' anymore, I am not trying to set
it, I just kept them there so that the settings file can be read without
error in old versions.

Then things look pretty good for me. I just want to make sure we don't
create a regression if we backport this fix this late before the release
of 7.0.5.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:17&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:17 mlennert]:
> Then things look pretty good for me. I just want to make sure we don't
create a regression if we backport this fix this late before the release
of 7.0.5.

I understand, thanks for testing. I will backport later today.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:18&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

In [changeset:"69594" 69594]:
{{{
#!CommitTicketReference repository="" revision="69594"
GUI/vdigit: fix snapping units, see #2848 (merge from trunk r69578,
r69579, r69580)
}}}

--
Ticket URL: </ticket/2848#comment:19>
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

In [changeset:"69595" 69595]:
{{{
#!CommitTicketReference repository="" revision="69595"
GUI/vdigit: fix snapping units, see #2848 (merge from trunk r69578,
r69579, r69580)
}}}

--
Ticket URL: </ticket/2848#comment:20>
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: fixed | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by annakrat):

* status: new => closed
* resolution: => fixed

Comment:

OK, backported, tested again and hopefully fixed now.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:21&gt;
GRASS GIS <https://grass.osgeo.org>

#2848: g.gui.vdigit: snapping distance seems to only be defined in map units, not
screen pixels
--------------------------+---------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 7.0.5
Component: wxGUI | Version: svn-releasebranch70
Resolution: fixed | Keywords: vector, digitize
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by martinl):

In [changeset:"70404" 70404]:
{{{
#!CommitTicketReference repository="" revision="70404"
wxGUI/vdigit: fix GetThreshold() (see #2848)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2848#comment:22&gt;
GRASS GIS <https://grass.osgeo.org>