Changeset 5341 for trunk/gui


Ignore:
Timestamp:
Apr 28, 2015, 7:44:36 PM (9 years ago)
Author:
ldelgass
Message:

volume viewer cleanups

File:
1 edited

Legend:

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

    r5336 r5341  
    104104    private method DoRotate {}
    105105    private method DrawLegend {}
    106     private method DrawLegendOld {}
    107106    private method EnterLegend { x y }
    108107    private method EventuallyResize { w h }
     
    16551654
    16561655itcl::body Rappture::VtkVolumeViewer::BuildViewTab {} {
    1657     set fg [option get $itk_component(hull) font Font]
    1658     #set bfg [option get $itk_component(hull) boldFont Font]
     1656    set font [option get $itk_component(hull) font Font]
     1657    #set bfont [option get $itk_component(hull) boldFont Font]
    16591658
    16601659    set inner [$itk_component(main) insert end \
     
    16671666        -variable [itcl::scope _settings(-axesvisible)] \
    16681667        -command [itcl::code $this AdjustSetting -axesvisible] \
    1669         -font "Arial 9"
     1668        -font $font
    16701669
    16711670    checkbutton $inner.outline \
     
    16731672        -variable [itcl::scope _settings(-volumeoutline)] \
    16741673        -command [itcl::code $this AdjustSetting -volumeoutline] \
    1675         -font "Arial 9"
     1674        -font $font
    16761675
    16771676    checkbutton $inner.legend \
     
    16791678        -variable [itcl::scope _settings(-legendvisible)] \
    16801679        -command [itcl::code $this AdjustSetting -legendvisible] \
    1681         -font "Arial 9"
     1680        -font $font
    16821681
    16831682    checkbutton $inner.volume \
     
    16851684        -variable [itcl::scope _settings(-volumevisible)] \
    16861685        -command [itcl::code $this AdjustSetting -volumevisible] \
    1687         -font "Arial 9"
    1688 
    1689     label $inner.background_l -text "Background" -font "Arial 9"
     1686        -font $font
     1687
     1688    label $inner.background_l -text "Background" -font $font
    16901689    itk_component add background {
    16911690        Rappture::Combobox $inner.background -width 10 -editable no
    16921691    }
    16931692    $inner.background choices insert end \
    1694         "black"              "black"            \
    1695         "white"              "white"            \
    1696         "grey"               "grey"
     1693        "black" "black" \
     1694        "white" "white" \
     1695        "grey"  "grey"
    16971696
    16981697    $itk_component(background) value $_settings(-background)
     
    17011700
    17021701    blt::table $inner \
    1703         0,0 $inner.axes  -cspan 2 -anchor w \
    1704         1,0 $inner.outline  -cspan 2 -anchor w \
    1705         2,0 $inner.volume  -cspan 2 -anchor w \
    1706         3,0 $inner.legend  -cspan 2 -anchor w \
    1707         4,0 $inner.background_l       -anchor e -pady 2 \
    1708         4,1 $inner.background                   -fill x \
     1702        0,0 $inner.axes -cspan 2 -anchor w \
     1703        1,0 $inner.outline -cspan 2 -anchor w \
     1704        2,0 $inner.volume -cspan 2 -anchor w \
     1705        3,0 $inner.legend -cspan 2 -anchor w \
     1706        4,0 $inner.background_l -anchor e -pady 2 \
     1707        4,1 $inner.background -fill x
    17091708
    17101709    blt::table configure $inner r* -resize none
     
    17141713itcl::body Rappture::VtkVolumeViewer::BuildVolumeTab {} {
    17151714    set font [option get $itk_component(hull) font Font]
    1716     #set bfont [option get $itk_component(hull) boldFont Font]
     1715    set bfont [option get $itk_component(hull) boldFont Font]
    17171716
    17181717    set inner [$itk_component(main) insert end \
     
    17361735    label $inner.lighting_l \
    17371736        -text "Lighting / Material Properties" \
    1738         -font "Arial 9 bold"
     1737        -font $bfont
    17391738
    17401739    checkbutton $inner.lighting \
     
    17961795
    17971796    label $inner.transferfunction_l \
    1798         -text "Transfer Function" -font "Arial 9 bold"
     1797        -text "Transfer Function" -font $bfont
    17991798
    18001799    label $inner.thin -text "Thin" -font $font
     
    18231822    }
    18241823    $inner.blendmode choices insert end \
    1825         "composite"          "Composite"         \
    1826         "max_intensity"      "Maximum Intensity" \
    1827         "additive"           "Additive"
     1824        "composite"     "Composite"         \
     1825        "max_intensity" "Maximum Intensity" \
     1826        "additive"      "Additive"
    18281827
    18291828    $itk_component(blendmode) value \
     
    18341833    blt::table $inner \
    18351834        0,0 $inner.volcomponents_l -anchor e -cspan 2 \
    1836         0,2 $inner.volcomponents             -cspan 3 -fill x \
    1837         1,0 $inner.field_l   -anchor e -cspan 2  \
    1838         1,2 $inner.field               -cspan 3 -fill x \
     1835        0,2 $inner.volcomponents -cspan 3 -fill x \
     1836        1,0 $inner.field_l -anchor e -cspan 2  \
     1837        1,2 $inner.field -cspan 3 -fill x \
    18391838        2,0 $inner.lighting_l -anchor w -cspan 4 \
    1840         3,1 $inner.lighting   -anchor w -cspan 3 \
    1841         4,1 $inner.ambient_l       -anchor e -pady 2 \
    1842         4,2 $inner.ambient                   -cspan 3 -fill x \
    1843         5,1 $inner.diffuse_l       -anchor e -pady 2 \
    1844         5,2 $inner.diffuse                   -cspan 3 -fill x \
    1845         6,1 $inner.specularLevel_l -anchor e -pady 2 \
    1846         6,2 $inner.specularLevel             -cspan 3 -fill x \
    1847         7,1 $inner.specularExponent_l -anchor e -pady 2 \
    1848         7,2 $inner.specularExponent          -cspan 3 -fill x \
    1849         8,1 $inner.visibility    -anchor w -cspan 3 \
    1850         9,1 $inner.quality_l -anchor e -pady 2 \
    1851         9,2 $inner.quality                     -cspan 3 -fill x \
    1852         10,0 $inner.transferfunction_l -anchor w              -cspan 4 \
    1853         11,1 $inner.opacity_l -anchor e -pady 2 \
    1854         11,2 $inner.opacity                    -cspan 3 -fill x \
    1855         12,1 $inner.colormap_l -anchor e  \
    1856         12,2 $inner.colormap                 -padx 2 -cspan 3 -fill x \
    1857         13,1 $inner.blendmode_l -anchor e  \
    1858         13,2 $inner.blendmode               -padx 2 -cspan 3 -fill x \
    1859         14,1 $inner.thin             -anchor e \
    1860         14,2 $inner.thickness                 -cspan 2 -fill x \
     1839        3,1 $inner.lighting -anchor w -cspan 3 \
     1840        4,1 $inner.ambient_l -anchor e \
     1841        4,2 $inner.ambient -cspan 3 -fill x \
     1842        5,1 $inner.diffuse_l -anchor e \
     1843        5,2 $inner.diffuse -cspan 3 -fill x \
     1844        6,1 $inner.specularLevel_l -anchor e \
     1845        6,2 $inner.specularLevel -cspan 3 -fill x \
     1846        7,1 $inner.specularExponent_l -anchor e \
     1847        7,2 $inner.specularExponent -cspan 3 -fill x \
     1848        8,1 $inner.visibility -anchor w -cspan 3 \
     1849        9,1 $inner.quality_l -anchor e \
     1850        9,2 $inner.quality -cspan 3 -fill x \
     1851        10,0 $inner.transferfunction_l -anchor w -cspan 4 \
     1852        11,1 $inner.opacity_l -anchor e \
     1853        11,2 $inner.opacity -cspan 3 -fill x \
     1854        12,1 $inner.colormap_l -anchor e \
     1855        12,2 $inner.colormap -padx 2 -cspan 3 -fill x \
     1856        13,1 $inner.blendmode_l -anchor e \
     1857        13,2 $inner.blendmode -padx 2 -cspan 3 -fill x \
     1858        14,1 $inner.thin -anchor e \
     1859        14,2 $inner.thickness -cspan 2 -fill x \
    18611860        14,4 $inner.thick -anchor w
    18621861
     
    18681867
    18691868itcl::body Rappture::VtkVolumeViewer::BuildAxisTab {} {
    1870     set fg [option get $itk_component(hull) font Font]
    1871     #set bfg [option get $itk_component(hull) boldFont Font]
     1869    set font [option get $itk_component(hull) font Font]
     1870    #set bfont [option get $itk_component(hull) boldFont Font]
    18721871
    18731872    set inner [$itk_component(main) insert end \
     
    18801879        -variable [itcl::scope _settings(-axesvisible)] \
    18811880        -command [itcl::code $this AdjustSetting -axesvisible] \
    1882         -font "Arial 9"
     1881        -font $font
    18831882
    18841883    checkbutton $inner.labels \
     
    18861885        -variable [itcl::scope _settings(-axislabels)] \
    18871886        -command [itcl::code $this AdjustSetting -axislabels] \
    1888         -font "Arial 9"
    1889     label $inner.grid_l -text "Grid" -font "Arial 9"
     1887        -font $font
     1888    label $inner.grid_l -text "Grid" -font $font
    18901889    checkbutton $inner.xgrid \
    18911890        -text "X" \
    18921891        -variable [itcl::scope _settings(-xgrid)] \
    18931892        -command [itcl::code $this AdjustSetting -xgrid] \
    1894         -font "Arial 9"
     1893        -font $font
    18951894    checkbutton $inner.ygrid \
    18961895        -text "Y" \
    18971896        -variable [itcl::scope _settings(-ygrid)] \
    18981897        -command [itcl::code $this AdjustSetting -ygrid] \
    1899         -font "Arial 9"
     1898        -font $font
    19001899    checkbutton $inner.zgrid \
    19011900        -text "Z" \
    19021901        -variable [itcl::scope _settings(-zgrid)] \
    19031902        -command [itcl::code $this AdjustSetting -zgrid] \
    1904         -font "Arial 9"
     1903        -font $font
    19051904    checkbutton $inner.minorticks \
    19061905        -text "Minor Ticks" \
    19071906        -variable [itcl::scope _settings(-axisminorticks)] \
    19081907        -command [itcl::code $this AdjustSetting -axisminorticks] \
    1909         -font "Arial 9"
    1910 
    1911     label $inner.mode_l -text "Mode" -font "Arial 9"
     1908        -font $font
     1909
     1910    label $inner.mode_l -text "Mode" -font $font
    19121911
    19131912    itk_component add axismode {
     
    19241923    blt::table $inner \
    19251924        0,0 $inner.visible -anchor w -cspan 4 \
    1926         1,0 $inner.labels  -anchor w -cspan 4 \
    1927         2,0 $inner.minorticks  -anchor w -cspan 4 \
    1928         4,0 $inner.grid_l  -anchor w \
    1929         4,1 $inner.xgrid   -anchor w \
    1930         4,2 $inner.ygrid   -anchor w \
    1931         4,3 $inner.zgrid   -anchor w \
    1932         5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
    1933         5,1 $inner.mode    -fill x  -cspan 3
     1925        1,0 $inner.labels -anchor w -cspan 4 \
     1926        2,0 $inner.minorticks -anchor w -cspan 4 \
     1927        4,0 $inner.grid_l -anchor w \
     1928        4,1 $inner.xgrid -anchor w \
     1929        4,2 $inner.ygrid -anchor w \
     1930        4,3 $inner.zgrid -anchor w \
     1931        5,0 $inner.mode_l -anchor w -padx { 2 0 } \
     1932        5,1 $inner.mode -fill x -cspan 3
    19341933
    19351934    blt::table configure $inner r* c* -resize none
     
    19391938
    19401939itcl::body Rappture::VtkVolumeViewer::BuildCameraTab {} {
     1940    set font [option get $itk_component(hull) font Font]
    19411941    set inner [$itk_component(main) insert end \
    19421942        -title "Camera Settings" \
     
    19441944    $inner configure -borderwidth 4
    19451945
    1946     label $inner.view_l -text "view" -font "Arial 9"
     1946    label $inner.view_l -text "view" -font $font
    19471947    set f [frame $inner.view]
    19481948    foreach side { front back left right top bottom } {
     
    19601960    set labels { qx qy qz qw xpan ypan zoom }
    19611961    foreach tag $labels {
    1962         label $inner.${tag}label -text $tag -font "Arial 9"
    1963         entry $inner.${tag} -font "Arial 9"  -bg white \
     1962        label $inner.${tag}label -text $tag -font $font
     1963        entry $inner.${tag} -font $font  -bg white \
    19641964            -textvariable [itcl::scope _view(-$tag)]
    19651965        bind $inner.${tag} <Return> \
     
    19771977        -variable [itcl::scope _view(-ortho)] \
    19781978        -command [itcl::code $this camera set -ortho] \
    1979         -font "Arial 9"
     1979        -font $font
    19801980    blt::table $inner \
    19811981            $row,0 $inner.ortho -cspan 2 -anchor w -pady 2
     
    19891989
    19901990itcl::body Rappture::VtkVolumeViewer::BuildCutplaneTab {} {
    1991 
    1992     set fg [option get $itk_component(hull) font Font]
     1991    set font [option get $itk_component(hull) font Font]
    19931992
    19941993    set inner [$itk_component(main) insert end \
     
    20022001        -variable [itcl::scope _settings(-cutplanesvisible)] \
    20032002        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
    2004         -font "Arial 9"
     2003        -font $font
    20052004
    20062005    checkbutton $inner.lighting \
     
    20082007        -variable [itcl::scope _settings(-cutplanelighting)] \
    20092008        -command [itcl::code $this AdjustSetting -cutplanelighting] \
    2010         -font "Arial 9"
    2011 
    2012     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     2009        -font $font
     2010
     2011    label $inner.opacity_l -text "Opacity" -font $font
    20132012    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    20142013        -variable [itcl::scope _settings(-cutplaneopacity)] \
     
    23352334
    23362335#
    2337 # DrawLegendOld --
    2338 #
    2339 #       Draws the legend in it's own canvas which resides to the right
    2340 #       of the contour plot area.
    2341 #
    2342 itcl::body Rappture::VtkVolumeViewer::DrawLegendOld { } {
    2343     set fname $_curFldName
    2344     set c $itk_component(view)
    2345     set w [winfo width $c]
    2346     set h [winfo height $c]
    2347     set font "Arial 8"
    2348     set lineht [font metrics $font -linespace]
    2349 
    2350     if { [info exists _fields($fname)] } {
    2351         foreach { title units } $_fields($fname) break
    2352         if { $units != "" } {
    2353             set title [format "%s (%s)" $title $units]
    2354         }
    2355     } else {
    2356         set title $fname
    2357     }
    2358     if { $_settings(-legendvisible) } {
    2359         set x [expr $w - 2]
    2360         if { [$c find withtag "legend"] == "" } {
    2361             set y 2
    2362             $c create text $x $y \
    2363                 -anchor ne \
    2364                 -fill $itk_option(-plotforeground) -tags "title legend" \
    2365                 -font $font
    2366             incr y $lineht
    2367             $c create text $x $y \
    2368                 -anchor ne \
    2369                 -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2370                 -font $font
    2371             incr y $lineht
    2372             $c create image $x $y \
    2373                 -anchor ne \
    2374                 -image $_image(legend) -tags "colormap legend"
    2375             $c create text $x [expr {$h-2}] \
    2376                 -anchor se \
    2377                 -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2378                 -font $font
    2379             #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
    2380             $c bind colormap <Leave> [itcl::code $this LeaveLegend]
    2381             $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    2382         }
    2383         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2384         $c bind title <Enter> [itcl::code $this Combo activate]
    2385         $c bind title <Leave> [itcl::code $this Combo deactivate]
    2386         # Reset the item coordinates according the current size of the plot.
    2387         $c itemconfigure title -text $title
    2388         if { [info exists _limits($_curFldName)] } {
    2389             foreach { vmin vmax } $_limits($_curFldName) break
    2390             $c itemconfigure vmin -text [format %g $vmin]
    2391             $c itemconfigure vmax -text [format %g $vmax]
    2392         }
    2393         set y 2
    2394         $c coords title $x $y
    2395         incr y $lineht
    2396         $c coords vmax $x $y
    2397         incr y $lineht
    2398         $c coords colormap $x $y
    2399         $c coords vmin $x [expr {$h - 2}]
    2400     }
    2401 }
    2402 
    2403 #
    24042336# EnterLegend --
    24052337#
Note: See TracChangeset for help on using the changeset viewer.