Ignore:
Timestamp:
Mar 11, 2015 10:26:15 AM (9 years ago)
Author:
dkearney
Message:

merging updates from 1.3 branch

looks like this branch originally came from the 1.3 branch and then had some
additions from the 1.4-pre branch and then a sync from the 1.3 branch. to get
this branch updated, I am reverting r4797 (additions from 1.4-pre branch),
reverting r4798 (additions from 1.3 branch), then merging in updates from 1.3
branch.

I fixed merge conflicts for the following files:

gui/scripts/gauge.tcl
gui/scripts/main.tcl
gui/scripts/tool.tcl
lang/tcl/scripts/task.tcl

Location:
branches/uq
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/uq

  • branches/uq/gui/scripts/vtkvolumeviewer.tcl

    r4797 r5121  
    11# -*- mode: tcl; indent-tabs-mode: nil -*-
    2 # ----------------------------------------------------------------------
    3 #  COMPONENT: vtkvolumeviewer - Vtk volume viewer
     2
     3# ----------------------------------------------------------------------
     4#  COMPONENT: VtkVolumeViewer - Vtk volume viewer
    45#
    56#  It connects to the Vtk server running on a rendering farm,
     
    78# ======================================================================
    89#  AUTHOR:  Michael McLennan, Purdue University
    9 #  Copyright (c) 2004-2014  HUBzero Foundation, LLC
     10#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    1011#
    1112#  See the file "license.terms" for information on usage and
     
    6667    protected method Disconnect {}
    6768    protected method DoResize {}
     69    protected method DoReseed {}
    6870    protected method DoRotate {}
    6971    protected method AdjustSetting {what {value ""}}
     
    8486    private method BuildCutplaneTab {}
    8587    private method BuildDownloadPopup { widget command }
    86     private method BuildViewTab {}
    8788    private method BuildVolumeTab {}
    8889    private method DrawLegend {}
     
    9091    private method EnterLegend { x y }
    9192    private method EventuallyResize { w h }
     93    private method EventuallyReseed { numPoints }
    9294    private method EventuallyRotate { q }
    9395    private method EventuallySetCutplane { axis args }
     
    127129    private variable _start 0
    128130    private variable _title ""
     131    private variable _seeds
    129132
    130133    common _downloadPopup;              # download options from popup
     
    133136    private variable _height 0
    134137    private variable _resizePending 0
     138    private variable _reseedPending 0
    135139    private variable _rotatePending 0
    136140    private variable _cutplanePending 0
     
    154158    set _serverType "vtkvis"
    155159
    156     EnableWaitDialog 900
    157 
    158160    # Rebuild event
    159161    $_dispatcher register !rebuild
     
    163165    $_dispatcher register !resize
    164166    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     167
     168    # Reseed event
     169    $_dispatcher register !reseed
     170    $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list"
    165171
    166172    # Rotate event
     
    215221        axesVisible             1
    216222        axisLabels              1
    217         background              black
    218223        cutplaneEdges           0
    219224        cutplane-xvisible       1
     
    227232        cutplaneWireframe       0
    228233        cutplane-opacity        100
    229         legendVisible           1
    230         outline                 0
    231234        volumeLighting          1
    232235        volume-material         80
     
    334337
    335338    if { [catch {
    336         BuildViewTab
    337339        BuildVolumeTab
    338340        BuildCutplaneTab
     
    342344        puts stderr errs=$errs
    343345    }
    344 
    345346    # Legend
     347
    346348    set _image(legend) [image create photo]
    347349    itk_component add legend {
     
    372374        [itcl::code $this EventuallyResize %w %h]
    373375
     376    if 0 {
     377    bind $itk_component(view) <Configure> \
     378        [itcl::code $this EventuallyResize %w %h]
     379    }
    374380    # Bindings for panning via mouse
    375381    bind $itk_component(view) <ButtonPress-2> \
     
    461467}
    462468
     469itcl::body Rappture::VtkVolumeViewer::EventuallyReseed { numPoints } {
     470    set _numSeeds $numPoints
     471    if { !$_reseedPending } {
     472        set _reseedPending 1
     473        $_dispatcher event -after 600 !reseed
     474    }
     475}
     476
    463477set rotate_delay 100
    464478
     
    487501# ----------------------------------------------------------------------
    488502itcl::body Rappture::VtkVolumeViewer::add {dataobj {settings ""}} {
    489     if { ![IsValidObject $dataobj] } {
    490         return;                         # Ignore invalid objects.
    491     }
    492503    array set params {
    493504        -color auto
     
    739750        if { $_reportClientInfo }  {
    740751            # Tell the server the viewer, hub, user and session.
    741             # Do this immediately on connect before buffering any commands
     752            # Do this immediately on connect before buffing any commands
    742753            global env
    743754
     
    797808    $_dispatcher cancel !rebuild
    798809    $_dispatcher cancel !resize
     810    $_dispatcher cancel !reseed
    799811    $_dispatcher cancel !rotate
    800812    $_dispatcher cancel !xcutplane
     
    807819    array unset _data
    808820    array unset _colormaps
     821    array unset _seeds
    809822    array unset _dataset2style
    810823    array unset _obj2datasets
     
    834847        }
    835848        $_image(plot) configure -data $bytes
    836         #puts stderr "[clock format [clock seconds]]: received image [image width $_image(plot)]x[image height $_image(plot)] image>"
     849        set time [clock seconds]
     850        set date [clock format $time]
     851        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"       
    837852        if { $_start > 0 } {
    838853            set finish [clock clicks -milliseconds]
     
    913928    set _legendPending 1
    914929
    915     if { $_width != $w || $_height != $h || $_reset } {
     930    if { $_reset } {
    916931        set _width $w
    917932        set _height $h
    918933        $_arcball resize $w $h
    919934        DoResize
    920     }
    921     if { $_reset } {
    922935        #
    923936        # Reset the camera and other view parameters
     
    931944        }
    932945        DoRotate
    933         InitSettings outline background \
    934             axis-xgrid axis-ygrid axis-zgrid axisFlyMode \
     946        InitSettings axis-xgrid axis-ygrid axis-zgrid axisFlyMode \
    935947            axesVisible axisLabels
    936948        PanCamera
    937949    }
     950    set _first ""
    938951
    939952    SendCmd "imgflush"
     
    953966                if { $_reportClientInfo }  {
    954967                    set info {}
    955                     lappend info "tool_id"       [$dataobj hints toolId]
    956                     lappend info "tool_name"     [$dataobj hints toolName]
    957                     lappend info "tool_version"  [$dataobj hints toolRevision]
    958                     lappend info "tool_title"    [$dataobj hints toolTitle]
     968                    lappend info "tool_id"       [$dataobj hints toolid]
     969                    lappend info "tool_name"     [$dataobj hints toolname]
     970                    lappend info "tool_title"    [$dataobj hints tooltitle]
     971                    lappend info "tool_command"  [$dataobj hints toolcommand]
     972                    lappend info "tool_revision" [$dataobj hints toolrevision]
    959973                    lappend info "dataset_label" [$dataobj hints label]
    960974                    lappend info "dataset_size"  $length
     
    969983            lappend _obj2datasets($dataobj) $tag
    970984            if { [info exists _obj2ovride($dataobj-raise)] } {
    971                 SendCmd "volume visible 1 $tag"
     985                SendCmd "dataset visible 1 $tag"
    972986            }
    973987            break
     
    983997            set label [$_first hints ${axis}label]
    984998            if { $label != "" } {
    985                 SendCmd [list axis name $axis $label]
     999                SendCmd "axis name $axis $label"
    9861000            }
    9871001            set units [$_first hints ${axis}units]
    9881002            if { $units != "" } {
    989                 SendCmd [list axis units $axis $units]
     1003                SendCmd "axis units $axis $units"
    9901004            }
    9911005        }
     
    12721286    }
    12731287    switch -- $what {
    1274         "background" {
    1275             set bgcolor [$itk_component(background) value]
    1276             array set fgcolors {
    1277                 "black" "white"
    1278                 "white" "black"
    1279                 "grey"  "black"
    1280             }
    1281             configure -plotbackground $bgcolor \
    1282                 -plotforeground $fgcolors($bgcolor)
    1283             $itk_component(view) delete "legend"
    1284             DrawLegend
    1285         }
    1286         "outline" {
    1287             set bool $_settings($what)
    1288             SendCmd "outline visible 0"
    1289             foreach tag [CurrentDatasets -visible] {
    1290                 SendCmd "outline visible $bool $tag"
    1291             }
    1292         }
    1293         "legendVisible" {
    1294             set bool $_settings($what)
    1295             set _settings($_current-$what) $bool
    1296         }
    12971288        "volumeVisible" {
    1298             set bool $_settings($what)
     1289            set bool $_settings(volumeVisible)
    12991290            foreach dataset [CurrentDatasets -visible] {
    13001291                SendCmd "volume visible $bool $dataset"
     
    13091300        }
    13101301        "volume-material" {
    1311             set val $_settings($what)
     1302            set val $_settings(volume-material)
    13121303            set diffuse [expr {0.01*$val}]
    13131304            set specular [expr {0.01*$val}]
     
    13201311        }
    13211312        "volumeLighting" {
    1322             set bool $_settings($what)
     1313            set bool $_settings(volumeLighting)
    13231314            foreach dataset [CurrentDatasets -visible] {
    13241315                SendCmd "volume lighting $bool $dataset"
     
    13261317        }
    13271318        "volume-quality" {
    1328             set val $_settings($what)
     1319            set val $_settings(volume-quality)
    13291320            set val [expr {0.01*$val}]
    13301321            foreach dataset [CurrentDatasets -visible] {
     
    13331324        }
    13341325        "axesVisible" {
    1335             set bool $_settings($what)
     1326            set bool $_settings(axesVisible)
    13361327            SendCmd "axis visible all $bool"
    13371328        }
    13381329        "axisLabels" {
    1339             set bool $_settings($what)
     1330            set bool $_settings(axisLabels)
    13401331            SendCmd "axis labels all $bool"
    13411332        }
     
    14061397        "volume-palette" {
    14071398            set palette [$itk_component(palette) value]
    1408             set _settings($what) $palette
     1399            set _settings(volume-palette) $palette
    14091400            foreach dataset [CurrentDatasets -visible $_first] {
    14101401                foreach {dataobj comp} [split $dataset -] break
     
    14131404            set _legendPending 1
    14141405        }
     1406        "volume-palette" {
     1407            set palette [$itk_component(palette) value]
     1408            set _settings(volume-palette) $palette
     1409            foreach dataset [CurrentDatasets -visible $_first] {
     1410                foreach {dataobj comp} [split $dataset -] break
     1411                ChangeColormap $dataobj $comp $palette
     1412            }
     1413            set _legendPending 1
     1414        }
    14151415        "field" {
    14161416            set label [$itk_component(field) value]
    14171417            set fname [$itk_component(field) translate $label]
    1418             set _settings($what) $fname
     1418            set _settings(field) $fname
    14191419            if { [info exists _fields($fname)] } {
    14201420                foreach { label units components } $_fields($fname) break
     
    15491549itcl::configbody Rappture::VtkVolumeViewer::plotbackground {
    15501550    if { [isconnected] } {
    1551         set color $itk_option(-plotbackground)
    1552         set rgb [Color2RGB $color]
    1553         SendCmd "screen bgcolor $rgb"
    1554         $itk_component(legend) configure -background $color
     1551        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
     1552        SendCmd "screen bgcolor $r $g $b"
    15551553    }
    15561554}
     
    15611559itcl::configbody Rappture::VtkVolumeViewer::plotforeground {
    15621560    if { [isconnected] } {
    1563         set color $itk_option(-plotforeground)
    1564         set rgb [Color2RGB $color]
    1565         SendCmd "axis color all $rgb"
    1566         SendCmd "outline color $rgb"
    1567         SendCmd "cutplane color $rgb"
    1568         $itk_component(legend) itemconfigure labels -fill $color
    1569         $itk_component(legend) itemconfigure limits -fill $color
    1570     }
    1571 }
    1572 
    1573 itcl::body Rappture::VtkVolumeViewer::BuildViewTab {} {
    1574     set font [option get $itk_component(hull) font Font]
    1575     #set bfont [option get $itk_component(hull) boldFont Font]
    1576 
    1577     set inner [$itk_component(main) insert end \
    1578         -title "View Settings" \
    1579         -icon [Rappture::icon wrench]]
    1580     $inner configure -borderwidth 4
    1581 
    1582     checkbutton $inner.axes \
    1583         -text "Axes" \
    1584         -variable [itcl::scope _settings(axesVisible)] \
    1585         -command [itcl::code $this AdjustSetting axesVisible] \
    1586         -font "Arial 9"
    1587 
    1588     checkbutton $inner.outline \
    1589         -text "Outline" \
    1590         -variable [itcl::scope _settings(outline)] \
    1591         -command [itcl::code $this AdjustSetting outline] \
    1592         -font "Arial 9"
    1593 
    1594     checkbutton $inner.legend \
    1595         -text "Legend" \
    1596         -variable [itcl::scope _settings(legendVisible)] \
    1597         -command [itcl::code $this AdjustSetting legendVisible] \
    1598         -font "Arial 9"
    1599 
    1600     checkbutton $inner.volume \
    1601         -text "Volume" \
    1602         -variable [itcl::scope _settings(volumeVisible)] \
    1603         -command [itcl::code $this AdjustSetting volumeVisible] \
    1604         -font "Arial 9"
    1605 
    1606     label $inner.background_l -text "Background" -font "Arial 9"
    1607     itk_component add background {
    1608         Rappture::Combobox $inner.background -width 10 -editable no
    1609     }
    1610     $inner.background choices insert end \
    1611         "black"              "black"            \
    1612         "white"              "white"            \
    1613         "grey"               "grey"             
    1614 
    1615     $itk_component(background) value $_settings(background)
    1616     bind $inner.background <<Value>> \
    1617         [itcl::code $this AdjustSetting background]
    1618 
    1619     blt::table $inner \
    1620         0,0 $inner.axes  -cspan 2 -anchor w \
    1621         1,0 $inner.outline  -cspan 2 -anchor w \
    1622         2,0 $inner.volume  -cspan 2 -anchor w \
    1623         3,0 $inner.legend  -cspan 2 -anchor w \
    1624         4,0 $inner.background_l       -anchor e -pady 2 \
    1625         4,1 $inner.background                   -fill x \
    1626 
    1627     blt::table configure $inner r* -resize none
    1628     blt::table configure $inner r5 -resize expand
     1561        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
     1562        #fix this!
     1563        #SendCmd "color background $r $g $b"
     1564    }
    16291565}
    16301566
    16311567itcl::body Rappture::VtkVolumeViewer::BuildVolumeTab {} {
    1632     set font [option get $itk_component(hull) font Font]
    1633     #set bfont [option get $itk_component(hull) boldFont Font]
     1568
     1569    set fg [option get $itk_component(hull) font Font]
     1570    #set bfg [option get $itk_component(hull) boldFont Font]
    16341571
    16351572    set inner [$itk_component(main) insert end \
     
    16851622        Rappture::Combobox $inner.palette -width 10 -editable no
    16861623    }
    1687 
    1688     $inner.palette choices insert end [GetColormapList]
     1624    $inner.palette choices insert end \
     1625        "BCGYR"              "BCGYR"            \
     1626        "BGYOR"              "BGYOR"            \
     1627        "blue"               "blue"             \
     1628        "blue-to-brown"      "blue-to-brown"    \
     1629        "blue-to-orange"     "blue-to-orange"   \
     1630        "blue-to-grey"       "blue-to-grey"     \
     1631        "green-to-magenta"   "green-to-magenta" \
     1632        "greyscale"          "greyscale"        \
     1633        "nanohub"            "nanohub"          \
     1634        "rainbow"            "rainbow"          \
     1635        "spectral"           "spectral"         \
     1636        "ROYGB"              "ROYGB"            \
     1637        "RYGCB"              "RYGCB"            \
     1638        "brown-to-blue"      "brown-to-blue"    \
     1639        "grey-to-blue"       "grey-to-blue"     \
     1640        "orange-to-blue"     "orange-to-blue"   
     1641
    16891642    $itk_component(palette) value "BCGYR"
    16901643    bind $inner.palette <<Value>> \
     
    17091662
    17101663itcl::body Rappture::VtkVolumeViewer::BuildAxisTab {} {
    1711     set font [option get $itk_component(hull) font Font]
    1712     #set bfont [option get $itk_component(hull) boldFont Font]
     1664
     1665    set fg [option get $itk_component(hull) font Font]
     1666    #set bfg [option get $itk_component(hull) boldFont Font]
    17131667
    17141668    set inner [$itk_component(main) insert end \
     
    17531707        "static_triad"    "static" \
    17541708        "closest_triad"   "closest" \
    1755         "furthest_triad"  "farthest" \
     1709        "furthest_triad"  "furthest" \
    17561710        "outer_edges"     "outer"         
    17571711    $itk_component(axismode) value "static"
     
    17701724    blt::table configure $inner r7 c1 -resize expand
    17711725}
     1726
    17721727
    17731728itcl::body Rappture::VtkVolumeViewer::BuildCameraTab {} {
     
    18071762
    18081763itcl::body Rappture::VtkVolumeViewer::BuildCutplaneTab {} {
    1809     set font [option get $itk_component(hull) font Font]
     1764
     1765    set fg [option get $itk_component(hull) font Font]
    18101766   
    18111767    set inner [$itk_component(main) insert end \
     
    20772033    set _settings(volumeLighting) $settings(-lighting)
    20782034    SetColormap $dataobj $comp
    2079     SendCmd "outline add $tag"
    2080     SendCmd "outline visible 0 $tag"
    20812035}
    20822036
Note: See TracChangeset for help on using the changeset viewer.