Changeset 4977
- Timestamp:
- Feb 2, 2015, 2:05:20 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/mapviewer.tcl
r4975 r4977 81 81 private method BuildMapTab {} 82 82 private method BuildTerrainTab {} 83 private method ChangeLayerVisibility { dataobj layer }84 83 private method Connect {} 85 84 private method CurrentLayers {args} … … 105 104 private method Rotate {option x y} 106 105 private method Select {option x y} 106 private method SetLayerOpacity { dataobj layer {value 100}} 107 107 private method SetLayerStyle { dataobj layer } 108 private method SetLayerVisibility { dataobj layer } 108 109 private method SetTerrainStyle { style } 109 private method SetOpacity { dataset }110 110 private method UpdateLayerControls {} 111 111 private method Zoom {option {x 0} {y 0}} … … 122 122 private variable _motion; 123 123 private variable _settings 124 private variable _opacity 124 125 private variable _visibility 125 126 private variable _style; # Array of current component styles. … … 1057 1058 if { $_mapsettings(type) == "geocentric" } { 1058 1059 $itk_component(grid) configure -state normal 1060 $itk_component(time_l) configure -state normal 1061 $itk_component(time) configure -state normal 1059 1062 SendCmd "map reset geocentric" 1060 1063 } else { 1061 1064 $itk_component(grid) configure -state disabled 1065 $itk_component(time_l) configure -state disabled 1066 $itk_component(time) configure -state disabled 1062 1067 set proj $_mapsettings(projection) 1063 1068 if { $proj == "" } { … … 1096 1101 set count 0 1097 1102 1103 set haveTerrain 0 1098 1104 foreach dataobj [get -objects] { 1099 1105 set _obj2datasets($dataobj) "" … … 1116 1122 SetLayerStyle $dataobj $layer 1117 1123 } 1124 if {$info(type) == "elevation"} { 1125 set haveTerrain 1 1126 } 1118 1127 lappend _obj2datasets($dataobj) $layer 1119 1128 # FIXME: This is overriding all layers' initial visibility setting … … 1121 1130 SendCmd "map layer visible 1 $layer" 1122 1131 set _visibility($layer) 1 1123 #SetLayerOpacity $layer 1124 } 1125 } 1132 #SetLayerOpacity $dataobj $layer 1133 } 1134 } 1135 } 1136 1137 if ($haveTerrain) { 1138 $itk_component(vscale_l) configure -state normal 1139 $itk_component(vscale) configure -state normal 1140 } else { 1141 $itk_component(vscale_l) configure -state disabled 1142 $itk_component(vscale) configure -state disabled 1126 1143 } 1127 1144 … … 1641 1658 $inner configure -borderwidth 4 1642 1659 1643 label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 1660 label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 1644 1661 itk_component add terrainpalette { 1645 1662 Rappture::Combobox $inner.palette -width 10 -editable no … … 1651 1668 [itcl::code $this AdjustSetting terrain-palette] 1652 1669 1653 label $inner.vscale_l -text "Vertical Scale" -font "Arial 9" -anchor w 1654 ::scale $inner.vscale -from 0 -to 10 -orient horizontal \ 1655 -variable [itcl::scope _settings(terrain-vertscale)] \ 1656 -width 10 \ 1657 -resolution 0.1 \ 1658 -showvalue on \ 1659 -command [itcl::code $this AdjustSetting terrain-vertscale] 1670 itk_component add vscale_l { 1671 label $inner.vscale_l -text "Vertical Scale" -font "Arial 9" -anchor w 1672 } 1673 itk_component add vscale { 1674 ::scale $inner.vscale -from 0 -to 10 -orient horizontal \ 1675 -variable [itcl::scope _settings(terrain-vertscale)] \ 1676 -width 10 \ 1677 -resolution 0.1 \ 1678 -showvalue on \ 1679 -command [itcl::code $this AdjustSetting terrain-vertscale] 1680 } 1660 1681 $inner.vscale set $_settings(terrain-vertscale) 1661 1682 1662 1683 blt::table $inner \ 1663 1684 0,0 $inner.vscale_l -anchor w -pady 2 \ 1664 0,1 $inner.vscale -fill x -pady 2 \1665 1,0 $inner.palette_l -anchor w -pady 2 \1666 1,1 $inner.palette -fill x -pady 21685 0,1 $inner.vscale -fill x -pady 2 1686 # 1,0 $inner.palette_l -anchor w -pady 2 \ 1687 # 1,1 $inner.palette -fill x -pady 2 1667 1688 1668 1689 blt::table configure $inner r* c* -resize none … … 1921 1942 if { [info exists info(opacity)] } { 1922 1943 set settings(-opacity) $info(opacity) 1923 } 1944 set _opacity($layer) $info(opacity) 1945 } 1946 set _opacity($layer) [expr $settings(-opacity) * 100] 1924 1947 if {!$_sendEarthFile} { 1925 1948 switch -- $info(driver) { … … 1986 2009 set settings(-opacity) $info(opacity) 1987 2010 } 2011 set _opacity($layer) [expr $settings(-opacity) * 100] 1988 2012 SendCmd [list map layer add line $info(ogr.url) $layer] 1989 2013 SendCmd "map layer opacity $settings(-opacity) $layer" … … 2001 2025 set settings(-opacity) $info(opacity) 2002 2026 } 2027 set _opacity($layer) [expr $settings(-opacity) * 100] 2003 2028 SendCmd [list map layer add polygon $info(ogr.url) $layer] 2004 2029 SendCmd "map layer opacity $settings(-opacity) $layer" … … 2024 2049 set settings(-opacity) $info(opacity) 2025 2050 } 2051 set _opacity($layer) [expr $settings(-opacity) * 100] 2026 2052 set contentExpr $info(content) 2027 2053 if {[info exists info(priority)]} { … … 2043 2069 } 2044 2070 2045 itcl::body Rappture::MapViewer::SetOpacity { dataset } { 2046 foreach {dataobj layer} [split $dataset -] break 2047 set type [$dataobj type $layer] 2048 set val $_settings(-opacity) 2071 itcl::body Rappture::MapViewer::SetLayerOpacity { dataobj layer {value 100}} { 2072 set val $_opacity($layer) 2049 2073 set sval [expr { 0.01 * double($val) }] 2050 if { !$_obj2ovride($dataobj-raise) } { 2051 # This is wrong. Need to figure out why raise isn't set with 1 2052 #set sval [expr $sval * .6] 2053 } 2054 SendCmd "$type opacity $sval $dataset" 2055 } 2056 2057 itcl::body Rappture::MapViewer::ChangeLayerVisibility { dataobj layer } { 2074 SendCmd "map layer opacity $sval $layer" 2075 } 2076 2077 itcl::body Rappture::MapViewer::SetLayerVisibility { dataobj layer } { 2058 2078 set bool $_visibility($layer) 2059 2079 SendCmd "map layer visible $bool $layer" … … 2073 2093 array unset info 2074 2094 array set info [$dataobj layer $layer] 2075 checkbutton $f.$ layer\2095 checkbutton $f.${layer}-visible \ 2076 2096 -text $info(label) \ 2097 -font "Arial 9" -anchor w \ 2077 2098 -variable [itcl::scope _visibility($layer)] \ 2078 2099 -command [itcl::code $this \ 2079 ChangeLayerVisibility $dataobj $layer] \ 2080 -font "Arial 9" -anchor w 2081 blt::table $f $row,0 $f.$layer -anchor w -pady 2 2082 Rappture::Tooltip::for $f.$layer $info(description) 2100 SetLayerVisibility $dataobj $layer] 2101 blt::table $f $row,0 $f.${layer}-visible -anchor w -pady 2 -cspan 2 2102 Rappture::Tooltip::for $f.${layer}-visible $info(description) 2083 2103 incr row 2104 if { $info(type) != "elevation" } { 2105 label $f.${layer}-opacity_l -text "Opacity" -font "Arial 9" 2106 ::scale $f.${layer}-opacity -from 0 -to 100 \ 2107 -orient horizontal -showvalue off \ 2108 -variable [itcl::scope _opacity($layer)] \ 2109 -command [itcl::code $this \ 2110 SetLayerOpacity $dataobj $layer] 2111 blt::table $f $row,0 $f.${layer}-opacity_l -anchor w -pady 2 2112 blt::table $f $row,1 $f.${layer}-opacity -anchor w -pady 2 2113 incr row 2114 } 2084 2115 } 2085 2116 }
Note: See TracChangeset
for help on using the changeset viewer.