[GRASS-dev] Re: single-click zoom doesn't preserve aspect ratio

Moritz Lennert mlennert at club.worldonline.be
Tue Nov 7 10:06:09 EST 2006


Moritz Lennert wrote:
> Maciej Sieczka wrote:
>> Trying to switch to "Map fills display window" mode, I get an error:
>>
>> can't read "nsres": no such variable
>> can't read "nsres": no such variable
>>     while executing
>> "expr round(abs($n-$s)/$nsres)"
>>     (procedure "MapCanvas::currentzoom" line 27)
>>     invoked from within
>> "MapCanvas::currentzoom $mon"
>>     (procedure "MapCanvas::runprograms" line 24)
>>     invoked from within
>> "MapCanvas::runprograms $mon [expr {$mymodified != 0}]"
>>     (procedure "MapCanvas::drawmap" line 38)
>>     invoked from within
>> "MapCanvas::drawmap $mon"
>>     (procedure "MapCanvas::display_server" line 9)
>>     invoked from within
>> "MapCanvas::display_server"
>>     ("after" script)
> 
> I can confirm this. Changing nsres and ewres (in the next line) to 
> explore_nsres and explore_ewres apparently solves the problem for me, 
> but I'm not sure whether this is the correct way to do it. Michael ?

Sorry, forgot to include the patch:

Index: mapcanvas.tcl
===================================================================
RCS file: /grassrepository/grass6/gui/tcltk/gis.m/mapcanvas.tcl,v
retrieving revision 1.49
diff -u -r1.49 mapcanvas.tcl
--- mapcanvas.tcl       4 Nov 2006 00:01:43 -0000       1.49
+++ mapcanvas.tcl       7 Nov 2006 15:04:15 -0000
@@ -969,8 +969,8 @@
                 # Calculate the resolutions proportional to the map size
                 set explore_nsres [expr {1.0 * ($n - $s) / 
$canvas_h($mon)}]
                 set explore_ewres [expr {1.0 * ($e - $w) / 
$canvas_w($mon)}]
-               set explore_rows [expr round(abs($n-$s)/$nsres)]
-               set explore_cols [expr round(abs($e-$w)/$ewres)]
+               set explore_rows [expr round(abs($n-$s)/$explore_nsres)]
+               set explore_cols [expr round(abs($e-$w)/$explore_ewres)]
                 lappend expanded_region $explore_nsres $explore_ewres 
$explore_rows $explore_cols
                 set region $expanded_region
         }

Moritz




More information about the grass-dev mailing list