Changeset 5008 for trunk


Ignore:
Timestamp:
Feb 12, 2015, 3:08:08 AM (10 years ago)
Author:
ldelgass
Message:

whitespace

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r4995 r5008  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22
    33# ----------------------------------------------------------------------
     
    1919package require BLT
    2020
    21 namespace eval Rappture { 
    22     # forward declaration 
     21namespace eval Rappture {
     22    # forward declaration
    2323}
    2424
     
    4747    protected method Parse { xmlobj path }
    4848
    49     constructor {xmlobj path} { 
    50         # defined below 
    51     }
    52     destructor { 
    53         # defined below 
     49    constructor {xmlobj path} {
     50        # defined below
     51    }
     52    destructor {
     53        # defined below
    5454    }
    5555
     
    123123        set name "layer[incr _nextLayer]"
    124124        set child [$_tree insert $parent -label $name]
    125         set layerType [$layers get $layer.type] 
     125        set layerType [$layers get $layer.type]
    126126        if { ![info exists _layerTypes($layerType)] } {
    127127            error "invalid layer type \"$layerType\": should be one of [array names _layerTypes]"
     
    130130        $_tree set $child "type" $layerType
    131131        foreach key { label description } {
    132             $_tree set $child $key [$layers get $layer.$key] 
     132            $_tree set $child $key [$layers get $layer.$key]
    133133        }
    134134        # Common settings (for all layer types) with defaults
     
    156156                $_tree set $child "gdal.$key" $value
    157157            }
    158             set file [$layers get $layer.gdal.file] 
     158            set file [$layers get $layer.gdal.file]
    159159            if { $file != "" } {
    160160                # FIXME: Add test for valid file path
     
    169169                $_tree set $child "ogr.$key" $value
    170170            }
    171             set file [$layers get $layer.ogr.file] 
     171            set file [$layers get $layer.ogr.file]
    172172            if { $file != "" } {
    173173                # FIXME: Add test for valid file path
     
    251251    if { $mapType == "" } {
    252252        set mapType "projected";           # Default type is "projected".
    253     } 
     253    }
    254254    if { ![info exists _mapTypes($mapType)] } {
    255255        error "unknown map type \"$mapType\": should be one of [array names _mapTypes]"
     
    280280    set list {}
    281281    foreach node [$_tree children root->"layers"] {
    282         lappend list [$_tree label $node] 
     282        lappend list [$_tree label $node]
    283283    }
    284284    return $list
     
    293293    set list {}
    294294    foreach node [$_tree children root->"viewpoints"] {
    295         lappend list [$_tree label $node] 
     295        lappend list [$_tree label $node]
    296296    }
    297297    return $list
     
    340340# USAGE: isGeocentric
    341341#
    342 # Returns if the map is geocentric (1) or projected (0) 
    343 # ---------------------------------------------------------------------- 
    344 itcl::body Rappture::Map::isGeocentric {} { 
     342# Returns if the map is geocentric (1) or projected (0)
     343# ----------------------------------------------------------------------
     344itcl::body Rappture::Map::isGeocentric {} {
    345345    return [expr {[hints "type"] eq "geocentric"}]
    346 } 
    347 
    348 itcl::body Rappture::Map::earthfile {} { 
     346}
     347
     348itcl::body Rappture::Map::earthfile {} {
    349349    array set info [$_tree get root]
    350350    append out "<map"
     
    408408    }
    409409    append out "</map>\n"
    410 } 
     410}
  • trunk/gui/scripts/mapviewer.tcl

    r4996 r5008  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: mapviewer - Map object viewer
     
    3939    itk_option define -plotbackground plotBackground Background ""
    4040
    41     private variable _layersFrame "";   # Name of layers frame widget
     41    private variable _layersFrame "";   # Name of layers frame widget
    4242    private variable _mapsettings;      # Global map settings
    4343
     
    6060    public method get {args}
    6161    public method isconnected {}
    62     public method parameters {title args} { 
    63         # do nothing 
     62    public method parameters {title args} {
     63        # do nothing
    6464    }
    6565    public method scale {args}
     
    7777    private method AdjustSetting {what {value ""}}
    7878    private method BuildCameraTab {}
    79     private method BuildDownloadPopup { widget command } 
     79    private method BuildDownloadPopup { widget command }
    8080    private method BuildLayerTab {}
    8181    private method BuildMapTab {}
     
    9090    private method EventuallyHandleMotionEvent { x y }
    9191    private method EventuallyPan { dx dy }
    92     private method EventuallyResize { w h } 
    93     private method EventuallyRotate { dx dy } 
    94     private method GetImage { args } 
     92    private method EventuallyResize { w h }
     93    private method EventuallyRotate { dx dy }
     94    private method GetImage { args }
    9595    private method GetNormalizedMouse { x y }
    9696    private method InitSettings { args  }
     
    111111    private method Zoom {option {x 0} {y 0}}
    112112
    113     private variable _dlist "";         # list of data objects
     113    private variable _dlist "";         # list of data objects
    114114    private variable _obj2datasets
    115     private variable _obj2ovride;       # maps dataobj => style override
    116     private variable _layers;           # Contains the names of all the
    117                                         # layer in the server.
     115    private variable _obj2ovride;       # maps dataobj => style override
     116    private variable _layers;           # Contains the names of all the
     117                                        # layer in the server.
    118118    private variable _viewpoints;
    119119    private variable _click;            # info used for rotate operations
     
    159159
    160160    if { [catch {
    161        
     161
    162162    # Rebuild event
    163163    $_dispatcher register !rebuild
     
    267267
    268268    set _map(id) [$c create image 0 0 -anchor nw -image $_image(plot)]
    269     set _map(cwidth) -1 
    270     set _map(cheight) -1 
     269    set _map(cwidth) -1
     270    set _map(cheight) -1
    271271    set _map(zoom) 1.0
    272272    set _map(original) ""
     
    323323    set _image(legend) [image create photo]
    324324    itk_component add legend {
    325         canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0 
     325        canvas $itk_component(plotarea).legend -width 50 -highlightthickness 0
    326326    } {
    327327        usual
     
    330330    }
    331331
    332     # Hack around the Tk panewindow.  The problem is that the requested 
     332    # Hack around the Tk panewindow.  The problem is that the requested
    333333    # size of the 3d view isn't set until an image is retrieved from
    334334    # the server.  So the panewindow uses the tiny size.
     
    336336    pack forget $itk_component(view)
    337337    blt::table $itk_component(plotarea) \
    338         0,0 $itk_component(view) -fill both -reqwidth $w 
     338        0,0 $itk_component(view) -fill both -reqwidth $w
    339339    blt::table configure $itk_component(plotarea) c1 -resize none
    340340
     
    484484    Connect
    485485} errs] != 0 } {
    486         puts stderr errs=$errs
     486        puts stderr errs=$errs
    487487    }
    488488}
     
    665665                    continue
    666666                }
    667                 if {[info exists _obj2ovride($dataobj-raise)] && 
     667                if {[info exists _obj2ovride($dataobj-raise)] &&
    668668                    $_obj2ovride($dataobj-raise)} {
    669669                    set dlist [linsert $dlist 0 $dataobj]
     
    693693            }
    694694            return $dlist
    695         }           
     695        }
    696696        -image {
    697697            if {[llength $args] != 2} {
     
    741741            continue
    742742        }
    743         array unset hints 
     743        array unset hints
    744744        array set hints [$dataobj hints]
    745745        if { ![info exists _mapsettings(label)] } {
     
    786786                set _haveTerrain 1
    787787                break
    788             } 
     788            }
    789789        }
    790790        foreach viewpoint [$dataobj viewpoints] {
     
    941941    # disconnected -- no more data sitting on server
    942942    array unset _layers
    943     array unset _layersFrame 
     943    array unset _layersFrame
    944944    global readyForNextFrame
    945945    set readyForNextFrame 1
     
    10851085                    $itk_component(time) configure -state disabled
    10861086                    set proj $_mapsettings(projection)
    1087                     if { $proj == "" } { 
     1087                    if { $proj == "" } {
    10881088                        SendCmd "map reset projected global-mercator"
    10891089                    } elseif { ![info exists _mapsettings(extents)] || $_mapsettings(extents) == "" } {
     
    10941094                            set $key $_mapsettings($key)
    10951095                        }
    1096                         SendCmd [list map reset "projected" $proj $x1 $y1 $x2 $y2] 
     1096                        SendCmd [list map reset "projected" $proj $x1 $y1 $x2 $y2]
    10971097                    }
    10981098                }
     
    11021102
    11031103            # Most terrain settings are global to the map and apply even
    1104             # if there is no elevation layer.  The exception is the 
     1104            # if there is no elevation layer.  The exception is the
    11051105            # vertical scale, which only applies if there is an elevation
    11061106            # layer
     
    11241124        set _obj2datasets($dataobj) ""
    11251125        foreach layer [$dataobj layers] {
    1126             array unset info
    1127             array set info [$dataobj layer $layer]
     1126            array unset info
     1127            array set info [$dataobj layer $layer]
    11281128            if { ![info exists _layers($layer)] } {
    11291129                if { $_reportClientInfo }  {
     
    12031203itcl::body Rappture::MapViewer::CurrentLayers {args} {
    12041204    set flag [lindex $args 0]
    1205     switch -- $flag { 
     1205    switch -- $flag {
    12061206        "-all" {
    12071207            if { [llength $args] > 1 } {
     
    12221222                set dlist [get -visible]
    12231223            }
    1224         }           
     1224        }
    12251225        default {
    12261226            set dlist $args
     
    16111611        -variable [itcl::scope _settings(coords-visible)] \
    16121612        -command [itcl::code $this AdjustSetting coords-visible] \
    1613         -font "Arial 9" -anchor w 
     1613        -font "Arial 9" -anchor w
    16141614
    16151615    itk_component add grid {
     
    16181618        -variable [itcl::scope _settings(grid)] \
    16191619        -command [itcl::code $this AdjustSetting grid] \
    1620         -font "Arial 9" -anchor w 
     1620        -font "Arial 9" -anchor w
    16211621    } {
    1622         ignore -font
     1622        ignore -font
    16231623    }
    16241624
     
    16271627        -variable [itcl::scope _settings(terrain-wireframe)] \
    16281628        -command [itcl::code $this AdjustSetting terrain-wireframe] \
    1629         -font "Arial 9" -anchor w 
     1629        -font "Arial 9" -anchor w
    16301630
    16311631    checkbutton $inner.lighting \
     
    17041704        0,1 $inner.vscale    -fill x   -pady 2
    17051705#        1,0 $inner.palette_l -anchor w -pady 2 \
    1706 #        1,1 $inner.palette   -fill x   -pady 2 
     1706#        1,1 $inner.palette   -fill x   -pady 2
    17071707
    17081708    blt::table configure $inner r* c* -resize none
     
    17211721    set f [frame $inner.layers]
    17221722    blt::table $inner \
    1723         0,0 $f -fill both 
     1723        0,0 $f -fill both
    17241724    set _layersFrame $inner
    17251725}
     
    18021802
    18031803#
    1804 #  camera -- 
     1804#  camera --
    18051805#
    18061806# USAGE: camera get
     
    18111811#
    18121812itcl::body Rappture::MapViewer::camera {option args} {
    1813     switch -- $option { 
     1813    switch -- $option {
    18141814        "get" {
    18151815            # We got the camera settings from the server
     
    18741874
    18751875itcl::body Rappture::MapViewer::GetImage { args } {
    1876     if { [image width $_image(download)] > 0 && 
     1876    if { [image width $_image(download)] > 0 &&
    18771877         [image height $_image(download)] > 0 } {
    18781878        set bytes [$_image(download) data -format "jpeg -quality 100"]
     
    18871887        -title "[Rappture::filexfer::label downloadWord] as..."
    18881888    set inner [$popup component inner]
    1889     label $inner.summary -text "" -anchor w 
     1889    label $inner.summary -text "" -anchor w
    18901890
    18911891    radiobutton $inner.image_button -text "Image File" \
    18921892        -variable [itcl::scope _downloadPopup(format)] \
    1893         -value image 
     1893        -value image
    18941894    Rappture::Tooltip::for $inner.image_button \
    18951895        "Save as digital image."
     
    19111911        2,0 $inner.image_button -anchor w -cspan 2 -padx { 4 0 } \
    19121912        4,1 $inner.cancel -width .9i -fill y \
    1913         4,0 $inner.ok -padx 2 -width .9i -fill y 
     1913        4,0 $inner.ok -padx 2 -width .9i -fill y
    19141914    blt::table configure $inner r3 -height 4
    19151915    blt::table configure $inner r4 -pady 4
     
    19901990                                     $layer]
    19911991                    }
    1992                 }                       
     1992                }
    19931993            }
    19941994            SendCmd "map layer opacity $settings(-opacity) $layer"
     
    20992099}
    21002100
    2101 itcl::body Rappture::MapViewer::UpdateLayerControls {} { 
     2101itcl::body Rappture::MapViewer::UpdateLayerControls {} {
    21022102    set row 0
    21032103    set inner $_layersFrame
     
    21102110    foreach dataobj [get -objects] {
    21112111        foreach layer [$dataobj layers] {
    2112             array unset info
    2113             array set info [$dataobj layer $layer]
     2112            array unset info
     2113            array set info [$dataobj layer $layer]
    21142114            checkbutton $f.${layer}-visible \
    21152115                -text $info(label) \
     
    21322132                incr row
    21332133            }
    2134         }
     2134        }
    21352135    }
    21362136    if { $row > 0 } {
     
    21432143# Generate an OSG Earth file to send to server.  This is inteneded
    21442144# as a stopgap and testing tool until the protocol is fleshed out.
    2145 # 
     2145#
    21462146# Note that the lighting settings are required to be "hard-coded"
    21472147# as below for the runtime control to work.  Don't make those user
     
    21512151# the parser in OSG Earth accepts all of Tcl's forms of boolean vals.
    21522152#
    2153 itcl::body Rappture::MapViewer::EarthFile {} { 
     2153itcl::body Rappture::MapViewer::EarthFile {} {
    21542154    append out "<map"
    21552155    append out " name=\"$_mapsettings(label)\""
     
    22212221    append out "</map>\n"
    22222222    return $out
    2223 } 
     2223}
Note: See TracChangeset for help on using the changeset viewer.