Changeset 5280


Ignore:
Timestamp:
Apr 18, 2015, 6:57:07 AM (5 years ago)
Author:
ldelgass
Message:

More syncing closer to 1.4 branch

Location:
branches/1.3/gui/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/flowvisviewer.tcl

    r5279 r5280  
    237237        $this-streams           0
    238238        $this-volume            1
     239        $this-light             40
     240        $this-light2side        1
    239241        $this-opacity           50
     242        $this-thickness         350
    240243        $this-xcutplane         0
    241244        $this-xcutposition      0
     
    320323    set _image(legend) [image create photo]
    321324    itk_component add legend {
    322         canvas $itk_component(plotarea).legend \
    323             -height 50 -highlightthickness 0 -background black
     325        canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0
    324326    } {
    325327        usual
     
    15511553#              ignores the -markers option.  The problem is that we are forced
    15521554#              to compute the name from an increasing complex set of values:
    1553 #              color, levels, marker, opacity.  I think we're stuck doing it
    1554 #              now.
     1555#              color, levels, markers.
    15551556#
    15561557itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } {
     
    15581559        -color BCGYR
    15591560        -levels 6
    1560         -opacity 0.5
    15611561    }
    15621562    array set style [lindex [$dataobj components -style $cname] 0]
    1563     set _settings($this-opacity) [expr $style(-opacity) * 100]
    1564     set tf "$style(-color):$style(-levels):$style(-opacity)"
     1563    set tf "$style(-color):$style(-levels)"
    15651564    set _dataset2style($dataobj-$cname) $tf
    15661565    lappend _style2datasets($tf) $dataobj $cname
     
    15811580        -color BCGYR
    15821581        -levels 6
    1583         -opacity 0.5
    15841582    }
    15851583    set dataobj ""; set comp ""
     
    16001598    #        ignores the -markers option.  The problem is that we are forced
    16011599    #        to compute the name from an increasing complex set of values:
    1602     #        color, levels, marker, opacity.  I think the cow's out of the
    1603     #        barn on this one.
    1604 
     1600    #        color, levels, markers.
    16051601    if { ![info exists _isomarkers($tf)] } {
    16061602        # Have to defer creation of isomarkers until we have data limits
     
    16181614    } else {
    16191615        set cmap [ColorsToColormap $style(-color)]
    1620     }
    1621 
    1622     if { ![info exists _settings($this-opacity)] } {
    1623         set _settings($this-opacity) [expr $style(-opacity) * 100]
    16241616    }
    16251617
     
    16911683itcl::configbody Rappture::FlowvisViewer::plotbackground {
    16921684    if { [isconnected] } {
    1693         foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
    1694         #fix this!
    1695         #SendCmd "color background $r $g $b"
     1685        set color $itk_option(-plotbackground)
     1686        set rgb [Color2RGB $color]
     1687        SendCmd "screen bgcolor $rgb"
     1688        $itk_component(legend) configure -background $color
    16961689    }
    16971690}
     
    17021695itcl::configbody Rappture::FlowvisViewer::plotforeground {
    17031696    if { [isconnected] } {
    1704         foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
    1705         #fix this!
    1706         #SendCmd "color background $r $g $b"
     1697        set color $itk_option(-plotforeground)
     1698        set rgb [Color2RGB $color]
     1699        SendCmd "volume outline color $rgb"
     1700        SendCmd "grid axiscolor $rgb"
     1701        SendCmd "grid linecolor $rgb"
     1702        $itk_component(legend) itemconfigure labels -fill $color
     1703        $itk_component(legend) itemconfigure limits -fill $color
    17071704    }
    17081705}
     
    17381735            set x [expr {double($i)/($levels+1)}]
    17391736            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1737            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    17401738            $m relval $x
    17411739            lappend _isomarkers($tf) $m
     
    17441742        foreach x $levels {
    17451743            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1744            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    17461745            $m relval $x
    17471746            lappend _isomarkers($tf) $m
     
    17711770            set value [expr {$value * 0.01}]
    17721771            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1772            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    17731773            $m relval $value
    17741774            lappend _isomarkers($tf) $m
     
    17761776            # ${n} : Set absolute value.
    17771777            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1778            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    17781779            $m absval $value
    17791780            lappend _isomarkers($tf) $m
     
    17961797    set c $itk_component(legend)
    17971798    set m [Rappture::IsoMarker \#auto $c $this $tf]
     1799    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    17981800    set w [winfo width $c]
    17991801    $m relval [expr {double($x-10)/($w-20)}]
     
    19631965
    19641966itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
    1965     foreach { key value } {
    1966         light2side      1
    1967         light           40
    1968         transp          50
    1969         opacity         100
    1970         thickness       350
    1971     } {
    1972         set _settings($this-$key) $value
    1973     }
    1974 
    19751967    set inner [$itk_component(main) insert end \
    19761968        -title "Volume Settings" \
  • branches/1.3/gui/scripts/isomarker.tcl

    r5277 r5280  
    5353    set _tick [$c create image 0 $h \
    5454                   -image $_normalIcon -anchor s \
    55                    -tags "$this $obj" -state hidden]
     55                   -tags "tick $this $obj" -state hidden]
    5656    set _label [$c create text 0 $h \
    5757                    -anchor n -fill white -font "Helvetica 8" \
    58                     -tags "$this $obj" -state hidden]
     58                    -tags "labels $this $obj" -state hidden]
    5959    $c bind $_tick <Enter>           [itcl::code $this EnterTick]
    6060    $c bind $_tick <Leave>           [itcl::code $this LeaveTick]
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r5271 r5280  
    215215        -ypan                   $_view(-ypan)
    216216        -zoom                   $_view(-zoom)
     217        $this-axes              1
     218        $this-grid              0
     219        $this-light             40
     220        $this-light2side        1
     221        $this-opacity           50
     222        $this-thickness         350
     223        $this-legend            1
     224        $this-outline           0
    217225        $this-volume            1
    218226        $this-xcutplane         0
     
    667675        return
    668676    }
    669     # Ensure that the global opacity and thickness settings (in the slider
    670     # settings widgets) are used for the active transfer-function.  Update
    671     # the values in the _settings varible.
    672     set opacity [expr { double($_settings($this-opacity)) * 0.01 }]
     677    # Ensure that the global thickness setting (in the slider
     678    # settings widget) is used for the active transfer-function.  Update
     679    # the value in the _settings varible.
    673680    # Scale values between 0.00001 and 0.01000
    674681    set thickness [expr {double($_settings($this-thickness)) * 0.0001}]
     
    686693        }
    687694        set tf $_dataset2style($tag)
    688         set _settings($this-$tf-opacity) $opacity
    689695        set _settings($this-$tf-thickness) $thickness
    690696        ComputeTransferFunction $tf
     
    739745            -image $_image(legend) -tags colorbar
    740746        $c create text $lx $ly -anchor sw \
    741             -fill $itk_option(-plotforeground) -tags "limits vmin"
     747            -fill $itk_option(-plotforeground) -tags "limits labels vmin"
    742748        $c create text [expr {$w-$lx}] $ly -anchor se \
    743             -fill $itk_option(-plotforeground) -tags "limits vmax"
     749            -fill $itk_option(-plotforeground) -tags "limits labels vmax"
    744750        $c lower colorbar
    745751        $c bind colorbar <ButtonRelease-1> [itcl::code $this AddIsoMarker %x %y]
     
    949955        PanCamera
    950956        SendCmd "camera zoom $_view(-zoom)"
    951         InitSettings light2side light transp isosurface grid axes
     957        InitSettings light2side light opacity isosurface grid axes
    952958
    953959        # Turn off cutplanes for all volumes
     
    12131219            SendCmd "volume shading light2side $val"
    12141220        }
    1215         transp {
    1216             set val $_settings($this-transp)
    1217             set sval [expr { 0.01 * double($val) }]
    1218             SendCmd "volume shading opacity $sval"
    1219         }
    12201221        opacity {
    12211222            set val $_settings($this-opacity)
    12221223            set sval [expr { 0.01 * double($val) }]
    1223             foreach tf [array names _activeTfs] {
    1224                 set _settings($this-$tf-opacity) $sval
    1225                 set _activeTfs($tf) 0
    1226             }
    1227             updateTransferFunctions
     1224            SendCmd "volume shading opacity $sval"
    12281225        }
    12291226        thickness {
     
    13081305            SendCmd "legend $_dataset2style($tag) $w $h"
    13091306        }
    1310     } else {
    1311         # Can't do this as this will remove the items associated with the
    1312         # isomarkers.
    1313 
    1314         #$itk_component(legend) delete all
    13151307    }
    13161308}
     
    13281320#              ignores the -markers option.  The problem is that we are forced
    13291321#              to compute the name from an increasing complex set of values:
    1330 #              color, levels, marker, opacity.  I think we're stuck doing it
    1331 #              now.
     1322#              color, levels, markers.
    13321323#
    13331324itcl::body Rappture::NanovisViewer::NameTransferFunction { dataobj cname } {
     
    13351326        -color BCGYR
    13361327        -levels 6
    1337         -opacity 1.0
    1338         -markers ""
    13391328    }
    13401329    set tag $dataobj-$cname
    13411330    array set style [lindex [$dataobj components -style $cname] 0]
    1342     set tf "$style(-color):$style(-levels):$style(-opacity)"
     1331    set tf "$style(-color):$style(-levels)"
    13431332    set _dataset2style($tag) $tf
    13441333    lappend _style2datasets($tf) $tag
     
    13491338# ComputeTransferFunction --
    13501339#
    1351 #   Computes and sends the transfer function to the render server.  It's
    1352 #   assumed that the volume data limits are known and that the global
    1353 #   transfer-functions slider values have been set up.  Both parts are
    1354 #   needed to compute the relative value (location) of the marker, and
    1355 #   the alpha map of the transfer function.
     1340#       Computes and sends the transfer function to the render server.  It's
     1341#       assumed that the volume data limits are known and that the global
     1342#       transfer-functions slider values have been set up.  Both parts are
     1343#       needed to compute the relative value (location) of the marker, and
     1344#       the alpha map of the transfer function.
    13561345#
    13571346itcl::body Rappture::NanovisViewer::ComputeTransferFunction { tf } {
     
    13591348        -color BCGYR
    13601349        -levels 6
    1361         -opacity 1.0
    1362         -markers ""
    13631350    }
    13641351
     
    13761363    #        ignores the -markers option.  The problem is that we are forced
    13771364    #        to compute the name from an increasing complex set of values:
    1378     #        color, levels, marker, opacity.  I think the cow's out of the
    1379     #        barn on this one.
    1380 
     1365    #        color, levels, markers.
    13811366    if { ![info exists _isomarkers($tf)] } {
    13821367        # Have to defer creation of isomarkers until we have data limits
     
    13891374    }
    13901375    set cmap [ColorsToColormap $style(-color)]
    1391     set tag $this-$tf
    1392     if { ![info exists _settings($tag-opacity)] } {
    1393         set _settings($tag-opacity) $style(-opacity)
    1394     }
    1395     set max 1.0 ;#$_settings($tag-opacity)
     1376
     1377    # Transfer function should be normalized with [0,1] range
     1378    # The volume shading opacity setting is used to scale opacity
     1379    # in the volume shader.
     1380    set max 1.0
    13961381
    13971382    set isovalues {}
     
    14021387    set isovalues [lsort -real $isovalues]
    14031388
     1389    set tag $this-$tf
    14041390    if { ![info exists _settings($tag-thickness)]} {
    14051391        set _settings($tag-thickness) 0.005
     
    14551441itcl::configbody Rappture::NanovisViewer::plotbackground {
    14561442    if { [isconnected] } {
    1457         foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
    1458         #fix this!
    1459         #SendCmd "color background $r $g $b"
     1443        set color $itk_option(-plotbackground)
     1444        set rgb [Color2RGB $color]
     1445        SendCmd "screen bgcolor $rgb"
     1446        $itk_component(legend) configure -background $color
    14601447    }
    14611448}
     
    14661453itcl::configbody Rappture::NanovisViewer::plotforeground {
    14671454    if { [isconnected] } {
    1468         foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
    1469         #fix this!
    1470         #SendCmd "color background $r $g $b"
     1455        set color $itk_option(-plotforeground)
     1456        set rgb [Color2RGB $color]
     1457        SendCmd "volume outline color $rgb"
     1458        SendCmd "grid axiscolor $rgb"
     1459        SendCmd "grid linecolor $rgb"
     1460        $itk_component(legend) itemconfigure labels -fill $color
     1461        $itk_component(legend) itemconfigure limits -fill $color
    14711462    }
    14721463}
     
    15021493            set x [expr {double($i)/($levels+1)}]
    15031494            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1495            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    15041496            $m relval $x
    15051497            lappend _isomarkers($tf) $m
     
    15081500        foreach x $levels {
    15091501            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1502            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    15101503            $m relval $x
    15111504            lappend _isomarkers($tf) $m
     
    15351528            set value [expr {$value * 0.01}]
    15361529            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1530            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    15371531            $m relval $value
    15381532            lappend _isomarkers($tf) $m
     
    15401534            # ${n} : Set absolute value.
    15411535            set m [Rappture::IsoMarker \#auto $c $this $tf]
     1536            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    15421537            $m absval $value
    15431538            lappend _isomarkers($tf) $m
     
    15611556    set c $itk_component(legend)
    15621557    set m [Rappture::IsoMarker \#auto $c $this $tf]
     1558    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
    15631559    set w [winfo width $c]
    15641560    $m relval [expr {double($x-10)/($w-20)}]
     
    16381634}
    16391635
    1640 
    16411636itcl::body Rappture::NanovisViewer::BuildViewTab {} {
    1642     foreach { key value } {
    1643         grid            0
    1644         axes            1
    1645         outline         0
    1646         volume          1
    1647         legend          1
    1648         particles       1
    1649         lic             1
    1650     } {
    1651         set _settings($this-$key) $value
    1652     }
    1653 
    16541637    set fg [option get $itk_component(hull) font Font]
    16551638    #set bfg [option get $itk_component(hull) boldFont Font]
     
    17121695
    17131696itcl::body Rappture::NanovisViewer::BuildVolumeTab {} {
    1714     foreach { key value } {
    1715         light2side      1
    1716         light           40
    1717         transp          50
    1718         opacity         100
    1719         thickness       350
    1720     } {
    1721         set _settings($this-$key) $value
    1722     }
    1723 
    17241697    set inner [$itk_component(main) insert end \
    17251698        -title "Volume Settings" \
     
    17451718        -showvalue off -command [itcl::code $this AdjustSetting light]
    17461719    label $inner.bright -text "Surface" -font $fg
    1747 
    1748     label $inner.fog -text "Clear" -font $fg
    1749     ::scale $inner.transp -from 0 -to 100 -orient horizontal \
    1750         -variable [itcl::scope _settings($this-transp)] \
    1751         -width 10 \
    1752         -showvalue off -command [itcl::code $this AdjustSetting transp]
    1753     label $inner.plastic -text "Opaque" -font $fg
    17541720
    17551721    label $inner.clear -text "Clear" -font $fg
     
    17841750        3,1 $inner.light -cspan 2 -pady 2 -fill x \
    17851751        3,3 $inner.bright -anchor w -pady 2 \
    1786         4,0 $inner.fog -anchor e -pady 2 \
    1787         4,1 $inner.transp -cspan 2 -pady 2 -fill x \
    1788         4,3 $inner.plastic -anchor w -pady 2 \
     1752        4,0 $inner.clear -anchor e -pady 2 \
     1753        4,1 $inner.opacity -cspan 2 -pady 2 -fill x \
     1754        4,3 $inner.opaque -anchor w -pady 2 \
    17891755        5,0 $inner.thin -anchor e -pady 2 \
    17901756        5,1 $inner.thickness -cspan 2 -pady 2 -fill x\
  • branches/1.3/gui/scripts/vtkvolumeviewer.tcl

    r5256 r5280  
    15501550itcl::configbody Rappture::VtkVolumeViewer::plotbackground {
    15511551    if { [isconnected] } {
    1552         foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
    1553         SendCmd "screen bgcolor $r $g $b"
     1552        set color $itk_option(-plotbackground)
     1553        set rgb [Color2RGB $color]
     1554        SendCmd "screen bgcolor $rgb"
     1555        $itk_component(legend) configure -background $color
    15541556    }
    15551557}
     
    15601562itcl::configbody Rappture::VtkVolumeViewer::plotforeground {
    15611563    if { [isconnected] } {
    1562         foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
    1563         #fix this!
    1564         #SendCmd "color background $r $g $b"
     1564        set color $itk_option(-plotforeground)
     1565        set rgb [Color2RGB $color]
     1566        SendCmd "axis color all $rgb"
     1567        SendCmd "outline color $rgb"
     1568        SendCmd "$_cutplaneCmd color $rgb"
     1569        $itk_component(legend) itemconfigure labels -fill $color
     1570        $itk_component(legend) itemconfigure limits -fill $color
    15651571    }
    15661572}
     
    20132019    $itk_component(palette) value $style(-color)
    20142020
     2021    SendCmd "outline add $tag"
     2022    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     2023    SendCmd "outline visible $style(-outline) $tag"
     2024
    20152025    SendCmd "$_cutplaneCmd add $tag"
     2026    SendCmd "$_cutplaneCmd color [Color2RGB $itk_option(-plotforeground)] $tag"
    20162027    SendCmd "$_cutplaneCmd visible 0 $tag"
    20172028
     
    22492260        }
    22502261        deactivate {
    2251             $c itemconfigure title -fill white
     2262            $c itemconfigure title -fill $itk_option(-plotforeground)
    22522263        }
    22532264        invoke {
Note: See TracChangeset for help on using the changeset viewer.