Changeset 2584 for trunk/gui/scripts


Ignore:
Timestamp:
Sep 28, 2011, 4:11:15 PM (13 years ago)
Author:
gah
Message:

updates to visviewer: please wait popup

Location:
trunk/gui/scripts
Files:
5 edited

Legend:

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

    r2547 r2584  
    256256
    257257    itk_component add 3dview {
    258         label $itk_component(plotarea).vol -image $_image(plot) \
     258        label $itk_component(plotarea).view -image $_image(plot) \
    259259            -highlightthickness 0 -borderwidth 0
    260260    } {
  • trunk/gui/scripts/heightmapviewer.tcl

    r1984 r2584  
    164164
    165165    itk_component add 3dview {
    166         canvas $itk_component(plotarea).vol \
     166        canvas $itk_component(plotarea).view \
    167167            -highlightthickness 0 -borderwidth 0
    168168    } {
  • trunk/gui/scripts/molvisviewer.tcl

    r2504 r2584  
    219219   
    220220    itk_component add 3dview {
    221         label $itk_component(plotarea).vol -image $_image(plot) \
     221        label $itk_component(plotarea).view -image $_image(plot) \
    222222            -highlightthickness 0 -borderwidth 0
    223223    } {
  • trunk/gui/scripts/nanovisviewer.tcl

    r2390 r2584  
    221221
    222222    itk_component add 3dview {
    223         label $itk_component(plotarea).vol -image $_image(plot) \
     223        label $itk_component(plotarea).view -image $_image(plot) \
    224224            -highlightthickness 0 -borderwidth 0
    225225    } {
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r2583 r2584  
    8686    private method BuildCameraTab {}
    8787    private method BuildColormap { colormap dataobj comp }
    88     private method BuildCutawayTab {}
     88    private method BuildCutplaneTab {}
    8989    private method BuildDownloadPopup { widget command }
    9090    private method BuildStreamsTab {}
    9191    private method BuildVolumeTab {}
    9292    private method ConvertToVtkData { dataobj comp }
    93     private method DrawLegend {}
     93    private method DrawLegend { title }
    9494    private method EnterLegend { x y }
    9595    private method EventuallyResize { w h }
    9696    private method EventuallyRotate { q }
     97    private method EventuallySetCutplane { axis args }
    9798    private method GetImage { args }
    9899    private method GetVtkData { args }
     
    101102    private method MotionLegend { x y }
    102103    private method PanCamera {}
    103     private method RequestLegend {}
     104    private method RequestLegend { {mode "vmag"} }
    104105    private method SetColormap { dataobj comp }
    105106    private method SetLegendTip { x y }
     
    128129    private variable _volume
    129130    private variable _axis
     131    private variable _cutplane
    130132    private variable _streamlines
    131133    private variable _reset 1      ;# indicates if camera needs to be reset
     
    144146    private variable _resizePending 0
    145147    private variable _rotatePending 0
     148    private variable _cutplanePending 0
    146149    private variable _outline
     150    private variable _fields
    147151}
    148152
     
    168172    $_dispatcher dispatch $this !rotate "[itcl::code $this DoRotate]; list"
    169173
    170     set _outbuf ""
     174    # X-Cutplane event
     175    $_dispatcher register !xcutplane
     176    $_dispatcher dispatch $this !xcutplane \
     177        "[itcl::code $this AdjustSetting xcutplane-position]; list"
     178
     179    # Y-Cutplane event
     180    $_dispatcher register !ycutplane
     181    $_dispatcher dispatch $this !ycutplane \
     182        "[itcl::code $this AdjustSetting ycutplane-position]; list"
     183
     184    # Z-Cutplane event
     185    $_dispatcher register !zcutplane
     186    $_dispatcher dispatch $this !zcutplane \
     187        "[itcl::code $this AdjustSetting zcutplane-position]; list"
    171188
    172189    #
     
    207224        ygrid           0
    208225        zgrid           0
    209         xcutaway        0
    210         ycutaway        0
    211         zcutaway        0
     226        xcutplane       0
     227        ycutplane       0
     228        zcutplane       0
    212229        xposition       0
    213230        yposition       0
    214231        zposition       0
    215         xdirection      -1
    216         ydirection      -1
    217         zdirection      -1
    218232        visible         1
    219233        labels          1
     234    }]
     235    array set _cutplane [subst {
     236        xvisible        0
     237        yvisible        0
     238        zvisible        0
     239        xposition       0
     240        yposition       0
     241        zposition       0
     242        visible         1
    220243    }]
    221244    array set _volume [subst {
     
    302325    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    303326
     327    itk_component add volume {
     328        Rappture::PushButton $f.volume \
     329            -onimage [Rappture::icon volume-on] \
     330            -offimage [Rappture::icon volume-off] \
     331            -variable [itcl::scope _volume(visible)] \
     332            -command [itcl::code $this AdjustSetting volume-visible]
     333    }
     334    $itk_component(volume) select
     335    Rappture::Tooltip::for $itk_component(volume) \
     336        "Toggle the volume on/off"
     337    pack $itk_component(volume) -padx 2 -pady 2
     338
     339    itk_component add streamlines {
     340        Rappture::PushButton $f.streamlines \
     341            -onimage [Rappture::icon stream] \
     342            -offimage [Rappture::icon stream] \
     343            -variable [itcl::scope _streamlines(visible)] \
     344            -command [itcl::code $this AdjustSetting streamlines-visible] \
     345    }
     346    $itk_component(streamlines) select
     347    Rappture::Tooltip::for $itk_component(streamlines) \
     348        "Toggle the streamlines on/off"
     349    pack $itk_component(streamlines) -padx 2 -pady 2
     350
    304351    if { [catch {
    305352        BuildVolumeTab
    306353        BuildStreamsTab
    307354        BuildAxisTab
    308         BuildCutawayTab
     355        BuildCutplaneTab
    309356        BuildCameraTab
    310357    } errs] != 0 } {
     
    402449    $_dispatcher cancel !resize
    403450    $_dispatcher cancel !rotate
     451    $_dispatcher cancel !xcutplane
     452    $_dispatcher cancel !ycutplane
     453    $_dispatcher cancel !zcutplane
    404454    image delete $_image(plot)
    405455    image delete $_image(download)
     
    457507}
    458508
     509itcl::body Rappture::VtkStreamlinesViewer::EventuallySetCutplane { axis args } {
     510    if { !$_cutplanePending } {
     511        set _cutplanePending 1
     512        $_dispatcher event -after 100 !${axis}cutplane
     513    }
     514}
     515
    459516# ----------------------------------------------------------------------
    460517# USAGE: add <dataobj> ?<settings>?
     
    465522# ----------------------------------------------------------------------
    466523itcl::body Rappture::VtkStreamlinesViewer::add {dataobj {settings ""}} {
     524    puts stderr "add dataobj=$dataobj settings=$settings"
    467525    array set params {
    468526        -color auto
     
    509567# ----------------------------------------------------------------------
    510568itcl::body Rappture::VtkStreamlinesViewer::delete {args} {
     569    puts stderr "[info level -1]: delete args=$args"
    511570    if { [llength $args] == 0} {
    512571        set args $_dlist
     
    545604# ----------------------------------------------------------------------
    546605itcl::body Rappture::VtkStreamlinesViewer::get {args} {
     606    puts stderr "get args=$args"
    547607    if {[llength $args] == 0} {
    548608        set args "-objects"
     
    616676# ----------------------------------------------------------------------
    617677itcl::body Rappture::VtkStreamlinesViewer::scale {args} {
     678    puts stderr "scale args=$args"
    618679    array unset _limits
    619680    foreach dataobj $args {
     
    657718# ----------------------------------------------------------------------
    658719itcl::body Rappture::VtkStreamlinesViewer::download {option args} {
     720    puts stderr "download option=$option args=$args"
    659721    switch $option {
    660722        coming {
     
    866928# ----------------------------------------------------------------------
    867929itcl::body Rappture::VtkStreamlinesViewer::Rebuild {} {
     930    puts stderr "Rebuild"
    868931
    869932    set w [winfo width $itk_component(view)]
     
    924987                append _outbuf $bytes
    925988                set _datasets($tag) 1
     989                SetObjectStyle $dataobj $comp
    926990            }
    927991            lappend _obj2datasets($dataobj) $tag
     
    931995                SendCmd "dataset visible 0 $tag"
    932996            }
    933             SetObjectStyle $dataobj $comp
    934997        }
    935998    }
     
    10161079# ----------------------------------------------------------------------
    10171080itcl::body Rappture::VtkStreamlinesViewer::Zoom {option} {
     1081    puts stderr "Zoom option=$option"
    10181082    switch -- $option {
    10191083        "in" {
     
    10501114
    10511115itcl::body Rappture::VtkStreamlinesViewer::PanCamera {} {
     1116    puts stderr "PanCamera"
    10521117    set x $_view(xpan)
    10531118    set y $_view(ypan)
     
    10651130# ----------------------------------------------------------------------
    10661131itcl::body Rappture::VtkStreamlinesViewer::Rotate {option x y} {
     1132    puts stderr "Rotate option=$option x=$x y=$y"
    10671133    switch -- $option {
    10681134        "click" {
     
    11231189# ----------------------------------------------------------------------
    11241190itcl::body Rappture::VtkStreamlinesViewer::Pan {option x y} {
     1191    puts stderr "Pan option=$option x=$x y=$y"
    11251192    switch -- $option {
    11261193        "set" {
     
    11871254#
    11881255itcl::body Rappture::VtkStreamlinesViewer::AdjustSetting {what {value ""}} {
     1256    puts stderr "AdjustSetting what=$what value=$value"
    11891257    if { ![isconnected] } {
    11901258        return
     
    12471315            SendCmd "axis flymode $mode"
    12481316        }
    1249         "axis-xcutaway" - "axis-ycutaway" - "axis-zcutaway" {
    1250             set axis [string range $what 5 5]
    1251             set bool $_axis(${axis}cutaway)
     1317        "xcutplane-visible" - "ycutplane-visible" - "zcutplane-visible" {
     1318            set axis [string range $what 0 0]
     1319            set bool $_cutplane(${axis}visible)
     1320            puts stderr "axis=$axis, bool=$bool"
    12521321            if { $bool } {
    1253                 set pos [expr $_axis(${axis}position) * 0.01]
    1254                 set dir $_axis(${axis}direction)
    12551322                $itk_component(${axis}CutScale) configure -state normal \
    12561323                    -troughcolor white
    1257                 SendCmd "renderer clipplane $axis $pos $dir"
    12581324            } else {
    12591325                $itk_component(${axis}CutScale) configure -state disabled \
    12601326                    -troughcolor grey82
    1261                 SendCmd "renderer clipplane $axis 1 -1"
    12621327            }
    1263         }
    1264         "axis-xposition" - "axis-yposition" - "axis-zposition" -
    1265         "axis-xdirection" - "axis-ydirection" - "axis-zdirection" {
    1266             set axis [string range $what 5 5]
    1267             #set dir $_axis(${axis}direction)
    1268             set pos [expr $_axis(${axis}position) * 0.01]
    1269             SendCmd "renderer clipplane ${axis} $pos -1"
     1328            puts stderr "cutplane axis $axis $bool"
     1329            SendCmd "cutplane axis $axis $bool"
     1330            SendCmd "cutplane colormode vmag"
     1331        }
     1332        "xcutplane-position" - "ycutplane-position" - "zcutplane-position" {
     1333            set axis [string range $what 0 0]
     1334            set pos [expr $_cutplane(${axis}position) * 0.01]
     1335            puts stderr "cutplane slice ${axis} ${pos}"
     1336            SendCmd "cutplane slice ${axis} ${pos}"
     1337            set _cutplanePending 0
    12701338        }
    12711339        "streamlines-seeds" {
     
    13241392            }
    13251393        }
     1394        "streamlines-field" {
     1395            set field [$itk_component(field) value]
     1396            set mode scalar
     1397            if { $field == "U" } {
     1398                set mode vmag
     1399            }
     1400            foreach dataset [CurrentDatasets -visible $_first] {
     1401                puts stderr "streamlines colormode ${mode} $dataset"
     1402                SendCmd "dataset scalar ${field} $dataset"
     1403                SendCmd "streamlines colormode ${mode} $dataset"
     1404                SendCmd "streamlines colormode ${mode} $dataset"
     1405                #SendCmd "dataset vector ${field} $dataset"
     1406            }
     1407            RequestLegend $mode
     1408        }
    13261409        default {
    13271410            error "don't know how to fix $what"
     
    13371420#       to be vertical when drawn.
    13381421#
    1339 itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} {
     1422itcl::body Rappture::VtkStreamlinesViewer::RequestLegend { {mode vmag} } {
     1423    puts stderr "RequestLegend mode=$mode"
    13401424    #puts stderr "RequestLegend _first=$_first"
    13411425    #puts stderr "RequestLegend width=$_width height=$_height"
     
    13441428    set c $itk_component(legend)
    13451429    set w 12
    1346     set h [expr {$_height - 2 * ($lineht + 2)}]
     1430    set h [expr {$_height - 3 * ($lineht + 2)}]
    13471431    if { $h < 1} {
    13481432        return
     
    13531437        if { [info exists _dataset2style($dataset)] } {
    13541438            #puts stderr "RequestLegend w=$w h=$h"
    1355             SendCmd "legend $_dataset2style($dataset) vmag {} $w $h 0"
     1439            SendCmd "legend $_dataset2style($dataset) $mode {} $w $h 0"
    13561440            break;
    13571441        }
     
    13631447#
    13641448itcl::body Rappture::VtkStreamlinesViewer::SetColormap { dataobj comp } {
     1449    puts stderr "SetColormap dataobj=$dataobj comp=$comp"
    13651450    array set style {
    13661451        -color rainbow
     
    13851470    }
    13861471    SendCmd "streamlines colormap $colormap $tag"
     1472    SendCmd "cutplane colormap $colormap $tag"
    13871473    return $colormap
    13881474}
     
    13921478#
    13931479itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { colormap dataobj comp } {
     1480    puts stderr "BuildColormap colormap=$colormap dataobj=$dataobj comp=$comp"
    13941481    array set style {
    13951482        -color rainbow
     
    14421529
    14431530itcl::body Rappture::VtkStreamlinesViewer::limits { dataobj } {
    1444 
     1531    puts stderr "[info level -1]: limits dataobj=$dataobj"
    14451532    array unset _limits $dataobj-*
    14461533    foreach comp [$dataobj components] {
     
    14541541            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
    14551542            $reader SetFileName $tmpfile
    1456             $reader ReadAllNormalsOn
    14571543            $reader ReadAllScalarsOn
    14581544            $reader ReadAllVectorsOn
     
    14631549            set pointData [$output GetPointData]
    14641550            puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
    1465             puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]"
    1466             puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]"
    1467             puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]"
    14681551            puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
    14691552            puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
     
    14711554            set pointData [$output GetPointData]
    14721555            puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
     1556            for { set i 0 } { $i < [$fieldData GetNumberOfArrays] } { incr i } {
     1557                puts stderr [$fieldData GetArrayName $i]
     1558            }
    14731559            puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
     1560            for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } {
     1561                set name [$pointData GetArrayName $i]
     1562                if { ![info exists _fields($name)] } {
     1563                    $itk_component(field) choices insert end "$name" "$name"
     1564                    set _fields($name) 1
     1565                }
     1566            }
    14741567            puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
    14751568            puts stderr "point \#components=[$pointData GetNumberOfComponents]"
     
    16191712        -command [itcl::code $this AdjustSetting streamlines-scale]
    16201713
     1714    label $inner.field_l -text "Field" -font "Arial 9"
     1715    itk_component add field {
     1716        Rappture::Combobox $inner.field -width 10 -editable no
     1717    }
     1718    bind $inner.field <<Value>> \
     1719        [itcl::code $this AdjustSetting streamlines-field]
     1720
    16211721    blt::table $inner \
    16221722        0,0 $inner.streamlines -anchor w -pady 2 -cspan 2 \
    16231723        1,0 $inner.lighting    -anchor w -pady 2 -cspan 2 \
    16241724        2,0 $inner.seeds       -anchor w -pady 2 -cspan 2 \
    1625         3,0 $inner.density_l   -anchor w -pady 2 \
     1725        3,0 $inner.density_l   -anchor w -pady 2 -cspan 2 \
    16261726        4,0 $inner.density     -fill x   -pady 2 -cspan 2 \
    16271727        5,0 $inner.mode_l      -anchor w -pady 2  \
    16281728        5,1 $inner.mode        -anchor w -pady 2  \
    1629         6,0 $inner.opacity_l   -anchor w -pady 2  \
    1630         7,0 $inner.opacity     -fill x   -pady 2 -cspan 2
     1729        6,0 $inner.opacity_l   -anchor w -pady 2 -cspan 2 \
     1730        7,0 $inner.opacity     -fill x   -pady 2 -cspan 2 \
     1731        8,0 $inner.field_l     -anchor w -pady 2  \
     1732        8,1 $inner.field       -anchor w -pady 2  \
     1733       
    16311734
    16321735    blt::table configure $inner r* c* -resize none
    1633     blt::table configure $inner r8 c1 c2 -resize expand
     1736    blt::table configure $inner r9 c1 c2 -resize expand
    16341737}
    16351738
     
    17341837}
    17351838
    1736 itcl::body Rappture::VtkStreamlinesViewer::BuildCutawayTab {} {
     1839itcl::body Rappture::VtkStreamlinesViewer::BuildCutplaneTab {} {
    17371840
    17381841    set fg [option get $itk_component(hull) font Font]
    17391842   
    17401843    set inner [$itk_component(main) insert end \
    1741         -title "Cutaway Along Axis" \
     1844        -title "Cutplane Along Axis" \
    17421845        -icon [Rappture::icon cutbutton]]
    17431846
     
    17491852            -onimage [Rappture::icon x-cutplane] \
    17501853            -offimage [Rappture::icon x-cutplane] \
    1751             -command [itcl::code $this AdjustSetting axis-xcutaway] \
    1752             -variable [itcl::scope _axis(xcutaway)]
     1854            -command [itcl::code $this AdjustSetting xcutplane-visible] \
     1855            -variable [itcl::scope _cutplane(xvisible)]
    17531856    }
    17541857    Rappture::Tooltip::for $itk_component(xCutButton) \
    1755         "Toggle the X-axis cutaway on/off"
     1858        "Toggle the X-axis cutplane on/off"
    17561859
    17571860    itk_component add xCutScale {
     
    17591862            -width 10 -orient vertical -showvalue yes \
    17601863            -borderwidth 1 -highlightthickness 0 \
    1761             -command [itcl::code $this Slice move x] \
    1762             -variable [itcl::scope _axis(xposition)]
     1864            -command [itcl::code $this EventuallySetCutplane x] \
     1865            -variable [itcl::scope _cutplane(xposition)]
    17631866    } {
    17641867        usual
    17651868        ignore -borderwidth -highlightthickness
    17661869    }
    1767     # Set the default cutaway value before disabling the scale.
     1870    # Set the default cutplane value before disabling the scale.
    17681871    $itk_component(xCutScale) set 100
    17691872    $itk_component(xCutScale) configure -state disabled
    17701873    Rappture::Tooltip::for $itk_component(xCutScale) \
    17711874        "@[itcl::code $this Slice tooltip x]"
    1772 
    1773     itk_component add xDirButton {
    1774         Rappture::PushButton $inner.xdir \
    1775             -onimage [Rappture::icon arrow-down] \
    1776             -onvalue -1 \
    1777             -offimage [Rappture::icon arrow-up] \
    1778             -offvalue 1 \
    1779             -command [itcl::code $this AdjustSetting axis-xdirection] \
    1780             -variable [itcl::scope _axis(xdirection)]
    1781     }
    1782     set _axis(xdirection) -1
    1783     Rappture::Tooltip::for $itk_component(xDirButton) \
    1784         "Toggle the direction of the X-axis cutaway"
    17851875
    17861876    # Y-value slicer...
     
    17891879            -onimage [Rappture::icon y-cutplane] \
    17901880            -offimage [Rappture::icon y-cutplane] \
    1791             -command [itcl::code $this AdjustSetting axis-ycutaway] \
    1792             -variable [itcl::scope _axis(ycutaway)]
     1881            -command [itcl::code $this AdjustSetting ycutplane-visible] \
     1882            -variable [itcl::scope _cutplane(yvisible)]
    17931883    }
    17941884    Rappture::Tooltip::for $itk_component(yCutButton) \
    1795         "Toggle the Y-axis cutaway on/off"
     1885        "Toggle the Y-axis cutplane on/off"
    17961886
    17971887    itk_component add yCutScale {
     
    17991889            -width 10 -orient vertical -showvalue yes \
    18001890            -borderwidth 1 -highlightthickness 0 \
    1801             -command [itcl::code $this Slice move y] \
    1802             -variable [itcl::scope _axis(yposition)]
     1891            -command [itcl::code $this EventuallySetCutplane y] \
     1892            -variable [itcl::scope _cutplane(yposition)]
    18031893    } {
    18041894        usual
     
    18071897    Rappture::Tooltip::for $itk_component(yCutScale) \
    18081898        "@[itcl::code $this Slice tooltip y]"
    1809     # Set the default cutaway value before disabling the scale.
     1899    # Set the default cutplane value before disabling the scale.
    18101900    $itk_component(yCutScale) set 100
    18111901    $itk_component(yCutScale) configure -state disabled
    1812 
    1813     itk_component add yDirButton {
    1814         Rappture::PushButton $inner.ydir \
    1815             -onimage [Rappture::icon arrow-down] \
    1816             -onvalue -1 \
    1817             -offimage [Rappture::icon arrow-up] \
    1818             -offvalue 1 \
    1819             -command [itcl::code $this AdjustSetting axis-ydirection] \
    1820             -variable [itcl::scope _axis(ydirection)]
    1821     }
    1822     Rappture::Tooltip::for $itk_component(yDirButton) \
    1823         "Toggle the direction of the Y-axis cutaway"
    1824     set _axis(ydirection) -1
    18251902
    18261903    # Z-value slicer...
     
    18291906            -onimage [Rappture::icon z-cutplane] \
    18301907            -offimage [Rappture::icon z-cutplane] \
    1831             -command [itcl::code $this AdjustSetting axis-zcutaway] \
    1832             -variable [itcl::scope _axis(zcutaway)]
     1908            -command [itcl::code $this AdjustSetting zcutplane-visible] \
     1909            -variable [itcl::scope _cutplane(zvisible)]
    18331910    }
    18341911    Rappture::Tooltip::for $itk_component(zCutButton) \
    1835         "Toggle the Z-axis cutaway on/off"
     1912        "Toggle the Z-axis cutplane on/off"
    18361913
    18371914    itk_component add zCutScale {
     
    18391916            -width 10 -orient vertical -showvalue yes \
    18401917            -borderwidth 1 -highlightthickness 0 \
    1841             -command [itcl::code $this Slice move z] \
    1842             -variable [itcl::scope _axis(zposition)]
     1918            -command [itcl::code $this EventuallySetCutplane z] \
     1919            -variable [itcl::scope _cutplane(zposition)]
    18431920    } {
    18441921        usual
     
    18501927    Rappture::Tooltip::for $itk_component(zCutScale) \
    18511928        "@[itcl::code $this Slice tooltip z]"
    1852 
    1853     itk_component add zDirButton {
    1854         Rappture::PushButton $inner.zdir \
    1855             -onimage [Rappture::icon arrow-down] \
    1856             -onvalue -1 \
    1857             -offimage [Rappture::icon arrow-up] \
    1858             -offvalue 1 \
    1859             -command [itcl::code $this AdjustSetting axis-zdirection] \
    1860             -variable [itcl::scope _axis(zdirection)]
    1861     }
    1862     set _axis(zdirection) -1
    1863     Rappture::Tooltip::for $itk_component(zDirButton) \
    1864         "Toggle the direction of the Z-axis cutaway"
    18651929
    18661930    blt::table $inner \
     
    18821946#
    18831947itcl::body Rappture::VtkStreamlinesViewer::camera {option args} {
     1948    puts stderr "camera option=$option args=$args"
    18841949    switch -- $option {
    18851950        "show" {
     
    19462011        }
    19472012    }
    1948     return [list .txt $bytes]
     2013    return [list .vtk $bytes]
    19492014}
    19502015
     
    20012066
    20022067itcl::body Rappture::VtkStreamlinesViewer::SetObjectStyle { dataobj comp } {
     2068    puts stderr "SetObjectStyle dataobj=$dataobj comp=$comp"
    20032069    # Parse style string.
    20042070    set tag $dataobj-$comp
     
    20302096        set _seeds($dataobj) 1
    20312097    }
     2098    SendCmd "cutplane add $tag"
     2099    SendCmd "cutplane colormode vmag $tag"
     2100    SendCmd "cutplane edges 0 $tag"
     2101    SendCmd "cutplane wireframe 0 $tag"
     2102    SendCmd "cutplane lighting 1 $tag"
     2103    SendCmd "cutplane linewidth 1 $tag"
     2104    #SendCmd "cutplane linecolor 1 1 1 $tag"
     2105    #puts stderr "cutplane axis $axis $bool"
     2106    #SendCmd "cutplane visible $tag"
     2107    SendCmd "cutplane colormode vmag $tag"
     2108    foreach axis { x y z } {
     2109        SendCmd "cutplane slice $axis 1.0 $tag"
     2110        SendCmd "cutplane axis $axis 0 $tag"
     2111    }
     2112
    20322113    SendCmd "polydata add $tag"
    20332114    SendCmd "polydata edges $settings(-edges) $tag"
     
    20612142# ----------------------------------------------------------------------
    20622143itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {
    2063     #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"
     2144    puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"
    20642145    set _limits(vmin) $vmin
    20652146    set _limits(vmax) $vmax
     
    20722153        $_image(legend) configure -data $bytes
    20732154        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    2074         DrawLegend
     2155        DrawLegend $title
    20752156    }
    20762157}
     
    20822163#       of the contour plot area.
    20832164#
    2084 itcl::body Rappture::VtkStreamlinesViewer::DrawLegend {} {
     2165itcl::body Rappture::VtkStreamlinesViewer::DrawLegend { title } {
    20852166    set c $itk_component(view)
    20862167    set w [winfo width $c]
     
    20922173        set x [expr $w - 2]
    20932174        if { [$c find withtag "legend"] == "" } {
    2094             $c create image $x [expr {$lineht+2}] \
     2175            set y 2
     2176            $c create text $x $y \
    20952177                -anchor ne \
    2096                 -image $_image(legend) -tags "colormap legend"
    2097             $c create text $x 2 \
     2178                -fill $itk_option(-plotforeground) -tags "title legend" \
     2179                -font $font
     2180            incr y $lineht
     2181            $c create text $x $y \
    20982182                -anchor ne \
    20992183                -fill $itk_option(-plotforeground) -tags "vmax legend" \
    21002184                -font $font
     2185            incr y $lineht
     2186            $c create image $x $y \
     2187                -anchor ne \
     2188                -image $_image(legend) -tags "colormap legend"
    21012189            $c create text $x [expr {$h-2}] \
    21022190                -anchor se \
     
    21082196        }
    21092197        # Reset the item coordinates according the current size of the plot.
    2110         $c coords colormap $x [expr {$lineht+2}]
     2198        $c itemconfigure title -text $title
    21112199        if { $_limits(vmin) != "" } {
    21122200            $c itemconfigure vmin -text [format %g $_limits(vmin)]
     
    21152203            $c itemconfigure vmax -text [format %g $_limits(vmax)]
    21162204        }
    2117         $c coords vmin $x [expr {$h-2}]
    2118         $c coords vmax $x 2
     2205        set y 2
     2206        puts stderr "$c coords title $x $y"
     2207        $c coords title $x $y
     2208        incr y $lineht
     2209        $c coords vmax $x $y
     2210        puts stderr "$c coords vmin $x $y"
     2211        incr y $lineht
     2212        $c coords colormap $x $y
     2213        puts stderr "$c coords vmin $x [expr {$h - 2}]"
     2214        $c coords vmin $x [expr {$h - 2}]
    21192215    }
    21202216}
     
    21572253    set coords [$c coords colormap]
    21582254    set imgX [expr $w - [image width $_image(legend)] - 2]
    2159     set imgY [expr $y - $lineht - 2]
     2255    set imgY [expr $y - 2 * ($lineht + 2)]
    21602256
    21612257    # Make a swatch of the selected color
     
    22022298            }
    22032299            set newpos [expr {0.01*$newval}]
    2204             SendCmd "renderer clipplane $axis $newpos -1"
     2300            SendCmd "cutplane slice $axis $newpos"
    22052301        }
    22062302        "tooltip" {
Note: See TracChangeset for help on using the changeset viewer.