[GRASS-dev] gis.m: 2 region handling bugs

Michael,

In the course of
http://grass.itc.it/pipermail/grassuser/2006-August/035804.html we had
to switch offlist to Polish with Jarek to sort out details. Do you speak
Polish, by any chance ;)?

As a result I found following 2 bugs. Jarek has somewhat similar another
problem, but I can't reproduce it. It seems related to my BUG #1 though.

Below you'll find a detailed, reproducable description of the 2 bugs I
found. Based on spearfish60. Both refer to CONSTRAIN display mode.

Using Grass 6.3 CVS, today, Ubuntu 6.06 Dapper, stock tcl/tk 8.4.12.

BUG #1. Region set in gis.m is reset after refreshing the Map Display
(display/zoom/pan).

#0
grass63 -text
spearfish60
g.region rast=slope -a
gis.m
add 'slope' raster, display it

#1 gis.m:
g.region -g
n=4928040
s=4913640
w=589950
e=609030
nsres=30
ewres=30
rows=480
cols=636

#2 gis.m:
g.region -ag res=10
n=4928040
s=4913640
w=589950
e=609030
nsres=10
ewres=10
rows=1440
cols=1908

#3 gis.m:
press "Display active layers"

#4 gis.m:
g.region -g
n=4928040
s=4913640
w=589950
e=609030
nsres=30
ewres=30
rows=480
cols=636

WRONG. REGION EXTENT SHOULD BE AS SET IN STEP #2.

BUG #2. When there are no layers to display in the gis.m, the "Zoom to
current region (set with g.region)" doesn't work.

#0 grass63 -text, any location

#1 terminal:
gis.m

#2 gis.m:
g.region -g
n=4928040
s=4913640
w=589950
e=609030
nsres=30
ewres=30
rows=480
cols=636

#3 terminal:
g.region res=10 -ag
n=4928040
s=4913640
w=589950
e=609030
nsres=10
ewres=10
rows=1440
cols=1908

#4 gis.m
Zoom to... -> Zoom to current region (set with g.region)

#5 gis.m:
g.region -g
n=4928040
s=4913640
w=589950
e=609030
nsres=30
ewres=30
rows=480
cols=636

WRONG. REGION SHOULD BE AS SET IN STEP #3.

Maciek

Michael,

In current 6.3 CVS these 2 bugs are solved. Also the region is alligned
to resolution now when it should. Excellent, thanks! I think respective
fixes should be backported to 6.2.

But, I have found another 2 bugs:

# BUG1: when more than 1 Map Display is used, it is impossible to zoom
in/out properly.

To reproduce:

1. grass63 -text, use spearfish60
2. g.region rast=slope -a
3. start gis.m
4. add raster 'slope', display it
5. start a 2nd Map Display
6. add a different raster here, e.g. 'landuse', display it
7. now zoom in/out a couple of times - once on the Map Display 1 and
once on Map Display 2

After 2nd/3rd zooming in/out you'll see that either Map Display follows
the rectangle you tell it to zoom to anymore.

Maybe display geometries of different Map Displays get mixed, ?

# BUG2 Shouldn't the "Region:" information at the bottom of each Map
Display window update as I zoom/pan? Currently it doesn't, which looks
weird IMO, even if it is intended.

Maciek

Maciek,

Thanks for the input. See below.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Maciej Sieczka <tutey@o2.pl>
Date: Wed, 30 Aug 2006 14:29:57 +0200
To: Michael Barton <michael.barton@asu.edu>
Cc: grass-dev <grass-dev@grass.itc.it>, Jarek Jasiewicz <jarekj@amu.edu.pl>
Subject: gis.m: another 2 region bugs [was: gis.m: 2 region handling bugs]

Michael,

In current 6.3 CVS these 2 bugs are solved. Also the region is alligned
to resolution now when it should. Excellent, thanks! I think respective
fixes should be backported to 6.2.

But, I have found another 2 bugs:

# BUG1: when more than 1 Map Display is used, it is impossible to zoom
in/out properly.

To reproduce:

1. grass63 -text, use spearfish60
2. g.region rast=slope -a
3. start gis.m
4. add raster 'slope', display it
5. start a 2nd Map Display
6. add a different raster here, e.g. 'landuse', display it
7. now zoom in/out a couple of times - once on the Map Display 1 and
once on Map Display 2

After 2nd/3rd zooming in/out you'll see that either Map Display follows
the rectangle you tell it to zoom to anymore.

Maybe display geometries of different Map Displays get mixed, ?

I did this but can't reproduce your error. However, check the following.

I didn't try to switch between the maps fast. Check the layer tree to make
sure that the correct map is registering the focus before zooming. On my Mac
G5, that can take a half second or so. It may take longer on your computer.
You can see the layer tree switch. If this switch hasn't happened, it indeed
can get confused about which zoom values are being used. AFAIK, there is no
way to speed up this switching.

Also, note that the switching is controlled by the cursor being over a map
window and that window being on the top of the stack. If map windows are
overlapping substantially on your screen, it could cause some internal (or
external ;-)) region confusion. Again, giving the map a moment to switch
between displays should help.

I don't particularly like using the mouse position to switch between
displays. I would prefer to have the user actively click a window to make it
the active one. However, this was necessary because TclTk has no bindings
that will serve for the entire map display window and its frame. So if you
clicked in the wrong place, the map would not be activated.

# BUG2 Shouldn't the "Region:" information at the bottom of each Map
Display window update as I zoom/pan? Currently it doesn't, which looks
weird IMO, even if it is intended.

Oddly, it turns out that the resolution IS updated but the rows and columns
are not. This probably got mucked up in fixing the region setting for
latlon. I'll try to get it straightened out.

Michael

Maciek

I've fixed this and committed it to the cvs. I've tested it in Spearfish and
with an Arizona latlon region. If someone else could test it, I'd appreciate
it.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Maciej Sieczka <tutey@o2.pl>
Date: Wed, 30 Aug 2006 14:29:57 +0200
To: Michael Barton <michael.barton@asu.edu>
Cc: grass-dev <grass-dev@grass.itc.it>, Jarek Jasiewicz <jarekj@amu.edu.pl>
Subject: gis.m: another 2 region bugs [was: gis.m: 2 region handling bugs]

# BUG2 Shouldn't the "Region:" information at the bottom of each Map
Display window update as I zoom/pan? Currently it doesn't, which looks
weird IMO, even if it is intended.

Michael Barton wrote:

I did this but can't reproduce your error.

I'm affraid you didn't try hard or for some reason it works all
different on your Mac than on my Linux. I can reproduce the bug at will
(wish I could show it you, I will think of some desktop recording
software). It is not about how quick I switch between display, no
matter if I wait half a seconf or minute the problem finally crops out.
Can you please re-test?

# BUG2 Shouldn't the "Region:" information at the bottom of each Map
Display window update as I zoom/pan? Currently it doesn't, which looks
weird IMO, even if it is intended.

Oddly, it turns out that the resolution IS updated but the rows and columns
are not. This probably got mucked up in fixing the region setting for
latlon. I'll try to get it straightened out.

Thanks.

Maciek