Ignore:
Timestamp:
Mar 28, 2014, 9:56:19 AM (10 years ago)
Author:
gah
Message:

merge changes in map.tcl mapviewer.tcl for elevation, extents, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/map.tcl

    r4281 r4288  
    2525itcl::class Rappture::Map {
    2626    private variable _tree "";         # Tree of information about the map.
    27     private variable _isGeocentric 0;
    2827    private variable _isValid 0;
    2928    private variable _nextLayer 0;     # Counter used to generate unique
     
    3130    private common _layerTypes
    3231    private common _mapTypes
    33 
     32    array set _layerTypes {
     33        "raster"        0
     34        "elevation"     1
     35        "polygon"       2
     36        "points"        3
     37        "circle"        4
     38        "line"          5
     39    }
     40    array set _mapTypes {
     41        "geocentric"    0
     42        "projected"     1
     43    }
    3444    protected method Parse { xmlobj path }
    3545
     
    4050        # defined below
    4151    }
    42     public method isGeocentric {}
    4352    public method layers {}
    4453    public method layer { name }
     
    5463        return [$_tree get $id "type" ""]
    5564    }
    56     public method style { name } {
    57         set id [$_tree findchild root->"layers" $name]
    58         if { $id < 0 } {
    59             error "unknown layer \"$name\""
    60         }
    61         return [$_tree get $id "style" ""]
    62     }
    6365}
    6466
     
    7072        error "bad value \"$xmlobj\": should be LibraryObj"
    7173    }
    72     array set _layerTypes {
    73         "raster"        0
    74         "elevation"     1
    75         "polygon"       2
    76         "points"        3
    77         "circle"        4
    78         "line"          5
    79     }
    80     array set _mapTypes {
    81         "geocentric"    0
    82         "projected"     1
    83     }
    84 
    8574    Parse $xmlobj $path
    8675}
     
    149138    $_tree set root "label"       [$map get "about.label"]
    150139    $_tree set root "extents"     [$map get "extents"]
    151     $_tree set root "projection"  [$map get "projection"]
    152140
    153     set mapType [$map get "type"]
    154     if { $mapType == "" } {
    155         set mapType "projected"
     141    set projection [$map get "projection"]
     142    if { $projection  == "" } {
     143        set projection "global-mercator"; # Default projection.
     144    }
     145    # FIXME: Verify projection is valid.
     146    $_tree set root "projection" $projection
     147
     148    set type [$map get "type"]
     149    if { $type == "" } {
     150        set type "projected";           # Default type is "projected".
    156151    }
    157 
    158     if { ![info exists _mapTypes($mapType)] } {
     152    if { ![info exists _mapTypes($type)] } {
    159153        error "unknown map type \"$mapType\": should be one of [array names _mapTypes]"
    160     } elseif {$mapType == "geocentric"} {
    161         set _isGeocentric 1
    162154    }
    163     $_tree set root "type" $mapType
     155    $_tree set root "type" $type
    164156
    165157    foreach {key path} {
     
    206198}
    207199
    208 # ----------------------------------------------------------------------
    209 # Returns if the map is geocentric (1) or projected (0)
    210 # ----------------------------------------------------------------------
    211 itcl::body Rappture::Map::isGeocentric {} {
    212     return $_isGeocentric
    213 }
Note: See TracChangeset for help on using the changeset viewer.