1 | # -*- mode: tcl; indent-tabs-mode: nil -*- |
---|
2 | # ---------------------------------------------------------------------- |
---|
3 | # COMPONENT: geomapdataproviderogr - |
---|
4 | # holds data source information for a geomap |
---|
5 | # vector ogr layer |
---|
6 | # |
---|
7 | # ====================================================================== |
---|
8 | # AUTHOR: Derrick Kearney, Purdue University |
---|
9 | # Copyright (c) 2004-2015 HUBzero Foundation, LLC |
---|
10 | # |
---|
11 | # See the file "license.terms" for information on usage and |
---|
12 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
13 | # ====================================================================== |
---|
14 | package require Itcl |
---|
15 | package require BLT |
---|
16 | |
---|
17 | namespace eval Rappture { |
---|
18 | # forward declaration |
---|
19 | } |
---|
20 | |
---|
21 | |
---|
22 | itcl::class Rappture::GeoMapDataProviderOGR { |
---|
23 | inherit Rappture::GeoMapDataProvider |
---|
24 | |
---|
25 | constructor {type url args} { |
---|
26 | Rappture::GeoMapDataProvider::constructor $type "ogr" $url |
---|
27 | } { |
---|
28 | # defined below |
---|
29 | } |
---|
30 | destructor { |
---|
31 | # defined below |
---|
32 | } |
---|
33 | |
---|
34 | protected method Type { args } |
---|
35 | |
---|
36 | public method exportToBltTree { tree } |
---|
37 | } |
---|
38 | |
---|
39 | # ---------------------------------------------------------------------- |
---|
40 | # CONSTRUCTOR |
---|
41 | # ---------------------------------------------------------------------- |
---|
42 | itcl::body Rappture::GeoMapDataProviderOGR::constructor {type url args} { |
---|
43 | |
---|
44 | Type $type |
---|
45 | eval configure $args |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | # ---------------------------------------------------------------------- |
---|
50 | # DESTRUCTOR |
---|
51 | # ---------------------------------------------------------------------- |
---|
52 | itcl::body Rappture::GeoMapDataProviderOGR::destructor {} { |
---|
53 | |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | # ---------------------------------------------------------------------- |
---|
58 | # Type: get/set type of layer |
---|
59 | # ---------------------------------------------------------------------- |
---|
60 | itcl::body Rappture::GeoMapDataProviderOGR::Type {args} { |
---|
61 | |
---|
62 | set valids {icon line point polygon text} |
---|
63 | |
---|
64 | |
---|
65 | if {[llength $args] > 1} { |
---|
66 | error "wrong # of arguments: should be ?type?" |
---|
67 | } |
---|
68 | |
---|
69 | set value [Rappture::GeoMapDataProvider::Type] |
---|
70 | |
---|
71 | if {[llength $args] == 1} { |
---|
72 | |
---|
73 | set value [lindex $args 0] |
---|
74 | |
---|
75 | if {[string compare "" $value] == 0} { |
---|
76 | error "bad value \"$value\": should be a non-empty string" |
---|
77 | } |
---|
78 | |
---|
79 | if {[lsearch $valids $value] < 0} { |
---|
80 | error "bad value \"$value\": should be one of \"$valids\"" |
---|
81 | } |
---|
82 | |
---|
83 | Rappture::GeoMapDataProvider::Type $value |
---|
84 | } |
---|
85 | |
---|
86 | return $value |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | # ---------------------------------------------------------------------- |
---|
91 | # ExportToBltTree: export object to a blt::tree |
---|
92 | # |
---|
93 | # ExportToBltTree $tree |
---|
94 | # |
---|
95 | # ---------------------------------------------------------------------- |
---|
96 | itcl::body Rappture::GeoMapDataProviderOGR::exportToBltTree {tree} { |
---|
97 | |
---|
98 | Rappture::GeoMapDataProvider::exportToBltTree $tree |
---|
99 | |
---|
100 | $tree set root \ |
---|
101 | ogr.url [url] |
---|
102 | } |
---|
103 | |
---|