Ignore:
Timestamp:
May 18, 2016 7:37:52 AM (8 years ago)
Author:
dkearney
Message:

merging r6288 through r6350 from trunk to blt4trunk branch

Location:
branches/blt4_trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4_trunk

  • branches/blt4_trunk/gui/apps/launcher.tcl

    r5663 r6351  
    4242set params(execute) ""
    4343set params(input) ""
     44
     45set rapptureInfo(cwd) [pwd]
    4446
    4547if {[info exists env(TOOL_PARAMETERS)]} {
  • branches/blt4_trunk/gui/scripts/flowvisviewer.tcl

    r6269 r6351  
    641641    set op [lindex $args 0]
    642642    switch -- $op {
    643         -objects {
     643        "-objects" {
    644644            # put the dataobj list in order according to -raise options
    645645            set dlist $_dlist
     
    656656            return $dlist
    657657        }
    658         -image {
     658        "-image" {
    659659            if {[llength $args] != 2} {
    660660                error "wrong # args: should be \"get -image view|legend\""
     
    28152815    radiobutton $inner.image_button -text "Image File" \
    28162816        -variable [itcl::scope _downloadPopup(format)] \
    2817         -font "Arial 9 " \
     2817        -font "Arial 9" \
    28182818        -value image
    28192819    Rappture::Tooltip::for $inner.image_button \
  • branches/blt4_trunk/gui/scripts/gauge.tcl

    r6021 r6351  
    636636    $itk_component(spindn) configure -state $itk_option(-state)
    637637    $itk_component(presets) configure -state $itk_option(-state)
     638    if { [info exists itk_component(uq)] } {
     639        $itk_component(uq) configure -state $itk_option(-state)
     640    }
    638641    _redraw  ;# fix gauge
    639642}
     
    756759
    757760        $popup configure \
    758         -deactivatecommand [itcl::code $this _pop_uq_deactivate]
     761            -deactivatecommand [itcl::code $this _pop_uq_deactivate]
    759762    }
    760763    update
  • branches/blt4_trunk/gui/scripts/map.tcl

    r6269 r6351  
    3131
    3232    public method addLayer { type name paramArray driver driverParamArray {stylesheet {}} {script {}} {selectors {}} }
     33    public method addSelector { layerName selectorName paramArray }
    3334    public method addViewpoint { name props }
    3435    public method clearExtents {}
    3536    public method deleteLayer { layerName }
     37    public method deleteSelector { layerName selectorName }
    3638    public method deleteViewpoint { viewpointName }
     39    public method dirty { key args } {
     40        if {[llength $args] == 0} {
     41            if { [info exists _dirty($key)] } {
     42                return $_dirty($key)
     43            } else {
     44                return 0
     45            }
     46        } else {
     47            set _dirty($key) [lindex $args 0]
     48        }
     49    }
    3750    public method getPlacardConfig { layerName }
    3851    public method hasLayer { layerName }
     
    5063    public method setAttribution { attribution }
    5164    public method setCamera { camera }
     65    public method setColormap { layerName colormap }
    5266    public method setDescription { description }
    5367    public method setExtents { xmin ymin xmax ymax {srs "wgs84"} }
     
    5569    public method setPlacardConfig { layerName attrlist style padding }
    5670    public method setProjection { projection }
     71    public method setScript { layerName script }
    5772    public method setStyle { style }
     73    public method setStylesheet { layerName stylesheet }
    5874    public method setToolInfo { id name command title revision }
    5975    public method setType { type }
     
    7086    private variable _tree "";         # Tree of information about the map.
    7187    private variable _isValid 0;
     88    private variable _dirty;
     89    array set _dirty {
     90        viewpoints 0
     91    }
    7292    private common _nextSelector 0;
    7393    private common _layerTypes
     
    629649            array set selector $selectorItem
    630650            if { [info exists selector(id)] } {
    631                 set id $selector(id)
     651                set selectorId $selector(id)
    632652            } else {
    633                 set id "selector[incr _nextSelector]"
    634             }
    635             set snode [$_tree insert $sparent -label $id]
     653                set selectorId "selector[incr _nextSelector]"
     654            }
     655            set snode [$_tree insert $sparent -label $selectorId]
    636656            foreach key { name style styleExpression query queryBounds queryOrderBy } {
    637657                if {[info exists selector($key)]} {
     
    765785        }
    766786    }
     787    set _dirty($id) 1
    767788    return $id
    768789}
     
    804825    }
    805826    $_tree delete $id
     827    array unset _dirty $layerName
    806828}
    807829
     
    868890}
    869891
     892itcl::body Rappture::Map::setScript { layerName script } {
     893    set id [$_tree findchild root->"layers" $layerName]
     894    if { $id < 0 } {
     895        error "unknown layer \"$layerName\""
     896    }
     897    $_tree set $id "script" $script
     898    set _dirty($layerName) 1
     899}
     900
     901itcl::body Rappture::Map::setStylesheet { layerName stylesheet } {
     902    set id [$_tree findchild root->"layers" $layerName]
     903    if { $id < 0 } {
     904        error "unknown layer \"$layerName\""
     905    }
     906    $_tree set $id "stylesheet" $stylesheet
     907    set _dirty($layerName) 1
     908}
     909
     910itcl::body Rappture::Map::setColormap { layerName colormap } {
     911    set id [$_tree findchild root->"layers" $layerName]
     912    if { $id < 0 } {
     913        error "unknown layer \"$layerName\""
     914    }
     915    $_tree set $id "colorramp.colormap" $colormap
     916    set _dirty($layerName) 1
     917}
     918
    870919# ----------------------------------------------------------------------
    871920# USAGE: selectors
     
    904953        return 1
    905954    }
     955}
     956
     957itcl::body Rappture::Map::addSelector { layerName name params } {
     958    set nodeid $name
     959    set layerid [$_tree findchild root->"layers" $layerName]
     960    if { $layerid < 0 } {
     961        error "unknown layer \"$layerName\""
     962    }
     963    if {[hasSelector $layerName $nodeid]} {
     964        error "Selector '$nodeid' already exists"
     965    }
     966    set parent [$_tree findchild root->"layers"->"$layerName" "selectors"]
     967    if { $parent == "" } {
     968        set parent [$_tree insert $layerid -label "selectors"]
     969    }
     970    set child [$_tree insert $parent -label $nodeid]
     971    array set info $params
     972    foreach key { name style styleExpression query queryBounds queryOrderBy } {
     973        if { [info exists info($key)] &&
     974             $info($key) != ""} {
     975            $_tree set $child $key $info($key)
     976        }
     977    }
     978    set _dirty($layerName) 1
     979}
     980
     981itcl::body Rappture::Map::deleteSelector { layerName selectorName } {
     982    set id [$_tree findchild root->"layers"->"$layerName"->"selectors" $selectorName]
     983    if { $id < 0 } {
     984        error "unknown selector \"$selectorName\""
     985    }
     986    $_tree delete $id
     987    set _dirty($layerName) 1
    906988}
    907989
     
    9711053        $_tree set $child z $info(altitude)
    9721054    }
     1055    set _dirty(viewpoints) 1
    9731056}
    9741057
     
    9791062    }
    9801063    $_tree delete $id
     1064    set _dirty(viewpoints) 1
    9811065}
    9821066
  • branches/blt4_trunk/gui/scripts/mapviewer.tcl

    r6284 r6351  
    6161    public method parameters {title args} { # do nothing }
    6262    public method placard {option args}
     63    public method refresh {} { Rebuild }
    6364    public method scale {args}
    6465    public method select {option {args ""}}
     
    857858            return $dlist
    858859        }
    859         -image {
     860        "-image" {
    860861            if {[llength $args] < 2} {
    861862                error "wrong # args: should be \"get -image view|legend\""
     
    14661467                set _layers($tag) 1
    14671468                SetLayerStyle $dataobj $layer
    1468             }
     1469            } elseif { [$dataobj dirty $layer] } {
     1470                # Recreate layer
     1471                # FIXME: retain layer order
     1472                SendCmd "map layer delete $tag"
     1473                SetLayerStyle $dataobj $layer
     1474            }
     1475            $dataobj dirty $layer 0
    14691476            # Don't change visibility of shared/base layers
    14701477            if { !$info(shared) } {
     
    28042811            set wfsType ""
    28052812            SendStylesheetFiles $info(stylesheet)
     2813            set ssSize [string length $info(stylesheet)]
     2814            set scriptSize [string length $script]
     2815            set selectorsSize [string length $selectors]
    28062816            if { [info exists info(ogr.connection)] } {
    2807                 set cmd [list map layer add $tag feature db $format $info(ogr.layer) $info(ogr.connection) $info(cache) $info(stylesheet) $script $selectors]
     2817                set cmd [list map layer add $tag feature db $format $info(ogr.layer) $info(ogr.connection) $info(cache) $ssSize $scriptSize $selectorsSize]
    28082818                if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    28092819                    lappend cmd $style(-minrange) $style(-maxrange)
    28102820                }
    28112821            } else {
    2812                 set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(ogr.url) $info(cache) $info(stylesheet) $script $selectors]
     2822                set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(ogr.url) $info(cache) $ssSize $scriptSize $selectorsSize]
    28132823                if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    28142824                    lappend cmd $style(-minrange) $style(-maxrange)
     
    28172827            }
    28182828            SendCmd $cmd
     2829            if { $ssSize > 0 }       { SendData $info(stylesheet) }
     2830            if { $scriptSize > 0 }   { SendData $script }
     2831            if { $selectorsSize > 0} { SendData $selectors }
    28192832            SendCmd "map layer opacity $style(-opacity) $tag"
    28202833        }
  • branches/blt4_trunk/gui/scripts/mesh.tcl

    r5659 r6351  
    211211        set result [ReadUnstructuredGrid $path]
    212212    } elseif {[$_mesh element "node"] != "" && [$_mesh element "element"] != ""} {
     213        puts stderr "WARNING: <node>/<element> mesh is deprecated.  Please use an unstructured mesh instead."
    213214        set result [ReadNodesElements $path]
    214215    }
     
    14381439    array set node2celltype {
    14391440        3 5
    1440         4 10
     1441        4 9
    14411442        8 12
    14421443        6 13
     
    14521453        set numNodes [llength $nodeList]
    14531454        if { ![info exists node2celltype($numNodes)] } {
    1454             puts stderr "WARNING: bad nodes/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"
     1455            puts stderr "WARNING: bad node/element mesh \$path\": unknown number of nodes \"$numNodes\": should be 3, 4, 5, 6, or 8"
    14551456            return 0
    14561457        }
    14571458        set celltype $node2celltype($numNodes)
     1459        if { $_dim == 3 && $numNodes == 4 } {
     1460            # If mesh is 3D, assume a tetrahedron (default is quad)
     1461            # XXX: Does prophet output tets, and if so what is the node order?
     1462            set celltype 10
     1463        }
    14581464        append celltypes "$celltype\n"
    1459         if { $celltype == 12 } {
    1460             # Formerly used voxels instead of hexahedrons. We're converting
    1461             # it here to be backward compatible and still fault-tolerant of
    1462             # non-axis aligned cells.
     1465        if { $celltype == 9 } {
     1466            # Fix the node order for quad cells
     1467            # (this converts from PROPHET convention to VTK convention)
     1468            set newList {}
     1469            foreach i { 0 1 3 2 } {
     1470                lappend newList [lindex $nodeList $i]
     1471            }
     1472            set nodeList $newList
     1473        } elseif { $celltype == 12 } {
     1474            # Fix the node order for hexahedron cells
     1475            # (this converts from PROPHET convention to VTK convention)
    14631476            set newList {}
    14641477            foreach i { 0 1 3 2 4 5 7 6 } {
  • branches/blt4_trunk/gui/scripts/nanovisviewer.tcl

    r6269 r6351  
    462462    set op [lindex $args 0]
    463463    switch -- $op {
    464         -objects {
     464        "-objects" {
    465465            # put the dataobj list in order according to -raise options
    466466            set dlist $_dlist
     
    477477            return $dlist
    478478        }
    479         -image {
     479        "-image" {
    480480            if {[llength $args] != 2} {
    481481                error "wrong # args: should be \"get -image view|legend\""
     
    15491549        } else {
    15501550            # $n : absolute value, compute relative
    1551             lappend list  [expr {(double($value)-$min)/($max-$min)]}
     1551            lappend list [expr {(double($value)-$min)/($max-$min)}]
    15521552        }
    15531553    }
     
    20292029    radiobutton $inner.image_button -text "Image File" \
    20302030        -variable [itcl::scope _downloadPopup(format)] \
    2031         -font "Arial 9 " \
     2031        -font "Arial 9" \
    20322032        -value image
    20332033    Rappture::Tooltip::for $inner.image_button \
  • branches/blt4_trunk/gui/scripts/probdisteditor.tcl

    r6021 r6351  
    1919option add *ProbDistEditor*Entry.width 10 widgetDefault
    2020
    21     itcl::class Rappture::ProbDistEditor {
     21itcl::class Rappture::ProbDistEditor {
    2222    inherit itk::Widget
    2323
    2424    itk_option define -fillcolor fillColor FillColor ""
    2525
    26     constructor {args} { # defined below }
     26    constructor {args} {
     27        # defined below
     28    }
    2729    public method value {{newval ""}}
    2830    public method mode {{newval ""}}
     
    3335    protected method _apply {op {widget ""}}
    3436
    35     protected variable _dispatcher ""   ;# dispatcher for !events
    36     protected variable _mode ""         ;# type of distribution function
    37     protected variable _value           ;# data values for mode-detail
    38     protected variable _uvalue          ;# data values for mode-detail with units
    39     protected variable _umin             ;# minimum allowed value for tool with units
    40     protected variable _umax             ;# maximum allowed value for tool with units
    41     protected variable _units           ;# units for min and max
     37    protected variable _dispatcher ""# dispatcher for !events
     38    protected variable _mode "";        # type of distribution function
     39    protected variable _value;          # data values for mode-detail
     40    protected variable _uvalue;         # data values for mode-detail with units
     41    protected variable _umin;           # minimum allowed value for tool with units
     42    protected variable _umax;           # maximum allowed value for tool with units
     43    protected variable _units;          # units for min and max
    4244}
    4345
  • branches/blt4_trunk/gui/scripts/responseviewer.tcl

    r6032 r6351  
    147147
    148148itcl::body Rappture::ResponseViewer::_plot_response {var1 var2} {
    149     #puts "plotting $var1 vs $var2"
    150 
    151     set fname response_result.xml
    152 
    153     set rs $_response
    154     if {[catch {exec puq get_response $fname $rs $var1 $var2 $_label} res]} {
     149    #puts stderr "plotting $var1 vs $var2"
     150    global rapptureInfo
     151    set fname [file join $rapptureInfo(cwd) "response_result.xml"]
     152    if { [catch {
     153        exec puq.sh get_response $fname $_response $var1 $var2 $_label
     154    } res] != 0 } {
    155155        set fp [open "response.err" r]
    156156        set rdata [read $fp]
    157157        close $fp
    158         puts "Surrogate Model failed: $res\n$rdata"
     158        puts stderr "Surrogate Model failed: $res\n$rdata"
    159159        error "Sampling of Surrogate Model failed: $res\n$rdata"
    160160        # FIXME: Maybe put in text box instead of error()?
     
    163163
    164164    set xmlobj [Rappture::library $fname]
    165     #puts "xmlobj=$xmlobj"
     165    #puts stderr "xmlobj=$xmlobj"
    166166    set w $itk_component(frame).field
    167167
  • branches/blt4_trunk/gui/scripts/transferfunctioneditor.tcl

    r5640 r6351  
    4242    private method GetScreenPosition { name }
    4343    private method LeaveTick { name }
    44     private method SetRelativeValue  { name x }
    45     private method GetRelativeValue  { name }
     44    private method SetRelativeValue { name x }
     45    private method GetRelativeValue { name }
    4646    private method RemoveDuplicateMarkers {name x y}
    4747    private method SetScreenPosition { name }
     
    225225}
    226226
    227 itcl::body Rappture::TransferFunctionEditor::GetRelativeValue  { name } {
     227itcl::body Rappture::TransferFunctionEditor::GetRelativeValue { name } {
    228228    return $_values($name)
    229229}
    230230
    231 itcl::body Rappture::TransferFunctionEditor::SetRelativeValue  { name value } {
     231itcl::body Rappture::TransferFunctionEditor::SetRelativeValue { name value } {
     232    if {$value < 0.0} {
     233        set value 0.0
     234    } elseif {$value > 1.0} {
     235        set value 1.0
     236    }
    232237    set _values($name) $value
    233238    set x [GetScreenPosition $name]
  • branches/blt4_trunk/gui/scripts/visviewer.tcl

    r6052 r6351  
    2020    itk_option define -receivecommand receiveCommand ReceiveCommand ""
    2121
    22     private common _servers         ;# array of visualization server lists
    23     set _servers(geovis)  "localhost:2015"
    24     set _servers(nanovis) "localhost:2000"
    25     set _servers(pymol)   "localhost:2020"
    26     set _servers(vmdmds)  "localhost:2018"
    27     set _servers(vtkvis)  "localhost:2010"
    28 
    29     private common _done            ;   # Used to indicate status of send.
    30     private variable _buffer        ;   # buffer for incoming/outgoing commands
    31     private variable _outbuf       ;    # buffer for outgoing commands
    32     private variable _blockOnWrite 0;   # Should writes to socket block?
    33     private variable _initialized
    34     private variable _isOpen 0
    35     private variable _afterId -1
    36     private variable _icon 0
    37     private variable _trace 0        ;    # Protocol tracing for console
    38     private variable _logging 0      ;    # Command logging to file
    39     # Number of milliseconds to wait before idle timeout.  If greater than 0,
    40     # automatically disconnect from the visualization server when idle timeout
    41     # is reached.
    42     private variable _idleTimeout 43200000; # 12 hours
    43     #private variable _idleTimeout 5000;    # 5 seconds
    44     #private variable _idleTimeout 0;       # No timeout
    45 
    46     protected variable _debug 0
    47     protected variable _serverType "???";# Type of server.
    48     protected variable _sid ""      ;   # socket connection to server
    49     protected variable _maxConnects 100
    50     protected variable _buffering 0
    51     protected variable _cmdSeq 0     ;    # Command sequence number
    52     protected variable _dispatcher "";  # dispatcher for !events
    53     protected variable _hosts ""    ;   # list of hosts for server
    54     protected variable _parser ""   ;   # interpreter for incoming commands
    55     protected variable _image
    56     protected variable _hostname
    57     protected variable _numConnectTries 0
    58     protected variable _debugConsole 0
    59     protected variable _reportClientInfo 1
    60     # Number of milliscends to wait for server reply before displaying wait
    61     # dialog.  If set to 0, dialog is never displayed.
    62     protected variable _waitTimeout 0
    63 
    6422    constructor { args } {
    6523        # defined below
     
    6826        # defined below
    6927    }
    70     # Used internally only.
    71     private method BuildConsole {}
    72     private method DebugConsole {}
    73     private method HideConsole {}
    74     private method ReceiveHelper {}
    75     private method SendDebugCommand {}
    76     private method SendHelper {}
    77     private method ServerDown {}
    78     private method Shuffle { servers }
    79     private method TraceComm { channel {data {}} }
    80     private method WaitDialog { state }
    81     private method Waiting { option widget }
     28    public proc GetServerList { type } {
     29        return $_servers($type)
     30    }
     31    public proc SetServerList { type namelist } {
     32        # Convert the comma separated list into a Tcl list.  OGRE also adds
     33        # a trailing comma that we want to ignore.
     34        regsub -all "," $namelist " " namelist
     35        CheckNameList $namelist
     36        set _servers($type) $namelist
     37    }
     38    public proc RemoveServerFromList { type server } {
     39        if { ![info exists _servers($type)] } {
     40            error "unknown server type \"$type\""
     41        }
     42        set i [lsearch $_servers($type) $server]
     43        if { $i < 0 } {
     44            return
     45        }
     46        set _servers($type) [lreplace $_servers($type) $i $i]
     47    }
     48    public proc SetPymolServerList { namelist } {
     49        SetServerList "pymol" $namelist
     50    }
     51    public proc SetNanovisServerList { namelist } {
     52        SetServerList "nanovis" $namelist
     53    }
     54    public proc SetVtkServerList { namelist } {
     55        SetServerList "vtk" $namelist
     56    }
    8257
    8358    protected method CheckConnection {}
     
    11792    protected method ToggleConsole {}
    11893
     94    protected variable _debug 0
     95    protected variable _serverType "???";# Type of server.
     96    protected variable _sid "";         # socket connection to server
     97    protected variable _maxConnects 100
     98    protected variable _buffering 0
     99    protected variable _cmdSeq 0;       # Command sequence number
     100    protected variable _dispatcher "";  # dispatcher for !events
     101    protected variable _hosts "";       # list of hosts for server
     102    protected variable _parser "";      # interpreter for incoming commands
     103    protected variable _image
     104    protected variable _hostname
     105    protected variable _numConnectTries 0
     106    protected variable _debugConsole 0
     107    protected variable _reportClientInfo 1
     108    # Number of milliscends to wait for server reply before displaying wait
     109    # dialog.  If set to 0, dialog is never displayed.
     110    protected variable _waitTimeout 0
     111
     112    private method BuildConsole {}
     113    private method DebugConsole {}
     114    private method HideConsole {}
     115    private method ReceiveHelper {}
     116    private method SendDebugCommand {}
     117    private method SendHelper {}
     118    private method ServerDown {}
     119    private method Shuffle { servers }
     120    private method TraceComm { channel {data {}} }
     121    private method WaitDialog { state }
     122    private method Waiting { option widget }
     123
    119124    private proc CheckNameList { namelist }  {
    120125        foreach host $namelist {
     
    125130        }
    126131    }
    127     public proc GetServerList { type } {
    128         return $_servers($type)
    129     }
    130     public proc SetServerList { type namelist } {
    131         # Convert the comma separated list into a Tcl list.  OGRE also adds
    132         # a trailing comma that we want to ignore.
    133         regsub -all "," $namelist " " namelist
    134         CheckNameList $namelist
    135         set _servers($type) $namelist
    136     }
    137     public proc RemoveServerFromList { type server } {
    138         if { ![info exists _servers($type)] } {
    139             error "unknown server type \"$type\""
    140         }
    141         set i [lsearch $_servers($type) $server]
    142         if { $i < 0 } {
    143             return
    144         }
    145         set _servers($type) [lreplace $_servers($type) $i $i]
    146     }
    147     public proc SetPymolServerList { namelist } {
    148         SetServerList "pymol" $namelist
    149     }
    150     public proc SetNanovisServerList { namelist } {
    151         SetServerList "nanovis" $namelist
    152     }
    153     public proc SetVtkServerList { namelist } {
    154         SetServerList "vtk" $namelist
    155     }
     132
     133    private variable _buffer;           # buffer for incoming/outgoing commands
     134    private variable _outbuf;           # buffer for outgoing commands
     135    private variable _blockOnWrite 0;   # Should writes to socket block?
     136    private variable _initialized
     137    private variable _isOpen 0
     138    private variable _afterId -1
     139    private variable _icon 0
     140    private variable _trace 0;          # Protocol tracing for console
     141    private variable _logging 0;        # Command logging to file
     142    # Number of milliseconds to wait before idle timeout.  If greater than 0,
     143    # automatically disconnect from the visualization server when idle timeout
     144    # is reached.
     145    private variable _idleTimeout 43200000; # 12 hours
     146    #private variable _idleTimeout 5000;# 5 seconds
     147    #private variable _idleTimeout 0;   # No timeout
     148
     149    private common _servers;            # array of visualization server lists
     150    set _servers(geovis)  "localhost:2015"
     151    set _servers(nanovis) "localhost:2000"
     152    set _servers(pymol)   "localhost:2020"
     153    set _servers(vmdmds)  "localhost:2018"
     154    set _servers(vtkvis)  "localhost:2010"
     155    private common _done;               # Used to indicate status of send.
    156156}
    157157
     
    864864                -xscrollmode auto -yscrollmode auto
    865865            text $inner.scrl.text \
    866                 -font "Arial 9 " -background white -relief sunken -bd 1 \
     866                -font "Arial 9" -background white -relief sunken -bd 1 \
    867867                -height 5 -wrap word -width 60
    868868            $inner.scrl contents $inner.scrl.text
  • branches/blt4_trunk/gui/scripts/vtkglyphviewer.tcl

    r6252 r6351  
    102102    private method ReceiveDataset { args }
    103103    private method ReceiveImage { args }
    104     private method ReceiveLegend { colormap title vmin vmax size }
     104    private method ReceiveLegend { colormap title min max size }
    105105    private method RequestLegend {}
    106106    private method Rotate {option x y}
     
    151151    private variable _rotatePending 0
    152152    private variable _cutplanePending 0
    153     private variable _field      ""
    154153    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    155154    private variable _fields
     
    591590    }
    592591    array set params $settings
    593     set params(-description) ""
    594     set params(-param) ""
    595     array set params $settings
    596592
    597593    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    691687            return $dlist
    692688        }
    693         -image {
     689        "-image" {
    694690            if {[llength $args] != 2} {
    695691                error "wrong # args: should be \"get -image view\""
     
    705701        }
    706702        default {
    707             error "bad option \"$op\": should be -objects or -image"
     703            error "bad option \"$op\": should be -objects, -visible or -image"
    708704        }
    709705    }
     
    22122208                    SendCmd "camera zoom $_view($what)"
    22132209                }
    2214              }
     2210            }
    22152211        }
    22162212    }
     
    22462242    radiobutton $inner.vtk_button -text "VTK data file" \
    22472243        -variable [itcl::scope _downloadPopup(format)] \
    2248         -font "Arial 9 " \
     2244        -font "Arial 9" \
    22492245        -value vtk
    22502246    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22512247    radiobutton $inner.image_button -text "Image File" \
    22522248        -variable [itcl::scope _downloadPopup(format)] \
    2253         -font "Arial 9 " \
     2249        -font "Arial 9" \
    22542250        -value image
    22552251    Rappture::Tooltip::for $inner.image_button \
  • branches/blt4_trunk/gui/scripts/vtkheightmapviewer.tcl

    r6269 r6351  
    7171    private method BuildDownloadPopup { widget command }
    7272    private method CameraReset {}
    73     private method Combo { option }
    7473    private method Connect {}
    7574    private method CurrentDatasets {args}
     
    8887    private method IsValidObject { dataobj }
    8988    private method LeaveLegend {}
     89    private method LegendTitleAction { option }
    9090    private method MotionLegend { x y }
    9191    private method Pan {option x y}
     
    214214
    215215    array set _settings {
    216         -axisflymode            "static"
     216        -axesvisible            1
    217217        -axislabels             1
    218218        -axisminorticks         1
    219         -axisvisible            1
     219        -axismode               "static"
    220220        -colormap               BCGYR
    221221        -colormapdiscrete       0
     
    243243    array set _changed {
    244244        -colormap               0
     245        -colormapdiscrete       0
     246        -colormapvisible        0
     247        -edges                  0
     248        -isolinecolor           0
     249        -isolinesvisible        0
    245250        -numisolines            0
    246251        -opacity                0
     252        -wireframe              0
    247253    }
    248254    itk_component add view {
     
    483489    }
    484490    array set params $settings
    485     set params(-description) ""
    486     set params(-param) ""
    487     array set params $settings
    488491
    489492    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    583586            return $dlist
    584587        }
    585         -image {
     588        "-image" {
    586589            if {[llength $args] != 2} {
    587590                error "wrong # args: should be \"get -image view\""
     
    597600        }
    598601        default {
    599             error "bad option \"$op\": should be -objects or -image"
     602            error "bad option \"$op\": should be -objects, -visible or -image"
    600603        }
    601604    }
     
    10171020                    -activeforeground $itk_option(-plotforeground) \
    10181021                    -font "Arial 8" \
    1019                     -command [itcl::code $this Combo invoke]
     1022                    -command [itcl::code $this LegendTitleAction save]
    10201023                set _fields($fname) [list $label $units $components]
    10211024                if { $_curFldName == "" } {
     
    10901093        PanCamera
    10911094        InitSettings -xgrid -ygrid -zgrid \
    1092             -axisvisible -axislabels -heightmapscale -field -isheightmap \
     1095            -axesvisible -axislabels -heightmapscale -field -isheightmap \
    10931096            -numisolines
    10941097        if { [array size _fields] < 2 } {
     
    13511354    }
    13521355    switch -- $what {
    1353         "-axisflymode" {
    1354             set mode [$itk_component(axisflymode) value]
    1355             set mode [$itk_component(axisflymode) translate $mode]
    1356             set _settings($what) $mode
    1357             SendCmd "axis flymode $mode"
     1356        "-axesvisible" {
     1357            set bool $_settings($what)
     1358            SendCmd "axis visible all $bool"
    13581359        }
    13591360        "-axislabels" {
     
    13651366            SendCmd "axis minticks all $bool"
    13661367        }
    1367         "-axisvisible" {
    1368             set bool $_settings($what)
    1369             SendCmd "axis visible all $bool"
     1368        "-axismode" {
     1369            set mode [$itk_component(axismode) value]
     1370            set mode [$itk_component(axismode) translate $mode]
     1371            set _settings($what) $mode
     1372            SendCmd "axis flymode $mode"
    13701373        }
    13711374        "-background" {
     
    13911394            if { $color == "none" } {
    13921395                if { $_settings(-colormapvisible) } {
     1396                    set _changed(-colormapvisible) 1
    13931397                    SendCmd "heightmap surface 0"
    13941398                    set _settings(-colormapvisible) 0
     
    13961400            } else {
    13971401                if { !$_settings(-colormapvisible) } {
     1402                    set _changed(-colormapvisible) 1
    13981403                    SendCmd "heightmap surface 1"
    13991404                    set _settings(-colormapvisible) 1
     
    14081413            EventuallyRequestLegend
    14091414        }
    1410         "-colormapvisible" {
    1411             set bool $_settings($what)
    1412             SendCmd "heightmap surface $bool"
    1413         }
    14141415        "-colormapdiscrete" {
     1416            set _changed($what) 1
    14151417            set bool $_settings($what)
    14161418            set numColors [expr $_settings(-numisolines) + 1]
     
    14281430            EventuallyRequestLegend
    14291431        }
     1432        "-colormapvisible" {
     1433            set _changed($what) 1
     1434            set bool $_settings($what)
     1435            SendCmd "heightmap surface $bool"
     1436        }
    14301437        "-edges" {
     1438            set _changed($what) 1
    14311439            set bool $_settings($what)
    14321440            SendCmd "heightmap edges $bool"
     
    15741582        }
    15751583        "-isolinecolor" {
     1584            set _changed($what) 1
    15761585            set color [$itk_component(isolinecolor) value]
    15771586            if { $color == "none" } {
    15781587                if { $_settings(-isolinesvisible) } {
     1588                    set _changed(-isolinesvisible) 1
    15791589                    SendCmd "heightmap isolines 0"
    15801590                    set _settings(-isolinesvisible) 0
    15811591                }
    15821592            } else {
     1593                set _settings($what) $color
    15831594                if { !$_settings(-isolinesvisible) } {
     1595                    set _changed(-isolinesvisible) 1
    15841596                    SendCmd "heightmap isolines 1"
    15851597                    set _settings(-isolinesvisible) 1
     
    15901602        }
    15911603        "-isolinesvisible" {
     1604            set _changed($what) 1
    15921605            set bool $_settings($what)
     1606            set color [$itk_component(isolinecolor) value]
     1607            if { $bool && $color != $_settings(-isolinecolor)} {
     1608                $itk_component(isolinecolor) value $_settings(-isolinecolor)
     1609            }
    15931610            SendCmd "heightmap isolines $bool"
    15941611            DrawLegend
     
    16341651        }
    16351652        "-outline" {
     1653            set _changed($what) 1
    16361654            if { $_settings(-isheightmap) } {
    16371655                SendCmd "outline visible 0"
     
    16571675        }
    16581676        "-wireframe" {
     1677            set _changed($what) 1
    16591678            set bool $_settings($what)
    16601679            SendCmd "heightmap wireframe $bool"
     
    17171736        set cmap $_currentColormap
    17181737        if { ![info exists _colormaps($cmap)] } {
    1719            BuildColormap $cmap
    1720            set _colormaps($cmap) 1
     1738            BuildColormap $cmap
     1739            set _colormaps($cmap) 1
    17211740        }
    17221741        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     
    20342053    checkbutton $inner.visible \
    20352054        -text "Axes" \
    2036         -variable [itcl::scope _settings(-axisvisible)] \
    2037         -command [itcl::code $this AdjustSetting -axisvisible] \
     2055        -variable [itcl::scope _settings(-axesvisible)] \
     2056        -command [itcl::code $this AdjustSetting -axesvisible] \
    20382057        -font "Arial 9"
    20392058    checkbutton $inner.labels \
     
    20662085    label $inner.mode_l -text "Mode" -font "Arial 9"
    20672086
    2068     itk_component add axisflymode {
     2087    itk_component add axismode {
    20692088        Rappture::Combobox $inner.mode -width 10 -editable 0
    20702089    }
     
    20742093        "furthest_triad"  "farthest" \
    20752094        "outer_edges"     "outer"
    2076     $itk_component(axisflymode) value $_settings(-axisflymode)
    2077     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     2095    $itk_component(axismode) value $_settings(-axismode)
     2096    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    20782097
    20792098    blt::table $inner \
     
    22122231    radiobutton $inner.vtk_button -text "VTK data file" \
    22132232        -variable [itcl::scope _downloadPopup(format)] \
    2214         -font "Arial 9 " \
     2233        -font "Arial 9" \
    22152234        -value vtk
    22162235    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22172236    radiobutton $inner.image_button -text "Image File" \
    22182237        -variable [itcl::scope _downloadPopup(format)] \
    2219         -font "Arial 9 " \
     2238        -font "Arial 9" \
    22202239        -value image
    22212240    Rappture::Tooltip::for $inner.image_button \
     
    22582277    set tag $dataobj-$comp
    22592278    array set style {
    2260         -color BCGYR
    2261         -levels 10
    2262         -opacity 1.0
     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
    22632291    }
    22642292    set stylelist [$dataobj style $comp]
     
    22982326        DrawLegend
    22992327    }
     2328    foreach setting {-edges -outline -wireframe \
     2329                     -colormapvisible -isolinecolor -isolinesvisible} {
     2330        if {$_changed($setting)} {
     2331            # User-modified UI setting overrides style
     2332            set style($setting) $_settings($setting)
     2333        } else {
     2334            # Set UI control to style setting (tool provided or default)
     2335            set _settings($setting) $style($setting)
     2336        }
     2337    }
     2338
    23002339    SendCmd "outline add $tag"
    23012340    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
    2302     SendCmd "outline visible $_settings(-outline) $tag"
     2341    SendCmd "outline visible $style(-outline) $tag"
     2342
    23032343    set scale [GetHeightmapScale]
    23042344    SendCmd "[list heightmap add contourlist $_contourList $scale $tag]"
    23052345    set _comp2scale($tag) $_settings(-heightmapscale)
    2306     SendCmd "heightmap edges $_settings(-edges) $tag"
    2307     SendCmd "heightmap wireframe $_settings(-wireframe) $tag"
     2346    SendCmd "heightmap edges $style(-edges) $tag"
     2347    SendCmd "heightmap linecolor [Color2RGB $style(-edgecolor)] $tag"
     2348    SendCmd "heightmap linewidth $style(-linewidth) $tag"
     2349    SendCmd "heightmap wireframe $style(-wireframe) $tag"
    23082350    SetCurrentColormap $style(-color)
    2309     set color [$itk_component(isolinecolor) value]
    2310     SendCmd "heightmap isolinecolor [Color2RGB $color] $tag"
     2351    SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag"
     2352    $itk_component(isolinecolor) value $style(-isolinecolor)
     2353    SendCmd "heightmap isolinewidth $style(-isolinewidth) $tag"
    23112354    SendCmd "heightmap lighting $_settings(-isheightmap) $tag"
    2312     SendCmd "heightmap isolines $_settings(-isolinesvisible) $tag"
    2313     SendCmd "heightmap surface $_settings(-colormapvisible) $tag"
     2355    SendCmd "heightmap isolines $style(-isolinesvisible) $tag"
     2356    SendCmd "heightmap surface $style(-colormapvisible) $tag"
    23142357    SendCmd "heightmap opacity $style(-opacity) $tag"
    23152358    set _settings(-opacity) [expr $style(-opacity) * 100.0]
     
    23492392# DrawLegend --
    23502393#
    2351 # Draws the legend in the own canvas on the right side of the plot area.
     2394# Draws the legend in its own canvas on the right side of the plot area.
    23522395#
    23532396itcl::body Rappture::VtkHeightmapViewer::DrawLegend {} {
     
    24372480    }
    24382481
    2439     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2440     $c bind title <Enter> [itcl::code $this Combo activate]
    2441     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2482    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2483    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2484    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    24422485    # Reset the item coordinates according the current size of the plot.
    24432486    if { [info exists _limits($_curFldName)] } {
     
    25532596
    25542597# ----------------------------------------------------------------------
    2555 # USAGE: _dropdown post
    2556 # USAGE: _dropdown unpost
    2557 # USAGE: _dropdown select
    2558 #
    2559 # Used internally to handle the dropdown list for this combobox.  The
    2560 # post/unpost options are invoked when the list is posted or unposted
    2561 # to manage the relief of the controlling button.  The select option
    2562 # is invoked whenever there is a selection from the list, to assign
    2563 # the value back to the gauge.
    2564 # ----------------------------------------------------------------------
    2565 itcl::body Rappture::VtkHeightmapViewer::Combo {option} {
     2598# USAGE: LegendTitleAction post
     2599# USAGE: LegendTitleAction enter
     2600# USAGE: LegendTitleAction leave
     2601# USAGE: LegendTitleAction save
     2602#
     2603# Used internally to handle the dropdown list for the fields menu combobox.
     2604# The post option is invoked when the field title is pressed to launch the
     2605# dropdown.  The enter option is invoked when the user mouses over the field
     2606# title. The leave option is invoked when the user moves the mouse away
     2607# from the field title.  The save option is invoked whenever there is a
     2608# selection from the list, to alert the visualization server.
     2609# ----------------------------------------------------------------------
     2610itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} {
    25662611    set c $itk_component(view)
    25672612    switch -- $option {
     
    25732618            tk_popup $itk_component(fieldmenu) $x $y
    25742619        }
    2575         activate {
     2620        enter {
    25762621            $c itemconfigure title -fill red
    25772622        }
    2578         deactivate {
     2623        leave {
    25792624            $c itemconfigure title -fill $itk_option(-plotforeground)
    25802625        }
    2581         invoke {
     2626        save {
    25822627            $itk_component(field) value $_curFldLabel
    25832628            AdjustSetting -field
    25842629        }
    25852630        default {
    2586             error "bad option \"$option\": should be post, unpost, select"
     2631            error "bad option \"$option\": should be post, enter, leave or save"
    25872632        }
    25882633    }
  • branches/blt4_trunk/gui/scripts/vtkimageviewer.tcl

    r6269 r6351  
    7070    private method BuildImageTab {}
    7171    private method BuildDownloadPopup { widget command }
    72     private method Combo { option }
    7372    private method Connect {}
    7473    private method CurrentDatasets {args}
     
    8685    private method IsValidObject { dataobj }
    8786    private method LeaveLegend {}
     87    private method LegendTitleAction { option }
    8888    private method MotionLegend { x y }
    8989    private method Pan {option x y}
     
    209209
    210210    array set _settings {
    211         -axisflymode            "static"
     211        -axesvisible            1
    212212        -axislabels             1
    213213        -axisminorticks         1
    214         -axisvisible            1
     214        -axismode               "static"
    215215        -backingcolor           white
    216216        -backingvisible         1
     
    473473    }
    474474    array set params $settings
    475     set params(-description) ""
    476     set params(-param) ""
    477     array set params $settings
    478475
    479476    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    573570            return $dlist
    574571        }
    575         -image {
     572        "-image" {
    576573            if {[llength $args] != 2} {
    577574                error "wrong # args: should be \"get -image view\""
     
    587584        }
    588585        default {
    589             error "bad option \"$op\": should be -objects or -image"
     586            error "bad option \"$op\": should be -objects, -visible or -image"
    590587        }
    591588    }
     
    990987                    -activeforeground $itk_option(-plotforeground) \
    991988                    -font "Arial 8" \
    992                     -command [itcl::code $this Combo invoke]
     989                    -command [itcl::code $this LegendTitleAction save]
    993990                set _fields($fname) [list $label $units $components]
    994991                if { $_curFldName == "" } {
     
    10471044        PanCamera
    10481045        InitSettings -xgrid -ygrid -zgrid \
    1049             -axisvisible -axislabels -field -view3d
     1046            -axesvisible -axislabels -field -view3d
    10501047        if { [array size _fields] < 2 } {
    10511048            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    12981295    }
    12991296    switch -- $what {
    1300         "-axisflymode" {
    1301             set mode [$itk_component(axisflymode) value]
    1302             set mode [$itk_component(axisflymode) translate $mode]
    1303             set _settings($what) $mode
    1304             SendCmd "axis flymode $mode"
     1297        "-axesvisible" {
     1298            set bool $_settings($what)
     1299            SendCmd "axis visible all $bool"
    13051300        }
    13061301        "-axislabels" {
     
    13121307            SendCmd "axis minticks all $bool"
    13131308        }
    1314         "-axisvisible" {
    1315             set bool $_settings($what)
    1316             SendCmd "axis visible all $bool"
     1309        "-axismode" {
     1310            set mode [$itk_component(axismode) value]
     1311            set mode [$itk_component(axismode) translate $mode]
     1312            set _settings($what) $mode
     1313            SendCmd "axis flymode $mode"
    13171314        }
    13181315        "-background" {
     
    13961393            SendCmd "camera reset"
    13971394            DrawLegend
     1395        }
     1396        "-legendvisible" {
     1397            if { !$_settings($what) } {
     1398                $itk_component(view) delete legend
     1399            }
     1400            DrawLegend
     1401        }
     1402        "-level" {
     1403            set val $_settings($what)
     1404            SendCmd "image level $val"
     1405        }
     1406        "-opacity" {
     1407            set _changed($what) 1
     1408            if { $_settings(-view3d) } {
     1409                set _settings(-saveopacity) $_settings($what)
     1410                set val [expr $_settings($what) * 0.01]
     1411                SendCmd "image opacity $val"
     1412            } else {
     1413                SendCmd "image opacity 1.0"
     1414            }
     1415        }
     1416        "-outline" {
     1417            set bool $_settings($what)
     1418            SendCmd "outline visible $bool"
     1419        }
     1420        "-stretchtofit" {
     1421            set bool $_settings($what)
     1422            if { $bool } {
     1423                if { $_settings(-view3d) } {
     1424                    SendCmd "camera aspect native"
     1425                } else {
     1426                    SendCmd "camera aspect window"
     1427                }
     1428            } else {
     1429                SendCmd "camera aspect native"
     1430            }
    13981431        }
    13991432        "-view3d" {
     
    14511484            set val $_settings($what)
    14521485            SendCmd "image window $val"
    1453         }
    1454         "-level" {
    1455             set val $_settings($what)
    1456             SendCmd "image level $val"
    1457         }
    1458         "-legendvisible" {
    1459             if { !$_settings($what) } {
    1460                 $itk_component(view) delete legend
    1461             }
    1462             DrawLegend
    1463         }
    1464         "-opacity" {
    1465             set _changed($what) 1
    1466             if { $_settings(-view3d) } {
    1467                 set _settings(-saveopacity) $_settings($what)
    1468                 set val [expr $_settings($what) * 0.01]
    1469                 SendCmd "image opacity $val"
    1470             } else {
    1471                 SendCmd "image opacity 1.0"
    1472             }
    1473         }
    1474         "-outline" {
    1475             set bool $_settings($what)
    1476             SendCmd "outline visible $bool"
    1477         }
    1478         "-stretchtofit" {
    1479             set bool $_settings($what)
    1480             if { $bool } {
    1481                 if { $_settings(-view3d) } {
    1482                     SendCmd "camera aspect native"
    1483                 } else {
    1484                     SendCmd "camera aspect window"
    1485                 }
    1486             } else {
    1487                 SendCmd "camera aspect native"
    1488             }
    14891486        }
    14901487        "-xgrid" - "-ygrid" - "-zgrid" {
     
    17981795    checkbutton $inner.visible \
    17991796        -text "Axes" \
    1800         -variable [itcl::scope _settings(-axisvisible)] \
    1801         -command [itcl::code $this AdjustSetting -axisvisible] \
     1797        -variable [itcl::scope _settings(-axesvisible)] \
     1798        -command [itcl::code $this AdjustSetting -axesvisible] \
    18021799        -font "Arial 9"
    18031800    checkbutton $inner.labels \
     
    18301827    label $inner.mode_l -text "Mode" -font "Arial 9"
    18311828
    1832     itk_component add axisflymode {
     1829    itk_component add axismode {
    18331830        Rappture::Combobox $inner.mode -width 10 -editable 0
    18341831    }
     
    18381835        "furthest_triad"  "farthest" \
    18391836        "outer_edges"     "outer"
    1840     $itk_component(axisflymode) value $_settings(-axisflymode)
    1841     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1837    $itk_component(axismode) value $_settings(-axismode)
     1838    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    18421839
    18431840    blt::table $inner \
     
    19761973    radiobutton $inner.vtk_button -text "VTK data file" \
    19771974        -variable [itcl::scope _downloadPopup(format)] \
    1978         -font "Arial 9 " \
     1975        -font "Arial 9" \
    19791976        -value vtk
    19801977    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    19811978    radiobutton $inner.image_button -text "Image File" \
    19821979        -variable [itcl::scope _downloadPopup(format)] \
    1983         -font "Arial 9 " \
     1980        -font "Arial 9" \
    19841981        -value image
    19851982    Rappture::Tooltip::for $inner.image_button \
     
    20952092# DrawLegend --
    20962093#
    2097 #       Draws the legend in the own canvas on the right side of the plot area.
     2094# Draws the legend in its own canvas on the right side of the plot area.
    20982095#
    20992096itcl::body Rappture::VtkImageViewer::DrawLegend {} {
     
    21562153    set x1 [expr $x2 - ($iw*12)/10]
    21572154
    2158     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2159     $c bind title <Enter> [itcl::code $this Combo activate]
    2160     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2155    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2156    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2157    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21612158    # Reset the item coordinates according the current size of the plot.
    21622159    if { [info exists _limits($_curFldName)] } {
     
    22722269
    22732270# ----------------------------------------------------------------------
    2274 # USAGE: _dropdown post
    2275 # USAGE: _dropdown unpost
    2276 # USAGE: _dropdown select
    2277 #
    2278 # Used internally to handle the dropdown list for this combobox.  The
    2279 # post/unpost options are invoked when the list is posted or unposted
    2280 # to manage the relief of the controlling button.  The select option
    2281 # is invoked whenever there is a selection from the list, to assign
    2282 # the value back to the gauge.
    2283 # ----------------------------------------------------------------------
    2284 itcl::body Rappture::VtkImageViewer::Combo {option} {
     2271# USAGE: LegendTitleAction post
     2272# USAGE: LegendTitleAction enter
     2273# USAGE: LegendTitleAction leave
     2274# USAGE: LegendTitleAction save
     2275#
     2276# Used internally to handle the dropdown list for the fields menu combobox.
     2277# The post option is invoked when the field title is pressed to launch the
     2278# dropdown.  The enter option is invoked when the user mouses over the field
     2279# title. The leave option is invoked when the user moves the mouse away
     2280# from the field title.  The save option is invoked whenever there is a
     2281# selection from the list, to alert the visualization server.
     2282# ----------------------------------------------------------------------
     2283itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} {
    22852284    set c $itk_component(view)
    22862285    switch -- $option {
     
    22922291            tk_popup $itk_component(fieldmenu) $x $y
    22932292        }
    2294         activate {
     2293        enter {
    22952294            $c itemconfigure title -fill red
    22962295        }
    2297         deactivate {
     2296        leave {
    22982297            $c itemconfigure title -fill $itk_option(-plotforeground)
    22992298        }
    2300         invoke {
     2299        save {
    23012300            $itk_component(field) value $_curFldLabel
    23022301            AdjustSetting -field
    23032302        }
    23042303        default {
    2305             error "bad option \"$option\": should be post, unpost, select"
     2304            error "bad option \"$option\": should be post, enter, leave or save"
    23062305        }
    23072306    }
  • branches/blt4_trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r6252 r6351  
    107107    private method ReceiveDataset { args }
    108108    private method ReceiveImage { args }
    109     private method ReceiveLegend { colormap title vmin vmax size }
     109    private method ReceiveLegend { colormap title min max size }
    110110    private method RequestLegend {}
    111111    private method Rotate {option x y}
     
    160160    private variable _rotatePending 0
    161161    private variable _cutplanePending 0
    162     private variable _field      ""
    163162    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    164163    private variable _fields
     
    618617    }
    619618    array set params $settings
    620     set params(-description) ""
    621     set params(-param) ""
    622     array set params $settings
    623619
    624620    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    718714            return $dlist
    719715        }
    720         -image {
     716        "-image" {
    721717            if {[llength $args] != 2} {
    722718                error "wrong # args: should be \"get -image view\""
     
    732728        }
    733729        default {
    734             error "bad option \"$op\": should be -objects or -image"
     730            error "bad option \"$op\": should be -objects, -visible or -image"
    735731        }
    736732    }
     
    15051501        }
    15061502        "-isolinecolor" {
    1507             set color [$itk_component(isolineColor) value]
     1503            set color [$itk_component(isolinecolor) value]
    15081504            set _settings($what) $color
    15091505            DrawLegend
     
    17411737
    17421738    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1743     itk_component add isolineColor {
     1739    itk_component add isolinecolor {
    17441740        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    17451741    }
     
    17561752        "none"               "none"
    17571753
    1758     $itk_component(isolineColor) value "white"
     1754    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    17591755    bind $inner.linecolor <<Value>> \
    17601756        [itcl::code $this AdjustSetting -isolinecolor]
     
    21842180                    SendCmd "camera zoom $_view($what)"
    21852181                }
    2186              }
     2182            }
    21872183        }
    21882184    }
     
    22182214    radiobutton $inner.vtk_button -text "VTK data file" \
    22192215        -variable [itcl::scope _downloadPopup(format)] \
    2220         -font "Arial 9 " \
     2216        -font "Arial 9" \
    22212217        -value vtk
    22222218    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22232219    radiobutton $inner.image_button -text "Image File" \
    22242220        -variable [itcl::scope _downloadPopup(format)] \
    2225         -font "Arial 9 " \
     2221        -font "Arial 9" \
    22262222        -value image
    22272223    Rappture::Tooltip::for $inner.image_button \
     
    22592255    array set style {
    22602256        -color                  BCGYR
     2257        -constcolor             white
    22612258        -cutplaneedges          0
    22622259        -cutplanelighting       1
     
    22842281        set style(-opacity) 1.0
    22852282    }
     2283    set style(-constcolor) $itk_option(-plotforeground)
    22862284    array set style [$dataobj style $comp]
    22872285    #DebugTrace [array get style]
     
    23152313    }
    23162314    if { $_currentColormap == "" } {
    2317         SetCurrentColormap $style(-color)
    23182315        $itk_component(colormap) value $style(-color)
    23192316    }
     
    23432340
    23442341    SendCmd "cutplane add $tag"
    2345     SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
     2342    SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag"
    23462343    foreach axis {x y z} {
    23472344        set pos [expr $style(-${axis}cutplaneposition) * 0.01]
     
    23592356
    23602357    SendCmd "outline add $tag"
    2361     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     2358    SendCmd "outline color [Color2RGB $style(-constcolor)] $tag"
    23622359    SendCmd "outline visible $style(-outline) $tag"
    23632360
     
    23672364    SendCmd "contour3d edges $style(-edges) $tag"
    23682365    set _settings(-isosurfaceedges) $style(-edges)
    2369     #SendCmd "contour3d color [Color2RGB $style(-color)] $tag"
     2366    #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag"
    23702367    SendCmd "contour3d lighting $style(-lighting) $tag"
    23712368    set _settings(-isosurfacelighting) $style(-lighting)
  • branches/blt4_trunk/gui/scripts/vtkmeshviewer.tcl

    r6210 r6351  
    411411    }
    412412    array set params $settings
    413     set params(-description) ""
    414     set params(-param) ""
    415     array set params $settings
    416413
    417414    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    510507            return $dlist
    511508        }
    512         -image {
     509        "-image" {
    513510            if {[llength $args] != 2} {
    514511                error "wrong # args: should be \"get -image view\""
     
    524521        }
    525522        default {
    526             error "bad option \"$op\": should be -objects or -image"
     523            error "bad option \"$op\": should be -objects, -visible or -image"
    527524        }
    528525    }
     
    14671464    radiobutton $inner.vtk_button -text "VTK data file" \
    14681465        -variable [itcl::scope _downloadPopup(format)] \
    1469         -font "Helvetica 9 " \
     1466        -font "Arial 9" \
    14701467        -value vtk
    14711468    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
  • branches/blt4_trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r6252 r6351  
    7272    private method BuildSurfaceTab {}
    7373    private method DrawLegend {}
    74     private method Combo { option }
    7574    private method Connect {}
    7675    private method CurrentDatasets {args}
     
    9190    private method IsValidObject { dataobj }
    9291    private method LeaveLegend {}
     92    private method LegendTitleAction { option }
    9393    private method MotionLegend { x y }
    9494    private method Pan {option x y}
     
    101101    private method ReceiveDataset { args }
    102102    private method ReceiveImage { args }
    103     private method ReceiveLegend { colormap title vmin vmax size }
     103    private method ReceiveLegend { colormap title min max size }
    104104    private method RequestLegend {}
    105105    private method Rotate {option x y}
     
    145145    private variable _curFldName ""
    146146    private variable _curFldLabel ""
    147     private variable _field ""
    148147    private variable _streamlinesLength 0
    149148    private variable _numSeeds 200
     
    552551    }
    553552    array set params $settings
    554     set params(-description) ""
    555     set params(-param) ""
    556     array set params $settings
    557553
    558554    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    653649            return $dlist
    654650        }
    655         -image {
     651        "-image" {
    656652            if {[llength $args] != 2} {
    657653                error "wrong # args: should be \"get -image view\""
     
    667663        }
    668664        default {
    669             error "bad option \"$op\": should be -objects or -image"
     665            error "bad option \"$op\": should be -objects, -visible or -image"
    670666        }
    671667    }
     
    10461042                    -activeforeground $itk_option(-plotforeground) \
    10471043                    -font "Arial 8" \
    1048                     -command [itcl::code $this Combo invoke]
     1044                    -command [itcl::code $this LegendTitleAction save]
    10491045                set _fields($fname) [list $label $units $components]
    10501046                if { $_curFldName == "" && $components == 3 } {
     
    20682064    radiobutton $inner.vtk_button -text "VTK data file" \
    20692065        -variable [itcl::scope _downloadPopup(format)] \
    2070         -font "Helvetica 9 " \
     2066        -font "Arial 9" \
    20712067        -value vtk
    20722068    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    21852181
    21862182# ----------------------------------------------------------------------
    2187 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2183# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    21882184#
    21892185# Invoked automatically whenever the "legend" command comes in from
     
    21912187# specified <size> will follow.
    21922188# ----------------------------------------------------------------------
    2193 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {
     2189itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } {
    21942190    set _legendPending 0
    21952191    set _title $title
     
    22552251            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    22562252        }
    2257         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2258         $c bind title <Enter> [itcl::code $this Combo activate]
    2259         $c bind title <Leave> [itcl::code $this Combo deactivate]
     2253        $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2254        $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2255        $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    22602256        # Reset the item coordinates according the current size of the plot.
    22612257        $c itemconfigure title -text $title
     
    23802376
    23812377# ----------------------------------------------------------------------
    2382 # USAGE: _dropdown post
    2383 # USAGE: _dropdown unpost
    2384 # USAGE: _dropdown select
    2385 #
    2386 # Used internally to handle the dropdown list for this combobox.  The
    2387 # post/unpost options are invoked when the list is posted or unposted
    2388 # to manage the relief of the controlling button.  The select option
    2389 # is invoked whenever there is a selection from the list, to assign
    2390 # the value back to the gauge.
    2391 # ----------------------------------------------------------------------
    2392 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} {
     2378# USAGE: LegendTitleAction post
     2379# USAGE: LegendTitleAction enter
     2380# USAGE: LegendTitleAction leave
     2381# USAGE: LegendTitleAction save
     2382#
     2383# Used internally to handle the dropdown list for the fields menu combobox.
     2384# The post option is invoked when the field title is pressed to launch the
     2385# dropdown.  The enter option is invoked when the user mouses over the field
     2386# title. The leave option is invoked when the user moves the mouse away
     2387# from the field title.  The save option is invoked whenever there is a
     2388# selection from the list, to alert the visualization server.
     2389# ----------------------------------------------------------------------
     2390itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} {
    23932391    set c $itk_component(view)
    23942392    switch -- $option {
     
    24002398            tk_popup $itk_component(fieldmenu) $x $y
    24012399        }
    2402         activate {
     2400        enter {
    24032401            $c itemconfigure title -fill red
    24042402        }
    2405         deactivate {
     2403        leave {
    24062404            $c itemconfigure title -fill white
    24072405        }
    2408         invoke {
     2406        save {
    24092407            $itk_component(field) value $_curFldLabel
    24102408            AdjustSetting -field
    24112409        }
    24122410        default {
    2413             error "bad option \"$option\": should be post, unpost, select"
     2411            error "bad option \"$option\": should be post, enter, leave or save"
    24142412        }
    24152413    }
  • branches/blt4_trunk/gui/scripts/vtksurfaceviewer.tcl

    r6252 r6351  
    6969    private method BuildDownloadPopup { widget command }
    7070    private method BuildSurfaceTab {}
    71     private method Combo { option }
    7271    private method Connect {}
    7372    private method CurrentDatasets {args}
     
    8584    private method IsValidObject { dataobj }
    8685    private method LeaveLegend {}
     86    private method LegendTitleAction { option }
    8787    private method MotionLegend { x y }
    8888    private method Pan {option x y}
     
    9595    private method ReceiveDataset { args }
    9696    private method ReceiveImage { args }
    97     private method ReceiveLegend { colormap title vmin vmax size }
     97    private method ReceiveLegend { colormap title min max size }
    9898    private method RequestLegend {}
    9999    private method Rotate {option x y}
     
    139139    private variable _legendPending 0
    140140    private variable _rotatePending 0
    141     private variable _field ""
    142141    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    143142    private variable _fields
     
    474473    }
    475474    array set params $settings
    476     set params(-description) ""
    477     set params(-param) ""
    478     array set params $settings
    479475
    480476    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    574570            return $dlist
    575571        }
    576         -image {
     572        "-image" {
    577573            if {[llength $args] != 2} {
    578574                error "wrong # args: should be \"get -image view\""
     
    588584        }
    589585        default {
    590             error "bad option \"$op\": should be -objects or -image"
     586            error "bad option \"$op\": should be -objects, -visible or -image"
    591587        }
    592588    }
     
    13181314        "-isolinecolor" {
    13191315            set _changed($what) 1
    1320             set color [$itk_component(isolineColor) value]
    1321             set _settings($what) $color
    1322             SendCmd "contour2d linecolor [Color2RGB $color]"
     1316            set color [$itk_component(isolinecolor) value]
     1317            if { $color == "none" } {
     1318                if { $_settings(-isolinesvisible) } {
     1319                    set _changed(-isolinesvisible) 1
     1320                    foreach tag [CurrentDatasets -visible] {
     1321                        SendCmd "contour2d visible 0 $tag"
     1322                    }
     1323                    set _settings(-isolinesvisible) 0
     1324                }
     1325            } else {
     1326                set _settings($what) $color
     1327                if { !$_settings(-isolinesvisible) } {
     1328                    set _changed(-isolinesvisible) 1
     1329                    foreach tag [CurrentDatasets -visible] {
     1330                        SendCmd "contour2d visible 1 $tag"
     1331                    }
     1332                    set _settings(-isolinesvisible) 1
     1333                }
     1334                SendCmd "contour2d linecolor [Color2RGB $color]"
     1335            }
    13231336            DrawLegend
    13241337        }
     
    13281341            SendCmd "contour2d visible 0"
    13291342            if { $bool } {
     1343                if { [$itk_component(isolinecolor) value] != $_settings(-isolinecolor)} {
     1344                    $itk_component(isolinecolor) value $_settings(-isolinecolor)
     1345                }
    13301346                foreach tag [CurrentDatasets -visible] {
    13311347                    SendCmd "contour2d visible $bool $tag"
     
    15461562
    15471563    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1548     itk_component add isolineColor {
     1564    itk_component add isolinecolor {
    15491565        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    15501566    }
     
    15611577        "none"               "none"
    15621578
    1563     $itk_component(isolineColor) value "white"
     1579    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    15641580    bind $inner.linecolor <<Value>> \
    15651581        [itcl::code $this AdjustSetting -isolinecolor]
     
    17971813                    SendCmd "camera zoom $_view($what)"
    17981814                }
    1799              }
     1815            }
    18001816        }
    18011817    }
     
    18311847    radiobutton $inner.vtk_button -text "VTK data file" \
    18321848        -variable [itcl::scope _downloadPopup(format)] \
    1833         -font "Arial 9 " \
     1849        -font "Arial 9" \
    18341850        -value vtk
    18351851    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    18361852    radiobutton $inner.image_button -text "Image File" \
    18371853        -variable [itcl::scope _downloadPopup(format)] \
    1838         -font "Arial 9 " \
     1854        -font "Arial 9" \
    18391855        -value image
    18401856    Rappture::Tooltip::for $inner.image_button \
     
    21702186    }
    21712187
    2172     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2173     $c bind title <Enter> [itcl::code $this Combo activate]
    2174     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2188    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2189    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2190    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21752191    # Reset the item coordinates according the current size of the plot.
    21762192    $c itemconfigure title -text $title
     
    21972213
    21982214# ----------------------------------------------------------------------
    2199 # USAGE: _dropdown post
    2200 # USAGE: _dropdown unpost
    2201 # USAGE: _dropdown select
    2202 #
    2203 # Used internally to handle the dropdown list for this combobox.  The
    2204 # post/unpost options are invoked when the list is posted or unposted
    2205 # to manage the relief of the controlling button.  The select option
    2206 # is invoked whenever there is a selection from the list, to assign
    2207 # the value back to the gauge.
    2208 # ----------------------------------------------------------------------
    2209 itcl::body Rappture::VtkSurfaceViewer::Combo {option} {
     2215# USAGE: LegendTitleAction post
     2216# USAGE: LegendTitleAction enter
     2217# USAGE: LegendTitleAction leave
     2218# USAGE: LegendTitleAction save
     2219#
     2220# Used internally to handle the dropdown list for the fields menu combobox.
     2221# The post option is invoked when the field title is pressed to launch the
     2222# dropdown.  The enter option is invoked when the user mouses over the field
     2223# title. The leave option is invoked when the user moves the mouse away
     2224# from the field title.  The save option is invoked whenever there is a
     2225# selection from the list, to alert the visualization server.
     2226# ----------------------------------------------------------------------
     2227itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} {
    22102228    set c $itk_component(view)
    22112229    switch -- $option {
     
    22192237            tk_popup $itk_component(fieldmenu) $x $y
    22202238        }
    2221         activate {
     2239        enter {
    22222240            $c itemconfigure title -fill red
    22232241        }
    2224         deactivate {
     2242        leave {
    22252243            $c itemconfigure title -fill $itk_option(-plotforeground)
    22262244        }
    2227         invoke {
     2245        save {
    22282246            $itk_component(field) value $_curFldLabel
    22292247            AdjustSetting -field
    22302248        }
    22312249        default {
    2232             error "bad option \"$option\": should be post, unpost, select"
     2250            error "bad option \"$option\": should be post, enter, leave or save"
    22332251        }
    22342252    }
     
    23202338                -activeforeground $itk_option(-plotforeground) \
    23212339                -font "Arial 8" \
    2322                 -command [itcl::code $this Combo invoke]
     2340                -command [itcl::code $this LegendTitleAction save]
    23232341            set _fields($fname) [list $label $units $components]
    23242342            if { $_curFldName == "" } {
  • branches/blt4_trunk/gui/scripts/vtkviewer.tcl

    r6210 r6351  
    104104    private method ReceiveDataset { args }
    105105    private method ReceiveImage { args }
    106     private method ReceiveLegend { colormap title vmin vmax size }
     106    private method ReceiveLegend { colormap title min max size }
    107107    private method RequestLegend {}
    108108    private method Rotate {option x y}
     
    595595    }
    596596    array set params $settings
    597     set params(-description) ""
    598     set params(-param) ""
    599     array set params $settings
    600597
    601598    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    695692            return $dlist
    696693        }
    697         -image {
     694        "-image" {
    698695            if {[llength $args] != 2} {
    699696                error "wrong # args: should be \"get -image view\""
     
    709706        }
    710707        default {
    711             error "bad option \"$op\": should be -objects or -image"
     708            error "bad option \"$op\": should be -objects, -visible or -image"
    712709        }
    713710    }
     
    25882585    radiobutton $inner.vtk_button -text "VTK data file" \
    25892586        -variable [itcl::scope _downloadPopup(format)] \
    2590         -font "Helvetica 9 " \
     2587        -font "Arial 9" \
    25912588        -value vtk
    25922589    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    28662863
    28672864# ----------------------------------------------------------------------
    2868 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2865# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    28692866#
    28702867# Invoked automatically whenever the "legend" command comes in from
     
    28722869# specified <size> will follow.
    28732870# ----------------------------------------------------------------------
    2874 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {
    2875     set _limits(vmin) $vmin
    2876     set _limits(vmax) $vmax
     2871itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } {
     2872    set _limits(vmin) $min
     2873    set _limits(vmax) $max
    28772874    set _title $title
    28782875    if { [IsConnected] } {
  • branches/blt4_trunk/gui/scripts/vtkvolumeviewer.tcl

    r6252 r6351  
    7474    private method BuildVolumeComponents {}
    7575    private method BuildVolumeTab {}
    76     private method Combo { option }
    7776    private method ComputeAlphamap { cname }
    7877    private method ComputeTransferFunction { cname }
     
    9796    private method IsValidObject { dataobj }
    9897    private method LeaveLegend {}
     98    private method LegendTitleAction { option }
    9999    private method MotionLegend { x y }
    100100    private method Pan {option x y}
     
    109109    private method ReceiveDataset { args }
    110110    private method ReceiveImage { args }
    111     private method ReceiveLegend { colormap title vmin vmax size }
     111    private method ReceiveLegend { colormap title min max size }
    112112    private method RemoveMarker { x y }
    113113    private method RequestLegend {}
     
    240240    array set _settings {
    241241        -axesvisible            1
    242         -axisflymode            static
    243242        -axislabels             1
    244243        -axisminorticks         1
     244        -axismode               "static"
    245245        -background             black
    246246        -color                  "default"
     
    536536    }
    537537    array set params $settings
    538     set params(-description) ""
    539     set params(-param) ""
    540     array set params $settings
    541538
    542539    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    638635            return $dlist
    639636        }
    640         -image {
     637        "-image" {
    641638            if {[llength $args] != 2} {
    642639                error "wrong # args: should be \"get -image view\""
     
    652649        }
    653650        default {
    654             error "bad option \"$op\": should be -objects or -image"
     651            error "bad option \"$op\": should be -objects, -visible or -image"
    655652        }
    656653    }
     
    10041001        set _first ""
    10051002        InitSettings -background \
    1006             -xgrid -ygrid -zgrid -axisflymode \
     1003            -xgrid -ygrid -zgrid -axismode \
    10071004            -axesvisible -axislabels -axisminorticks
    10081005        StopBufferingCommands
     
    10861083                        -activeforeground $itk_option(-plotforeground) \
    10871084                        -font "Arial 8" \
    1088                         -command [itcl::code $this Combo invoke]
     1085                        -command [itcl::code $this LegendTitleAction save]
    10891086                    set _fields($fname) [list $label $units $components]
    10901087                    if { $_curFldName == "" } {
     
    13511348    }
    13521349    switch -- $what {
    1353         "-current" {
    1354             set cname [$itk_component(volcomponents) value]
    1355             SwitchComponent $cname
     1350        "-axesvisible" {
     1351            set bool $_settings($what)
     1352            SendCmd "axis visible all $bool"
     1353        }
     1354        "-axislabels" {
     1355            set bool $_settings($what)
     1356            SendCmd "axis labels all $bool"
     1357        }
     1358        "-axisminorticks" {
     1359            set bool $_settings($what)
     1360            SendCmd "axis minticks all $bool"
     1361        }
     1362        "-axismode" {
     1363            set mode [$itk_component(axismode) value]
     1364            set mode [$itk_component(axismode) translate $mode]
     1365            set _settings($what) $mode
     1366            SendCmd "axis flymode $mode"
    13561367        }
    13571368        "-background" {
     
    13681379            DrawLegend
    13691380        }
    1370         "-volumeoutline" {
    1371             set bool $_settings($what)
    1372             SendCmd "outline visible 0"
    1373             foreach tag [GetDatasetsWithComponent $_current] {
    1374                 SendCmd "outline visible $bool $tag"
    1375             }
    1376         }
    1377         "-legendvisible" {
    1378             set bool $_settings($what)
    1379             if { $bool } {
    1380                 blt::table $itk_component(plotarea) \
    1381                     1,0 $itk_component(legend) -fill x
    1382             } else {
    1383                 blt::table forget $itk_component(legend)
    1384             }
    1385         }
    1386         "-volumevisible" {
    1387             set bool $_settings($what)
    1388             set _settings($_current${what}) $bool
    1389             # Only the data objects in the array _obj2ovride(*-raise) are
    1390             # in the working set and can be displayed on screen. The global
    1391             # volume control determines whether they are visible.
    1392             #
    1393             # Note: The use of the current component is a hold over from
    1394             #       nanovis.  If we can't display more than one volume,
    1395             #       we don't have to limit the effects to a specific
    1396             #       component.
    1397             foreach tag [GetDatasetsWithComponent $_current] {
    1398                 foreach {dataobj cname} [split $tag -] break
    1399                 if { [info exists _obj2ovride($dataobj-raise)] } {
    1400                     SendCmd "volume visible $bool $tag"
    1401                 }
    1402             }
    1403             if { $bool } {
    1404                 Rappture::Tooltip::for $itk_component(volume) \
    1405                     "Hide the volume"
    1406             } else {
    1407                 Rappture::Tooltip::for $itk_component(volume) \
    1408                     "Show the volume"
    1409             }
    1410         }
    1411         "-volumeblendmode" {
    1412             set val [$itk_component(blendmode) value]
    1413             set mode [$itk_component(blendmode) translate $val]
    1414             set _settings($what) $mode
    1415             set _settings($_current${what}) $mode
    1416             foreach tag [GetDatasetsWithComponent $_current] {
    1417                 SendCmd "volume blendmode $mode $tag"
    1418             }
    1419         }
    1420         "-volumeambient" {
    1421             # Other parts of the code use the -volumeambient setting to
    1422             # tell if the component settings have been initialized
    1423             if { ![info exists _settings($_current${what})] } {
    1424                 InitComponentSettings $_current
    1425             }
    1426             set val $_settings($what)
    1427             set _settings($_current${what}) $val
    1428             set ambient [expr {0.01*$val}]
    1429             foreach tag [GetDatasetsWithComponent $_current] {
    1430                 SendCmd "volume shading ambient $ambient $tag"
    1431             }
    1432         }
    1433         "-volumediffuse" {
    1434             set val $_settings($what)
    1435             set _settings($_current${what}) $val
    1436             set diffuse [expr {0.01*$val}]
    1437             foreach tag [GetDatasetsWithComponent $_current] {
    1438                 SendCmd "volume shading diffuse $diffuse $tag"
    1439             }
    1440         }
    1441         "-volumespecularlevel" - "-volumespecularexponent" {
    1442             set val $_settings($what)
    1443             set _settings($_current${what}) $val
    1444             set level [expr {0.01*$val}]
    1445             set exp $_settings($what)
    1446             foreach tag [GetDatasetsWithComponent $_current] {
    1447                 SendCmd "volume shading specular $level $exp $tag"
    1448             }
    1449         }
    1450         "-volumelighting" {
    1451             set bool $_settings($what)
    1452             set _settings($_current${what}) $bool
    1453             foreach tag [GetDatasetsWithComponent $_current] {
    1454                 SendCmd "volume lighting $bool $tag"
    1455             }
    1456         }
    1457         "-volumeopacity" {
    1458             set val $_settings($what)
    1459             set _settings($_current${what}) $val
    1460             set val [expr {0.01*$val}]
    1461             foreach tag [GetDatasetsWithComponent $_current] {
    1462                 SendCmd "volume opacity $val $tag"
    1463             }
    1464         }
    1465         "-volumequality" {
    1466             set val $_settings($what)
    1467             set _settings($_current${what}) $val
    1468             set val [expr {0.01*$val}]
    1469             foreach tag [GetDatasetsWithComponent $_current] {
    1470                 SendCmd "volume quality $val $tag"
    1471             }
    1472         }
    1473         "-axesvisible" {
    1474             set bool $_settings($what)
    1475             SendCmd "axis visible all $bool"
    1476         }
    1477         "-axislabels" {
    1478             set bool $_settings($what)
    1479             SendCmd "axis labels all $bool"
    1480         }
    1481         "-axisminorticks" {
    1482             set bool $_settings($what)
    1483             SendCmd "axis minticks all $bool"
    1484         }
    1485         "-xgrid" - "-ygrid" - "-zgrid" {
    1486             set axis [string range $what 1 1]
    1487             set bool $_settings($what)
    1488             SendCmd "axis grid $axis $bool"
    1489         }
    1490         "-axisflymode" {
    1491             set mode [$itk_component(axismode) value]
    1492             set mode [$itk_component(axismode) translate $mode]
    1493             set _settings($what) $mode
    1494             SendCmd "axis flymode $mode"
    1495         }
    1496         "-cutplanesvisible" {
    1497             set bool $_settings($what)
    1498             foreach dataset [CurrentDatasets -visible] {
    1499                 SendCmd "$_cutplaneCmd visible $bool $dataset"
    1500             }
     1381        "-color" {
     1382            set color [$itk_component(colormap) value]
     1383            set _settings($what) $color
     1384            set _settings($_current${what}) $color
     1385            ResetColormap $_current $color
     1386        }
     1387        "-current" {
     1388            set cname [$itk_component(volcomponents) value]
     1389            SwitchComponent $cname
    15011390        }
    15021391        "-cutplanelighting" {
     
    15241413            }
    15251414        }
    1526         "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
    1527             set axis [string range $what 1 1]
     1415        "-cutplanesvisible" {
    15281416            set bool $_settings($what)
    1529             if { $bool } {
    1530                 $itk_component(${axis}CutScale) configure -state normal \
    1531                     -troughcolor white
    1532             } else {
    1533                 $itk_component(${axis}CutScale) configure -state disabled \
    1534                     -troughcolor grey82
    1535             }
    15361417            foreach dataset [CurrentDatasets -visible] {
    1537                 SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
    1538             }
    1539         }
    1540         "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
    1541             set axis [string range $what 1 1]
    1542             set pos [expr $_settings($what) * 0.01]
    1543             foreach dataset [CurrentDatasets -visible] {
    1544                 SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
    1545             }
    1546             set _cutplanePending 0
    1547         }
    1548         "-volumethickness" {
    1549             set _settings($_current${what}) $_settings($what)
    1550             updateTransferFunctions
    1551         }
    1552         "-color" {
    1553             set color [$itk_component(colormap) value]
    1554             set _settings($what) $color
    1555             set _settings($_current${what}) $color
    1556             ResetColormap $_current $color
     1418                SendCmd "$_cutplaneCmd visible $bool $dataset"
     1419            }
    15571420        }
    15581421        "-field" {
     
    15841447            SendCmd "camera reset"
    15851448            DrawLegend
     1449        }
     1450        "-legendvisible" {
     1451            set bool $_settings($what)
     1452            if { $bool } {
     1453                blt::table $itk_component(plotarea) \
     1454                    1,0 $itk_component(legend) -fill x
     1455            } else {
     1456                blt::table forget $itk_component(legend)
     1457            }
     1458        }
     1459        "-volumeambient" {
     1460            # Other parts of the code use the -volumeambient setting to
     1461            # tell if the component settings have been initialized
     1462            if { ![info exists _settings($_current${what})] } {
     1463                InitComponentSettings $_current
     1464            }
     1465            set val $_settings($what)
     1466            set _settings($_current${what}) $val
     1467            set ambient [expr {0.01*$val}]
     1468            foreach tag [GetDatasetsWithComponent $_current] {
     1469                SendCmd "volume shading ambient $ambient $tag"
     1470            }
     1471        }
     1472        "-volumeblendmode" {
     1473            set val [$itk_component(blendmode) value]
     1474            set mode [$itk_component(blendmode) translate $val]
     1475            set _settings($what) $mode
     1476            set _settings($_current${what}) $mode
     1477            foreach tag [GetDatasetsWithComponent $_current] {
     1478                SendCmd "volume blendmode $mode $tag"
     1479            }
     1480        }
     1481        "-volumediffuse" {
     1482            set val $_settings($what)
     1483            set _settings($_current${what}) $val
     1484            set diffuse [expr {0.01*$val}]
     1485            foreach tag [GetDatasetsWithComponent $_current] {
     1486                SendCmd "volume shading diffuse $diffuse $tag"
     1487            }
     1488        }
     1489        "-volumelighting" {
     1490            set bool $_settings($what)
     1491            set _settings($_current${what}) $bool
     1492            foreach tag [GetDatasetsWithComponent $_current] {
     1493                SendCmd "volume lighting $bool $tag"
     1494            }
     1495        }
     1496        "-volumeopacity" {
     1497            set val $_settings($what)
     1498            set _settings($_current${what}) $val
     1499            set val [expr {0.01*$val}]
     1500            foreach tag [GetDatasetsWithComponent $_current] {
     1501                SendCmd "volume opacity $val $tag"
     1502            }
     1503        }
     1504        "-volumeoutline" {
     1505            set bool $_settings($what)
     1506            SendCmd "outline visible 0"
     1507            foreach tag [GetDatasetsWithComponent $_current] {
     1508                SendCmd "outline visible $bool $tag"
     1509            }
     1510        }
     1511        "-volumequality" {
     1512            set val $_settings($what)
     1513            set _settings($_current${what}) $val
     1514            set val [expr {0.01*$val}]
     1515            foreach tag [GetDatasetsWithComponent $_current] {
     1516                SendCmd "volume quality $val $tag"
     1517            }
     1518        }
     1519        "-volumespecularlevel" - "-volumespecularexponent" {
     1520            set val $_settings($what)
     1521            set _settings($_current${what}) $val
     1522            set level [expr {0.01*$val}]
     1523            set exp $_settings($what)
     1524            foreach tag [GetDatasetsWithComponent $_current] {
     1525                SendCmd "volume shading specular $level $exp $tag"
     1526            }
     1527        }
     1528        "-volumethickness" {
     1529            set _settings($_current${what}) $_settings($what)
     1530            updateTransferFunctions
     1531        }
     1532        "-volumevisible" {
     1533            set bool $_settings($what)
     1534            set _settings($_current${what}) $bool
     1535            # Only the data objects in the array _obj2ovride(*-raise) are
     1536            # in the working set and can be displayed on screen. The global
     1537            # volume control determines whether they are visible.
     1538            #
     1539            # Note: The use of the current component is a hold over from
     1540            #       nanovis.  If we can't display more than one volume,
     1541            #       we don't have to limit the effects to a specific
     1542            #       component.
     1543            foreach tag [GetDatasetsWithComponent $_current] {
     1544                foreach {dataobj cname} [split $tag -] break
     1545                if { [info exists _obj2ovride($dataobj-raise)] } {
     1546                    SendCmd "volume visible $bool $tag"
     1547                }
     1548            }
     1549            if { $bool } {
     1550                Rappture::Tooltip::for $itk_component(volume) \
     1551                    "Hide the volume"
     1552            } else {
     1553                Rappture::Tooltip::for $itk_component(volume) \
     1554                    "Show the volume"
     1555            }
     1556        }
     1557        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
     1558            set axis [string range $what 1 1]
     1559            set bool $_settings($what)
     1560            if { $bool } {
     1561                $itk_component(${axis}CutScale) configure -state normal \
     1562                    -troughcolor white
     1563            } else {
     1564                $itk_component(${axis}CutScale) configure -state disabled \
     1565                    -troughcolor grey82
     1566            }
     1567            foreach dataset [CurrentDatasets -visible] {
     1568                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
     1569            }
     1570        }
     1571        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1572            set axis [string range $what 1 1]
     1573            set pos [expr $_settings($what) * 0.01]
     1574            foreach dataset [CurrentDatasets -visible] {
     1575                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
     1576            }
     1577            set _cutplanePending 0
     1578        }
     1579        "-xgrid" - "-ygrid" - "-zgrid" {
     1580            set axis [string range $what 1 1]
     1581            set bool $_settings($what)
     1582            SendCmd "axis grid $axis $bool"
    15861583        }
    15871584        default {
     
    19081905        "furthest_triad"  "farthest" \
    19091906        "outer_edges"     "outer"
    1910     $itk_component(axismode) value $_settings(-axisflymode)
    1911     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1907    $itk_component(axismode) value $_settings(-axismode)
     1908    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    19121909
    19131910    blt::table $inner \
     
    21742171    radiobutton $inner.vtk_button -text "VTK data file" \
    21752172        -variable [itcl::scope _downloadPopup(format)] \
    2176         -font "Helvetica 9 " \
     2173        -font "Arial 9" \
    21772174        -value vtk
    21782175    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    22522249
    22532250# ----------------------------------------------------------------------
    2254 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2251# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    22552252#
    22562253# Invoked automatically whenever the "legend" command comes in from
     
    22582255# specified <size> will follow.
    22592256# ----------------------------------------------------------------------
    2260 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
     2257itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } {
    22612258    if { [isconnected] } {
    22622259        set bytes [ReceiveBytes $size]
     
    24282425
    24292426# ----------------------------------------------------------------------
    2430 # USAGE: _dropdown post
    2431 # USAGE: _dropdown unpost
    2432 # USAGE: _dropdown select
    2433 #
    2434 # Used internally to handle the dropdown list for this combobox.  The
    2435 # post/unpost options are invoked when the list is posted or unposted
    2436 # to manage the relief of the controlling button.  The select option
    2437 # is invoked whenever there is a selection from the list, to assign
    2438 # the value back to the gauge.
    2439 # ----------------------------------------------------------------------
    2440 itcl::body Rappture::VtkVolumeViewer::Combo {option} {
     2427# USAGE: LegendTitleAction post
     2428# USAGE: LegendTitleAction enter
     2429# USAGE: LegendTitleAction leave
     2430# USAGE: LegendTitleAction save
     2431#
     2432# Used internally to handle the dropdown list for the fields menu combobox.
     2433# The post option is invoked when the field title is pressed to launch the
     2434# dropdown.  The enter option is invoked when the user mouses over the field
     2435# title. The leave option is invoked when the user moves the mouse away
     2436# from the field title.  The save option is invoked whenever there is a
     2437# selection from the list, to alert the visualization server.
     2438# ----------------------------------------------------------------------
     2439itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} {
    24412440    set c $itk_component(view)
    24422441    switch -- $option {
     
    24482447            tk_popup $itk_component(fieldmenu) $x $y
    24492448        }
    2450         activate {
     2449        enter {
    24512450            $c itemconfigure title -fill red
    24522451        }
    2453         deactivate {
     2452        leave {
    24542453            $c itemconfigure title -fill $itk_option(-plotforeground)
    24552454        }
    2456         invoke {
     2455        save {
    24572456            $itk_component(field) value $_curFldLabel
    24582457            AdjustSetting -field
    24592458        }
    24602459        default {
    2461             error "bad option \"$option\": should be post, unpost, select"
     2460            error "bad option \"$option\": should be post, enter, leave or save"
    24622461        }
    24632462    }
     
    25102509        } else {
    25112510            # $n : absolute value, compute relative
    2512             lappend list  [expr {(double($value)-$min)/($max-$min)]}
     2511            lappend list [expr {(double($value)-$min)/($max-$min)}]
    25132512        }
    25142513    }
Note: See TracChangeset for help on using the changeset viewer.