Changeset 6414


Ignore:
Timestamp:
Jul 1, 2016 7:11:32 AM (8 years ago)
Author:
ldelgass
Message:

merge from trunk

Location:
branches/blt4_trunk
Files:
4 deleted
33 edited
22 copied

Legend:

Unmodified
Added
Removed
  • branches/blt4_trunk

  • branches/blt4_trunk/configure

    r6252 r6414  
    1022510225
    1022610226
    10227 ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/copy_rappture_examples gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile gui/src/Makefile builder/Makefile builder/pkgIndex.tcl builder/scripts/Makefile tester/Makefile tester/pkgIndex.tcl tester/scripts/Makefile lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/R/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/scripts/Makefile lang/tcl/src/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/octave2/Makefile examples/app-fermi/octave/octave3/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/perl/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/app-fermi/R/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/mapviewer/Makefile examples/mapviewer/camera/Makefile examples/mapviewer/colorramp/Makefile examples/mapviewer/common/Makefile examples/mapviewer/feature/Makefile examples/mapviewer/gdal/Makefile examples/mapviewer/layers/Makefile examples/mapviewer/ogr/Makefile examples/mapviewer/placard/Makefile examples/mapviewer/select/Makefile examples/mapviewer/tms/Makefile examples/mapviewer/wms/Makefile examples/mapviewer/xyz/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/curve/Makefile examples/zoo/drawing/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/histogram/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/log/Makefile examples/zoo/mesh/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/parallelepiped/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile video/Makefile video/pkgIndex.tcl oldtest/Makefile oldtest/src/Makefile puq/Makefile puq/puq.sh"
     10227ac_config_files="$ac_config_files Makefile packages/Makefile src/Makefile src/core/Makefile src/core2/Makefile src/objects/Makefile src/objects/RpHash.h gui/Makefile gui/apps/Makefile gui/apps/about gui/apps/copy_rappture_examples gui/apps/encodedata gui/apps/rappture gui/apps/rappture-csh.env gui/apps/rappture.env gui/apps/rappture.use gui/apps/rerun gui/apps/simsim gui/apps/xmldiff gui/pkgIndex.tcl gui/scripts/Makefile gui/src/Makefile builder/Makefile builder/pkgIndex.tcl builder/scripts/Makefile tester/Makefile tester/pkgIndex.tcl tester/scripts/Makefile lang/Makefile lang/java/Makefile lang/java/rappture/Makefile lang/perl/Makefile lang/perl/Makefile.PL lang/python/Makefile lang/python/setup.py lang/matlab/Makefile lang/octave/Makefile lang/octave/octave2/Makefile lang/octave/octave3/Makefile lang/R/Makefile lang/ruby/Makefile lang/ruby/build.rb lang/tcl/Makefile lang/tcl/pkgIndex.tcl lang/tcl/scripts/Makefile lang/tcl/src/Makefile lang/tcl/tests/Makefile lib/Makefile examples/3D/Makefile examples/Makefile examples/app-fermi/2.0/Makefile examples/app-fermi/Makefile examples/app-fermi/cee/Makefile examples/app-fermi/fortran/Makefile examples/app-fermi/java/Makefile examples/app-fermi/matlab/Makefile examples/app-fermi/matlab/compiled/Makefile examples/app-fermi/matlab/uncompiled/Makefile examples/app-fermi/octave/octave2/Makefile examples/app-fermi/octave/octave3/Makefile examples/app-fermi/octave/Makefile examples/app-fermi/perl/Makefile examples/app-fermi/python/Makefile examples/app-fermi/ruby/Makefile examples/app-fermi/tcl/Makefile examples/app-fermi/wrapper/Makefile examples/app-fermi/wrapper/cee/Makefile examples/app-fermi/wrapper/perl/Makefile examples/app-fermi/wrapper/python/Makefile examples/app-fermi/wrapper/tcl/Makefile examples/app-fermi/R/Makefile examples/c-example/Makefile examples/canvas/Makefile examples/demo.bash examples/flow/Makefile examples/flow/demo1/Makefile examples/flow/demo2/Makefile examples/flow/demo3/Makefile examples/graph/Makefile examples/mapviewer/Makefile examples/mapviewer/camera/Makefile examples/mapviewer/colorramp/Makefile examples/mapviewer/common/Makefile examples/mapviewer/feature/Makefile examples/mapviewer/gdal/Makefile examples/mapviewer/layers/Makefile examples/mapviewer/ogr/Makefile examples/mapviewer/placard/Makefile examples/mapviewer/select/Makefile examples/mapviewer/tms/Makefile examples/mapviewer/wms/Makefile examples/mapviewer/xyz/Makefile examples/objects/Makefile examples/objects/axis/Makefile examples/objects/curve/Makefile examples/objects/dxWriter/Makefile examples/objects/floatBuffer/Makefile examples/objects/histogram/Makefile examples/objects/library/Makefile examples/objects/number/Makefile examples/objects/path/Makefile examples/objects/plot/Makefile examples/objects/scatter/Makefile examples/objects/string/Makefile examples/objects/tree/Makefile examples/objects/xmlparser/Makefile examples/zoo/Makefile examples/zoo/binary/Makefile examples/zoo/boolean/Makefile examples/zoo/choice/Makefile examples/zoo/curve/Makefile examples/zoo/drawing/Makefile examples/zoo/enable/Makefile examples/zoo/field/Makefile examples/zoo/group/Makefile examples/zoo/histogram/Makefile examples/zoo/image/Makefile examples/zoo/image/docs/Makefile examples/zoo/image/examples/Makefile examples/zoo/integer/Makefile examples/zoo/integer2/Makefile examples/zoo/loader/Makefile examples/zoo/loader/examples/Makefile examples/zoo/log/Makefile examples/zoo/mesh/Makefile examples/zoo/multichoice/Makefile examples/zoo/note/Makefile examples/zoo/note/docs/Makefile examples/zoo/number/Makefile examples/zoo/number2/Makefile examples/zoo/parallelepiped/Makefile examples/zoo/periodicelement/Makefile examples/zoo/phase/Makefile examples/zoo/sequence/Makefile examples/zoo/sequence/examples/Makefile examples/zoo/string/Makefile examples/zoo/structure/Makefile examples/zoo/structure/examples/Makefile examples/zoo/table/Makefile video/Makefile video/pkgIndex.tcl oldtest/Makefile oldtest/src/Makefile puq/Makefile puq/puq.sh"
    1022810228
    1022910229cat >confcache <<\_ACEOF
     
    1104511045    "examples/zoo/log/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/log/Makefile" ;;
    1104611046    "examples/zoo/mesh/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/mesh/Makefile" ;;
     11047    "examples/zoo/multichoice/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/multichoice/Makefile" ;;
    1104711048    "examples/zoo/note/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/note/Makefile" ;;
    1104811049    "examples/zoo/note/docs/Makefile") CONFIG_FILES="$CONFIG_FILES examples/zoo/note/docs/Makefile" ;;
  • branches/blt4_trunk/configure.in

    r6252 r6414  
    603603    examples/zoo/log/Makefile
    604604    examples/zoo/mesh/Makefile
     605    examples/zoo/multichoice/Makefile
    605606    examples/zoo/note/Makefile
    606607    examples/zoo/note/docs/Makefile
  • branches/blt4_trunk/examples/mapviewer/feature/Makefile.in

    r6210 r6414  
    1616destdir         = $(prefix)/examples/mapviewer/feature
    1717FILES           = \
    18                   $(srcdir)/afr_countries.dbf \
    19                   $(srcdir)/afr_countries.prj \
    20                   $(srcdir)/afr_countries.shp \
    21                   $(srcdir)/afr_countries.shx \
     18                  $(srcdir)/afr_elas.dbf \
     19                  $(srcdir)/afr_elas.prj \
     20                  $(srcdir)/afr_elas.shp \
     21                  $(srcdir)/afr_elas.shx \
     22                  $(srcdir)/feature_layer_26_colors.tcl \
     23                  $(srcdir)/feature_multiple_selection_by_callback.tcl \
     24                  $(srcdir)/feature_multiple_selection_by_new_layer.tcl \
     25                  $(srcdir)/feature_multiple_selection_by_updated_layer.tcl \
    2226                  $(srcdir)/feature_selector_query.tcl
    2327
  • branches/blt4_trunk/examples/mapviewer/feature/feature_selector_query.tcl

    r6286 r6414  
    2828# Parameters for feature layer
    2929array set ogrParams {
    30     url {local://afr_countries.shp}
     30    url {local://afr_elas.shp}
    3131}
    3232array set countries {
  • branches/blt4_trunk/examples/mapviewer/ogr/ogr_csv_icon_example.tcl

    r6286 r6414  
    2626}
    2727
    28 # create an feature point layer from a csv file using the OGR driver
     28# create a feature icon layer from a csv file using the OGR driver
    2929# the longitude and latitude fields must be named "longitude" and
    3030# "latitude" respectively
  • branches/blt4_trunk/examples/zoo/Makefile.in

    r3714 r6414  
    3030                log \
    3131                mesh \
     32                multichoice \
    3233                note \
    3334                number \
  • branches/blt4_trunk/gui/scripts/Makefile.in

    r6021 r6414  
    7878                $(srcdir)/mainwin.tcl \
    7979                $(srcdir)/map.tcl \
     80                $(srcdir)/mapentry.tcl \
    8081                $(srcdir)/mapviewer.tcl \
    8182                $(srcdir)/mesh.tcl \
    8283                $(srcdir)/meshresult.tcl \
    8384                $(srcdir)/molvisviewer.tcl \
     85                $(srcdir)/multichoiceentry.tcl \
    8486                $(srcdir)/nanovisviewer.tcl \
    8587                $(srcdir)/note.tcl \
  • branches/blt4_trunk/gui/scripts/combobox.tcl

    r5659 r6414  
    175175
    176176# ----------------------------------------------------------------------
    177 # USAGE: getValue <value>
    178 #
    179 # Clients use this to translate a value to a label.
     177# USAGE: current
     178#
     179# Clients use this to retrieve a label from the entry widget and return
     180# its value, if one exists. If no value exists for the label, then the
     181# label is returned.
    180182# ----------------------------------------------------------------------
    181183itcl::body Rappture::Combobox::current {} {
  • branches/blt4_trunk/gui/scripts/combochecks.tcl

    r5659 r6414  
    1919option add *Combochecks.relief sunken widgetDefault
    2020option add *Combochecks.width 10 widgetDefault
     21option add *Combochecks.editable yes widgetDefault
    2122option add *Combochecks.textBackground white widgetDefault
    2223option add *Combochecks.textForeground black widgetDefault
     
    2829    inherit itk::Widget
    2930
     31    itk_option define -editable editable Editable ""
    3032    itk_option define -state state State "normal"
    3133    itk_option define -width width Width 0
    3234    itk_option define -disabledbackground disabledBackground DisabledBackground ""
    3335    itk_option define -disabledforeground disabledForeground DisabledForeground ""
     36    itk_option define -interactcommand interactCommand InteractCommand ""
    3437
    3538    constructor {args} { # defined below }
    3639
    3740    public method value {args}
    38     public method current {}
     41    public method translate {value {defValue ""}}
     42    public method label {value}
    3943    public method choices {option args}
    4044
    4145    protected method _entry {option}
    42     protected method _fixDisplay {}
     46    protected method _dropdown {option}
    4347    protected method _fixState {}
    4448
     
    5761    keep -foreground -background
    5862    keep -textforeground -textbackground
     63    keep -selectbackground -selectforeground -selectborderwidth
    5964}
    6065
     
    95100
    96101    itk_component add ddlist {
    97         Rappture::Dropdownchecks $itk_component(button).ddlist
    98     }
     102        Rappture::Dropdownchecks $itk_component(button).ddlist \
     103            -postcommand [itcl::code $this _dropdown post] \
     104            -unpostcommand [itcl::code $this _dropdown unpost] \
     105    }
     106
    99107    bind $itk_component(ddlist) <<DropdownchecksSelect>> \
    100         [itcl::code $this _fixDisplay]
     108        [itcl::code $this _dropdown select]
    101109
    102110    $itk_component(button) configure -command \
     
    115123# ----------------------------------------------------------------------
    116124itcl::body Rappture::Combochecks::value {args} {
    117     switch -- [llength $args] {
    118         0 {
    119             # return a list of checked optons
    120             set max [$itk_component(ddlist) size]
    121             set rlist ""
    122             foreach val [$itk_component(ddlist) get -value] {
    123                 if {[$itk_component(ddlist) state $val]} {
    124                     lappend rlist $val
    125                 }
    126             }
    127             return $rlist
    128         }
    129         1 {
    130             set newval [lindex $args 0]
    131 
    132             $itk_component(ddlist) reset
    133             foreach part $newval {
    134                 $itk_component(ddlist) state $part 1
    135             }
    136             _fixDisplay
    137 
    138             after 10 [list catch \
    139                 [list event generate $itk_component(hull) <<Value>>]]
    140 
    141         }
    142         default {
    143             error "wrong # args: should be \"value ?newval?\""
    144         }
    145     }
     125    if {[llength $args] == 1} {
     126        set newval [lindex $args 0]
     127
     128        # FIXME: not sure if I need to update the ddlist just in case
     129        # user calls value() without manipulating the ddlist
     130        $itk_component(ddlist) reset
     131        foreach part $newval {
     132            set part [translate $part]
     133            $itk_component(ddlist) state $part 1
     134        }
     135
     136        $itk_component(entry) configure -state normal
     137        $itk_component(entry) delete 0 end
     138        $itk_component(entry) insert end [join $newval {, }]
     139        if {!$itk_option(-editable)} {
     140            $itk_component(entry) configure -state disabled
     141        }
     142
     143        after 10 [list catch \
     144            [list event generate $itk_component(hull) <<Value>>]]
     145    } elseif {[llength $args] != 0} {
     146        error "wrong # args: should be \"value ?newval?\""
     147    }
     148    return [$itk_component(entry) get]
     149}
     150
     151# ----------------------------------------------------------------------
     152# USAGE: translate <value>
     153#
     154# Clients use this to translate a value from the entry part of the
     155# combobox to one of the underlying values in the combobox.  If the
     156# <value> string matches one of the labels for the choices, this
     157# method returns the corresponding value.  Otherwise, it returns "".
     158# ----------------------------------------------------------------------
     159itcl::body Rappture::Combochecks::translate {value {defValue ""}} {
     160    foreach {val label} [choices get -both] {
     161        if {$label eq $value} {
     162            return $val
     163        }
     164    }
     165    return $defValue
     166}
     167
     168# ----------------------------------------------------------------------
     169# USAGE: label <value>
     170#
     171# Clients use this to translate a value to a label.
     172# ----------------------------------------------------------------------
     173itcl::body Rappture::Combochecks::label { myValue } {
     174    foreach {val label} [choices get -both] {
     175        if {$myValue == $val} {
     176            return $label
     177        }
     178    }
     179    return ""
    146180}
    147181
     
    167201# USAGE: _entry click
    168202#
     203# Used internally to handle the entry widget for this combobox.  The
     204# click option is invoked when the user click on the entry widget and
     205# performs a post operation on the dropdown list. The apply option
     206# is invoked when the user presses the Return key to set the value of
     207# the entry widget or selects a value. It generates a Value signal.
     208# ----------------------------------------------------------------------
     209itcl::body Rappture::Combochecks::_entry {option} {
     210    switch -- $option {
     211        apply {
     212            if {$itk_option(-editable) && $itk_option(-state) == "normal"} {
     213                event generate $itk_component(hull) <<Value>>
     214                if {[string length $itk_option(-interactcommand)] > 0} {
     215                    uplevel #0 $itk_option(-interactcommand)
     216                }
     217            }
     218        }
     219        click {
     220            if {!$itk_option(-editable) && $itk_option(-state) == "normal"} {
     221                $itk_component(button) configure -relief sunken
     222                update idletasks; after 100
     223                $itk_component(button) configure -relief raised
     224
     225                $itk_component(ddlist) post $itk_component(hull) left
     226            }
     227        }
     228        default {
     229            error "bad option \"$option\": should be apply, click"
     230        }
     231    }
     232}
     233
     234# ----------------------------------------------------------------------
     235# USAGE: _dropdown post
     236# USAGE: _dropdown unpost
     237# USAGE: _dropdown select
     238#
    169239# Used internally to handle the dropdown list for this combobox.  The
    170240# post/unpost options are invoked when the list is posted or unposted
    171241# to manage the relief of the controlling button.  The select option
    172242# is invoked whenever there is a selection from the list, to assign
    173 # the value back to the gauge.
    174 # ----------------------------------------------------------------------
    175 itcl::body Rappture::Combochecks::_entry {option} {
     243# the value back to the entry.
     244# ----------------------------------------------------------------------
     245itcl::body Rappture::Combochecks::_dropdown {option} {
    176246    switch -- $option {
    177         apply {
    178             if {$itk_option(-state) == "normal"} {
    179                 event generate $itk_component(hull) <<Value>>
    180             }
    181         }
    182         click {
    183             if {$itk_option(-state) == "normal"} {
    184                 $itk_component(button) configure -relief sunken
    185                 update idletasks; after 100
    186                 $itk_component(button) configure -relief raised
    187 
    188                 $itk_component(ddlist) post $itk_component(hull) left
     247        post {
     248#            set value [$itk_component(entry) get]
     249#            set i [$itk_component(ddlist) index -label $value]
     250#            if {$i >= 0} {
     251#                $itk_component(ddlist) select clear 0 end
     252#                $itk_component(ddlist) select set $i
     253#            }
     254        }
     255        unpost {
     256            if {$itk_option(-editable)} {
     257                focus $itk_component(entry)
     258            }
     259        }
     260        select {
     261            set newval [$itk_component(ddlist) current -label]
     262            set val [$itk_component(entry) get]
     263            if {$newval ne "" && $newval ne $val} {
     264                value $newval
     265                if {[string length $itk_option(-interactcommand)] > 0} {
     266                    uplevel #0 $itk_option(-interactcommand)
     267                }
     268            }
     269            if {$newval eq ""} {
     270                value $val
    189271            }
    190272        }
    191273        default {
    192             error "bad option \"$option\": should be apply, click"
    193         }
    194     }
    195 }
    196 
    197 # ----------------------------------------------------------------------
    198 # USAGE: _fixDisplay
    199 #
    200 # Used internally to handle the dropdown list for this combobox.
    201 # Invoked whenever there is a selection from the list, to assign
    202 # the value back to the entry.
    203 # ----------------------------------------------------------------------
    204 itcl::body Rappture::Combochecks::_fixDisplay {} {
    205     $itk_component(entry) configure -state normal
    206     $itk_component(entry) delete 0 end
    207     $itk_component(entry) insert end [join [value] {, }]
    208     $itk_component(entry) configure -state disabled
     274            error "bad option \"$option\": should be post, unpost, select"
     275        }
     276    }
    209277}
    210278
     
    212280# USAGE: _fixState
    213281#
    214 # Used internally to fix the widget state when the -state option
    215 # changes.
     282# Used internally to fix the widget state when the -editable/-state
     283# options change.
    216284# ----------------------------------------------------------------------
    217285itcl::body Rappture::Combochecks::_fixState {} {
     
    232300    }
    233301
    234     if {$itk_option(-state) != "normal"} {
     302    if {$itk_option(-editable)} {
     303        if {$itk_option(-state) == "normal"} {
     304            $itk_component(entry) configure -state normal
     305        } else {
     306            $itk_component(entry) configure -state disabled
     307        }
     308    } else {
     309        $itk_component(entry) configure -state disabled
     310    }
     311
     312    if {!$itk_option(-editable) || $itk_option(-state) != "normal"} {
    235313        # can't keep focus here -- move it along to the next widget
    236314        if {[focus] == $itk_component(entry)} {
     
    238316        }
    239317    }
     318}
     319
     320# ----------------------------------------------------------------------
     321# CONFIGURATION OPTION: -editable
     322# ----------------------------------------------------------------------
     323itcl::configbody Rappture::Combochecks::editable {
     324    if {![string is boolean -strict $itk_option(-editable)]} {
     325        error "bad value \"$itk_option(-editable)\": should be boolean"
     326    }
     327    _fixState
    240328}
    241329
  • branches/blt4_trunk/gui/scripts/controlOwner.tcl

    r5659 r6414  
    6767        integer current
    6868        loader current
     69        multichoice current
    6970        note contents
    7071        number current
  • branches/blt4_trunk/gui/scripts/controls.tcl

    r5659 r6414  
    156156            bind $w <<Value>> [itcl::code $this _controlChanged $name]
    157157        }
     158        multichoice {
     159            Rappture::MultiChoiceEntry $w $_owner $path
     160            bind $w <<Value>> [itcl::code $this _controlChanged $name]
     161        }
    158162        number {
    159163            Rappture::NumberEntry $w $_owner $path
     
    174178        drawing {
    175179            Rappture::DrawingEntry $w $_owner $path
     180        }
     181        map {
     182            Rappture::MapEntry $w $_owner $path
    176183        }
    177184        image {
     
    276283    $_owner widgetfor $path $w
    277284
    278     if {[lsearch {control group drawing separator note} $type] < 0} {
     285    if {[lsearch {control group drawing map separator note} $type] < 0} {
    279286        # make a label for this control
    280287        set label [$w label]
  • branches/blt4_trunk/gui/scripts/dropdownchecks.tcl

    r5659 r6414  
    3838    public method state {value {newval ""}}
    3939    public method reset {}
     40    public method current {{what -value}}
    4041
    4142    private variable _dispatcher "" ;# dispatcher for !events
     
    280281        set _states($val) 0
    281282    }
     283}
     284
     285# ----------------------------------------------------------------------
     286# USAGE: current ?-value|-label|-both?
     287#
     288# Clients use this to query the current selections from the listbox/canvas.
     289# Returns a list of values, labels, or list of lists of both, according
     290# to the option.
     291# ----------------------------------------------------------------------
     292itcl::body Rappture::Dropdownchecks::current {{what -value}} {
     293    set rlist ""
     294    set l  [llength $_values]
     295    for {set i 0} {$i < $l} {incr i} {
     296        set val [lindex $_values $i]
     297        if {$_states($val)} {
     298            switch -- $what {
     299                -value { lappend rlist [lindex $_values $i] }
     300                -label { lappend rlist [lindex $_labels $i] }
     301                -both  { lappend rlist [list [lindex $_values $i] \
     302                                             [lindex $_labels $i]] }
     303                default {
     304                    error "bad option \"$what\": should be -value, -label, -both"
     305                }
     306            }
     307        }
     308    }
     309    return $rlist
    282310}
    283311
  • branches/blt4_trunk/gui/scripts/field.tcl

    r5763 r6414  
    882882                continue;               # Ignore this component
    883883            }
    884             ReadVtkDataSet $cname $contents
     884            if { ![ReadVtkDataSet $cname $contents] } {
     885                puts stderr "WARNING: Invalid VTK file for \"$_path.$cname.vtk\""
     886                continue;               # Ignore this component
     887            }
    885888            set _comp2vtk($cname) $contents
    886889            set _comp2style($cname) [$_field get $cname.style]
     
    918921                # dimensions based on the bounds (sets _dim).  We rely on this
    919922                # conversion for limits even if we send DX data to nanovis.
    920                 ReadVtkDataSet $cname $vtkdata
     923                if { ![ReadVtkDataSet $cname $vtkdata] } {
     924                    puts stderr "WARNING: Could not parse generated VTK for \"$_path.$cname.$type\""
     925                    continue;           # Ignore this component
     926                }
    921927                if 0 {
    922928                    set f [open /tmp/$_path.$cname.vtk "w"]
     
    952958            }
    953959            set vtkdata [DicomToVtk $cname $contents]
     960            if { $vtkdata == "" } {
     961                puts stderr "WARNING: Could not parse generated VTK for \"$_path.$cname.$type\""
     962                continue;               # Ignore this component
     963            }
    954964            if { $_viewer == "" } {
    955965                set _viewer [expr {($_dim == 3) ? "vtkvolume" : "vtkimage"}]
     
    964974            }
    965975            set vtkdata [AvsToVtk $cname $contents]
    966             ReadVtkDataSet $cname $vtkdata
     976            if { ![ReadVtkDataSet $cname $vtkdata] } {
     977                puts stderr "WARNING: Could not parse generated VTK for \"$_path.$cname.$type\""
     978                continue;               # Ignore this component
     979            }
    967980            set _comp2vtk($cname) $vtkdata
    968981            set _comp2style($cname) [$_field get $cname.style]
     
    11811194
    11821195    set dataset [$reader GetOutput]
     1196    if { $dataset == "" } {
     1197        puts stderr "Failed to parse VTK file"
     1198        rename $reader ""
     1199        return 0
     1200    }
    11831201    set limits {}
    11841202    foreach {xmin xmax ymin ymax zmin zmax} [$dataset GetBounds] break
     1203    if {$xmin > $xmax || $ymin > $ymax || $zmin > $zmax} {
     1204        puts stderr "Invalid VTK file"
     1205        rename $reader ""
     1206        return 0
     1207    }
    11851208    # Figure out the dimension of the mesh from the bounds.
    11861209    set _dim 0
     
    12931316
    12941317    rename $reader ""
     1318    return 1
    12951319}
    12961320
     
    16521676    if { ![file exists $path] } {
    16531677        puts stderr "path \"$path\" doesn't exist."
    1654         return 0
     1678        return ""
    16551679    }
    16561680
     
    16611685            if { [llength $files] == 0 } {
    16621686                puts stderr "no dicom files found in \"$path\""
    1663                 return 0
     1687                return ""
    16641688            }
    16651689        }
     
    16861710    }
    16871711
    1688     ReadVtkDataSet $cname $data(vtkdata)
     1712    if { ![ReadVtkDataSet $cname $data(vtkdata)] } {
     1713        return ""
     1714    }
    16891715    return $data(vtkdata)
    16901716}
  • branches/blt4_trunk/gui/scripts/flowvisviewer.tcl

    r6351 r6414  
    10951095        DoResize
    10961096    }
    1097 
     1097    if { $_reset } {
     1098        InitSettings -background -axesvisible -gridvisible
     1099    }
    10981100    set _first ""
    10991101    foreach dataobj [get -objects] {
     
    11481150
    11491151    if { $_reset } {
    1150         InitSettings -axesvisible -gridvisible \
    1151             -opacity -light2side -isosurfaceshading \
     1152        InitSettings -opacity -light2side -isosurfaceshading \
    11521153            -ambient -diffuse -specularlevel -specularexponent
    11531154
  • branches/blt4_trunk/gui/scripts/map.tcl

    r6351 r6414  
    8181    protected method parseXML { xmlobj path }
    8282
     83    protected proc colorToHTML { color }
     84    protected proc fixBoolean { val }
     85    protected proc fixEnum { str }
     86    protected proc fixQuotes { str }
     87    protected proc isBooleanProp { prop }
     88    protected proc isColorProp { prop }
    8389    protected proc isFileProp { prop }
    8490    protected proc parseStylesheet { stylesheet }
     91    protected proc styleToCSS { layerType props {styleName "style"} }
     92    protected proc translateProp { layerType styleProp styleValue }
    8593
    8694    private variable _tree "";         # Tree of information about the map.
     
    10741082}
    10751083
     1084itcl::body Rappture::Map::styleToCSS { layerType props {styleName "style"} } {
     1085    append output "$styleName { "
     1086    foreach {name value} $props {
     1087        if {[string range $name 0 0] eq "-"} {
     1088            set name [string range $name 1 end]
     1089        }
     1090        # These aren't really style properties
     1091        if {$name eq "minrange" || $name eq "maxrange" } {
     1092            continue
     1093        }
     1094        foreach {name value} [translateProp $layerType $name $value] {}
     1095        # TODO: Fix quoting
     1096        if {$name ne ""} {
     1097            append output "$name: $value; "
     1098        }
     1099    }
     1100    append output "}"
     1101    return $output
     1102}
     1103
     1104itcl::body Rappture::Map::colorToHTML { color } {
     1105    foreach {r g b} [winfo rgb . $color] break
     1106    return [format "#%02X%02X%02X" [expr {$r/256}] [expr {$g/256}] [expr {$b/256}]]
     1107}
     1108
     1109itcl::body Rappture::Map::isColorProp { prop } {
     1110    foreach colorprop { fill stroke point-fill text-fill text-halo } {
     1111        if { $prop eq $colorprop } {
     1112            return 1
     1113        }
     1114    }
     1115    return 0
     1116}
     1117
     1118itcl::body Rappture::Map::isBooleanProp { prop } {
     1119    foreach boolprop {
     1120        extrusion-flatten
     1121        skin-tiled
     1122        icon-declutter
     1123        render-depth-test
     1124        render-lighting
     1125        render-transparent
     1126        render-depth-offset
     1127        text-declutter
     1128    } {
     1129        if { $prop eq $boolprop } {
     1130            return 1
     1131        }
     1132    }
     1133    return 0
     1134}
     1135
    10761136itcl::body Rappture::Map::isFileProp { prop } {
    10771137    foreach fileprop {
     
    10841144    }
    10851145    return 0
     1146}
     1147
     1148itcl::body Rappture::Map::fixQuotes { str } {
     1149    return [string map {"\{" "\"" "\}" "\""} [list $str]]
     1150}
     1151
     1152itcl::body Rappture::Map::fixEnum { str } {
     1153    return [string map {"_" "-"} $str]
     1154}
     1155
     1156itcl::body Rappture::Map::fixBoolean { val } {
     1157    if { $val } {
     1158        return "true"
     1159    } else {
     1160        return "false"
     1161    }
     1162}
     1163
     1164itcl::body Rappture::Map::translateProp { layerType styleProp styleValue } {
     1165    switch -- $layerType {
     1166        "icon" {
     1167            array set trans {
     1168                "align" "icon-align"
     1169                "clamping" "altitude-clamping"
     1170                "clamptechnique" "altitude-technique"
     1171                "declutter" "icon-declutter"
     1172                "library" "icon-library"
     1173                "minbias" "render-depth-offset-min-bias"
     1174                "maxbias" "render-depth-offset-max-bias"
     1175                "scale" "icon-scale"
     1176                "heading" "icon-heading"
     1177                "placement" "icon-placement"
     1178                "url" "icon"
     1179            }
     1180        }
     1181        "label" {
     1182            array set trans {
     1183                "align" "text-align"
     1184                "clamping" "altitude-clamping"
     1185                "clamptechnique" "altitude-technique"
     1186                "color" "text-fill"
     1187                "content" "text-content"
     1188                "declutter" "text-declutter"
     1189                "font" "text-font"
     1190                "fontsize" "text-size"
     1191                "halocolor" "text-halo"
     1192                "halowidth" "text-halo-offset"
     1193                "layout" "text-layout"
     1194                "minbias" "render-depth-offset-min-bias"
     1195                "maxbias" "render-depth-offset-max-bias"
     1196                "priority" "text-priority"
     1197                "xoffset" "text-offset-x"
     1198                "yoffset" "text-offset-y"
     1199            }
     1200        }
     1201        "line" {
     1202            array set trans {
     1203                "cap" "stroke-linecap"
     1204                "clamping" "altitude-clamping"
     1205                "clamptechnique" "altitude-technique"
     1206                "color" "stroke"
     1207                "join" "stroke-linejoin"
     1208                "minbias" "render-depth-offset-min-bias"
     1209                "maxbias" "render-depth-offset-max-bias"
     1210                "stipplepattern" "stroke-stipple-pattern"
     1211                "stipplefactor" "stroke-stipple-factor"
     1212                "width" "stroke-width"
     1213            }
     1214        }
     1215        "point" {
     1216             array set trans {
     1217                "clamping" "altitude-clamping"
     1218                "clamptechnique" "altitude-technique"
     1219                "color" "point-fill"
     1220                "minbias" "render-depth-offset-min-bias"
     1221                "maxbias" "render-depth-offset-max-bias"
     1222                "size" "point-size"
     1223            }
     1224        }
     1225        "polygon" {
     1226            array set trans {
     1227                "clamping" "altitude-clamping"
     1228                "clamptechnique" "altitude-technique"
     1229                "color" "fill"
     1230                "minbias" "render-depth-offset-min-bias"
     1231                "maxbias" "render-depth-offset-max-bias"
     1232                "strokecolor" "stroke"
     1233                "strokewidth" "stroke-width"
     1234            }
     1235        }
     1236        "image" - "elevation" - "feature" {
     1237        }
     1238        default {
     1239            error "Unknown layer type: \"$layerType\""
     1240        }
     1241    }
     1242    if {[info exists trans($styleProp)]} {
     1243        set styleProp $trans($styleProp)
     1244    }
     1245    if {[isColorProp $styleProp]} {
     1246        set styleValue [colorToHTML $styleValue]
     1247    }
     1248    if {$styleProp eq "icon-scale" && $styleValue eq ""} {
     1249        set styleProp ""
     1250    }
     1251    if {$styleProp eq "icon-heading" && $styleValue eq ""} {
     1252        set styleProp ""
     1253    }
     1254    if {$styleProp eq "text-align" || $styleProp eq "icon-align"} {
     1255        set styleValue [fixEnum $styleValue]
     1256    }
     1257    if {[isBooleanProp $styleProp]} {
     1258        set styleValue [fixBoolean $styleValue]
     1259    }
     1260    set styleValue [fixQuotes $styleValue]
     1261    return [list $styleProp $styleValue]
    10861262}
    10871263
  • branches/blt4_trunk/gui/scripts/mapviewer.tcl

    r6351 r6414  
    3636    inherit Rappture::VisViewer
    3737
     38    itk_option define -map map Map ""
    3839    itk_option define -plotforeground plotForeground Foreground ""
    3940    itk_option define -plotbackground plotBackground Background ""
     
    6162    public method parameters {title args} { # do nothing }
    6263    public method placard {option args}
    63     public method refresh {} { Rebuild }
     64    public method refresh {} {
     65        Rebuild
     66        # Temporary hack to fix one frame delay in update
     67        SendCmd "imgflush"
     68        SendCmd "renderer render"
     69    }
    6470    public method scale {args}
    6571    public method select {option {args ""}}
     
    11661172            lappend info "installdir" "$Rappture::installdir"
    11671173            lappend info "hub" [exec hostname]
     1174            lappend info "hub_url" [Rappture::Tool::resources -huburl]
    11681175            lappend info "client" "mapviewer"
    11691176            lappend info "user" $user
     
    28082815                }
    28092816            }
    2810             set format ""
    2811             set wfsType ""
    28122817            SendStylesheetFiles $info(stylesheet)
    28132818            set ssSize [string length $info(stylesheet)]
    28142819            set scriptSize [string length $script]
    28152820            set selectorsSize [string length $selectors]
    2816             if { [info exists info(ogr.connection)] } {
    2817                 set cmd [list map layer add $tag feature db $format $info(ogr.layer) $info(ogr.connection) $info(cache) $ssSize $scriptSize $selectorsSize]
    2818                 if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    2819                     lappend cmd $style(-minrange) $style(-maxrange)
    2820                 }
    2821             } else {
    2822                 set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(ogr.url) $info(cache) $ssSize $scriptSize $selectorsSize]
    2823                 if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    2824                     lappend cmd $style(-minrange) $style(-maxrange)
    2825                 }
    2826                 SendFiles $info(ogr.url)
     2821            switch -- $info(driver) {
     2822                "ogr" {
     2823                    if { [info exists info(ogr.connection)] } {
     2824                        set cmd [list map layer add $tag feature db {} $info(ogr.layer) $info(ogr.connection) $info(cache) $ssSize $scriptSize $selectorsSize]
     2825                        if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2826                            lappend cmd $style(-minrange) $style(-maxrange)
     2827                        }
     2828                    } else {
     2829                        set cmd [list map layer add $tag feature $info(driver) {} {} $info(ogr.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2830                        if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2831                            lappend cmd $style(-minrange) $style(-maxrange)
     2832                        }
     2833                        SendFiles $info(ogr.url)
     2834                    }
     2835                }
     2836                "tfs" {
     2837                    set format "json"
     2838                    if {[info exists info(tfs.format)]} {
     2839                        set format $info(tfs.format)
     2840                    }
     2841                    set cmd [list map layer add $tag feature $info(driver) $format {} $info(tfs.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2842                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2843                        lappend cmd $style(-minrange) $style(-maxrange)
     2844                    }
     2845                }
     2846                "wfs" {
     2847                    set format "json"
     2848                    if {[info exists info(wfs.format)]} {
     2849                        set format $info(wfs.format)
     2850                    }
     2851                    set wfsType ""
     2852                    if {[info exists info(wfs.typename)]} {
     2853                        set wfsType $info(wfs.typename)
     2854                    }
     2855                    set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(wfs.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2856                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2857                        lappend cmd $style(-minrange) $style(-maxrange)
     2858                    }
     2859                }
    28272860            }
    28282861            SendCmd $cmd
    2829             if { $ssSize > 0 }       { SendData $info(stylesheet) }
    2830             if { $scriptSize > 0 }   { SendData $script }
    2831             if { $selectorsSize > 0} { SendData $selectors }
     2862            if { $ssSize > 0 }        { SendData $info(stylesheet) }
     2863            if { $scriptSize > 0 }    { SendData $script }
     2864            if { $selectorsSize > 0 } { SendData $selectors }
    28322865            SendCmd "map layer opacity $style(-opacity) $tag"
    28332866        }
     
    32623295    }
    32633296}
     3297
     3298# ----------------------------------------------------------------------
     3299# OPTION: -map
     3300# ----------------------------------------------------------------------
     3301itcl::configbody Rappture::MapViewer::map {
     3302    if {$itk_option(-map) != "" } {
     3303        if {[catch {$itk_option(-map) isa Rappture::Map} valid] != 0 || !$valid} {
     3304            error "bad value \"$itk_option(-map)\": should be Rappture::Map object"
     3305        }
     3306        $this clear
     3307        $this add $itk_option(-map)
     3308        $this scale $itk_option(-map)
     3309    } else {
     3310        $this clear
     3311    }
     3312
     3313    if { [isconnected] } {
     3314        $_dispatcher event -idle !rebuild
     3315    }
     3316}
  • branches/blt4_trunk/gui/scripts/nanovisviewer.tcl

    r6351 r6414  
    871871        DoResize
    872872    }
    873 
     873    if { $_reset } {
     874        InitSettings -background -axesvisible -gridvisible
     875    }
    874876    set _first ""
    875877    SendCmd "volume state 0"
     
    926928
    927929    if { $_reset } {
    928         InitSettings -axesvisible -gridvisible \
    929             -opacity -light2side -isosurfaceshading \
     930        InitSettings -opacity -light2side -isosurfaceshading \
    930931            -ambient -diffuse -specularlevel -specularexponent \
    931932            -current
  • branches/blt4_trunk/gui/scripts/page.tcl

    r5659 r6414  
    176176                set type [$obj element -as type]
    177177                switch -- $type {
    178                     number - integer - boolean - choice {
     178                    number - integer - boolean - choice - multichoice {
    179179                        Rappture::ResultViewer $w -width 0 -height 0
    180180                        pack $w -fill x -padx 4 -pady 4
  • branches/blt4_trunk/gui/scripts/resultviewer.tcl

    r6052 r6414  
    2626
    2727    constructor {args} {
    28         # defined below
     28        # defined below
    2929    }
    3030    destructor {
     
    395395                    }
    396396                }
    397                 boolean - choice {
     397                boolean - choice - multichoice {
    398398                    set mode "value"
    399399                    if {![info exists _mode2widget($mode)]} {
     
    549549            set dobj [$xmlobj element -as object $path]
    550550        }
    551         number - integer - boolean - choice {
     551        number - integer - boolean - choice - multichoice {
    552552            set dobj [$xmlobj element -as object $path]
    553553        }
  • branches/blt4_trunk/gui/scripts/sequence.tcl

    r6031 r6414  
    8686                    set obj [Rappture::Field ::\#auto $xmlobj $path.$name.$cname]
    8787                }
     88                image {
     89                    set obj [Rappture::Image ::\#auto $xmlobj $path.$name.$cname]
     90                }
    8891                map {
    8992                    set obj [Rappture::Map ::\#auto $xmlobj $path.$name.$cname]
    9093                }
    91                 image {
    92                     set obj [Rappture::Image ::\#auto $xmlobj $path.$name.$cname]
     94                mesh {
     95                    set obj [Rappture::Mesh ::\#auto $xmlobj $path.$name.$cname]
    9396                }
    9497                structure {
  • branches/blt4_trunk/gui/scripts/sequencedial.tcl

    r5659 r6414  
    5656    itk_option define -interactcommand interactCommand InteractCommand ""
    5757
    58 
    5958    constructor {args} { # defined below }
    6059    destructor { # defined below }
  • branches/blt4_trunk/gui/scripts/sequenceresult.tcl

    r6052 r6414  
    498498                pack $w -expand yes -fill both
    499499            }
     500            ::Rappture::Mesh {
     501                Rappture::VtkMeshViewer $w
     502                pack $w -expand yes -fill both
     503            }
    500504            ::Rappture::LibraryObj {
    501505                switch -- [$dataobj element -as type] {
  • branches/blt4_trunk/gui/scripts/vtkglyphviewer.tcl

    r6351 r6414  
    151151    private variable _rotatePending 0
    152152    private variable _cutplanePending 0
    153     private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    154153    private variable _fields
    155154    private variable _curFldName ""
    156155    private variable _curFldLabel ""
    157156    private variable _curFldComp 3
     157    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    158158    private variable _mouseOver "";     # what called LegendRangeAction:
    159159                                        # vmin or vmax
     
    626626        set _dlist [lreplace $_dlist $pos $pos]
    627627        array unset _obj2ovride $dataobj-*
    628         array unset _settings $dataobj-*
    629628        set changed 1
    630629    }
     
    13191318itcl::body Rappture::VtkGlyphViewer::InitSettings { args } {
    13201319    foreach spec $args {
    1321         if { [info exists _settings($_first${spec})] } {
    1322             # Reset global setting with dataobj specific setting
    1323             set _settings($spec) $_settings($_first${spec})
    1324         }
    13251320        AdjustSetting $spec
    13261321    }
     
    13831378            } else {
    13841379                if { !$_settings(-colormapvisible) } {
    1385                     SendCmd "glyphs colormode $_colorMode $_curFldName"
     1380                    SendCmd [list glyphs colormode $_colorMode $_curFldName]
    13861381                    set _settings(-colormapvisible) 1
    13871382                }
     
    14641459                    SetMinMaxGauges $vmin $vmax
    14651460                }
    1466                 SendCmd "dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp"
    1467             }
    1468             #SendCmd "cutplane colormode $_colorMode $_curFldName"
    1469             SendCmd "glyphs colormode $_colorMode $_curFldName"
     1461                SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp]
     1462            }
     1463            #SendCmd [list cutplane colormode $_colorMode $_curFldName]
     1464            SendCmd [list glyphs colormode $_colorMode $_curFldName]
    14701465            DrawLegend
    14711466        }
     
    15681563                foreach { vmin vmax } $_limits($_curFldName) break
    15691564            }
    1570             SendCmd "dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp"
     1565            SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp]
    15711566            DrawLegend
    15721567        }
     
    16501645            set _colormaps($cmap) 1
    16511646        }
    1652         #SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     1647        #SendCmd [list legend $cmap $_colorMode $_curFldName {} $w $h 0]
    16531648        SendCmd "legend2 $cmap $w $h"
    16541649    }
     
    24322427        set _settings(-colormap) "none"
    24332428    } else {
    2434         SendCmd "glyphs colormode $style(-colormode) $_curFldName $tag"
     2429        SendCmd [list glyphs colormode $style(-colormode) $_curFldName $tag]
    24352430        set _settings(-colormapvisible) 1
    24362431        set _settings(-colormap) $style(-color)
     
    31133108    $itk_component(field) value $_curFldLabel
    31143109    if { $_settings(-customrange) } {
    3115         set limits [list [$itk_component(min) value] [$itk_component(max) value]]
    3116         SendCmd "dataset maprange explicit $limits $_curFldName point_data $_curFldComp"
     3110        set vmin [$itk_component(min) value]
     3111        set vmax [$itk_component(max) value]
     3112        SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp]
    31173113    } else {
    31183114        if { ![info exists _limits($_curFldName)] } {
    31193115            SendCmd "dataset maprange all"
    31203116        } else {
    3121             set limits $_limits($_curFldName)
    3122             SendCmd "dataset maprange explicit $limits $_curFldName point_data $_curFldComp"
    3123         }
    3124     }
    3125 }
     3117            foreach { vmin vmax } $_limits($_curFldName) break
     3118            SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName point_data $_curFldComp]
     3119        }
     3120    }
     3121}
  • branches/blt4_trunk/gui/scripts/vtkheightmapviewer.tcl

    r6351 r6414  
    103103    private method Rotate {option x y}
    104104    private method SetCurrentColormap { color }
     105    private method SetCurrentFieldName { dataobj }
    105106    private method SetLegendTip { x y }
    106107    private method SetObjectStyle { dataobj comp }
     
    261262
    262263    itk_component add fieldmenu {
    263         menu $itk_component(plotarea).menu \
    264             -relief flat \
    265             -tearoff 0
     264        menu $itk_component(plotarea).menu -relief flat -tearoff 0
    266265    } {
    267266        usual
     
    292291    }
    293292    pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
    294     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     293    Rappture::Tooltip::for $itk_component(reset) \
     294        "Reset the view to the default zoom level"
    295295
    296296    itk_component add zoomin {
     
    526526        set _dlist [lreplace $_dlist $pos $pos]
    527527        array unset _obj2ovride $dataobj-*
    528         array unset _settings $dataobj-*
    529528        set changed 1
    530529    }
     
    923922        # Reset the camera and other view parameters
    924923        #
    925         InitSettings -isheightmap -background
     924        InitSettings -isheightmap -background \
     925            -xgrid -ygrid -zgrid -axismode \
     926            -axesvisible -axislabels -axisminorticks
    926927
    927928        # Setting a custom exponent and label format for axes is causing
     
    936937        #SendCmd "axis exp 0 0 0 1"
    937938
     939        SendCmd "axis tickpos outside"
    938940        SendCmd "axis lrot z 90"
    939941        $_arcball quaternion [ViewToQuaternion]
     
    960962        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    961963            set _first $dataobj
     964            SetCurrentFieldName $dataobj
    962965        }
    963966        foreach comp [$dataobj components] {
     
    10011004        }
    10021005    }
    1003     if { $_first != "" } {
    1004         $itk_component(field) choices delete 0 end
    1005         $itk_component(fieldmenu) delete 0 end
    1006         array unset _fields
    1007         set _curFldName ""
    1008         foreach cname [$_first components] {
    1009             foreach fname [$_first fieldnames $cname] {
    1010                 if { [info exists _fields($fname)] } {
    1011                     continue
    1012                 }
    1013                 foreach { label units components } \
    1014                     [$_first fieldinfo $fname] break
    1015                 $itk_component(field) choices insert end "$fname" "$label"
    1016                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1017                     -value $label -variable [itcl::scope _curFldLabel] \
    1018                     -selectcolor red \
    1019                     -activebackground $itk_option(-plotbackground) \
    1020                     -activeforeground $itk_option(-plotforeground) \
    1021                     -font "Arial 8" \
    1022                     -command [itcl::code $this LegendTitleAction save]
    1023                 set _fields($fname) [list $label $units $components]
    1024                 if { $_curFldName == "" } {
    1025                     set _curFldName $fname
    1026                     set _curFldLabel $label
    1027                 }
    1028             }
    1029         }
    1030         $itk_component(field) value $_curFldLabel
    1031     }
     1006
    10321007    InitSettings -stretchtofit -outline
    1033 
    10341008    if { $_reset } {
    1035         SendCmd "axis tickpos outside"
    1036         #SendCmd "axis lformat all %g"
    1037 
    10381009        foreach axis { x y z } {
    10391010            set label ""
     
    10921063        }
    10931064        PanCamera
    1094         InitSettings -xgrid -ygrid -zgrid \
    1095             -axesvisible -axislabels -heightmapscale -field -isheightmap \
    1096             -numisolines
     1065        InitSettings -heightmapscale -field -isheightmap -numisolines
    10971066        if { [array size _fields] < 2 } {
    10981067            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    13341303itcl::body Rappture::VtkHeightmapViewer::InitSettings { args } {
    13351304    foreach spec $args {
    1336         if { [info exists _settings($_first${spec})] } {
    1337             # Reset global setting with dataobj specific setting
    1338             set _settings($spec) $_settings($_first${spec})
    1339         }
    13401305        AdjustSetting $spec
    13411306    }
     
    14861451            # Get the new limits because the field changed.
    14871452            ResetAxes
    1488             SendCmd "dataset scalar $_curFldName"
    1489             SendCmd "heightmap colormode $_colorMode $_curFldName"
     1453            SendCmd [list dataset scalar $_curFldName]
     1454            SendCmd [list heightmap colormode $_colorMode $_curFldName]
    14901455            UpdateContourList
    14911456            SendCmd "heightmap contourlist [list $_contourList]"
     
    17391704            set _colormaps($cmap) 1
    17401705        }
    1741         #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1706        #SendCmd [list legend $cmap scalar $_curFldName {} $w $h 0]
    17421707        SendCmd "legend2 $cmap $w $h"
    17431708    }
     
    17821747    set bmax [expr $bmax - $bmin]
    17831748    set bmin 0
    1784     SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1749    SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
    17851750    SendCmd "axis bounds z $bmin $bmax"
    17861751    SendCmd "axis range z $_limits($_curFldName)"
     
    22772242    set tag $dataobj-$comp
    22782243    array set style {
    2279         -color           BCGYR
    2280         -colormapvisible 1
    2281         -edgecolor       black
    2282         -edges           0
    2283         -isolinecolor    black
    2284         -isolinesvisible 1
    2285         -isolinewidth    1.0
    2286         -levels          10
    2287         -linewidth       1.0
    2288         -opacity         1.0
    2289         -outline         0
    2290         -wireframe       0
     2244        -color            BCGYR
     2245        -colormapdiscrete 0
     2246        -colormapvisible  1
     2247        -edgecolor        black
     2248        -edges            0
     2249        -isolinecolor     black
     2250        -isolinesvisible  1
     2251        -isolinewidth     1.0
     2252        -levels           10
     2253        -linewidth        1.0
     2254        -opacity          1.0
     2255        -outline          0
     2256        -wireframe        0
    22912257    }
    22922258    set stylelist [$dataobj style $comp]
     
    23262292        DrawLegend
    23272293    }
    2328     foreach setting {-edges -outline -wireframe \
     2294    foreach setting {-edges -outline -wireframe -colormapdiscrete \
    23292295                     -colormapvisible -isolinecolor -isolinesvisible} {
    23302296        if {$_changed($setting)} {
     
    23492315    SendCmd "heightmap wireframe $style(-wireframe) $tag"
    23502316    SetCurrentColormap $style(-color)
     2317    if {$style(-colormapdiscrete)} {
     2318        SendCmd "heightmap preinterp 1 $tag"
     2319        set numColors [expr $style(-levels) + 1]
     2320        SendCmd "colormap res $numColors $style(-color)"
     2321    }
    23512322    SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag"
    23522323    $itk_component(isolinecolor) value $style(-isolinecolor)
     
    26792650    blt::vector destroy $v
    26802651}
     2652
     2653itcl::body Rappture::VtkHeightmapViewer::SetCurrentFieldName { dataobj } {
     2654    set _first $dataobj
     2655    $itk_component(field) choices delete 0 end
     2656    $itk_component(fieldmenu) delete 0 end
     2657    array unset _fields
     2658    set _curFldName ""
     2659    foreach cname [$_first components] {
     2660        foreach fname [$_first fieldnames $cname] {
     2661            if { [info exists _fields($fname)] } {
     2662                continue
     2663            }
     2664            foreach { label units components } \
     2665                [$_first fieldinfo $fname] break
     2666            $itk_component(field) choices insert end "$fname" "$label"
     2667            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2668                -value $label -variable [itcl::scope _curFldLabel] \
     2669                -selectcolor red \
     2670                -activebackground $itk_option(-plotbackground) \
     2671                -activeforeground $itk_option(-plotforeground) \
     2672                -font "Arial 8" \
     2673                -command [itcl::code $this LegendTitleAction save]
     2674            set _fields($fname) [list $label $units $components]
     2675            if { $_curFldName == "" } {
     2676                set _curFldName $fname
     2677                set _curFldLabel $label
     2678            }
     2679        }
     2680    }
     2681    $itk_component(field) value $_curFldLabel
     2682}
  • branches/blt4_trunk/gui/scripts/vtkimageviewer.tcl

    r6351 r6414  
    100100    private method Rotate {option x y}
    101101    private method SetCurrentColormap { color }
     102    private method SetCurrentFieldName { dataobj }
    102103    private method SetLegendTip { x y }
    103104    private method SetObjectStyle { dataobj comp }
     
    243244
    244245    itk_component add fieldmenu {
    245         menu $itk_component(plotarea).menu \
    246             -relief flat \
    247             -tearoff 0
     246        menu $itk_component(plotarea).menu -relief flat -tearoff 0
    248247    } {
    249248        usual
     
    274273    }
    275274    pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
    276     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     275    Rappture::Tooltip::for $itk_component(reset) \
     276        "Reset the view to the default zoom level"
    277277
    278278    itk_component add zoomin {
     
    510510        set _dlist [lreplace $_dlist $pos $pos]
    511511        array unset _obj2ovride $dataobj-*
    512         array unset _settings $dataobj-*
    513512        set changed 1
    514513    }
     
    604603        }
    605604        foreach axis { x y } {
     605            set units [$dataobj hints ${axis}units]
     606            set found($units) 1
    606607            set lim [$dataobj limits $axis]
    607608            if { ![info exists _limits($axis)] } {
     
    618619            }
    619620            set _limits($axis) [list $amin $amax]
    620             set units [$dataobj hints ${axis}units]
    621             set found($units) 1
    622621        }
    623622        foreach { fname lim } [$dataobj fieldlimits] {
     
    900899        DoResize
    901900        if { $_settings(-stretchtofit) } {
    902             AdjustSetting -stretchToFit
     901            AdjustSetting -stretchtofit
    903902        }
    904903    }
     
    907906        # Reset the camera and other view parameters
    908907        #
    909         InitSettings -view3d -background
    910 
     908        InitSettings -view3d -background \
     909            -xgrid -ygrid -zgrid -axismode \
     910            -axesvisible -axislabels -axisminorticks
     911
     912        SendCmd "axis tickpos outside"
    911913        SendCmd "axis lrot z 90"
    912914        $_arcball quaternion [ViewToQuaternion]
     
    932934        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    933935            set _first $dataobj
     936            SetCurrentFieldName $dataobj
    934937        }
    935938        foreach comp [$dataobj components] {
     
    968971        }
    969972    }
    970     if { $_first != ""  } {
    971         $itk_component(field) choices delete 0 end
    972         $itk_component(fieldmenu) delete 0 end
    973         array unset _fields
    974         set _curFldName ""
    975         foreach cname [$_first components] {
    976             foreach fname [$_first fieldnames $cname] {
    977                 if { [info exists _fields($fname)] } {
    978                     continue
    979                 }
    980                 foreach { label units components } \
    981                     [$_first fieldinfo $fname] break
    982                 $itk_component(field) choices insert end "$fname" "$label"
    983                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    984                     -value $label -variable [itcl::scope _curFldLabel] \
    985                     -selectcolor red \
    986                     -activebackground $itk_option(-plotbackground) \
    987                     -activeforeground $itk_option(-plotforeground) \
    988                     -font "Arial 8" \
    989                     -command [itcl::code $this LegendTitleAction save]
    990                 set _fields($fname) [list $label $units $components]
    991                 if { $_curFldName == "" } {
    992                     set _curFldName $fname
    993                     set _curFldLabel $label
    994                 }
    995             }
    996         }
    997         $itk_component(field) value $_curFldLabel
    998     }
     973
    999974    InitSettings -stretchtofit -outline
    1000 
    1001975    if { $_reset } {
    1002         SendCmd "axis tickpos outside"
    1003         #SendCmd "axis lformat all %g"
    1004 
    1005976        foreach axis { x y z } {
    1006977            set label ""
     
    10431014        }
    10441015        PanCamera
    1045         InitSettings -xgrid -ygrid -zgrid \
    1046             -axesvisible -axislabels -field -view3d
     1016        InitSettings -field -view3d
    10471017        if { [array size _fields] < 2 } {
    10481018            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    12751245itcl::body Rappture::VtkImageViewer::InitSettings { args } {
    12761246    foreach spec $args {
    1277         if { [info exists _settings($_first${spec})] } {
    1278             # Reset global setting with dataobj specific setting
    1279             set _settings($spec) $_settings($_first${spec})
    1280         }
    12811247        AdjustSetting $spec
    12821248    }
     
    13891355
    13901356            # Get the new limits because the field changed.
    1391             SendCmd "dataset scalar $_curFldName"
    1392             #SendCmd "image colormode scalar $_curFldName"
     1357            SendCmd [list dataset scalar $_curFldName]
     1358            #SendCmd [list image colormode scalar $_curFldName]
    13931359            SendCmd "camera reset"
    13941360            DrawLegend
     
    15451511            set _colormaps($cmap) 1
    15461512        }
    1547         #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1513        #SendCmd [list legend $cmap scalar $_curFldName {} $w $h 0]
    15481514        SendCmd "legend2 $cmap $w $h"
    15491515    }
     
    20462012    if { [info exists style(-stretchtofit)] } {
    20472013        set _settings(-stretchtofit) $style(-stretchtofit)
    2048         AdjustSetting -stretchToFit
     2014        AdjustSetting -stretchtofit
    20492015    }
    20502016    SendCmd "outline add $tag"
     
    23272293    set _view(-zoom) 1.0
    23282294}
     2295
     2296itcl::body Rappture::VtkImageViewer::SetCurrentFieldName { dataobj } {
     2297    set _first $dataobj
     2298    $itk_component(field) choices delete 0 end
     2299    $itk_component(fieldmenu) delete 0 end
     2300    array unset _fields
     2301    set _curFldName ""
     2302    foreach cname [$_first components] {
     2303        foreach fname [$_first fieldnames $cname] {
     2304            if { [info exists _fields($fname)] } {
     2305                continue
     2306            }
     2307            foreach { label units components } \
     2308                [$_first fieldinfo $fname] break
     2309            $itk_component(field) choices insert end "$fname" "$label"
     2310            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2311                -value $label -variable [itcl::scope _curFldLabel] \
     2312                -selectcolor red \
     2313                -activebackground $itk_option(-plotbackground) \
     2314                -activeforeground $itk_option(-plotforeground) \
     2315                -font "Arial 8" \
     2316                -command [itcl::code $this LegendTitleAction save]
     2317            set _fields($fname) [list $label $units $components]
     2318            if { $_curFldName == "" } {
     2319                set _curFldName $fname
     2320                set _curFldLabel $label
     2321            }
     2322        }
     2323    }
     2324    $itk_component(field) value $_curFldLabel
     2325}
  • branches/blt4_trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r6351 r6414  
    160160    private variable _rotatePending 0
    161161    private variable _cutplanePending 0
    162     private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    163162    private variable _fields
    164163    private variable _curFldName ""
    165164    private variable _curFldLabel ""
     165    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    166166    private variable _mouseOver "";     # what called LegendRangeAction:
    167167                                        # vmin or vmax
     
    653653        set _dlist [lreplace $_dlist $pos $pos]
    654654        array unset _obj2ovride $dataobj-*
    655         array unset _settings $dataobj-*
    656655        set changed 1
    657656    }
     
    13461345itcl::body Rappture::VtkIsosurfaceViewer::InitSettings { args } {
    13471346    foreach spec $args {
    1348         if { [info exists _settings($_first${spec})] } {
    1349             # Reset global setting with dataobj specific setting
    1350             set _settings($spec) $_settings($_first${spec})
    1351         }
    13521347        AdjustSetting $spec
    13531348    }
     
    14101405            } else {
    14111406                if { !$_settings(-colormapvisible) } {
    1412                     SendCmd "contour3d colormode $_colorMode $_curFldName"
     1407                    SendCmd [list contour3d colormode $_colorMode $_curFldName]
    14131408                    set _settings(-colormapvisible) 1
    14141409                }
     
    14771472                return
    14781473            }
    1479             SendCmd "dataset scalar $_curFldName"
     1474            SendCmd [list dataset scalar $_curFldName]
    14801475            if { ![info exists _limits($_curFldName)] } {
    14811476                SendCmd "dataset maprange all"
     
    14911486                    SetMinMaxGauges $vmin $vmax
    14921487                }
    1493                 SendCmd "dataset maprange explicit $vmin $vmax $_curFldName"
    1494             }
    1495             SendCmd "cutplane colormode $_colorMode $_curFldName"
    1496             SendCmd "contour3d colormode $_colorMode $_curFldName"
     1488                SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
     1489            }
     1490            SendCmd [list cutplane colormode $_colorMode $_curFldName]
     1491            SendCmd [list contour3d colormode $_colorMode $_curFldName]
    14971492            GenerateContourList
    14981493            SendCmd [list contour3d contourlist $_contourList(values)]
     
    15811576            GenerateContourList
    15821577            SendCmd [list contour3d contourlist $_contourList(values)]
    1583             SendCmd "dataset maprange explicit $vmin $vmax $_curFldName"
     1578            SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
    15841579            DrawLegend
    15851580        }
     
    16641659            set _colormaps($cmap) 1
    16651660        }
    1666         #SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     1661        #SendCmd [list legend $cmap $_colorMode $_curFldName {} $w $h 0]
    16671662        SendCmd "legend2 $cmap $w $h"
    16681663    }
     
    31413136    $itk_component(field) value $_curFldLabel
    31423137    if { $_settings(-customrange) } {
    3143         set limits [list [$itk_component(min) value] [$itk_component(max) value]]
    3144         SendCmd "dataset maprange explicit $limits $_curFldName"
     3138        set vmin [$itk_component(min) value]
     3139        set vmax [$itk_component(max) value]
     3140        SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
     3141        set limits [list $vmin $vmax]
    31453142        if { $limits != $_currentLimits } {
    31463143            set _currentLimits $limits
     
    31513148            SendCmd "dataset maprange all"
    31523149        } else {
    3153             set limits $_limits($_curFldName)
    3154             SendCmd "dataset maprange explicit $limits $_curFldName"
     3150            foreach { vmin vmax } $_limits($_curFldName) break
     3151            SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
     3152            set limits [list $vmin $vmax]
    31553153            if { $limits != $_currentLimits } {
    31563154                set _currentLimits $limits
  • branches/blt4_trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r6351 r6414  
    105105    private method Rotate {option x y}
    106106    private method SetCurrentColormap { color }
     107    private method SetCurrentFieldName { dataobj }
    107108    private method SetLegendTip { x y }
    108109    private method SetObjectStyle { dataobj comp }
     
    145146    private variable _curFldName ""
    146147    private variable _curFldLabel ""
     148    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    147149    private variable _streamlinesLength 0
    148150    private variable _numSeeds 200
    149     private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    150151
    151152    private common _downloadPopup;      # download options from popup
     
    300301    }
    301302    pack $itk_component(reset) -side top -padx 2 -pady 2
    302     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     303    Rappture::Tooltip::for $itk_component(reset) \
     304        "Reset the view to the default zoom level"
    303305
    304306    itk_component add zoomin {
     
    588590        set _dlist [lreplace $_dlist $pos $pos]
    589591        array unset _obj2ovride $dataobj-*
    590         array unset _settings $dataobj-*
    591592        set changed 1
    592593    }
     
    978979        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    979980            set _first $dataobj
     981            SetCurrentFieldName $dataobj
    980982        }
    981983        foreach comp [$dataobj components] {
     
    10231025            }
    10241026        }
    1025         $itk_component(field) choices delete 0 end
    1026         $itk_component(fieldmenu) delete 0 end
    1027         array unset _fields
    1028         set _curFldName ""
    1029         set _curFldLabel ""
    1030         foreach cname [$_first components] {
    1031             foreach fname [$_first fieldnames $cname] {
    1032                 if { [info exists _fields($fname)] } {
    1033                     continue
    1034                 }
    1035                 foreach { label units components } \
    1036                     [$_first fieldinfo $fname] break
    1037                 $itk_component(field) choices insert end "$fname" "$label"
    1038                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1039                     -value $label -variable [itcl::scope _curFldLabel] \
    1040                     -selectcolor red \
    1041                     -activebackground $itk_option(-plotbackground) \
    1042                     -activeforeground $itk_option(-plotforeground) \
    1043                     -font "Arial 8" \
    1044                     -command [itcl::code $this LegendTitleAction save]
    1045                 set _fields($fname) [list $label $units $components]
    1046                 if { $_curFldName == "" && $components == 3 } {
    1047                     set _curFldName $fname
    1048                     set _curFldLabel $label
    1049                 }
    1050             }
    1051         }
    1052         $itk_component(field) value $_curFldLabel
    10531027    }
    10541028
     
    12951269itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
    12961270    foreach spec $args {
    1297         if { [info exists _settings($_first${spec})] } {
    1298             # Reset global setting with dataobj specific setting
    1299             set _settings($spec) $_settings($_first${spec})
    1300         }
    13011271        AdjustSetting $spec
    13021272    }
     
    13821352                SendCmd "dataset maprange all"
    13831353            } else {
    1384                 SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
    1385             }
    1386             SendCmd "streamlines colormode $_colorMode $_curFldName"
    1387             SendCmd "cutplane colormode $_colorMode $_curFldName"
     1354                foreach { vmin vmax } $_limits($_curFldName) break
     1355                SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
     1356            }
     1357            SendCmd [list streamlines colormode $_colorMode $_curFldName]
     1358            SendCmd [list cutplane colormode $_colorMode $_curFldName]
    13881359            DrawLegend
    13891360        }
     
    15261497            set _colormaps($cmap) 1
    15271498        }
    1528         #SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     1499        #SendCmd [list legend $cmap $_colorMode $_curFldName {} $w $h 0]
    15291500        SendCmd "legend2 $cmap $w $h"
    15301501    }
     
    24342405    set _view(-zoom) 1.0
    24352406}
     2407
     2408itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } {
     2409    set _first $dataobj
     2410    $itk_component(field) choices delete 0 end
     2411    $itk_component(fieldmenu) delete 0 end
     2412    array unset _fields
     2413    set _curFldName ""
     2414    set _curFldLabel ""
     2415    foreach cname [$_first components] {
     2416        foreach fname [$_first fieldnames $cname] {
     2417            if { [info exists _fields($fname)] } {
     2418                continue
     2419            }
     2420            foreach { label units components } \
     2421                [$_first fieldinfo $fname] break
     2422            $itk_component(field) choices insert end "$fname" "$label"
     2423            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2424                -value $label -variable [itcl::scope _curFldLabel] \
     2425                -selectcolor red \
     2426                -activebackground $itk_option(-plotbackground) \
     2427                -activeforeground $itk_option(-plotforeground) \
     2428                -font "Arial 8" \
     2429                -command [itcl::code $this LegendTitleAction save]
     2430            set _fields($fname) [list $label $units $components]
     2431            if { $_curFldName == "" && $components == 3 } {
     2432                set _curFldName $fname
     2433                set _curFldLabel $label
     2434            }
     2435        }
     2436    }
     2437    $itk_component(field) value $_curFldLabel
     2438}
  • branches/blt4_trunk/gui/scripts/vtksurfaceviewer.tcl

    r6351 r6414  
    139139    private variable _legendPending 0
    140140    private variable _rotatePending 0
    141     private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    142141    private variable _fields
    143142    private variable _curFldName ""
    144143    private variable _curFldLabel ""
     144    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    145145
    146146    private common _downloadPopup;      # download options from popup
     
    509509        set _dlist [lreplace $_dlist $pos $pos]
    510510        array unset _obj2ovride $dataobj-*
    511         array unset _settings $dataobj-*
    512511        set changed 1
    513512    }
     
    11901189itcl::body Rappture::VtkSurfaceViewer::InitSettings { args } {
    11911190    foreach spec $args {
    1192         if { [info exists _settings($_first${spec})] } {
    1193             # Reset global setting with dataobj specific setting
    1194             set _settings($spec) $_settings($_first${spec})
    1195         }
    11961191        AdjustSetting $spec
    11971192    }
     
    12531248            } else {
    12541249                if { !$_settings(-colormapvisible) } {
    1255                     #SendCmd "contour2d colormode $_colorMode $_curFldName"
    1256                     SendCmd "polydata colormode $_colorMode $_curFldName"
     1250                    #SendCmd [list contour2d colormode $_colorMode $_curFldName]
     1251                    SendCmd [list polydata colormode $_colorMode $_curFldName]
    12571252                    set _settings(-colormapvisible) 1
    12581253                }
     
    12991294                return
    13001295            }
    1301             SendCmd "dataset scalar $_curFldName"
     1296            SendCmd [list dataset scalar $_curFldName]
    13021297            if { ![info exists _limits($_curFldName)] } {
    13031298                SendCmd "dataset maprange all"
    13041299            } else {
    1305                 SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
    1306             }
    1307             #SendCmd "contour2d colormode $_colorMode $_curFldName"
    1308             SendCmd "polydata colormode $_colorMode $_curFldName"
     1300                foreach { vmin vmax } $_limits($_curFldName) break
     1301                SendCmd [list dataset maprange explicit $vmin $vmax $_curFldName]
     1302            }
     1303            #SendCmd [list contour2d colormode $_colorMode $_curFldName]
     1304            SendCmd [list polydata colormode $_colorMode $_curFldName]
    13091305            UpdateContourList
    13101306            SendCmd "contour2d contourlist [list $_contourList]"
     
    14771473            set _colormaps($cmap) 1
    14781474        }
    1479         #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1475        #SendCmd [list legend $cmap scalar $_curFldName {} $w $h 0]
    14801476        SendCmd "legend2 $cmap $w $h"
    14811477    }
     
    19551951    SendCmd "polydata add $tag"
    19561952    if { $_curFldName != "" } {
    1957         SendCmd "polydata colormode $_colorMode $_curFldName $tag"
     1953        SendCmd [list polydata colormode $_colorMode $_curFldName $tag]
    19581954    }
    19591955    SendCmd "polydata edges $style(-edges) $tag"
  • branches/blt4_trunk/gui/scripts/vtkviewer.tcl

    r6351 r6414  
    134134    private variable _click;            # info used for rotate operations
    135135    private variable _limits;           # autoscale min/max for all axes
     136    private variable _fieldlimits;      # maps dataobj-comp to field limits
     137    private variable _fieldComponents;  # maps dataobj-comp-fname to number of
     138                                        # components
    136139    private variable _view;             # view params for 3D view
    137140    private variable _settings
     
    241244    set _arcball [blt::arcball create 100 100]
    242245    $_arcball quaternion [ViewToQuaternion]
    243 
    244     set _limits(zmin) 0.0
    245     set _limits(zmax) 1.0
    246246
    247247    array set _axis [subst {
     
    263263    }]
    264264    array set _settings [subst {
    265         glyphs-edges            0
    266         glyphs-lighting         1
    267         glyphs-opacity          100
    268         glyphs-outline          0
    269         glyphs-palette          BCGYR
    270         glyphs-visible          1
    271         glyphs-wireframe        0
    272         legend                  1
    273         molecule-atoms-visible  1
    274         molecule-atomscale      0.3
    275         molecule-bonds-visible  1
    276         molecule-bondscale      0.075
    277         molecule-bondstyle      "cylinder"
    278         molecule-edges          0
    279         molecule-labels         0
    280         molecule-lighting       1
    281         molecule-opacity        100
    282         molecule-outline        0
    283         molecule-palette        elementDefault
    284         molecule-quality        1.0
    285         molecule-representation "Ball and Stick"
    286         molecule-rscale         "covalent"
    287         molecule-visible        1
    288         molecule-wireframe      0
    289         polydata-edges          0
    290         polydata-lighting       1
    291         polydata-opacity        100
    292         polydata-outline        0
    293         polydata-palette        BCGYR
    294         polydata-visible        1
    295         polydata-wireframe      0
     265        glyphs-edges               0
     266        glyphs-lighting            1
     267        glyphs-opacity             100
     268        glyphs-outline             0
     269        glyphs-colormap            BCGYR
     270        glyphs-visible             1
     271        glyphs-wireframe           0
     272        legend                     1
     273        molecule-atoms-visible     1
     274        molecule-atomscale         0.3
     275        molecule-bonds-visible     1
     276        molecule-bondscale         0.075
     277        molecule-bondstyle         "cylinder"
     278        molecule-colorfield        "element"
     279        molecule-colormode         "by_elements"
     280        molecule-edges             0
     281        molecule-labels            0
     282        molecule-lighting          1
     283        molecule-opacity           100
     284        molecule-outline           0
     285        molecule-colormap          elementDefault
     286        molecule-quality           1.0
     287        molecule-representation    "Ball and Stick"
     288        molecule-rscale            "covalent"
     289        molecule-visible           1
     290        molecule-wireframe         0
     291        polydata-edges             0
     292        polydata-lighting          1
     293        polydata-opacity           100
     294        polydata-outline           0
     295        polydata-colormap          BCGYR
     296        polydata-visible           1
     297        polydata-wireframe         0
    296298    }]
    297299    itk_component add view {
     
    631633        set _dlist [lreplace $_dlist $pos $pos]
    632634        array unset _obj2ovride $dataobj-*
    633         array unset _settings $dataobj-*
    634635        set changed 1
    635636    }
     
    761762        if { ![$itk_component(main) exists "Glyphs Settings"] } {
    762763            if { [catch { BuildGlyphsTab } errs ]  != 0 } {
    763                 puts stderr "errs=$errs"
     764                global errorInfo
     765                puts stderr "errs=$errs\nerrorInfo=$errorInfo"
    764766            }
    765767        }
     
    768770        if { ![$itk_component(main) exists "Mesh Settings"] } {
    769771            if { [catch { BuildPolydataTab } errs ]  != 0 } {
    770                 puts stderr "errs=$errs"
     772                global errorInfo
     773                puts stderr "errs=$errs\nerrorInfo=$errorInfo"
    771774            }
    772775        }
     
    10321035    }
    10331036
    1034     set _limits(zmin) ""
    1035     set _limits(zmax) ""
    10361037    set _first ""
    10371038    SendCmd "dataset visible 0"
    10381039    set count 0
     1040    eval scale $_dlist
    10391041    foreach dataobj [get -objects] {
    10401042        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
     
    14261428            }
    14271429        }
    1428         "glyphs-palette" {
    1429             set palette [$itk_component(glyphspalette) value]
    1430             set _settings($what) $palette
     1430        "glyphs-colormap" {
     1431            set colormap [$itk_component(glyphscolormap) value]
     1432            set _settings($what) $colormap
    14311433            foreach dataset [CurrentDatasets -visible $_first] {
    14321434                foreach {dataobj comp} [split $dataset -] break
    14331435                set type [$dataobj type $comp]
    14341436                if { $type == "glyphs" } {
    1435                     ChangeColormap $dataobj $comp $palette
     1437                    ChangeColormap $dataobj $comp $colormap
    14361438                    # FIXME: fill in current selected fieldname
    14371439                    #SendCmd "glyphs colormode scalar {} $dataset"
     
    14981500            }
    14991501        }
    1500         "polydata-palette" {
    1501             set palette [$itk_component(meshpalette) value]
    1502             set _settings($what) $palette
     1502        "polydata-colormap" {
     1503            set colormap [$itk_component(meshcolormap) value]
     1504            set _settings($what) $colormap
    15031505            foreach dataset [CurrentDatasets -visible $_first] {
    15041506                foreach {dataobj comp} [split $dataset -] break
    15051507                set type [$dataobj type $comp]
    15061508                if { $type == "polydata" } {
    1507                     ChangeColormap $dataobj $comp $palette
     1509                    ChangeColormap $dataobj $comp $colormap
    15081510                    # FIXME: fill in current selected fieldname
    15091511                    #SendCmd "polydata colormode scalar {} $dataset"
     
    15701572            }
    15711573        }
    1572         "molecule-palette" {
    1573             set palette [$itk_component(moleculepalette) value]
    1574             set _settings($what) $palette
     1574        "molecule-colormap" {
     1575            set colormap [$itk_component(moleculecolormap) value]
     1576            set _settings($what) $colormap
    15751577            foreach dataset [CurrentDatasets -visible $_first] {
    15761578                foreach {dataobj comp} [split $dataset -] break
    15771579                set type [$dataobj type $comp]
    15781580                if { $type == "molecule" } {
    1579                     ChangeColormap $dataobj $comp $palette
    1580                     if { $palette == "elementDefault" } {
    1581                         SendCmd "molecule colormode by_elements element $dataset"
     1581                    ChangeColormap $dataobj $comp $colormap
     1582                    if { $colormap == "elementDefault" } {
     1583                        SendCmd [list molecule colormode by_elements element $dataset]
    15821584                    } else {
    15831585                        # FIXME: Set the chosen scalar field name here
    1584                         SendCmd "molecule colormode scalar {} $dataset"
     1586                        set _settings(molecule-colormode) scalar
     1587                        set _settings(molecule-colorfield) ""
     1588                        SendCmd [list molecule colormode $_settings(molecule-colormode) $_settings(molecule-colorfield) $dataset]
    15851589                    }
    15861590                }
     
    18711875
    18721876itcl::body Rappture::VtkViewer::limits { dataobj } {
    1873     foreach comp [$dataobj components] {
    1874         set tag $dataobj-$comp
     1877    foreach cname [$dataobj components] {
     1878        set tag $dataobj-$cname
    18751879        if { ![info exists _limits($tag)] } {
    1876             set data [$dataobj data $comp]
     1880            set data [$dataobj data $cname]
    18771881            if { $data == "" } {
    18781882                continue
     
    18851889            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
    18861890            $reader SetFileName $tmpfile
    1887 set debug 0
    1888             if {$debug} {
    1889                 # Only needed for debug output below
    1890                 $reader ReadAllNormalsOn
    1891                 $reader ReadAllTCoordsOn
    1892                 $reader ReadAllScalarsOn
    1893                 $reader ReadAllColorScalarsOn
    1894                 $reader ReadAllVectorsOn
    1895                 $reader ReadAllTensorsOn
    1896                 $reader ReadAllFieldsOn
    1897             }
     1891            $reader ReadAllNormalsOn
     1892            $reader ReadAllTCoordsOn
     1893            $reader ReadAllScalarsOn
     1894            $reader ReadAllColorScalarsOn
     1895            $reader ReadAllVectorsOn
     1896            $reader ReadAllTensorsOn
     1897            $reader ReadAllFieldsOn
    18981898            $reader Update
    18991899            file delete $tmpfile
    1900             set output [$reader GetOutput]
    1901             if { $output == "" } {
     1900            set dataset [$reader GetOutput]
     1901            if { $dataset == "" } {
    19021902                # Invalid VTK file -- loader failed to parse
    19031903                continue
    19041904            }
    1905             set _limits($tag) [$output GetBounds]
    1906             if {$debug} {
    1907                 puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
    1908                 puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]"
    1909                 puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]"
    1910                 puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]"
    1911                 puts stderr "\#tcoords=[$reader GetNumberOfTCoordsInFile]"
    1912                 puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
    1913                 puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
    1914                 set pointData [$output GetPointData]
    1915                 if { $pointData != ""} {
    1916                     puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
    1917                     puts stderr "point \#components=[$pointData GetNumberOfComponents]"
    1918                     puts stderr "point \#tuples=[$pointData GetNumberOfTuples]"
    1919                     puts stderr "point scalars=[$pointData GetScalars]"
    1920                     puts stderr "point vectors=[$pointData GetVectors]"
    1921                 }
    1922                 set cellData [$output GetCellData]
    1923                 if { $cellData != ""} {
    1924                     puts stderr "cell \#arrays=[$cellData GetNumberOfArrays]"
    1925                     puts stderr "cell \#components=[$cellData GetNumberOfComponents]"
    1926                     puts stderr "cell \#tuples=[$cellData GetNumberOfTuples]"
    1927                     puts stderr "cell scalars=[$cellData GetScalars]"
    1928                     puts stderr "cell vectors=[$cellData GetVectors]"
    1929                 }
    1930                 set fieldData [$output GetFieldData]
    1931                 if { $fieldData != ""} {
    1932                     puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
    1933                     puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
    1934                     puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]"
    1935                 }
    1936             }
    1937             rename $output ""
     1905            set _limits($tag) [$dataset GetBounds]
     1906            set dataAttrs [$dataset GetPointData]
     1907            if { $dataAttrs != ""} {
     1908                set numArrays [$dataAttrs GetNumberOfArrays]
     1909                for {set i 0} {$i < $numArrays} {incr i} {
     1910                    set array [$dataAttrs GetArray $i]
     1911                    set fname [$dataAttrs GetArrayName $i]
     1912                    foreach {min max} [$array GetRange -1] break
     1913                    lappend _fieldlimits($tag) $fname [list $min $max]
     1914                    set _fieldComponents($tag-$fname) [$array GetNumberOfComponents]
     1915                }
     1916            }
     1917            set dataAttrs [$dataset GetCellData]
     1918            if { $dataAttrs != ""} {
     1919                set numArrays [$dataAttrs GetNumberOfArrays]
     1920                for {set i 0} {$i < $numArrays} {incr i} {
     1921                    set array [$dataAttrs GetArray $i]
     1922                    set fname [$dataAttrs GetArrayName $i]
     1923                    foreach {min max} [$array GetRange -1] break
     1924                    lappend _fieldlimits($tag) $fname [list $min $max]
     1925                    set _fieldComponents($tag-$fname) [$array GetNumberOfComponents]
     1926                }
     1927            }
     1928            set dataAttrs [$dataset GetFieldData]
     1929            if { $dataAttrs != ""} {
     1930                set numArrays [$dataAttrs GetNumberOfArrays]
     1931                for {set i 0} {$i < $numArrays} {incr i} {
     1932                    set array [$dataAttrs GetArray $i]
     1933                    set fname [$dataAttrs GetArrayName $i]
     1934                    foreach {min max} [$array GetRange -1] break
     1935                    lappend _fieldlimits($tag) $fname [list $min $max]
     1936                    set _fieldComponents($tag-$fname) [$array GetNumberOfComponents]
     1937                }
     1938            }
     1939            rename $dataset ""
    19381940            rename $reader ""
    19391941        }
    1940         foreach { xMin xMax yMin yMax zMin zMax} $_limits($tag) break
     1942        foreach {xMin xMax yMin yMax zMin zMax} $_limits($tag) break
    19411943        if {![info exists limits(xmin)] || $limits(xmin) > $xMin} {
    19421944            set limits(xmin) $xMin
     
    20012003        -font "Arial 9" -anchor w
    20022004
    2003     label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
    2004     itk_component add glyphspalette {
    2005         Rappture::Combobox $inner.palette -width 10 -editable 0
    2006     }
    2007     $inner.palette choices insert end [GetColormapList]
    2008     $itk_component(glyphspalette) value "BCGYR"
    2009     bind $inner.palette <<Value>> \
    2010         [itcl::code $this AdjustSetting glyphs-palette]
     2005    label $inner.colormap_l -text "Colormap" -font "Arial 9" -anchor w
     2006    itk_component add glyphscolormap {
     2007        Rappture::Combobox $inner.colormap -width 10 -editable 0
     2008    }
     2009    $inner.colormap choices insert end [GetColormapList]
     2010    $itk_component(glyphscolormap) value "BCGYR"
     2011    bind $inner.colormap <<Value>> \
     2012        [itcl::code $this AdjustSetting glyphs-colormap]
    20112013
    20122014    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
     
    20192021
    20202022    blt::table $inner \
    2021         0,0 $inner.glyphs    -cspan 2  -anchor w -pady 2 \
    2022         1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
    2023         2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
    2024         3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
    2025         4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    2026         5,0 $inner.opacity_l -anchor w -pady 2 \
    2027         5,1 $inner.opacity   -fill x   -pady 2 \
    2028         6,0 $inner.palette_l -anchor w -pady 2 \
    2029         6,1 $inner.palette   -fill x   -pady 2
     2023        0,0 $inner.glyphs     -cspan 2  -anchor w -pady 2 \
     2024        1,0 $inner.outline    -cspan 2  -anchor w -pady 2 \
     2025        2,0 $inner.wireframe  -cspan 2  -anchor w -pady 2 \
     2026        3,0 $inner.lighting   -cspan 2  -anchor w -pady 2 \
     2027        4,0 $inner.edges      -cspan 2  -anchor w -pady 2 \
     2028        5,0 $inner.opacity_l  -anchor w -pady 2 \
     2029        5,1 $inner.opacity    -fill x   -pady 2 \
     2030        6,0 $inner.colormap_l -anchor w -pady 2 \
     2031        6,1 $inner.colormap   -fill x   -pady 2
    20302032
    20312033    blt::table configure $inner r* c* -resize none
     
    20732075        -font "Arial 9" -anchor w
    20742076
    2075     label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w
    2076     itk_component add meshpalette {
    2077         Rappture::Combobox $inner.palette -width 10 -editable 0
    2078     }
    2079     $inner.palette choices insert end [GetColormapList]
    2080     $itk_component(meshpalette) value "BCGYR"
    2081     bind $inner.palette <<Value>> \
    2082         [itcl::code $this AdjustSetting polydata-palette]
     2077    label $inner.colormap_l -text "Colormap" -font "Arial 9" -anchor w
     2078    itk_component add meshcolormap {
     2079        Rappture::Combobox $inner.colormap -width 10 -editable 0
     2080    }
     2081    $inner.colormap choices insert end [GetColormapList]
     2082    $itk_component(meshcolormap) value "BCGYR"
     2083    bind $inner.colormap <<Value>> \
     2084        [itcl::code $this AdjustSetting polydata-colormap]
    20832085
    20842086    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w
     
    20912093
    20922094    blt::table $inner \
    2093         0,0 $inner.mesh      -cspan 2  -anchor w -pady 2 \
    2094         1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
    2095         2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
    2096         3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
    2097         4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
    2098         5,0 $inner.opacity_l -anchor w -pady 2 \
    2099         5,1 $inner.opacity   -fill x   -pady 2 \
    2100         6,0 $inner.palette_l -anchor w -pady 2 \
    2101         6,1 $inner.palette   -fill x   -pady 2
     2095        0,0 $inner.mesh       -cspan 2  -anchor w -pady 2 \
     2096        1,0 $inner.outline    -cspan 2  -anchor w -pady 2 \
     2097        2,0 $inner.wireframe  -cspan 2  -anchor w -pady 2 \
     2098        3,0 $inner.lighting   -cspan 2  -anchor w -pady 2 \
     2099        4,0 $inner.edges      -cspan 2  -anchor w -pady 2 \
     2100        5,0 $inner.opacity_l  -anchor w -pady 2 \
     2101        5,1 $inner.opacity    -fill x   -pady 2 \
     2102        6,0 $inner.colormap_l -anchor w -pady 2 \
     2103        6,1 $inner.colormap   -fill x   -pady 2
    21022104
    21032105    blt::table configure $inner r* c* -resize none
     
    24472449    $inner.rscale value "Covalent"
    24482450
    2449     label $inner.palette_l -text "Palette" -font "Arial 9"
    2450     itk_component add moleculepalette {
    2451         Rappture::Combobox $inner.palette -width 10 -editable 0
    2452     }
    2453     $inner.palette choices insert end [GetColormapList -includeElementDefault]
    2454     $itk_component(moleculepalette) value "elementDefault"
    2455     bind $inner.palette <<Value>> \
    2456         [itcl::code $this AdjustSetting molecule-palette]
     2451    label $inner.colormap_l -text "Colormap" -font "Arial 9"
     2452    itk_component add moleculecolormap {
     2453        Rappture::Combobox $inner.colormap -width 10 -editable 0
     2454    }
     2455    $inner.colormap choices insert end [GetColormapList -includeElementDefault]
     2456    $itk_component(moleculecolormap) value "elementDefault"
     2457    bind $inner.colormap <<Value>> \
     2458        [itcl::code $this AdjustSetting molecule-colormap]
    24572459
    24582460    label $inner.atomscale_l -text "Atom Scale" -font "Arial 9"
     
    25022504        6,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
    25032505        7,0 $inner.rscale       -fill x    -pady 2 \
    2504         8,0 $inner.palette_l    -anchor w  -pady 0 \
    2505         9,0 $inner.palette      -fill x    -padx 2 \
     2506        8,0 $inner.colormap_l    -anchor w  -pady 0 \
     2507        9,0 $inner.colormap      -fill x    -padx 2 \
    25062508        10,0 $inner.atomscale_l  -anchor w -pady {3 0} \
    25072509        11,0 $inner.atomscale   -fill x    -padx 2 \
     
    26892691                -atomscale 0.3
    26902692                -atomsvisible 1
     2693                -bondconstcolor white
     2694                -bondcolormode "by_elements"
    26912695                -bondscale 0.075
    26922696                -bondstyle "cylinder"
    26932697                -bondsvisible 1
    26942698                -color "elementDefault"
     2699                -colormode "by_elements"
     2700                -colorfield "element"
     2701                -constcolor white
    26952702                -edgecolor black
    26962703                -edges 0
     
    28002807            SendCmd "molecule labels $settings(-labels) $tag"
    28012808            set _settings(molecule-labels) $settings(-labels)
     2809            SendCmd "molecule color [Color2RGB $settings(-constcolor)] $tag"
     2810            SendCmd "molecule bcmode $settings(-bondcolormode) $tag"
     2811            SendCmd "molecule bcolor [Color2RGB $settings(-bondconstcolor)] $tag"
     2812            SendCmd "molecule colormap $settings(-color) $tag"
     2813            set _settings(molecule-colormap) $settings(-color)
     2814            $itk_component(moleculecolormap) value $settings(-color)
     2815            SendCmd [list molecule colormode $settings(-colormode) $settings(-colorfield) $tag]
     2816            set _settings(molecule-colormode) $settings(-colormode)
     2817            set _settings(molecule-colorfield) $settings(-colorfield)
    28022818            SendCmd "molecule linecolor [Color2RGB $settings(-edgecolor)] $tag"
    28032819            SendCmd "molecule linewidth $settings(-linewidth) $tag"
  • branches/blt4_trunk/gui/scripts/vtkvolumeviewer.tcl

    r6351 r6414  
    115115    private method Rotate {option x y}
    116116    private method SendTransferFunctions {}
     117    private method SetCurrentFieldName { dataobj }
    117118    private method SetInitialTransferFunction { dataobj cname }
    118119    private method SetLegendTip { x y }
     
    574575        set _dlist [lreplace $_dlist $pos $pos]
    575576        array unset _obj2ovride $dataobj-*
    576         array unset _settings $dataobj-*
    577577        set changed 1
    578578    }
     
    10171017        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    10181018            set _first $dataobj
     1019            SetCurrentFieldName $dataobj
    10191020        }
    10201021        foreach cname [$dataobj components] {
     
    10631064            }
    10641065        }
    1065         $itk_component(field) choices delete 0 end
    1066         $itk_component(fieldmenu) delete 0 end
    1067         array unset _fields
    1068         set _curFldName ""
    1069         foreach cname [$_first components] {
    1070             foreach fname [$_first fieldnames $cname] {
    1071                 if { [info exists _fields($fname)] } {
    1072                     continue
    1073                 }
    1074                 foreach { label units components } \
    1075                     [$_first fieldinfo $fname] break
    1076                 # Only scalar fields are valid
    1077                 if {$_allowMultiComponent || $components == 1} {
    1078                     $itk_component(field) choices insert end "$fname" "$label"
    1079                     $itk_component(fieldmenu) add radiobutton -label "$label" \
    1080                         -value $label -variable [itcl::scope _curFldLabel] \
    1081                         -selectcolor red \
    1082                         -activebackground $itk_option(-plotbackground) \
    1083                         -activeforeground $itk_option(-plotforeground) \
    1084                         -font "Arial 8" \
    1085                         -command [itcl::code $this LegendTitleAction save]
    1086                     set _fields($fname) [list $label $units $components]
    1087                     if { $_curFldName == "" } {
    1088                         set _curFldName $fname
    1089                         set _curFldLabel $label
    1090                     }
    1091                 }
    1092             }
    1093         }
    1094         $itk_component(field) value $_curFldLabel
    10951066    }
    10961067
     
    13281299itcl::body Rappture::VtkVolumeViewer::InitSettings { args } {
    13291300    foreach spec $args {
    1330         if { [info exists _settings($_first${spec})] } {
    1331             # Reset global setting with dataobj specific setting
    1332             set _settings($spec) $_settings($_first${spec})
    1333         }
    13341301        AdjustSetting $spec
    13351302    }
     
    14421409            }
    14431410            foreach dataset [CurrentDatasets -visible $_first] {
    1444                 #SendCmd "$_cutplaneCmd colormode $_colorMode $_curFldName $dataset"
    1445                 SendCmd "dataset scalar $_curFldName $dataset"
     1411                #SendCmd [list $_cutplaneCmd colormode $_colorMode $_curFldName $dataset]
     1412                SendCmd [list dataset scalar $_curFldName $dataset]
    14461413            }
    14471414            SendCmd "camera reset"
     
    16071574        foreach {dataobj comp} [split $dataset -] break
    16081575        if { [info exists _dataset2style($dataset)] } {
    1609             #SendCmd "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
     1576            #SendCmd [list legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0]
    16101577            SendCmd "legend2 $_dataset2style($dataset) $w $h"
    16111578            break;
     
    28642831    return [ColorsToColormap $color]
    28652832}
     2833
     2834itcl::body Rappture::VtkVolumeViewer::SetCurrentFieldName { dataobj } {
     2835    set _first $dataobj
     2836    $itk_component(field) choices delete 0 end
     2837    $itk_component(fieldmenu) delete 0 end
     2838    array unset _fields
     2839    set _curFldName ""
     2840    foreach cname [$_first components] {
     2841        foreach fname [$_first fieldnames $cname] {
     2842            if { [info exists _fields($fname)] } {
     2843                continue
     2844            }
     2845            foreach { label units components } \
     2846                [$_first fieldinfo $fname] break
     2847            # Only scalar fields are valid
     2848            if {$_allowMultiComponent || $components == 1} {
     2849                $itk_component(field) choices insert end "$fname" "$label"
     2850                $itk_component(fieldmenu) add radiobutton -label "$label" \
     2851                    -value $label -variable [itcl::scope _curFldLabel] \
     2852                    -selectcolor red \
     2853                    -activebackground $itk_option(-plotbackground) \
     2854                    -activeforeground $itk_option(-plotforeground) \
     2855                    -font "Arial 8" \
     2856                    -command [itcl::code $this LegendTitleAction save]
     2857                set _fields($fname) [list $label $units $components]
     2858                if { $_curFldName == "" } {
     2859                    set _curFldName $fname
     2860                    set _curFldLabel $label
     2861                }
     2862            }
     2863        }
     2864    }
     2865    $itk_component(field) value $_curFldLabel
     2866}
  • branches/blt4_trunk/lang/tcl/scripts/Makefile.in

    r4209 r6414  
    5757                image \
    5858                integer \
     59                multichoice \
    5960                note \
    6061                number \
  • branches/blt4_trunk/tester/scripts/main.tcl

    r4127 r6414  
    148148wm title . "Rappture Regression Tester"
    149149wm geometry . 800x500
    150 Rappture::Panes .pw -orientation horizontal -sashcursor sb_h_double_arrow
     150Rappture::Panes .pw -orientation horizontal
    151151pack .pw -expand yes -fill both
    152152
     
    262262
    263263# viewer for value diffs where we have a special object viewer
    264 Rappture::Panes .testdiffs.body.val2objs -orientation horizontal -sashcursor sb_h_double_arrow
     264Rappture::Panes .testdiffs.body.val2objs -orientation horizontal
    265265
    266266# empty area for the object value viewer
Note: See TracChangeset for help on using the changeset viewer.