1 | # -*- mode: tcl; indent-tabs-mode: nil -*- |
---|
2 | # ---------------------------------------------------------------------- |
---|
3 | # COMPONENT: geomaplayerimage - holds generic image layer information |
---|
4 | # for a geomap |
---|
5 | # |
---|
6 | # ====================================================================== |
---|
7 | # AUTHOR: Derrick Kearney, Purdue University |
---|
8 | # Copyright (c) 2004-2015 HUBzero Foundation, LLC |
---|
9 | # |
---|
10 | # See the file "license.terms" for information on usage and |
---|
11 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
12 | # ====================================================================== |
---|
13 | package require Itcl |
---|
14 | |
---|
15 | namespace eval Rappture { |
---|
16 | # forward declaration |
---|
17 | } |
---|
18 | |
---|
19 | |
---|
20 | itcl::class Rappture::GeoMapLayerImage { |
---|
21 | inherit Rappture::GeoMapLayer |
---|
22 | |
---|
23 | constructor {provider args} { |
---|
24 | eval Rappture::GeoMapLayer::constructor $provider $args |
---|
25 | } { |
---|
26 | # defined below |
---|
27 | } |
---|
28 | destructor { |
---|
29 | # defined below |
---|
30 | } |
---|
31 | |
---|
32 | public variable coverage "false" |
---|
33 | |
---|
34 | public method export { args } |
---|
35 | } |
---|
36 | |
---|
37 | # ---------------------------------------------------------------------- |
---|
38 | # CONSTRUCTOR |
---|
39 | # ---------------------------------------------------------------------- |
---|
40 | itcl::body Rappture::GeoMapLayerImage::constructor {provider args} { |
---|
41 | |
---|
42 | eval configure $args |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | # ---------------------------------------------------------------------- |
---|
47 | # DESTRUCTOR |
---|
48 | # ---------------------------------------------------------------------- |
---|
49 | itcl::body Rappture::GeoMapLayerImage::destructor {} { |
---|
50 | |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | # ---------------------------------------------------------------------- |
---|
55 | # Coverage: get/set the coverage flag for this layer |
---|
56 | # |
---|
57 | # Coverage determines how the data is interpolated by the gpu |
---|
58 | # true means data should not be interpolated |
---|
59 | # false means data should be interpolated |
---|
60 | # ---------------------------------------------------------------------- |
---|
61 | itcl::configbody Rappture::GeoMapLayerImage::coverage { |
---|
62 | |
---|
63 | if {[string is bool $coverage] == 0} { |
---|
64 | error "bad value: \"$coverage\": should be a boolean" |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | # ---------------------------------------------------------------------- |
---|
70 | # export: clients use this public method to serialize the object to a |
---|
71 | # blt::tree object |
---|
72 | # |
---|
73 | # ---------------------------------------------------------------------- |
---|
74 | itcl::body Rappture::GeoMapLayerImage::export {args} { |
---|
75 | |
---|
76 | set t [eval Rappture::GeoMapLayer::export $args] |
---|
77 | |
---|
78 | set valids "-format" |
---|
79 | set format "blt_tree" |
---|
80 | |
---|
81 | while {[llength $args] > 0} { |
---|
82 | set flag [lindex $args 0] |
---|
83 | switch -- $flag { |
---|
84 | "-format" { |
---|
85 | if {[llength $args] > 1} { |
---|
86 | set format [lindex $args 1] |
---|
87 | set args [lrange $args 2 end] |
---|
88 | } else { |
---|
89 | error "wrong number args: should be ?-format <format>?" |
---|
90 | } |
---|
91 | } |
---|
92 | default { |
---|
93 | error "invalid option \"$flag\": should be one of $valids" |
---|
94 | } |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | set valids "blt_tree" |
---|
99 | |
---|
100 | switch -- $format { |
---|
101 | "blt_tree" { |
---|
102 | $t set root coverage $coverage |
---|
103 | } |
---|
104 | default { |
---|
105 | error "bad format \"$format\": should be one of $valids" |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | return $t |
---|
110 | } |
---|