Ignore:
Timestamp:
Oct 3, 2013, 10:26:53 AM (11 years ago)
Author:
gah
Message:

fix for new markers (immediately send new transfer function, don't create new marker is close to an existing marker).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r3975 r3984  
    9494    protected method Disconnect {}
    9595    protected method DoResize {}
    96     protected method DoReseed {}
    9796    protected method DoRotate {}
    9897    protected method AdjustSetting {what {value ""}}
     
    165164    private variable _height 0
    166165    private variable _resizePending 0
    167     private variable _reseedPending 0
    168166    private variable _rotatePending 0
    169167    private variable _cutplanePending 0
     
    197195    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    198196
    199     # Reseed event
    200     $_dispatcher register !reseed
    201     $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list"
    202 
    203197    # Rotate event
    204198    $_dispatcher register !rotate
     
    212206    $_dispatcher register !xcutplane
    213207    $_dispatcher dispatch $this !xcutplane \
    214         "[itcl::code $this AdjustSetting cutplane-xposition]; list"
     208        "[itcl::code $this AdjustSetting cutplanePositionX]; list"
    215209
    216210    # Y-Cutplane event
    217211    $_dispatcher register !ycutplane
    218212    $_dispatcher dispatch $this !ycutplane \
    219         "[itcl::code $this AdjustSetting cutplane-yposition]; list"
     213        "[itcl::code $this AdjustSetting cutplanePositionY]; list"
    220214
    221215    # Z-Cutplane event
    222216    $_dispatcher register !zcutplane
    223217    $_dispatcher dispatch $this !zcutplane \
    224         "[itcl::code $this AdjustSetting cutplane-zposition]; list"
     218        "[itcl::code $this AdjustSetting cutplanePositionZ]; list"
    225219
    226220    #
     
    247241
    248242    array set _settings {
    249         axis-xgrid              0
    250         axis-ygrid              0
    251         axis-zgrid              0
    252243        axesVisible             1
     244        axisGridX               0
     245        axisGridY               0
     246        axisGridZ               0
    253247        axisLabels              1
    254248        cutplaneEdges           0
    255         cutplane-xvisible       1
    256         cutplane-yvisible       1
    257         cutplane-zvisible       1
    258         cutplane-xposition      50
    259         cutplane-yposition      50
    260         cutplane-zposition      50
     249        cutplaneLighting        1
     250        cutplaneOpacity         100
    261251        cutplaneVisible         0
    262         cutplaneLighting        1
     252        cutplaneVisibleX        1
     253        cutplaneVisibleY        1
     254        cutplaneVisibleZ        1
    263255        cutplaneWireframe       0
    264         cutplane-opacity        100
    265         volume-blendmode        composite
     256        cutplaneXPosition       50
     257        cutplaneYPosition       50
     258        cutplaneZPosition       50
     259        legendVisible           1
     260        volumeAmbient           40
     261        volumeBlendMode         composite
     262        volumeDiffuse           60
    266263        volumeLighting          1
    267         volumeAmbient          40
    268         volumeDiffuse          60
    269         volumeThickness        350
    270         volume-specularLevel    30
    271         volume-specularExponent 90
    272         volume-opacity          50
    273         volume-quality          50
     264        volumeOpacity           50
     265        volumeQuality           50
     266        volumeSpecularExponent  90
     267        volumeSpecularLevel     30
     268        volumeThickness         350
    274269        volumeVisible           1
    275         legendVisible           1
    276270    }
    277271
     
    851845        EventuallyResize $w $h
    852846    }
     847    $_dispatcher event -idle !rebuild
    853848    return $result
    854849}
     
    868863itcl::body Rappture::VtkVolumeViewer::disconnect {} {
    869864    Disconnect
    870     set _reset 1
    871865}
    872866
     
    882876    $_dispatcher cancel !rebuild
    883877    $_dispatcher cancel !resize
    884     $_dispatcher cancel !reseed
    885878    $_dispatcher cancel !rotate
    886879    $_dispatcher cancel !xcutplane
     
    896889    array unset _dataset2style
    897890    array unset _obj2datasets
     891
     892    array unset _cname2style
     893    array unset _parsedFunction
     894    array unset _cname2transferFunction
     895
     896    set _resizePending 0
     897    set _rotatePending 0
     898    set _cutplanePending 0
     899    set _legendPending 0
     900    set _reset 1
    898901}
    899902
     
    10161019        }
    10171020        DoRotate
    1018         InitSettings axis-xgrid axis-ygrid axis-zgrid axisFlyMode \
     1021        InitSettings axisGridX axisGridY axisGridZ axisFlyMode \
    10191022            axesVisible axisLabels
    10201023        PanCamera
     
    11081111
    11091112    InitSettings volumeColormap \
    1110         volumeAmbient volumeDiffuse volume-specularLevel volume-specularExponent \
    1111         volume-opacity volume-quality volumeVisible \
     1113        volumeAmbient volumeDiffuse volumeSpecularLevel volumeSpecularExponent \
     1114        volumeOpacity volumeQuality volumeVisible \
    11121115        cutplaneVisible \
    1113         cutplane-xposition cutplane-yposition cutplane-zposition \
    1114         cutplane-xvisible cutplane-yvisible cutplane-zvisible
     1116        cutplanePositionX cutplanePositionY cutplanePositionZ \
     1117        cutplaneVisibleX cutplaneVisibleY cutplaneVisibleZ
    11151118
    11161119    if { $_reset } {
    11171120        InitSettings volumeLighting
    1118         Zoom reset
     1121        SendCmd "camera reset"
     1122        SendCmd "camera zoom $_view(zoom)"
    11191123        set _reset 0
    11201124    }
     
    13561360itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} {
    13571361    if { ![isconnected] } {
     1362        if { $_reset } {
     1363            # Just reconnect if we've been reset.
     1364            Connect
     1365        }
    13581366        return
    13591367    }
     
    13721380            }
    13731381        }
    1374         "volume-blendmode" {
     1382        "volumeBlendMode" {
    13751383            set val [$itk_component(blendmode) value]
    13761384            set mode [$itk_component(blendmode) translate $val]
    1377             set _settings(volume-blendmode) $mode
     1385            set _settings(volumeBlendMode) $mode
    13781386            foreach dataset [CurrentDatasets -visible] {
    13791387                SendCmd "volume blendmode $mode $dataset"
     
    13941402            }
    13951403        }
    1396         "volume-specularLevel" - "volume-specularExponent" {
    1397             set val $_settings(volume-specularLevel)
     1404        "volumeSpecularLevel" - "volumeSpecularExponent" {
     1405            set val $_settings(volumeSpecularLevel)
    13981406            set specularLevel [expr {0.01*$val}]
    1399             set specularExponent $_settings(volume-specularExponent)
     1407            set specularExponent $_settings(volumeSpecularExponent)
    14001408            foreach dataset [CurrentDatasets -visible] {
    14011409                SendCmd "volume shading specular $specularLevel $specularExponent $dataset"
     
    14081416            }
    14091417        }
    1410         "volume-opacity" {
    1411             set val $_settings(volume-opacity)
     1418        "volumeOpacity" {
     1419            set val $_settings(volumeOpacity)
    14121420            set val [expr {0.01*$val}]
    14131421            foreach dataset [CurrentDatasets -visible] {
     
    14151423            }
    14161424        }
    1417         "volume-quality" {
    1418             set val $_settings(volume-quality)
     1425        "volumeQuality" {
     1426            set val $_settings(volumeQuality)
    14191427            set val [expr {0.01*$val}]
    14201428            foreach dataset [CurrentDatasets -visible] {
     
    14301438            SendCmd "axis labels all $bool"
    14311439        }
    1432         "axis-xgrid" - "axis-ygrid" - "axis-zgrid" {
    1433             set axis [string range $what 5 5]
     1440        "axisGridX" - "axisGridY" - "axisGridZ" {
     1441            set axis [string tolower [string range $what end end]]
    14341442            set bool $_settings($what)
    14351443            SendCmd "axis grid $axis $bool"
     
    14651473            }
    14661474        }
    1467         "cutplane-opacity" {
     1475        "cutplaneOpacity" {
    14681476            set val $_settings($what)
    14691477            set sval [expr { 0.01 * double($val) }]
     
    14721480            }
    14731481        }
    1474         "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
    1475             set axis [string range $what 9 9]
     1482        "cutplaneVisibleX" - "cutplaneVisibleY" - "cutplaneVisibleZ" {
     1483            set axis [string tolower [string range $what end end]]
    14761484            set bool $_settings($what)
    14771485            if { $bool } {
     
    14861494            }
    14871495        }
    1488         "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
    1489             set axis [string range $what 9 9]
     1496        "cutplanePositionX" - "cutplanePositionY" - "cutplanePositionZ" {
     1497            set axis [string tolower [string range $what end end]]
    14901498            set pos [expr $_settings($what) * 0.01]
    14911499            foreach dataset [CurrentDatasets -visible] {
     
    16231631        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    16241632    }
    1625     if { ![info exists _settings(volume-opacity)] } {
    1626         set _settings(volume-opacity) $style(-opacity)
    1627     }
    1628     set max $_settings(volume-opacity)
     1633    if { ![info exists _settings(volumeOpacity)] } {
     1634        set _settings(volumeOpacity) $style(-opacity)
     1635    }
     1636    set max $_settings(volumeOpacity)
    16291637
    16301638    set opaqueWmap "0.0 1.0 1.0 1.0"
     
    17061714    label $inner.specularLevel_l -text "Specular" -font $font
    17071715    ::scale $inner.specularLevel -from 0 -to 100 -orient horizontal \
    1708         -variable [itcl::scope _settings(volume-specularLevel)] \
    1709         -showvalue off -command [itcl::code $this AdjustSetting volume-specularLevel] \
     1716        -variable [itcl::scope _settings(volumeSpecularLevel)] \
     1717        -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularLevel] \
    17101718        -troughcolor grey92
    17111719
    17121720    label $inner.specularExponent_l -text "Shininess" -font $font
    17131721    ::scale $inner.specularExponent -from 10 -to 128 -orient horizontal \
    1714         -variable [itcl::scope _settings(volume-specularExponent)] \
    1715         -showvalue off -command [itcl::code $this AdjustSetting volume-specularExponent] \
     1722        -variable [itcl::scope _settings(volumeSpecularExponent)] \
     1723        -showvalue off -command [itcl::code $this AdjustSetting volumeSpecularExponent] \
    17161724        -troughcolor grey92
    17171725
    17181726    label $inner.opacity_l -text "Opacity" -font $font
    17191727    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1720         -variable [itcl::scope _settings(volume-opacity)] \
    1721         -showvalue off -command [itcl::code $this AdjustSetting volume-opacity] \
     1728        -variable [itcl::scope _settings(volumeOpacity)] \
     1729        -showvalue off -command [itcl::code $this AdjustSetting volumeOpacity] \
    17221730        -troughcolor grey92
    17231731
    17241732    label $inner.quality_l -text "Quality" -font $font
    17251733    ::scale $inner.quality -from 0 -to 100 -orient horizontal \
    1726         -variable [itcl::scope _settings(volume-quality)] \
    1727         -showvalue off -command [itcl::code $this AdjustSetting volume-quality] \
     1734        -variable [itcl::scope _settings(volumeQuality)] \
     1735        -showvalue off -command [itcl::code $this AdjustSetting volumeQuality] \
    17281736        -troughcolor grey92
    17291737
     
    17841792    $itk_component(blendmode) value "composite"
    17851793    bind $inner.blendmode <<Value>> \
    1786         [itcl::code $this AdjustSetting volume-blendmode]
     1794        [itcl::code $this AdjustSetting volumeBlendMode]
    17871795
    17881796    blt::table $inner \
     
    18451853    checkbutton $inner.gridx \
    18461854        -text "Show X Grid" \
    1847         -variable [itcl::scope _settings(axis-xgrid)] \
    1848         -command [itcl::code $this AdjustSetting axis-xgrid] \
     1855        -variable [itcl::scope _settings(axisGridX)] \
     1856        -command [itcl::code $this AdjustSetting axisGridX] \
    18491857        -font "Arial 9"
    18501858    checkbutton $inner.gridy \
    18511859        -text "Show Y Grid" \
    1852         -variable [itcl::scope _settings(axis-ygrid)] \
    1853         -command [itcl::code $this AdjustSetting axis-ygrid] \
     1860        -variable [itcl::scope _settings(axisGridY)] \
     1861        -command [itcl::code $this AdjustSetting axisGridY] \
    18541862        -font "Arial 9"
    18551863    checkbutton $inner.gridz \
    18561864        -text "Show Z Grid" \
    1857         -variable [itcl::scope _settings(axis-zgrid)] \
    1858         -command [itcl::code $this AdjustSetting axis-zgrid] \
     1865        -variable [itcl::scope _settings(axisGridZ)] \
     1866        -command [itcl::code $this AdjustSetting axisGridZ] \
    18591867        -font "Arial 9"
    18601868
     
    19701978    label $inner.opacity_l -text "Opacity" -font "Arial 9"
    19711979    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1972         -variable [itcl::scope _settings(cutplane-opacity)] \
     1980        -variable [itcl::scope _settings(cutplaneOpacity)] \
    19731981        -width 10 \
    19741982        -showvalue off \
    1975         -command [itcl::code $this AdjustSetting cutplane-opacity]
    1976     $inner.opacity set $_settings(cutplane-opacity)
     1983        -command [itcl::code $this AdjustSetting cutplaneOpacity]
     1984    $inner.opacity set $_settings(cutplaneOpacity)
    19771985
    19781986    # X-value slicer...
     
    19811989            -onimage [Rappture::icon x-cutplane] \
    19821990            -offimage [Rappture::icon x-cutplane] \
    1983             -command [itcl::code $this AdjustSetting cutplane-xvisible] \
    1984             -variable [itcl::scope _settings(cutplane-xvisible)]
     1991            -command [itcl::code $this AdjustSetting cutplaneVisibleX] \
     1992            -variable [itcl::scope _settings(cutplaneVisibleX)]
    19851993    }
    19861994    Rappture::Tooltip::for $itk_component(xCutButton) \
     
    19932001            -borderwidth 1 -highlightthickness 0 \
    19942002            -command [itcl::code $this EventuallySetCutplane x] \
    1995             -variable [itcl::scope _settings(cutplane-xposition)]
     2003            -variable [itcl::scope _settings(cutplanePositionX)]
    19962004    } {
    19972005        usual
     
    20092017            -onimage [Rappture::icon y-cutplane] \
    20102018            -offimage [Rappture::icon y-cutplane] \
    2011             -command [itcl::code $this AdjustSetting cutplane-yvisible] \
    2012             -variable [itcl::scope _settings(cutplane-yvisible)]
     2019            -command [itcl::code $this AdjustSetting cutplaneVisibleY] \
     2020            -variable [itcl::scope _settings(cutplaneVisibleY)]
    20132021    }
    20142022    Rappture::Tooltip::for $itk_component(yCutButton) \
     
    20212029            -borderwidth 1 -highlightthickness 0 \
    20222030            -command [itcl::code $this EventuallySetCutplane y] \
    2023             -variable [itcl::scope _settings(cutplane-yposition)]
     2031            -variable [itcl::scope _settings(cutplanePositionY)]
    20242032    } {
    20252033        usual
     
    20372045            -onimage [Rappture::icon z-cutplane] \
    20382046            -offimage [Rappture::icon z-cutplane] \
    2039             -command [itcl::code $this AdjustSetting cutplane-zvisible] \
    2040             -variable [itcl::scope _settings(cutplane-zvisible)]
     2047            -command [itcl::code $this AdjustSetting cutplaneVisibleZ] \
     2048            -variable [itcl::scope _settings(cutplaneVisibleZ)]
    20412049    }
    20422050    Rappture::Tooltip::for $itk_component(zCutButton) \
     
    20492057            -borderwidth 1 -highlightthickness 0 \
    20502058            -command [itcl::code $this EventuallySetCutplane z] \
    2051             -variable [itcl::scope _settings(cutplane-zposition)]
     2059            -variable [itcl::scope _settings(cutplanePositionZ)]
    20522060    } {
    20532061        usual
     
    22242232itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
    22252233    set _legendPending 0
    2226     if { [IsConnected] } {
     2234    if { [isconnected] } {
    22272235        set bytes [ReceiveBytes $size]
    22282236        if { ![info exists _image(legend)] } {
     
    26432651    set _cname2transferFunction($cname) [list $cmap $wmap]
    26442652    SendCmd [list colormap add $cname $cmap $wmap]
     2653    SendCmd [list cutplane colormap $cname]
    26452654    EventuallyRequestLegend
    26462655}
Note: See TracChangeset for help on using the changeset viewer.