Changeset 5679 for branches/uq/gui/scripts/drawing.tcl
- Timestamp:
- Jun 9, 2015, 1:55:08 PM (9 years ago)
- Location:
- branches/uq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq
- Property svn:mergeinfo changed
-
branches/uq/gui/scripts/drawing.tcl
r5121 r5679 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: drawing - 3D drawing of data … … 12 12 package require BLT 13 13 14 namespace eval Rappture { 15 # forward declaration 14 namespace eval Rappture { 15 # forward declaration 16 16 } 17 17 18 18 itcl::class Rappture::Drawing { 19 private variable _drawing 20 private variable _xmlobj 21 private variable _styles 22 private variable _shapes 23 private variable _labels 24 private variable _types 25 private variable _data 26 private variable _hints 27 private variable _units 28 29 constructor {xmlobj path} { 30 # defined below 31 } 32 destructor { 33 # defined below 19 constructor {xmlobj path} { 20 # defined below 21 } 22 destructor { 23 # defined below 34 24 } 35 25 … … 40 30 public method values { elem } 41 31 public method data { elem } 42 public method hints {{keyword ""}} 43 public method components { args } 32 public method hints {{keyword ""}} 33 public method components { args } 34 35 private variable _drawing 36 private variable _xmlobj 37 private variable _styles 38 private variable _shapes 39 private variable _labels 40 private variable _types 41 private variable _data 42 private variable _hints 43 private variable _units 44 44 } 45 45 … … 48 48 # ---------------------------------------------------------------------- 49 49 itcl::body Rappture::Drawing::constructor {xmlobj path} { 50 package require vtk51 50 if {![Rappture::library isvalid $xmlobj]} { 52 51 error "bad value \"$xmlobj\": should be Rappture::library" … … 73 72 glyphs* { 74 73 set _data($elem) [$_xmlobj get $path.$elem.vtk] 75 74 set _data($elem) [string trim $_data($elem)] 76 75 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 77 76 set _labels($elem) [$_xmlobj get $path.$elem.about.label] … … 86 85 set contents [$_xmlobj get $path.$elem.vtk] 87 86 } 88 87 set _data($elem) [string trim $contents] 89 88 set _styles($elem) [$_xmlobj get $path.$elem.about.style] 90 89 set _labels($elem) [$_xmlobj get $path.$elem.about.label] … … 123 122 } 124 123 } 125 foreach {key} { axisorder } {126 set str [$_drawing get $key]127 if {"" != $str} {128 set _hints($key) $str129 }130 }131 124 foreach {key path} { 132 125 toolid tool.id … … 150 143 } 151 144 152 # 153 # label -- 154 # 145 # 146 # label -- 147 # 155 148 # Returns the label of the named drawing element. 156 149 # … … 158 151 if { [info exists _labels($elem)] } { 159 152 return $_labels($elem) 160 } 161 return "" 162 } 163 164 # 165 # type -- 166 # 153 } 154 return "" 155 } 156 157 # 158 # type -- 159 # 167 160 # Returns the type of the named drawing element. 168 161 # … … 170 163 if { [info exists _types($elem)] } { 171 164 return $_types($elem) 172 } 173 return "" 174 } 175 176 # 177 # style -- 178 # 165 } 166 return "" 167 } 168 169 # 170 # style -- 171 # 179 172 # Returns the style string of the named drawing element. 180 173 # … … 182 175 if { [info exists _styles($elem)] } { 183 176 return $_styles($elem) 184 } 185 return "" 186 } 187 188 # 189 # shape -- 190 # 177 } 178 return "" 179 } 180 181 # 182 # shape -- 183 # 191 184 # Returns the shape of the glyphs in the drawing element. 192 185 # … … 195 188 if { [info exists _shapes($elem)] } { 196 189 return $_shapes($elem) 197 } 198 switch -- $shape { 199 arrow - cone - cube - cylinder - dodecahedron - 200 201 202 203 204 205 206 } 207 return "" 208 } 209 210 # 211 # data -- 212 # 190 } 191 switch -- $shape { 192 arrow - cone - cube - cylinder - dodecahedron - 193 icosahedron - line - octahedron - sphere - tetrahedron { 194 return $shape 195 } 196 default { 197 puts stderr "unknown glyph shape \"$shape\"" 198 } 199 } 200 return "" 201 } 202 203 # 204 # data -- 205 # 213 206 # Returns the data of the named drawing element. 214 207 # … … 216 209 if { [info exists _data($elem)] } { 217 210 return $_data($elem) 218 } 219 return "" 220 } 221 222 # ---------------------------------------------------------------------- 223 # method values 211 } 212 return "" 213 } 214 215 # ---------------------------------------------------------------------- 216 # method values 224 217 # Returns a base64 encoded, gzipped Tcl list that represents the 225 # Tcl command and data to recreate the uniform rectangular grid 218 # Tcl command and data to recreate the uniform rectangular grid 226 219 # on the nanovis server. 227 220 # ---------------------------------------------------------------------- … … 229 222 if { [info exists _data($elem)] } { 230 223 return $_data($elem) 231 } 224 } 232 225 return "" 233 226 } 234 227 235 228 itcl::body Rappture::Drawing::components { args } { 236 return [array names _data] 229 return [array names _data] 237 230 } 238 231
Note: See TracChangeset
for help on using the changeset viewer.