<HTML>
<HEAD>
<TITLE>Zooming issue in gis manager</TITLE>
</HEAD>
<BODY>
<FONT SIZE="2"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:10.0px'>Before we make these changes, I'd like to reiterate again what is going on with a bit of visual display to better show the issues. <BR>
<BR>
1. There is not a systematic, major inaccuracy from zooming the display in the GIS Manager.<BR>
<BR>
2. This inaccuracy reported only occurs with interactive zooming when displaying a raster map so that the raster grid squares are much larger than the pixel size. That is, when you can see only a few grid squares in the display.<BR>
<BR>
3. It affects the number of grid cells displayed, not the actual computational or display regions.<BR>
<BR>
4. It is primarily (or likely entirely) a function of using g.region -a to align the display region to the raster grid at the current resolution. I originally did NOT use this flag, because I was concerned about potentially uncontrolled changes to zoom precision, but added this to the zooming a few months back at the request of others. <BR>
<BR>
Please note the screen shots links below to help document this issue. These pretty much reconstruct the original steps to show the problem, but without region alignment.<BR>
<BR>
First, I took out the -a switch from the g.region command in mapcanvas.tcl<BR>
<BR>
Then I interactively zoomed (zoom box) the spearfish erosion map to show 7 rows by 13 columns<BR>
<BR>
This is shown in <a href="http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display1.jpg">&lt;http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display1.jpg&gt;</a><BR>
<BR>
<BR>
I then selected &quot;save current region to match display&quot; to make the WIND file match the display region set interactively with the zoom.<BR>
<BR>
I next selected &quot;display region settings&quot; from the menu <BR>
<BR>
This can be seen in <a href="http://www.public.asu.edu/~cmbarton/files/grass_screenshots/output.jpg">&lt;http://www.public.asu.edu/~cmbarton/files/grass_screenshots/output.jpg&gt;</a><BR>
<BR>
Next, I switched to query mode and clicked the NW and SE corners of the display<BR>
<BR>
This can also be seen in output.jpg. Note that the xy values match those in the region extents output (within the small error of a mouse click)<BR>
<BR>
Finally, I selected &quot;zoom to current region&quot; to redraw the screen and make the display match the WIND file<BR>
<BR>
This can be seen in <a href="http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display2.jpg">&lt;http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display2.jpg&gt;</a><BR>
<BR>
Note that display1.jpg and display2.jpg are identical. <BR>
<BR>
<BR>
*****************<BR>
The reported problem with displaying grid cells at high magnification is primarily or entirely a function of how g.region -a aligns the region with the raster grid cell boundaries. I don't know how this works internally and someone with C programming experience will have to deal with it if we want it to work differently<BR>
<BR>
So, what do we want to do? We can either have<BR>
<BR>
1. All zooming is aligned with the cell borders, matching the current resolution, with the possible result of a bit of rounding error in the display when zoomed in to a point where the cells are very large compared to pixel size--due to the way that g.region -a works.<BR>
<BR>
OR<BR>
<BR>
2. Zooming is NOT aligned with the cell borders and the current resolution. In this case, what you see is very close to the actual region extents when zoomed in to a point where the cells are very large compared to pixel size. This is how I originally had it.<BR>
<BR>
Note that if you are NOT zoomed in to a point where grid cells look very large compared with pixels (i.e., most the the time in most maps), then the displays appear identical whether the region is aligned to the cell borders or not.<BR>
<BR>
We cannot have it both ways given how g.region -a works. That is, the underlying zoom math is correct and the same in both cases, but can either zoom with g.region -a or with g.region (without the -a flag).<BR>
<BR>
Michael<BR>
__________________________________________<BR>
Michael Barton, Professor of Anthropology<BR>
School of Human Evolution &amp; Social Change &nbsp;&nbsp;&nbsp;<BR>
Center for Social Dynamics &amp; Complexity<BR>
Arizona State University<BR>
<BR>
phone: 480-965-6213<BR>
fax: 480-965-7671<BR>
www: <FONT COLOR="#0000FF"><U><a href="http://www.public.asu.edu/~cmbarton">http://www.public.asu.edu/~cmbarton</a></U></FONT> <BR>
<BR>
<BR>
<BR>
&gt; From: Hamish &lt;<FONT COLOR="#0000FF"><U>hamish_nospam@yahoo.com</U></FONT>&gt;<BR>
&gt; Date: Tue, 31 Oct 2006 15:13:43 +1300<BR>
&gt; To: Maciej Sieczka &lt;<FONT COLOR="#0000FF"><U>tutey@o2.pl</U></FONT>&gt;<BR>
&gt; Cc: &lt;<FONT COLOR="#0000FF"><U>mlennert@club.worldonline.be</U></FONT>&gt;, &lt;<FONT COLOR="#0000FF"><U>michael.barton@asu.edu</U></FONT>&gt;, <BR>
&gt; &lt;<FONT COLOR="#0000FF"><U>grass-dev@grass.itc.it</U></FONT>&gt;<BR>
&gt; Subject: Re: [GRASS-dev] d.m/d.gis mysteries..<BR>
&gt; <BR>
&gt; Maciej Sieczka wrote:<BR>
&gt;&gt; I, personally, would even prefer d.m as the default GUI back,<BR>
&gt; <BR>
&gt; <BR>
&gt; with a mind to making long term users happy, and making the wxpython<BR>
&gt; development easier, I'd like to extend the GRASS_GUI variable.<BR>
&gt; <BR>
&gt; currently it is both a startup shell variable and a GRASS gisenv<BR>
&gt; variable. (if it exists, the former sets the latter at startup)<BR>
&gt; <BR>
&gt; currently you can do<BR>
&gt; <BR>
&gt; GRASS_GUI=text grass63<BR>
&gt; &nbsp;&nbsp;or<BR>
&gt; grass63 -text<BR>
&gt; <BR>
&gt; to start with the command line one<BR>
&gt; <BR>
&gt; GRASS_GUI=tcltk grass63<BR>
&gt; &nbsp;&nbsp;or<BR>
&gt; grass63 -gui<BR>
&gt; &nbsp;&nbsp;or<BR>
&gt; grass63 -tcltk<BR>
&gt; <BR>
&gt; to start with the Tcl/Tk startup + gis.m<BR>
&gt; <BR>
&gt; <BR>
&gt; <BR>
&gt; with this patch you can also do<BR>
&gt; <BR>
&gt; grass63 -oldgui &nbsp;&nbsp;# for d.m<BR>
&gt; <BR>
&gt; or<BR>
&gt; <BR>
&gt; GRASS_GUI=d.m grass63<BR>
&gt; <BR>
&gt; or<BR>
&gt; <BR>
&gt; GRASS_GUI=gis.m grass63<BR>
&gt; <BR>
&gt; or even<BR>
&gt; <BR>
&gt; # rename it to whatever the wxpython GUI will be called<BR>
&gt; GRASS_GUI=wxpython grass63<BR>
&gt; <BR>
&gt; when wx becomes the default just switch &quot;grass63 -gui&quot; to that target.<BR>
&gt; <BR>
&gt; <BR>
&gt; grass remembers the last one you used and uses that as the default.<BR>
&gt; <BR>
&gt; <BR>
&gt; WRT, d.zoom &amp; gis.m zooming- the x monitors and d.zoom have had more<BR>
&gt; than a decade of heavy use to become mature. gis.m has had barely 9<BR>
&gt; months of developer testing to become mature. And even then, most of the<BR>
&gt; long-time developers who hold the bulk &nbsp;of the &quot;institutional knowledge&quot;<BR>
&gt; only work from the command line.... it is really great that it has come<BR>
&gt; so far so fast.<BR>
&gt; <BR>
&gt; the zooming stuff is tricky business- even after all this time d.zoom<BR>
&gt; still has some problems and is far from elegant. accurate rendering &amp;<BR>
&gt; point placement is the bread and butter of a GIS though, so it'd be nice<BR>
&gt; to have everyone happy with gis.m in the long term. Folks will be<BR>
&gt; picking points off the screen and writing down coordinates for their<BR>
&gt; field sites. All the time spent now perfecting the design choices will<BR>
&gt; pay off well, I am sure. Even if only for when we do the wxPython<BR>
&gt; version we can pick the best choices the first time.<BR>
&gt; <BR>
&gt; <BR>
&gt; choices are good,<BR>
&gt; Hamish<BR>
<BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
__________________________________________<BR>
Michael Barton, Professor of Anthropology<BR>
School of Human Evolution &amp; Social Change &nbsp;&nbsp;&nbsp;<BR>
Center for Social Dynamics &amp; Complexity<BR>
Arizona State University<BR>
<BR>
phone: 480-965-6213<BR>
fax: 480-965-7671<BR>
www: <a href="http://www.public.asu.edu/~cmbarton">http://www.public.asu.edu/~cmbarton</a> <BR>
<BR>
</SPAN></FONT>
</BODY>
</HTML>