Ignore:
Timestamp:
Aug 25, 2016 1:53:07 PM (8 years ago)
Author:
dkearney
Message:

merging r6420 - r6496 from trunk to blt4-trunk branch

Location:
branches/blt4_trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4_trunk

  • branches/blt4_trunk/gui/scripts/mapviewer.tcl

    r6414 r6497  
    879879                        set colormap $dataobj-$layer
    880880                        set colormap "[regsub -all {::} ${colormap} {}]"
     881                        set colormap "[regsub -all {\-} ${colormap} {_}]"
    881882                    }
    882883                    return $_image(legend-$colormap)
     
    13701371
    13711372        if { [info exists _mapsettings(type)] } {
    1372             # The map must be reset once before any layers are added This
    1373             # should not be done more than once as it is very expensive.
     1373            # The map must be reset once before any layers are added.
     1374            # This should not be done more than once as it is very expensive.
    13741375            if { [info exists _mapsettings(style)] } {
    13751376                array set settings {
     
    18541855        }
    18551856        "drag" {
    1856             if {$_b1mode == "select"} {
    1857                 EventuallySelect $x $y
    1858             }
     1857            if {$_b1mode != "select"} {
     1858                return
     1859            }
     1860            if { ![info exists _click(x)] } {
     1861                set _click(x) $x
     1862            }
     1863            if { ![info exists _click(y)] } {
     1864                set _click(y) $y
     1865            }
     1866            EventuallySelect $x $y
    18591867        }
    18601868        "release" {
    18611869            set _b1mode ""
    1862             if {$_click(x) == $x &&
    1863                 $_click(y) == $y} {
     1870            if {![info exists _click(x)] ||
     1871                ![info exists _click(y)] ||
     1872                ($_click(x) == $x &&
     1873                 $_click(y) == $y)} {
    18641874                SendCmd "map box clear"
    18651875            } else {
     
    21092119            -command [itcl::code $this AdjustSetting time]
    21102120    }
     2121    Rappture::Tooltip::for $inner.time \
     2122        "Set ephemeris time for sky lighting"
    21112123
    21122124    itk_component add ambient_l {
     
    21232135            -command [itcl::code $this AdjustSetting terrain-ambient]
    21242136    }
     2137    Rappture::Tooltip::for $inner.ambient \
     2138        "Set minimum global ambient light level"
    21252139
    21262140    blt::table $inner \
     
    21702184    }
    21712185    $inner.vscale set $_settings(terrain-vertscale)
     2186    Rappture::Tooltip::for $inner.vscale \
     2187        "Set terrain vertical scale factor"
    21722188
    21732189    blt::table $inner \
     
    24932509                    array set cam $view
    24942510                    set duration 0.0
    2495                     if {[info exists cam(xmin)] && [info exists cam(ymin)] &&
    2496                         [info exists cam(xmax)] && [info exists cam(ymax)]} {
     2511                    if {[info exists cam(layer)]} {
     2512                        set tag $cam(layer)
     2513                        if {$_first != "" &&
     2514                            ![$_first layer $cam(layer) shared]} {
     2515                            set tag $_first-$cam(layer)
     2516                        }
     2517                        SendCmd [list camera lextent $tag]
     2518                    } elseif {[info exists cam(xmin)] &&
     2519                              [info exists cam(ymin)] &&
     2520                              [info exists cam(xmax)] &&
     2521                              [info exists cam(ymax)]} {
    24972522                        set srs ""
    24982523                        if {[info exists cam(srs)]} {
     
    25002525                        }
    25012526                        SendCmd [list camera extent $cam(xmin) $cam(ymin) $cam(xmax) $cam(ymax) $duration $srs]
     2527                    } elseif {[info exists cam(latitude)] &&
     2528                              [info exists cam(longitude)]} {
     2529                        array set _view $view
     2530                        set _view(x) $cam(longitude)
     2531                        set _view(y) $cam(latitude)
     2532                        set _view(srs) wgs84
     2533                        SendCmd [list camera set $_view(x) $_view(y) $_view(z) $_view(heading) $_view(pitch) $_view(distance) $duration $_view(srs) $_view(verticalDatum)]
    25022534                    } else {
    25032535                        array set _view $view
     
    27272759                "colorramp" {
    27282760                    set cmapName "[regsub -all {::} ${tag} {}]"
     2761                    set cmapName "[regsub -all {\-} ${cmapName} {_}]"
    27292762                    SendFiles $info(colorramp.url)
    27302763                    SendCmd [list colormap define $cmapName $info(colorramp.colormap)]
     
    27672800                array set style $info(style)
    27682801            }
    2769             switch -- $info(driver)  {
     2802            set verticalDatum ""
     2803            if {[info exists info(verticalDatum)]} {
     2804                set verticalDatum $info(verticalDatum)
     2805            }
     2806            switch -- $info(driver) {
    27702807                "gdal" {
    27712808                    SendFiles $info(gdal.url)
    27722809                    SendCmd [list map layer add $tag elevation gdal \
    2773                                  $info(gdal.url) $info(cache)]
     2810                                 $info(gdal.url) $info(cache) $verticalDatum]
    27742811                }
    27752812                "tms" {
    27762813                    SendCmd [list map layer add $tag elevation tms \
    2777                                  $info(tms.url) $info(cache)]
     2814                                 $info(tms.url) $info(cache) $verticalDatum]
    27782815                }
    27792816                "wcs" {
    27802817                    SendCmd [list map layer add $tag elevation wcs \
    2781                                  $info(wcs.url) $info(cache) $info(wcs.identifier)]
     2818                                 $info(wcs.url) $info(cache) $verticalDatum $info(wcs.identifier)]
    27822819                }
    27832820            }
     
    28652902            SendCmd "map layer opacity $style(-opacity) $tag"
    28662903        }
     2904        "model" {
     2905            switch -- $info(driver) {
     2906                "osg" {
     2907                    SendFiles $info(osg.url)
     2908                    SendCmd [list map layer add $tag model simple $info(osg.url) $info(osg.x) $info(osg.y) $info(osg.z)]
     2909                }
     2910            }
     2911        }
    28672912        "line" {
    28682913            array set style {
     
    28862931            set _opacity($tag) [expr $style(-opacity) * 100]
    28872932            foreach {r g b} [Color2RGB $style(-color)] {}
    2888             switch -- $info(driver)  {
     2933            switch -- $info(driver) {
    28892934                "ogr" {
    28902935                    SendFiles $info(ogr.url)
     
    29352980            set _opacity($tag) [expr $style(-opacity) * 100]
    29362981            foreach {r g b} [Color2RGB $style(-color)] {}
    2937             switch -- $info(driver)  {
     2982            switch -- $info(driver) {
    29382983                "ogr" {
    29392984                    SendFiles $info(ogr.url)
     
    29873032            }
    29883033            set _opacity($tag) [expr $style(-opacity) * 100]
    2989             switch -- $info(driver)  {
     3034            switch -- $info(driver) {
    29903035                "ogr" {
    29913036                    SendFiles $info(ogr.url)
     
    30403085            foreach {r g b} [Color2RGB $style(-color)] {}
    30413086            foreach {strokeR strokeG strokeB} [Color2RGB $style(-strokecolor)] {}
    3042             switch -- $info(driver)  {
     3087            switch -- $info(driver) {
    30433088                "ogr" {
    30443089                    SendFiles $info(ogr.url)
     
    31053150            foreach {fgR fgG fgB} [Color2RGB $style(-color)] {}
    31063151            foreach {bgR bgG bgB} [Color2RGB $style(-halocolor)] {}
    3107             switch -- $info(driver)  {
     3152            switch -- $info(driver) {
    31083153                "ogr" {
    31093154                    SendFiles $info(ogr.url)
     
    31923237                set tag $dataobj-$layer
    31933238                set ctlname "[regsub -all {::} ${tag} {}]"
    3194             }
     3239                set ctlname "[regsub -all {\-} ${ctlname} {_}]"
     3240            }
     3241            button $f.${ctlname}_zoom \
     3242                -borderwidth 1 -padx 1 -pady 1 \
     3243                -highlightthickness 0 \
     3244                -image [Rappture::icon zoom-extent] \
     3245                -command [itcl::code $this camera zoom layer $dataobj $layer 1.0]
     3246            Rappture::Tooltip::for $f.${ctlname}_zoom \
     3247                "Zoom to extent for $info(label)"
     3248
    31953249            checkbutton $f.${ctlname}_visible \
    31963250                -text $info(label) \
     
    31993253                -command [itcl::code $this \
    32003254                              SetLayerVisibility $dataobj $layer]
    3201             blt::table $f $row,0 $f.${ctlname}_visible -anchor w -pady 2 -cspan 2
     3255            blt::table $f $row,0 $f.${ctlname}_zoom -anchor w -pady 2
     3256            blt::table $f $row,1 $f.${ctlname}_visible -anchor w -pady 2 -cspan 2
    32023257            incr row
    32033258            if { $info(type) == "image" } {
     
    32173272                        label $f.legend-$colormap -image $_image(legend-$colormap)
    32183273                    }
    3219                     blt::table $f $row,0 $f.legend-$colormap-min -anchor w -pady 0
    3220                     blt::table $f $row,1 $f.legend-$colormap-max -anchor e -pady 0
     3274                    blt::table $f $row,0 $f.legend-$colormap-min -anchor w -pady 0 -cspan 2
     3275                    blt::table $f $row,2 $f.legend-$colormap-max -anchor e -pady 0
    32213276                    incr row
    3222                     blt::table $f $row,0 $f.legend-$colormap -anchor w -pady 2 -cspan 2
     3277                    blt::table $f $row,0 $f.legend-$colormap -anchor w -pady 2 -cspan 3
    32233278                    incr row
    32243279                    RequestLegend $colormap 256 16
     
    32353290                                  SetLayerOpacity $dataobj $layer]
    32363291                Rappture::Tooltip::for $f.${ctlname}_opacity "Set opacity of $info(label) layer"
    3237                 blt::table $f $row,0 $f.${ctlname}_opacity_l -anchor w -pady 2
    3238                 blt::table $f $row,1 $f.${ctlname}_opacity -anchor w -pady 2
     3292                blt::table $f $row,0 $f.${ctlname}_opacity_l -anchor w -pady 2 -cspan 2
     3293                blt::table $f $row,2 $f.${ctlname}_opacity -anchor w -pady 2
    32393294                incr row
    32403295            }
     
    32533308    SendCmd "[list map attrib [encoding convertto utf-8 [join $attrib ,]]]"
    32543309    label $f.map_attrib -text [join $attrib \n] -font "Arial 9"
    3255     blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 2
     3310    blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 3
    32563311    #incr row
    32573312    if { $row > 0 } {
    32583313        blt::table configure $f r* c* -resize none
    3259         blt::table configure $f r$row c1 -resize expand
     3314        blt::table configure $f r$row c2 -resize expand
    32603315    }
    32613316}
Note: See TracChangeset for help on using the changeset viewer.