Changeset 4995
- Timestamp:
- Feb 11, 2015, 2:46:21 AM (10 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/map.tcl
r4958 r4995 26 26 private variable _tree ""; # Tree of information about the map. 27 27 private variable _isValid 0; 28 private common _nextLayer 0; 28 private common _nextLayer 0; # Counter used to generate unique 29 29 # layer names. 30 private common _nextViewpoint 0; # Counter used to generate unique 31 # viewpoint names. 30 32 private common _layerTypes 31 33 private common _mapTypes … … 52 54 } 53 55 54 public method isGeocentric {} 55 public method layers {} 56 public method layer { layerName } 56 public method earthfile {} 57 57 public method hints { args } 58 public method isGeocentric {} 58 59 public method isvalid {} { 59 60 return $_isValid; 60 61 } 62 public method layer { layerName } 63 public method layers {} 61 64 public method type { layerName } 62 public method earthfile {} 65 public method viewpoint { viewpointName } 66 public method viewpoints {} 63 67 } 64 68 … … 215 219 $_tree set root "label" [$map get "about.label"] 216 220 $_tree set root "style" [$map get "style"] 217 221 $_tree set root "camera" [$map get "camera"] 222 set parent [$_tree insert root -label "viewpoints"] 223 set viewpoints [$map element -as object "viewpoints"] 224 if { $viewpoints != "" } { 225 foreach viewpoint [$viewpoints children -type viewpoint] { 226 set name "viewpoint[incr _nextViewpoint]" 227 set child [$_tree insert $parent -label $name] 228 $_tree set $child "name" $viewpoint 229 foreach key { label description x y z distance heading pitch srs verticalDatum } { 230 set val [$viewpoints get $viewpoint.$key] 231 $_tree set $child $key $val 232 } 233 } 234 } 235 218 236 set projection [$map get "projection"] 219 237 set extents [$map get "extents"] 220 238 if { $projection == "" } { 221 if { $extents != ""} {239 if { $extents != "" } { 222 240 error "cannot specify extents without a projection" 223 241 } … … 268 286 269 287 # ---------------------------------------------------------------------- 288 # USAGE: viewpoints 289 # 290 # Returns a list of IDs for the viewpoints in the map 291 # ---------------------------------------------------------------------- 292 itcl::body Rappture::Map::viewpoints {} { 293 set list {} 294 foreach node [$_tree children root->"viewpoints"] { 295 lappend list [$_tree label $node] 296 } 297 return $list 298 } 299 300 # ---------------------------------------------------------------------- 270 301 # USAGE: layer <layerName> 271 302 # … … 276 307 if { $id < 0 } { 277 308 error "unknown layer \"$layerName\"" 309 } 310 return [$_tree get $id] 311 } 312 313 # ---------------------------------------------------------------------- 314 # USAGE: viewopint <viewopintName> 315 # 316 # Returns an array of settings for the named viewpoint 317 # ---------------------------------------------------------------------- 318 itcl::body Rappture::Map::viewpoint { viewopintName } { 319 set id [$_tree findchild root->"viewpoints" $viewopintName] 320 if { $id < 0 } { 321 error "unknown viewpoint \"$viewpointName\"" 278 322 } 279 323 return [$_tree get $id] -
trunk/gui/scripts/mapviewer.tcl
r4990 r4995 116 116 private variable _layers; # Contains the names of all the 117 117 # layer in the server. 118 private variable _viewpoints; 118 119 private variable _click; # info used for rotate operations 119 120 private variable _view; # view params for 3D view … … 772 773 } 773 774 } 775 if { [info exists hints(camera)] } { 776 if { ![info exists _mapsettings(camera)] } { 777 set _mapsettings(camera) $hints(camera) 778 } 779 } 774 780 foreach layer [$dataobj layers] { 775 781 if { [$dataobj type $layer] == "elevation" } { … … 777 783 break 778 784 } 785 } 786 foreach viewpoint [$dataobj viewpoints] { 787 set _viewpoints($viewpoint) [$dataobj viewpoint $viewpoint] 788 array set vp $_viewpoints($viewpoint) 789 foreach key { x y z distance heading pitch srs verticalDatum } { 790 puts stderr "$viewpoint $key $vp($key)" 791 } 779 792 } 780 793 }
Note: See TracChangeset
for help on using the changeset viewer.