[GRASS-SVN] r36386 - grass/branches/develbranch_6/gui/tcltk/gis.m
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Mar 15 15:44:11 EDT 2009
Author: marisn
Date: 2009-03-15 15:44:11 -0400 (Sun, 15 Mar 2009)
New Revision: 36386
Modified:
grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl
Log:
Prevent gis.m from complete failure in Lat/Lon locations
Modified: grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl
===================================================================
--- grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl 2009-03-15 18:34:46 UTC (rev 36385)
+++ grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl 2009-03-15 19:44:11 UTC (rev 36386)
@@ -112,6 +112,7 @@
# zoom_attrs used in g.region command to set WIND file
variable zoom_attrs
set zoom_attrs {n s e w nsres ewres rows cols}
+ variable ll_proj ;# 1 if it's Lat/Lon projection, 0 othervise
# string with region information to show in status bar
variable regionstr
@@ -417,6 +418,7 @@
proc MapCanvas::get_mapunits {} {
+ variable ll_proj
# get map units from PROJ_UNITS
if {![catch {open "|g.proj -p" r} input]} {
set key ""
@@ -443,6 +445,11 @@
set mapunits $prj(units)
}
+ set ll_proj 0
+ if { [string eq "Lat/Lon" "$prj(name)"] } {
+ set ll_proj 1
+ }
+
return $mapunits
}
@@ -1029,6 +1036,7 @@
variable msg
variable canvas_w
variable canvas_h
+ variable ll_proj
set mapunits [MapCanvas::get_mapunits]
@@ -1044,8 +1052,13 @@
if {$exploremode($mon)} {
# Set the region extents to the smallest region no smaller than the canvas
set canvas_ar [expr {1.0 * $canvas_w($mon) / $canvas_h($mon)}]
- set expanded_region [MapCanvas::shrinkwrap 1 [lrange $region 0 3] $canvas_ar]
- foreach {n s e w} $expanded_region {break}
+ foreach {n s e w} [MapCanvas::shrinkwrap 1 [lrange $region 0 3] $canvas_ar] {break}
+ # In Lat/Lon N and S can not be larger than 90!
+ if { $ll_proj } {
+ if { $n > 90 } { set n 90 }
+ if { $s < -90 } { set s -90 }
+ }
+ set expanded_region "$n $s $e $w"
# 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)}]
More information about the grass-commit
mailing list