source: branches/multichoice/examples/mapviewer/camera/camera_example.tcl @ 6371

Last change on this file since 6371 was 6371, checked in by dkearney, 8 years ago

merging changes from trunk into multichoice branch

File size: 1.2 KB
Line 
1package require Tk
2package require Rappture
3package require RapptureGUI
4
5Rappture::resources::load
6
7set commondir [file join [file dirname [info script]] .. common]
8source [file join $commondir geovis_settings.tcl]
9
10set width 400
11set height 300
12wm geometry . ${width}x${height}
13update
14
15set mapviewer [Rappture::MapViewer .g]
16
17pack .g -expand yes -fill both
18
19# create a Gdal layer from a local geotiff
20# here we use the local:// prefix to specify that the
21# tif file needs to be transferred from the # client to the server.
22
23array set gdalParams {
24    url {/usr/share/geovis/world.tif}
25}
26array set layerParams {
27    label "Base Layer"
28    description "geotiff"
29    opacity 1.0
30}
31
32array set camera {
33    xmin 20
34    xmax 40
35    ymin -15
36    ymax 15
37    srs wgs84
38}
39
40# create a map object
41set map [Rappture::Map #auto]
42
43# add all layers to the map object
44$map addLayer image \
45    test [array get layerParams] \
46    gdal [array get gdalParams]
47
48$map setCamera [array get camera]
49
50# add a map to the vis client
51$mapviewer scale $map
52$mapviewer add $map
53
54after 10000 {
55    puts stderr "camera zoom extent"
56    $mapviewer camera zoom extent -64 40 -60 50 5 wgs84
57}
58after 20000 {
59    puts stderr "Reset camera"
60    $mapviewer camera reset
61}
Note: See TracBrowser for help on using the repository browser.