Changeset 36386


Ignore:
Timestamp:
Mar 15, 2009, 12:44:11 PM (15 years ago)
Author:
marisn
Message:

Prevent gis.m from complete failure in Lat/Lon locations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl

    r35025 r36386  
    113113        variable zoom_attrs
    114114        set zoom_attrs {n s e w nsres ewres rows cols}
     115        variable ll_proj ;# 1 if it's Lat/Lon projection, 0 othervise
    115116
    116117        # string with region information to show in status bar
     
    418419
    419420proc MapCanvas::get_mapunits {} {
     421        variable ll_proj
    420422        # get map units from PROJ_UNITS
    421423        if {![catch {open "|g.proj -p" r} input]} {
     
    444446        }
    445447       
     448        set ll_proj 0
     449        if { [string eq "Lat/Lon" "$prj(name)"] } {
     450                set ll_proj 1
     451        }
     452       
    446453        return $mapunits
    447454}
     
    10301037        variable canvas_w
    10311038        variable canvas_h
     1039        variable ll_proj
    10321040
    10331041        set mapunits [MapCanvas::get_mapunits]
     
    10451053                # Set the region extents to the smallest region no smaller than the canvas
    10461054                set canvas_ar [expr {1.0 * $canvas_w($mon) / $canvas_h($mon)}]
    1047                 set expanded_region [MapCanvas::shrinkwrap 1 [lrange $region 0 3] $canvas_ar]
    1048                 foreach {n s e w} $expanded_region {break}
     1055                foreach {n s e w} [MapCanvas::shrinkwrap 1 [lrange $region 0 3] $canvas_ar] {break}
     1056                # In Lat/Lon N and S can not be larger than 90!
     1057                if { $ll_proj } {
     1058                        if { $n >  90 } { set n  90 }
     1059                        if { $s < -90 } { set s -90 }
     1060                }
     1061                set expanded_region "$n $s $e $w"
    10491062                # Calculate the resolutions proportional to the map size
    10501063                set explore_nsres [expr {1.0 * ($n - $s) / $canvas_h($mon)}]
Note: See TracChangeset for help on using the changeset viewer.