Changeset 6497 for branches/blt4_trunk/gui/scripts/mapviewer.tcl
- Timestamp:
- Aug 25, 2016 1:53:07 PM (8 years ago)
- Location:
- branches/blt4_trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4_trunk
- Property svn:mergeinfo changed
-
branches/blt4_trunk/gui/scripts/mapviewer.tcl
r6414 r6497 879 879 set colormap $dataobj-$layer 880 880 set colormap "[regsub -all {::} ${colormap} {}]" 881 set colormap "[regsub -all {\-} ${colormap} {_}]" 881 882 } 882 883 return $_image(legend-$colormap) … … 1370 1371 1371 1372 if { [info exists _mapsettings(type)] } { 1372 # The map must be reset once before any layers are added This1373 # 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. 1374 1375 if { [info exists _mapsettings(style)] } { 1375 1376 array set settings { … … 1854 1855 } 1855 1856 "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 1859 1867 } 1860 1868 "release" { 1861 1869 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)} { 1864 1874 SendCmd "map box clear" 1865 1875 } else { … … 2109 2119 -command [itcl::code $this AdjustSetting time] 2110 2120 } 2121 Rappture::Tooltip::for $inner.time \ 2122 "Set ephemeris time for sky lighting" 2111 2123 2112 2124 itk_component add ambient_l { … … 2123 2135 -command [itcl::code $this AdjustSetting terrain-ambient] 2124 2136 } 2137 Rappture::Tooltip::for $inner.ambient \ 2138 "Set minimum global ambient light level" 2125 2139 2126 2140 blt::table $inner \ … … 2170 2184 } 2171 2185 $inner.vscale set $_settings(terrain-vertscale) 2186 Rappture::Tooltip::for $inner.vscale \ 2187 "Set terrain vertical scale factor" 2172 2188 2173 2189 blt::table $inner \ … … 2493 2509 array set cam $view 2494 2510 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)]} { 2497 2522 set srs "" 2498 2523 if {[info exists cam(srs)]} { … … 2500 2525 } 2501 2526 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)] 2502 2534 } else { 2503 2535 array set _view $view … … 2727 2759 "colorramp" { 2728 2760 set cmapName "[regsub -all {::} ${tag} {}]" 2761 set cmapName "[regsub -all {\-} ${cmapName} {_}]" 2729 2762 SendFiles $info(colorramp.url) 2730 2763 SendCmd [list colormap define $cmapName $info(colorramp.colormap)] … … 2767 2800 array set style $info(style) 2768 2801 } 2769 switch -- $info(driver) { 2802 set verticalDatum "" 2803 if {[info exists info(verticalDatum)]} { 2804 set verticalDatum $info(verticalDatum) 2805 } 2806 switch -- $info(driver) { 2770 2807 "gdal" { 2771 2808 SendFiles $info(gdal.url) 2772 2809 SendCmd [list map layer add $tag elevation gdal \ 2773 $info(gdal.url) $info(cache) ]2810 $info(gdal.url) $info(cache) $verticalDatum] 2774 2811 } 2775 2812 "tms" { 2776 2813 SendCmd [list map layer add $tag elevation tms \ 2777 $info(tms.url) $info(cache) ]2814 $info(tms.url) $info(cache) $verticalDatum] 2778 2815 } 2779 2816 "wcs" { 2780 2817 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)] 2782 2819 } 2783 2820 } … … 2865 2902 SendCmd "map layer opacity $style(-opacity) $tag" 2866 2903 } 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 } 2867 2912 "line" { 2868 2913 array set style { … … 2886 2931 set _opacity($tag) [expr $style(-opacity) * 100] 2887 2932 foreach {r g b} [Color2RGB $style(-color)] {} 2888 switch -- $info(driver) 2933 switch -- $info(driver) { 2889 2934 "ogr" { 2890 2935 SendFiles $info(ogr.url) … … 2935 2980 set _opacity($tag) [expr $style(-opacity) * 100] 2936 2981 foreach {r g b} [Color2RGB $style(-color)] {} 2937 switch -- $info(driver) 2982 switch -- $info(driver) { 2938 2983 "ogr" { 2939 2984 SendFiles $info(ogr.url) … … 2987 3032 } 2988 3033 set _opacity($tag) [expr $style(-opacity) * 100] 2989 switch -- $info(driver) 3034 switch -- $info(driver) { 2990 3035 "ogr" { 2991 3036 SendFiles $info(ogr.url) … … 3040 3085 foreach {r g b} [Color2RGB $style(-color)] {} 3041 3086 foreach {strokeR strokeG strokeB} [Color2RGB $style(-strokecolor)] {} 3042 switch -- $info(driver) 3087 switch -- $info(driver) { 3043 3088 "ogr" { 3044 3089 SendFiles $info(ogr.url) … … 3105 3150 foreach {fgR fgG fgB} [Color2RGB $style(-color)] {} 3106 3151 foreach {bgR bgG bgB} [Color2RGB $style(-halocolor)] {} 3107 switch -- $info(driver) 3152 switch -- $info(driver) { 3108 3153 "ogr" { 3109 3154 SendFiles $info(ogr.url) … … 3192 3237 set tag $dataobj-$layer 3193 3238 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 3195 3249 checkbutton $f.${ctlname}_visible \ 3196 3250 -text $info(label) \ … … 3199 3253 -command [itcl::code $this \ 3200 3254 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 3202 3257 incr row 3203 3258 if { $info(type) == "image" } { … … 3217 3272 label $f.legend-$colormap -image $_image(legend-$colormap) 3218 3273 } 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 03274 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 3221 3276 incr row 3222 blt::table $f $row,0 $f.legend-$colormap -anchor w -pady 2 -cspan 23277 blt::table $f $row,0 $f.legend-$colormap -anchor w -pady 2 -cspan 3 3223 3278 incr row 3224 3279 RequestLegend $colormap 256 16 … … 3235 3290 SetLayerOpacity $dataobj $layer] 3236 3291 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 23292 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 3239 3294 incr row 3240 3295 } … … 3253 3308 SendCmd "[list map attrib [encoding convertto utf-8 [join $attrib ,]]]" 3254 3309 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 23310 blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 3 3256 3311 #incr row 3257 3312 if { $row > 0 } { 3258 3313 blt::table configure $f r* c* -resize none 3259 blt::table configure $f r$row c 1-resize expand3314 blt::table configure $f r$row c2 -resize expand 3260 3315 } 3261 3316 }
Note: See TracChangeset
for help on using the changeset viewer.