Last change
on this file since 6285 was
6285,
checked in by ldelgass, 9 years ago
|
Fix examples for running with tclsh
|
File size:
1.2 KB
|
Line | |
---|
1 | package require Tk |
---|
2 | package require Rappture |
---|
3 | package require RapptureGUI |
---|
4 | |
---|
5 | Rappture::resources::load |
---|
6 | |
---|
7 | set commondir [file join [file dirname [info script]] .. common] |
---|
8 | source [file join $commondir geovis_settings.tcl] |
---|
9 | |
---|
10 | set width 400 |
---|
11 | set height 300 |
---|
12 | wm geometry . ${width}x${height} |
---|
13 | update |
---|
14 | |
---|
15 | set mapviewer [Rappture::MapViewer .g] |
---|
16 | |
---|
17 | pack .g -expand yes -fill both |
---|
18 | |
---|
19 | # create an feature line layer from a shape file using the OGR driver |
---|
20 | # we add the local:// prefix to tell the map viewer widget that |
---|
21 | # the file exists locally and needs to be transferred to the |
---|
22 | # geovis server. Because this is a shape file that could require |
---|
23 | # many other external files, all files that start with "afr_countries" |
---|
24 | # will also be transferred to the geovis server. |
---|
25 | set path "local://afr_countries.shp" |
---|
26 | array set ogrParams [subst { |
---|
27 | url {$path} |
---|
28 | }] |
---|
29 | array set layerParams { |
---|
30 | label "African Countries Shape File (Line)" |
---|
31 | description "Shape file with line data for African country borders" |
---|
32 | } |
---|
33 | |
---|
34 | # create a map object |
---|
35 | set map [Rappture::Map #auto] |
---|
36 | |
---|
37 | # add all layers to the map object |
---|
38 | $map addLayer line \ |
---|
39 | countries [array get layerParams] \ |
---|
40 | ogr [array get ogrParams] |
---|
41 | |
---|
42 | # add a map to the vis client |
---|
43 | $mapviewer scale $map |
---|
44 | $mapviewer add $map |
---|
Note: See
TracBrowser
for help on using the repository browser.