Changeset 4992 for branches/uiuc_vtk_viewers/gui
- Timestamp:
- Feb 10, 2015 7:17:06 PM (9 years ago)
- Location:
- branches/uiuc_vtk_viewers
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uiuc_vtk_viewers
- Property svn:mergeinfo changed
/trunk (added) merged: 4958-4959,4961,4964,4967,4970,4972,4974-4975,4977,4979,4989-4990
- Property svn:mergeinfo changed
-
branches/uiuc_vtk_viewers/gui/apps/execute.tcl
r4856 r4992 67 67 set toolobj [Rappture::library $toolxml] 68 68 set TaskObj [Rappture::Task ::#auto $toolobj $installdir] 69 set LogFid "" 69 70 70 # tasks in execute mode run quietly and don't try to save results 71 $TaskObj configure -jobstats "" -resultdir "" 71 # Define some things that we need for logging status... 72 # ---------------------------------------------------------------------- 73 proc log_output {message} { 74 global LogFid 75 76 if {$LogFid ne ""} { 77 # 78 # Scan through and pick out any =RAPPTURE-PROGRESS=> messages. 79 # 80 set percent "" 81 while {[regexp -indices \ 82 {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \ 83 match percent mesg]} { 84 85 foreach {i0 i1} $percent break 86 set percent [string range $message $i0 $i1] 87 88 foreach {i0 i1} $mesg break 89 set mesg [string range $message $i0 $i1] 90 91 foreach {i0 i1} $match break 92 set message [string replace $message $i0 $i1] 93 } 94 if {$percent ne ""} { 95 # report the last percent progress found 96 log_append progress "$percent% - $mesg" 97 } 98 } 99 } 100 101 # Actually write to the log file 102 proc log_append {level message} { 103 global LogFid 104 105 if {$LogFid ne ""} { 106 set date [clock format [clock seconds] -format {%Y-%m-%dT%H:%M:%S%z}] 107 set host [info hostname] 108 puts $LogFid "$date $host rappture [pid] \[$level\] $message" 109 flush $LogFid 110 } 111 } 112 113 # Actually write to the log file 114 proc log_stats {args} { 115 set line "" 116 foreach {key val} $args { 117 append line "$key=$val " 118 } 119 log_append usage $line 120 } 121 122 # Parse command line options to see 123 # ---------------------------------------------------------------------- 124 Rappture::getopts argv params { 125 value -status "" 126 value -output "" 127 value -cleanup no 128 } 129 130 if {$params(-status) ne ""} { 131 set LogFid [open $params(-status) w] 132 $TaskObj configure -logger {log_append status} -jobstats log_stats 133 } 134 135 if {$params(-output) eq ""} { 136 # no output? then run quietly and don't try to save results 137 $TaskObj configure -jobstats "" -resultdir "" 138 } 72 139 73 140 # Transfer input values from driver to TaskObj, and then run. … … 80 147 lappend args $path [$driverobj get $path.current] 81 148 } 149 } 150 151 if {$params(-status) ne ""} { 152 # recording status? then look through output for progress messages 153 lappend args -output log_output 82 154 } 83 155 … … 95 167 $runxml put output.status failed 96 168 } 97 $runxml put output.time [clock format [clock seconds]]98 169 99 $runxml put tool.version.rappture.version $::Rappture::version 100 $runxml put tool.version.rappture.revision $::Rappture::build 101 102 if {[info exists tcl_platform(user)]} { 103 $runxml put output.user $::tcl_platform(user) 170 # Handle output 171 # ---------------------------------------------------------------------- 172 switch -- $params(-output) { 173 "" { 174 # no output file -- write to stdout 175 puts "<?xml version=\"1.0\"?>\n[$runxml xml]" 176 } 177 "@default" { 178 # do the usual Rappture thing -- move to results dir 179 # but ignore any errors if it fails 180 catch {$TaskObj save $runxml} 181 } 182 default { 183 # save to the specified file 184 $TaskObj save $runxml $params(-output) 185 } 104 186 } 105 187 106 puts "<?xml version=\"1.0\"?>\n[$runxml xml]" 188 if {$params(-cleanup)} { 189 file delete -force -- $driverxml 190 } 191 192 log_append status "exit $status" 107 193 exit $status -
branches/uiuc_vtk_viewers/gui/apps/launcher.tcl
r4834 r4992 27 27 set mainscript "" 28 28 set alist "" 29 set loadlist "" 29 30 set toolxml "" 31 32 # ---------------------------------------------------------------------- 33 # Look for parameters passed into the tool session. If there are 34 # any "file" parameters, they indicate files that should be loaded 35 # for browsing or executed to get results: 36 # 37 # file(load):/path/to/run.xml 38 # file(execute):/path/to/driver.xml 39 # ---------------------------------------------------------------------- 40 set params(opt) "" 41 set params(load) "" 42 set params(execute) "" 43 set params(input) "" 44 45 if {[info exists env(TOOL_PARAMETERS)]} { 46 # if we can't find the file, wait a little 47 set ntries 25 48 while {$ntries > 0 && ![file exists $env(TOOL_PARAMETERS)]} { 49 after 200 50 incr ntries -1 51 } 52 53 if {![file exists $env(TOOL_PARAMETERS)]} { 54 # still no file after all that? then skip parameters 55 puts stderr "WARNING: can't read tool parameters in file \"$env(TOOL_PARAMETERS)\"\nFile not found." 56 57 } elseif {[catch { 58 # read the file and parse the contents 59 set fid [open $env(TOOL_PARAMETERS) r] 60 set info [read $fid] 61 close $fid 62 } result] != 0} { 63 puts stderr "WARNING: can't read tool parameters in file \"$env(TOOL_PARAMETERS)\"\n$result" 64 65 } else { 66 # parse the contents of the tool parameter file 67 foreach line [split $info \n] { 68 set line [string trim $line] 69 if {$line eq "" || [regexp {^#} $line]} { 70 continue 71 } 72 73 if {[regexp {^([a-zA-Z]+)(\(into\:)(.+)\)\:(.+)$} $line match type name path value] 74 || [regexp {^([a-zA-Z]+)(\([^)]+\))?\:(.+)} $line match type name value]} { 75 if {$type eq "file"} { 76 switch -exact -- $name { 77 "(load)" - "" { 78 lappend params(load) $value 79 set params(opt) "-load" 80 } 81 "(execute)" { 82 set params(execute) $value 83 set params(opt) "-execute" 84 } 85 "(input)" { 86 set params(input) $value 87 set params(opt) "-input" 88 } 89 "(into:" { 90 namespace eval ::Rappture { # forward decl } 91 set ::Rappture::parameters($path) $value 92 } 93 default { 94 puts stderr "WARNING: directive $name not recognized for file parameter \"$value\"" 95 } 96 } 97 } 98 } 99 } 100 } 101 } 30 102 31 103 # scan through the arguments and look for the function … … 81 153 lappend alist -tool $toolxml 82 154 } 83 -t ool - -testdir - -nosim {155 -testdir - -nosim { 84 156 lappend alist $opt [lindex $argv 0] 85 157 set argv [lrange $argv 1 end] … … 93 165 } 94 166 -load { 95 lappend alist $opt96 167 while { [llength $argv] > 0 } { 97 168 set val [lindex $argv 0] … … 99 170 break 100 171 } 101 lappend alist $val172 lappend loadlist $val 102 173 set argv [lrange $argv 1 end] 103 174 } … … 115 186 } 116 187 117 # If no arguments, assume that it's the -run option 188 # If no arguments, check to see if there are any tool parameters. 189 # If not, then assume that it's the -run option. 118 190 if {$mainscript eq ""} { 119 package require RapptureGUI 120 set guidir $RapptureGUI::library 121 set mainscript [file join $guidir scripts main.tcl] 122 set reqpkgs Tk 191 switch -- $params(opt) { 192 -load { 193 # add tool parameters to the end of any files given on cmd line 194 set loadlist [concat $loadlist $params(load)] 195 set alist [concat $alist -load $loadlist] 196 197 package require RapptureGUI 198 set guidir $RapptureGUI::library 199 set mainscript [file join $guidir scripts main.tcl] 200 set reqpkgs Tk 201 } 202 -execute { 203 if {[llength $params(execute)] != 1} { 204 puts stderr "ERROR: wrong number of (execute) files in TOOL_PARAMETERS (should be only 1)" 205 exit 1 206 } 207 set driverxml [lindex $params(execute) 0] 208 if {![file readable $driverxml]} { 209 puts stderr "error: driver file \"$driverxml\" not found" 210 exit 1 211 } 212 set dir [file dirname [info script]] 213 set mainscript [file join $dir execute.tcl] 214 set reqpkgs "" 215 216 # When executing from TOOL_PARAMETERS file directives, 217 # report status, clean up, and save output to data/results. 218 # This helps the web services interface do its thing. 219 set alist [list \ 220 -output @default \ 221 -status rappture.status \ 222 -cleanup yes] 223 } 224 "" - "-input" { 225 package require RapptureGUI 226 set guidir $RapptureGUI::library 227 set mainscript [file join $guidir scripts main.tcl] 228 set reqpkgs Tk 229 230 # finalize the -input argument for "rappture -run" 231 if {$params(input) ne ""} { 232 if {![file readable $params(input)]} { 233 puts stderr "error: driver file \"$params(input)\" not found" 234 exit 1 235 } 236 set alist [concat $alist -input $params(input)] 237 } 238 239 # finalize any pending -load arguments for "rappture -run" 240 if {[llength $loadlist] > 0} { 241 set alist [concat $alist -load $loadlist] 242 } 243 } 244 default { 245 puts stderr "internal error: funny action \"$params(opt)\" inferred from TOOL_PARAMETERS" 246 exit 1 247 } 248 } 249 } else { 250 # finalize any pending -load arguments for "rappture -run" 251 if {[llength $loadlist] > 0} { 252 set alist [concat $alist -load $loadlist] 253 } 123 254 } 124 255 -
branches/uiuc_vtk_viewers/gui/scripts/field.tcl
r4940 r4992 41 41 # mesh 3 points-on-mesh isosurface vtkvis 42 42 # dx 3 DX volume nanovis 43 # unirect2d 2 unirect 3d + extents > 1 flow flow nanovis44 # unirect3d 3 unirect 2d + extents > 1 flow flow nanovis45 # 43 # unirect2d 2 unirect2d + extents > 1 flow flow nanovis 44 # unirect3d 3 unirect3d + extents > 1 flow flow nanovis 45 # 46 46 # With <views>, can specify which viewer for specific datasets. So it's OK 47 47 # for the same dataset to be viewed in more than one way. -
branches/uiuc_vtk_viewers/gui/scripts/main.tcl
r3700 r4992 93 93 value -tool tool.xml 94 94 list -load "" 95 value -input "" 95 96 value -nosim 0 96 }97 98 proc ReadToolParameters { numTries } {99 incr numTries -1100 if { $numTries < 0 } {101 return102 }103 global env104 set paramsFile $env(TOOL_PARAMETERS)105 if { ![file readable $paramsFile] } {106 after 500 ReadToolParmeters $numTries107 return108 }109 catch {110 set f [open $paramsFile "r"]111 set contents [read $f]112 close $f113 set pattern {^file\((.*)\):(.*)$}114 foreach line [split $contents "\n"] {115 if { [regexp $pattern $line match path rest] } {116 set ::Rappture::parameters($path) $rest117 }118 }119 }120 }121 122 if { [info exists env(TOOL_PARAMETERS)] } {123 ReadToolParameters 10124 97 } 125 98 … … 132 105 set status [catch {Rappture::library $runfile} result] 133 106 lappend loadobjs $result 107 } 108 109 set inputobj {} 110 if {$params(-input) ne ""} { 111 if {![file exists $params(-input)]} { 112 puts stderr "can't find input file: \"$params(-input)\"" 113 exit 1 114 } 115 if {[catch {Rappture::library $params(-input)} result] == 0} { 116 set inputobj $result 117 } 134 118 } 135 119 … … 143 127 # run.xml files they are loading. 144 128 set pseudotool "" 145 if { 0 == [llength $loadobjs]} {129 if {[llength $loadobjs] == 0 && $inputobj eq ""} { 146 130 puts stderr "can't find tool \"$params(-tool)\"" 147 131 exit 1 … … 151 135 # if there are loaders or notes, they will still need 152 136 # examples/ and docs/ dirs from the install location 153 foreach runobj $loadobjs { 137 set check [concat $loadobjs $inputobj] 138 foreach runobj $check { 154 139 set tdir \ 155 140 [string trim [$runobj get tool.version.application.directory(tool)]] … … 374 359 375 360 # load previous xml runfiles 376 if { 0 != [llength $params(-load)]} {361 if {[llength $params(-load)] > 0} { 377 362 foreach runobj $loadobjs { 378 # this doesn't seem to work with loaders379 # loaders seem to get their value after this point380 # may need to tell loader elements to update its value381 $tool load $runobj382 363 $f.analyze load $runobj 383 364 } 365 # load the inputs for the very last run 366 $tool load $runobj 367 384 368 # don't need simulate button if we cannot simulate 385 369 if {$params(-nosim)} { … … 388 372 $f.analyze configure -notebookpage analyze 389 373 $win.pager current analyzer 374 } elseif {$params(-input) ne ""} { 375 $tool load $inputobj 376 } 377 378 # let components (loaders) settle after the newly loaded runs 379 update 380 381 foreach path [array names ::Rappture::parameters] { 382 set fname $::Rappture::parameters($path) 383 if {[catch { 384 set fid [open $fname r] 385 set info [read $fid] 386 close $fid}] == 0} { 387 388 set w [$tool widgetfor $path] 389 if {$w ne ""} { 390 if {[catch {$w value [string trim $info]} result]} { 391 puts stderr "WARNING: bad tool parameter value for \"$path\"" 392 puts stderr " $result" 393 } 394 } else { 395 puts stderr "WARNING: can't find control for tool parameter: $path" 396 } 397 } 390 398 } 391 399 -
branches/uiuc_vtk_viewers/gui/scripts/map.tcl
r4789 r4992 129 129 } 130 130 # Common settings (for all layer types) with defaults 131 foreach { key defval } { visible true} {131 foreach { key defval } { visible 1 cache 1 } { 132 132 $_tree set $child $key $defval 133 133 set val [$layers get $layer.$key] -
branches/uiuc_vtk_viewers/gui/scripts/mapviewer.tcl
r4950 r4992 79 79 private method BuildDownloadPopup { widget command } 80 80 private method BuildLayerTab {} 81 private method BuildMapTab {} 81 82 private method BuildTerrainTab {} 82 private method ChangeLayerVisibility { dataobj layer }83 83 private method Connect {} 84 84 private method CurrentLayers {args} … … 104 104 private method Rotate {option x y} 105 105 private method Select {option x y} 106 private method SetLayerOpacity { dataobj layer {value 100}} 106 107 private method SetLayerStyle { dataobj layer } 108 private method SetLayerVisibility { dataobj layer } 107 109 private method SetTerrainStyle { style } 108 private method SetOpacity { dataset }109 110 private method UpdateLayerControls {} 110 111 private method Zoom {option {x 0} {y 0}} … … 121 122 private variable _motion; 122 123 private variable _settings 124 private variable _opacity 123 125 private variable _visibility 124 126 private variable _style; # Array of current component styles. … … 184 186 $_parser alias camera [itcl::code $this camera] 185 187 $_parser alias screen [itcl::code $this ReceiveScreenInfo] 188 189 # Millisecond delay before animated wait dialog appears 190 set _waitTimeout 500 186 191 187 192 # Settings for mouse motion events: these are required … … 236 241 terrain-vertscale 1.0 237 242 terrain-wireframe 0 243 time 12 238 244 }] 245 246 set _settings(time) [clock format [clock seconds] -format %k -gmt 1] 247 239 248 itk_component add view { 240 249 canvas $itk_component(plotarea).view \ … … 301 310 302 311 BuildLayerTab 312 BuildMapTab 303 313 BuildTerrainTab 304 314 BuildCameraTab … … 940 950 set _hardcopy($tag) $bytes 941 951 } 952 set _waitTimeout 0 942 953 } 943 954 … … 1046 1057 } else { 1047 1058 if { $_mapsettings(type) == "geocentric" } { 1059 $itk_component(grid) configure -state normal 1060 $itk_component(time_l) configure -state normal 1061 $itk_component(time) configure -state normal 1048 1062 SendCmd "map reset geocentric" 1049 1063 } else { 1064 $itk_component(grid) configure -state disabled 1065 $itk_component(time_l) configure -state disabled 1066 $itk_component(time) configure -state disabled 1050 1067 set proj $_mapsettings(projection) 1051 1068 if { $proj == "" } { … … 1084 1101 set count 0 1085 1102 1103 set haveTerrain 0 1086 1104 foreach dataobj [get -objects] { 1087 1105 set _obj2datasets($dataobj) "" … … 1104 1122 SetLayerStyle $dataobj $layer 1105 1123 } 1124 if {$info(type) == "elevation"} { 1125 set haveTerrain 1 1126 } 1106 1127 lappend _obj2datasets($dataobj) $layer 1107 1128 # FIXME: This is overriding all layers' initial visibility setting … … 1109 1130 SendCmd "map layer visible 1 $layer" 1110 1131 set _visibility($layer) 1 1111 #SetLayerOpacity $layer 1112 } 1113 } 1132 #SetLayerOpacity $dataobj $layer 1133 } 1134 } 1135 } 1136 1137 if ($haveTerrain) { 1138 $itk_component(vscale_l) configure -state normal 1139 $itk_component(vscale) configure -state normal 1140 } else { 1141 $itk_component(vscale_l) configure -state disabled 1142 $itk_component(vscale) configure -state disabled 1114 1143 } 1115 1144 … … 1519 1548 SendCmd "map terrain wireframe $bool" 1520 1549 } 1550 "time" { 1551 set val $_settings($what) 1552 SendCmd "map time $val" 1553 } 1521 1554 default { 1522 1555 error "don't know how to fix $what" … … 1545 1578 } 1546 1579 1547 itcl::body Rappture::MapViewer::Build TerrainTab {} {1580 itcl::body Rappture::MapViewer::BuildMapTab {} { 1548 1581 1549 1582 set fg [option get $itk_component(hull) font Font] … … 1551 1584 1552 1585 set inner [$itk_component(main) insert end \ 1553 -title " TerrainSettings" \1554 -icon [Rappture::icon surface]]1586 -title "Map Settings" \ 1587 -icon [Rappture::icon wrench]] 1555 1588 $inner configure -borderwidth 4 1556 1589 … … 1561 1594 -font "Arial 9" -anchor w 1562 1595 1563 checkbutton $inner.grid \ 1596 itk_component add grid { 1597 checkbutton $inner.grid \ 1564 1598 -text "Show Graticule" \ 1565 1599 -variable [itcl::scope _settings(grid)] \ 1566 1600 -command [itcl::code $this AdjustSetting grid] \ 1567 1601 -font "Arial 9" -anchor w 1602 } { 1603 ignore -font 1604 } 1568 1605 1569 1606 checkbutton $inner.wireframe \ … … 1585 1622 -font "Arial 9" -anchor w 1586 1623 1587 label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 1624 itk_component add time_l { 1625 label $inner.time_l -text "Time (UTC)" -font "Arial 9" 1626 } { 1627 ignore -font 1628 } 1629 itk_component add time { 1630 ::scale $inner.time -from 0 -to 23.9 -orient horizontal \ 1631 -resolution 0.1 \ 1632 -variable [itcl::scope _settings(time)] \ 1633 -showvalue on \ 1634 -command [itcl::code $this AdjustSetting time] 1635 } 1636 1637 blt::table $inner \ 1638 0,0 $inner.posdisp -cspan 2 -anchor w -pady 2 \ 1639 1,0 $inner.grid -cspan 2 -anchor w -pady 2 \ 1640 2,0 $inner.wireframe -cspan 2 -anchor w -pady 2 \ 1641 3,0 $inner.lighting -cspan 2 -anchor w -pady 2 \ 1642 4,0 $inner.time_l -cspan 2 -anchor w -pady 2 \ 1643 4,1 $inner.time -cspan 2 -fill x -pady 2 1644 # 4,0 $inner.edges -cspan 2 -anchor w -pady 2 1645 1646 blt::table configure $inner r* c* -resize none 1647 blt::table configure $inner r5 c1 -resize expand 1648 } 1649 1650 itcl::body Rappture::MapViewer::BuildTerrainTab {} { 1651 1652 set fg [option get $itk_component(hull) font Font] 1653 #set bfg [option get $itk_component(hull) boldFont Font] 1654 1655 set inner [$itk_component(main) insert end \ 1656 -title "Terrain Settings" \ 1657 -icon [Rappture::icon surface]] 1658 $inner configure -borderwidth 4 1659 1660 label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 1588 1661 itk_component add terrainpalette { 1589 1662 Rappture::Combobox $inner.palette -width 10 -editable no … … 1595 1668 [itcl::code $this AdjustSetting terrain-palette] 1596 1669 1597 label $inner.vscale_l -text "Vertical Scale" -font "Arial 9" -anchor w 1598 ::scale $inner.vscale -from 0 -to 10 -orient horizontal \ 1599 -variable [itcl::scope _settings(terrain-vertscale)] \ 1600 -width 10 \ 1601 -resolution 0.1 \ 1602 -showvalue on \ 1603 -command [itcl::code $this AdjustSetting terrain-vertscale] 1670 itk_component add vscale_l { 1671 label $inner.vscale_l -text "Vertical Scale" -font "Arial 9" -anchor w 1672 } 1673 itk_component add vscale { 1674 ::scale $inner.vscale -from 0 -to 10 -orient horizontal \ 1675 -variable [itcl::scope _settings(terrain-vertscale)] \ 1676 -width 10 \ 1677 -resolution 0.1 \ 1678 -showvalue on \ 1679 -command [itcl::code $this AdjustSetting terrain-vertscale] 1680 } 1604 1681 $inner.vscale set $_settings(terrain-vertscale) 1605 1682 1606 1683 blt::table $inner \ 1607 0,0 $inner.posdisp -cspan 2 -anchor w -pady 2 \ 1608 1,0 $inner.grid -cspan 2 -anchor w -pady 2 \ 1609 2,0 $inner.wireframe -cspan 2 -anchor w -pady 2 \ 1610 3,0 $inner.lighting -cspan 2 -anchor w -pady 2 \ 1611 4,0 $inner.edges -cspan 2 -anchor w -pady 2 \ 1612 5,0 $inner.vscale_l -anchor w -pady 2 \ 1613 5,1 $inner.vscale -fill x -pady 2 \ 1614 6,0 $inner.palette_l -anchor w -pady 2 \ 1615 6,1 $inner.palette -fill x -pady 2 1684 0,0 $inner.vscale_l -anchor w -pady 2 \ 1685 0,1 $inner.vscale -fill x -pady 2 1686 # 1,0 $inner.palette_l -anchor w -pady 2 \ 1687 # 1,1 $inner.palette -fill x -pady 2 1616 1688 1617 1689 blt::table configure $inner r* c* -resize none 1618 blt::table configure $inner r 8c1 -resize expand1690 blt::table configure $inner r3 c1 -resize expand 1619 1691 } 1620 1692 … … 1726 1798 set _view($name) $value 1727 1799 } 1728 puts stderr "view: $_view(x), $_view(y), $_view(z), $_view(heading), $_view(pitch), $_view(distance), {$_view(srs)}, {$_view(verticalDatum)}"1800 # puts stderr "view: $_view(x), $_view(y), $_view(z), $_view(heading), $_view(pitch), $_view(distance), {$_view(srs)}, {$_view(verticalDatum)}" 1729 1801 } 1730 1802 "go" { … … 1870 1942 if { [info exists info(opacity)] } { 1871 1943 set settings(-opacity) $info(opacity) 1872 } 1944 set _opacity($layer) $info(opacity) 1945 } 1946 set _opacity($layer) [expr $settings(-opacity) * 100] 1873 1947 if {!$_sendEarthFile} { 1874 1948 switch -- $info(driver) { … … 1878 1952 "gdal" { 1879 1953 SendCmd [list map layer add image gdal \ 1880 $info(gdal.url) $ layer]1954 $info(gdal.url) $info(cache) $layer] 1881 1955 } 1882 1956 "tms" { 1883 1957 SendCmd [list map layer add image tms \ 1884 $info(tms.url) $ layer]1958 $info(tms.url) $info(cache) $layer] 1885 1959 } 1886 1960 "wms" { 1887 1961 SendCmd [list map layer add image wms \ 1888 $info(wms.url) \1962 $info(wms.url) $info(cache)\ 1889 1963 $info(wms.layers) \ 1890 1964 $info(wms.format) \ … … 1894 1968 "xyz" { 1895 1969 SendCmd [list map layer add image xyz \ 1896 $info(xyz.url) \1970 $info(xyz.url) $info(cache) \ 1897 1971 $layer] 1898 1972 } … … 1935 2009 set settings(-opacity) $info(opacity) 1936 2010 } 2011 set _opacity($layer) [expr $settings(-opacity) * 100] 1937 2012 SendCmd [list map layer add line $info(ogr.url) $layer] 1938 2013 SendCmd "map layer opacity $settings(-opacity) $layer" … … 1950 2025 set settings(-opacity) $info(opacity) 1951 2026 } 2027 set _opacity($layer) [expr $settings(-opacity) * 100] 1952 2028 SendCmd [list map layer add polygon $info(ogr.url) $layer] 1953 2029 SendCmd "map layer opacity $settings(-opacity) $layer" … … 1973 2049 set settings(-opacity) $info(opacity) 1974 2050 } 2051 set _opacity($layer) [expr $settings(-opacity) * 100] 1975 2052 set contentExpr $info(content) 1976 2053 if {[info exists info(priority)]} { … … 1992 2069 } 1993 2070 1994 itcl::body Rappture::MapViewer::SetOpacity { dataset } { 1995 foreach {dataobj layer} [split $dataset -] break 1996 set type [$dataobj type $layer] 1997 set val $_settings(-opacity) 2071 itcl::body Rappture::MapViewer::SetLayerOpacity { dataobj layer {value 100}} { 2072 set val $_opacity($layer) 1998 2073 set sval [expr { 0.01 * double($val) }] 1999 if { !$_obj2ovride($dataobj-raise) } { 2000 # This is wrong. Need to figure out why raise isn't set with 1 2001 #set sval [expr $sval * .6] 2002 } 2003 SendCmd "$type opacity $sval $dataset" 2004 } 2005 2006 itcl::body Rappture::MapViewer::ChangeLayerVisibility { dataobj layer } { 2074 SendCmd "map layer opacity $sval $layer" 2075 } 2076 2077 itcl::body Rappture::MapViewer::SetLayerVisibility { dataobj layer } { 2007 2078 set bool $_visibility($layer) 2008 2079 SendCmd "map layer visible $bool $layer" … … 2022 2093 array unset info 2023 2094 array set info [$dataobj layer $layer] 2024 checkbutton $f.$ layer\2095 checkbutton $f.${layer}-visible \ 2025 2096 -text $info(label) \ 2097 -font "Arial 9" -anchor w \ 2026 2098 -variable [itcl::scope _visibility($layer)] \ 2027 2099 -command [itcl::code $this \ 2028 ChangeLayerVisibility $dataobj $layer] \ 2029 -font "Arial 9" -anchor w 2030 blt::table $f $row,0 $f.$layer -anchor w -pady 2 2031 Rappture::Tooltip::for $f.$layer $info(description) 2100 SetLayerVisibility $dataobj $layer] 2101 blt::table $f $row,0 $f.${layer}-visible -anchor w -pady 2 -cspan 2 2102 Rappture::Tooltip::for $f.${layer}-visible $info(description) 2032 2103 incr row 2104 if { $info(type) != "elevation" } { 2105 label $f.${layer}-opacity_l -text "Opacity" -font "Arial 9" 2106 ::scale $f.${layer}-opacity -from 0 -to 100 \ 2107 -orient horizontal -showvalue off \ 2108 -variable [itcl::scope _opacity($layer)] \ 2109 -command [itcl::code $this \ 2110 SetLayerOpacity $dataobj $layer] 2111 blt::table $f $row,0 $f.${layer}-opacity_l -anchor w -pady 2 2112 blt::table $f $row,1 $f.${layer}-opacity -anchor w -pady 2 2113 incr row 2114 } 2033 2115 } 2034 2116 } -
branches/uiuc_vtk_viewers/gui/scripts/nanovisviewer.tcl
r4776 r4992 1269 1269 "-cutplanesvisible" { 1270 1270 set bool $_settings($what) 1271 # We only set cutplanes on the first dataset. 1271 1272 set datasets [CurrentDatasets -cutplanes] 1272 1273 set tag [lindex $datasets 0] … … 1363 1364 set axis [string range $what 1 1] 1364 1365 set bool $_settings($what) 1366 # We only set cutplanes on the first dataset. 1365 1367 set datasets [CurrentDatasets -cutplanes] 1366 1368 set tag [lindex $datasets 0] -
branches/uiuc_vtk_viewers/gui/scripts/textentry.tcl
r4276 r4992 106 106 # the string alone. 107 107 set str [string trim [$_owner xml get $path.default]] 108 if { [info exists ::Rappture::parameters($path.default)] } {109 set fileName $::Rappture::parameters($path.default)110 catch {111 set f [open $fileName "r"]112 set contents [read $f]113 close $f114 set str $contents115 }116 }117 108 if {"" != $str} { 118 109 value $str -
branches/uiuc_vtk_viewers/gui/scripts/tool.tcl
r4127 r4992 31 31 public method run {args} { 32 32 sync ;# sync all widget values to XML 33 eval $_task run $args 33 34 foreach {status result} [eval $_task run $args] break 35 if {$status == 0} { 36 # move good results to the data/results directory 37 $_task save $result 38 } 39 40 return [list $status $result] 34 41 } 35 42 public method abort {} { -
branches/uiuc_vtk_viewers/gui/scripts/vtkisosurfaceviewer.tcl
r4991 r4992 2354 2354 SendCmd "cutplane add $tag" 2355 2355 SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag" 2356 foreach axis {x y z} { 2357 set pos [expr $_settings(-${axis}cutplaneposition) * 0.01] 2358 set visible $_settings(-${axis}cutplanevisible) 2359 SendCmd "cutplane slice $axis $pos $tag" 2360 SendCmd "cutplane axis $axis $visible $tag" 2361 } 2356 2362 SendCmd "cutplane visible $style(-cutplanesvisible) $tag" 2357 2363 -
branches/uiuc_vtk_viewers/gui/src/RpDicomToVtk.cc
r4128 r4992 27 27 #include <stdio.h> 28 28 #include "tcl.h" 29 30 // #define RP_DICOM_TRACE 29 31 30 32 static int … … 95 97 int series = 0; 96 98 99 #ifdef RP_DICOM_TRACE 97 100 fprintf(stderr, "Num Studies: %d\n", numStudies); 101 #endif 98 102 vtkStringArray *files; 99 103 #if 0 100 104 for (int i = 0; i < numStudies; i++) { 101 105 int numSeries = sorter->GetNumberOfSeriesInStudy(i); 106 #ifdef RP_DICOM_TRACE 102 107 fprintf(stderr, "Study %d: %d series\n", i, numSeries); 108 #endif 103 109 int k = sorter->GetFirstSeriesInStudy(i); 104 110 for (int j = 0; j < numSeries; j++) { … … 144 150 #ifdef USE_VTK_DICOM_PACKAGE 145 151 vtkStringArray *ids = reader->GetStackIDs(); 152 #ifdef RP_DICOM_TRACE 146 153 for (int i = 0; i < ids->GetNumberOfValues(); i++) { 147 154 fprintf(stderr, "Stack: %s\n", ids->GetValue(i).c_str()); 148 155 } 156 #endif 149 157 vtkIntArray *fidxArray = reader->GetFileIndexArray(); 150 158 vtkDICOMMetaData *md = reader->GetMetaData(); … … 160 168 } 161 169 #endif 170 #ifdef RP_DICOM_TRACE 162 171 fprintf(stderr, "Number of data elements: %d\n", md->GetNumberOfDataElements()); 163 172 #endif 164 173 Tcl_ListObjAppendElement(interp, metaDataObj, Tcl_NewStringObj("num_files", -1)); 165 174 Tcl_ListObjAppendElement(interp, metaDataObj, Tcl_NewIntObj(md->GetNumberOfInstances())); … … 234 243 235 244 Tcl_ListObjAppendList(interp, objPtr, metaDataObj); 236 245 #ifdef RP_DICOM_TRACE 237 246 fprintf(stderr, "writing VTK\n"); 238 247 #endif 239 248 vtkSmartPointer<vtkDataSetWriter> writer = vtkSmartPointer<vtkDataSetWriter>::New(); 240 249 writer->SetInputConnection(reader->GetOutputPort()); … … 242 251 writer->WriteToOutputStringOn(); 243 252 writer->Update(); 244 253 #ifdef RP_DICOM_TRACE 245 254 fprintf(stderr, "writing VTK...done\n"); 246 255 #endif 247 256 Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("vtkdata", -1)); 248 257 -
branches/uiuc_vtk_viewers/gui/src/RpReadPoints.c
r3404 r4992 88 88 return TCL_OK; 89 89 } 90 90 91 91 /* 92 92 * ReadPoints string dimVar pointsVar
Note: See TracChangeset
for help on using the changeset viewer.