- Timestamp:
- Feb 16, 2015, 2:25:28 AM (10 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/map.tcl
r5008 r5027 86 86 } 87 87 88 #89 # hints --90 #91 88 itcl::body Rappture::Map::hints { args } { 92 89 switch -- [llength $args] { … … 107 104 # Parse -- 108 105 # 109 # 106 # Parses the map description in the XML object. 110 107 # 111 108 itcl::body Rappture::Map::Parse { xmlobj path } { … … 129 126 $_tree set $child "name" $layer 130 127 $_tree set $child "type" $layerType 131 foreach key { label description } {128 foreach key { label description attribution } { 132 129 $_tree set $child $key [$layers get $layer.$key] 133 130 } … … 218 215 } 219 216 $_tree set root "label" [$map get "about.label"] 217 $_tree set root "attribution" [$map get "about.attribution"] 220 218 $_tree set root "style" [$map get "style"] 221 219 $_tree set root "camera" [$map get "camera"] -
trunk/gui/scripts/mapviewer.tcl
r5023 r5027 39 39 itk_option define -plotbackground plotBackground Background "" 40 40 41 private variable _layersFrame ""; # Name of layers frame widget 42 private variable _mapsettings; # Global map settings 41 private variable _layersFrame ""; # Name of layers frame widget 42 private variable _viewpointsFrame ""; # Name of viewpoints frame widget 43 private variable _mapsettings; # Global map settings 43 44 44 45 constructor { hostlist args } { … … 81 82 private method BuildMapTab {} 82 83 private method BuildTerrainTab {} 84 private method BuildViewpointsTab {} 83 85 private method Connect {} 84 86 private method CurrentLayers {args} … … 94 96 private method GetImage { args } 95 97 private method GetNormalizedMouse { x y } 98 private method GoToViewpoint { dataobj viewpoint } 96 99 private method InitSettings { args } 97 100 private method MapIsGeocentric {} … … 114 117 private method ToggleWireframe {} 115 118 private method UpdateLayerControls {} 119 private method UpdateViewpointControls {} 116 120 private method Zoom {option {x 0} {y 0}} 117 121 … … 312 316 313 317 BuildLayerTab 318 BuildViewpointsTab 314 319 BuildMapTab 315 320 BuildTerrainTab … … 392 397 bind $itk_component(view) <Double-1> \ 393 398 [itcl::code $this camera go %x %y 0.4] 399 bind $itk_component(view) <Shift-Double-1> \ 400 [itcl::code $this camera go %x %y 1.0] 394 401 395 402 # Pin placemark annotations … … 641 648 # USAGE: delete ?<dataobj1> <dataobj2> ...? 642 649 # 643 # Clients use this to delete a dataobj from the plot. If no dataobjs 644 # are specified, then all dataobjs are deleted. No data objects are 645 # deleted. They are only removed from the display list. 646 # 650 # Clients use this to delete a dataobj from the plot. If no dataobjs 651 # are specified, then all dataobjs are deleted. No data objects are 652 # deleted. They are only removed from the display list. 647 653 # ---------------------------------------------------------------------- 648 654 itcl::body Rappture::MapViewer::delete {args} { … … 823 829 set _viewpoints($viewpoint) [$dataobj viewpoint $viewpoint] 824 830 array set vp $_viewpoints($viewpoint) 825 foreach key { x y z distance heading pitch srs verticalDatum } {831 foreach key { label description x y z distance heading pitch srs verticalDatum } { 826 832 if { [info exists vp($key)] } { 827 833 puts stderr "$viewpoint $key $vp($key)" … … 943 949 # isconnected -- 944 950 # 945 # 951 # Indicates if we are currently connected to the visualization server. 946 952 # 947 953 itcl::body Rappture::MapViewer::isconnected {} { … … 960 966 # Disconnect -- 961 967 # 962 # 963 # 968 # Clients use this method to disconnect from the current rendering 969 # server. 964 970 # 965 971 itcl::body Rappture::MapViewer::Disconnect {} { … … 1214 1220 1215 1221 UpdateLayerControls 1222 UpdateViewpointControls 1216 1223 set _reset 0 1217 1224 global readyForNextFrame … … 1322 1329 # EventuallyHandleMotionEvent -- 1323 1330 # 1324 # 1325 # 1326 # 1331 # This routine compresses (no button press) motion events. It 1332 # delivers a server mouse command once every 100 milliseconds (if a 1333 # motion event is pending). 1327 1334 # 1328 1335 itcl::body Rappture::MapViewer::EventuallyHandleMotionEvent {x y} { … … 1574 1581 # AdjustSetting -- 1575 1582 # 1576 # 1577 # 1578 # 1583 # Changes/updates a specific setting in the widget. There are 1584 # usually user-setable option. Commands are sent to the render 1585 # server. 1579 1586 # 1580 1587 itcl::body Rappture::MapViewer::AdjustSetting {what {value ""}} { … … 1673 1680 ignore -font 1674 1681 } 1682 Rappture::Tooltip::for $inner.grid "Toggle graticule (grid) display <g>" 1675 1683 1676 1684 checkbutton $inner.wireframe \ … … 1679 1687 -command [itcl::code $this AdjustSetting terrain-wireframe] \ 1680 1688 -font "Arial 9" -anchor w 1689 Rappture::Tooltip::for $inner.wireframe "Toggle wireframe rendering of terrain geometry <w>" 1681 1690 1682 1691 checkbutton $inner.lighting \ … … 1685 1694 -command [itcl::code $this AdjustSetting terrain-lighting] \ 1686 1695 -font "Arial 9" -anchor w 1696 Rappture::Tooltip::for $inner.lighting "Toggle sky lighting of terrain <l>" 1687 1697 1688 1698 checkbutton $inner.edges \ … … 1725 1735 set inner [$itk_component(main) insert end \ 1726 1736 -title "Terrain Settings" \ 1727 -icon [Rappture::icon surface]]1737 -icon [Rappture::icon terrain]] 1728 1738 $inner configure -borderwidth 4 1729 1739 … … 1762 1772 1763 1773 itcl::body Rappture::MapViewer::BuildLayerTab {} { 1764 1765 1774 set fg [option get $itk_component(hull) font Font] 1766 1775 #set bfg [option get $itk_component(hull) boldFont Font] … … 1774 1783 0,0 $f -fill both 1775 1784 set _layersFrame $inner 1785 } 1786 1787 itcl::body Rappture::MapViewer::BuildViewpointsTab {} { 1788 set fg [option get $itk_component(hull) font Font] 1789 #set bfg [option get $itk_component(hull) boldFont Font] 1790 1791 set inner [$itk_component(main) insert end \ 1792 -title "Places" \ 1793 -icon [Rappture::icon placemark16]] 1794 $inner configure -borderwidth 4 1795 set f [frame $inner.viewpoints] 1796 blt::table $inner \ 1797 0,0 $f -fill both 1798 set _viewpointsFrame $inner 1776 1799 } 1777 1800 … … 1950 1973 } 1951 1974 } 1975 } 1976 1977 itcl::body Rappture::MapViewer::GoToViewpoint { dataobj viewpoint } { 1978 if 0 { 1979 array set view { 1980 x 0 1981 y 0 1982 z 0 1983 heading 0 1984 pitch -89.999 1985 distance 0 1986 srs "" 1987 verticalDatum "" 1988 } 1989 } 1990 array set view [$dataobj viewpoint $viewpoint] 1991 foreach key {x y z heading pitch distance srs verticalDatum} { 1992 if { [info exists view($key)] } { 1993 set _view($key) $view($key) 1994 } 1995 } 1996 set duration 2.0 1997 SendCmd [list camera set $_view(x) $_view(y) $_view(z) $_view(heading) $_view(pitch) $_view(distance) $duration $_view(srs) $_view(verticalDatum)] 1952 1998 } 1953 1999 … … 2202 2248 } 2203 2249 set f $inner.layers 2250 set attrib [list] 2204 2251 foreach dataobj [get -objects] { 2205 2252 foreach layer [$dataobj layers] { 2206 2253 array unset info 2207 2254 array set info [$dataobj layer $layer] 2208 checkbutton $f.${layer} -visible \2255 checkbutton $f.${layer}_visible \ 2209 2256 -text $info(label) \ 2210 2257 -font "Arial 9" -anchor w \ … … 2212 2259 -command [itcl::code $this \ 2213 2260 SetLayerVisibility $dataobj $layer] 2214 blt::table $f $row,0 $f.${layer}-visible -anchor w -pady 2 -cspan 2 2215 Rappture::Tooltip::for $f.${layer}-visible $info(description) 2261 blt::table $f $row,0 $f.${layer}_visible -anchor w -pady 2 -cspan 2 2216 2262 incr row 2217 2263 if { $info(type) != "elevation" } { 2218 label $f.${layer} -opacity_l -text "Opacity" -font "Arial 9"2219 ::scale $f.${layer} -opacity -from 0 -to 100 \2264 label $f.${layer}_opacity_l -text "Opacity" -font "Arial 9" 2265 ::scale $f.${layer}_opacity -from 0 -to 100 \ 2220 2266 -orient horizontal -showvalue off \ 2221 2267 -variable [itcl::scope _opacity($layer)] \ 2222 2268 -command [itcl::code $this \ 2223 2269 SetLayerOpacity $dataobj $layer] 2224 blt::table $f $row,0 $f.${layer}-opacity_l -anchor w -pady 2 2225 blt::table $f $row,1 $f.${layer}-opacity -anchor w -pady 2 2270 Rappture::Tooltip::for $f.${layer}_opacity "Set opacity of $info(label) layer" 2271 blt::table $f $row,0 $f.${layer}_opacity_l -anchor w -pady 2 2272 blt::table $f $row,1 $f.${layer}_opacity -anchor w -pady 2 2226 2273 incr row 2227 2274 } 2275 set tooltip [list $info(description)] 2276 if { [info exists info(attribution)] && 2277 $info(attribution) != ""} { 2278 lappend tooltip $info(attribution) 2279 } 2280 Rappture::Tooltip::for $f.${layer}_visible [join $tooltip \n] 2281 } 2282 set mapAttrib [$dataobj hints "attribution"] 2283 if { $mapAttrib != "" } { 2284 lappend attrib $mapAttrib 2285 } 2286 } 2287 SendCmd "[list map attrib [join $attrib ,]]" 2288 label $f.map_attrib -text [join $attrib \n] -font "Arial 9" 2289 blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 2 2290 #incr row 2291 if { $row > 0 } { 2292 blt::table configure $f r* c* -resize none 2293 blt::table configure $f r$row c1 -resize expand 2294 } 2295 } 2296 2297 itcl::body Rappture::MapViewer::UpdateViewpointControls {} { 2298 set row 0 2299 set inner $_viewpointsFrame 2300 if { [winfo exists $inner.viewpoints] } { 2301 foreach w [winfo children $inner.viewpoints] { 2302 destroy $w 2303 } 2304 } 2305 set f $inner.viewpoints 2306 foreach dataobj [get -objects] { 2307 foreach viewpoint [$dataobj viewpoints] { 2308 array unset info 2309 array set info [$dataobj viewpoint $viewpoint] 2310 button $f.${viewpoint}_go \ 2311 -relief flat -compound left \ 2312 -image [Rappture::icon placemark16] \ 2313 -text $info(label) \ 2314 -font "Arial 9" -anchor w \ 2315 -command [itcl::code $this \ 2316 GoToViewpoint $dataobj $viewpoint] 2317 label $f.${viewpoint}_label \ 2318 -text $info(label) \ 2319 -font "Arial 9" -anchor w 2320 blt::table $f $row,0 $f.${viewpoint}_go -anchor w -pady 2 -cspan 2 2321 #blt::table $f $row,1 $f.${viewpoint}_label -anchor w -pady 2 2322 Rappture::Tooltip::for $f.${viewpoint}_go $info(description) 2323 incr row 2228 2324 } 2229 2325 }
Note: See TracChangeset
for help on using the changeset viewer.