Changeset 6371 for branches


Ignore:
Timestamp:
Jun 2, 2016 8:19:06 AM (8 years ago)
Author:
dkearney
Message:

merging changes from trunk into multichoice branch

Location:
branches/multichoice
Files:
4 deleted
49 edited
13 copied

Legend:

Unmodified
Added
Removed
  • branches/multichoice

  • branches/multichoice/builder/scripts/templates/clang.tl

    r3177 r6371  
    180180        $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS)
    181181
     182install:
     183
    182184clean:
    183185        $(RM) @@FILEROOT@@c run*.xml
  • branches/multichoice/builder/scripts/templates/fortran77.tl

    r3177 r6371  
    179179        $(FC) $(FCFLAGS) $(INCLUDES) $< -o $@ $(LIBS)
    180180
     181install:
     182
    181183clean:
    182184        $(RM) @@FILEROOT@@f77 run*.xml
  • branches/multichoice/builder/scripts/templates/java.tl

    r3177 r6371  
    126126        $(JAVAC) $(CLASSPATH) $<
    127127
     128install:
     129
    128130clean:
    129131        $(RM) @@FILEROOT@@.class run*.xml
  • branches/multichoice/examples/mapviewer/camera/camera_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/camera/camera_zoom_layer_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/colorramp/colorramp_geotiff_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/colorramp/colorramp_netcdf_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/feature/Makefile.in

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

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
     
    2728# Parameters for feature layer
    2829array set ogrParams {
    29     url {local://afr_countries.shp}
     30    url {local://afr_elas.shp}
    3031}
    3132array set countries {
  • branches/multichoice/examples/mapviewer/gdal/gdal_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/layers/add_remove_layers.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
     
    7980
    8081    # Update map
    81     $mapviewer delete
    82     $mapviewer add $map
     82    $mapviewer refresh
    8383    puts stderr "Deleted OSM Layer, Added colorramp"
    8484}
     
    9494
    9595    # Update map
    96     $mapviewer delete
    97     $mapviewer add $map
     96    $mapviewer refresh
    9897    puts stderr "Deleted colorramp Layer, Added line layer"
    9998}
     
    110109
    111110    # Update map
    112     $mapviewer delete
    113     $mapviewer add $map
     111    $mapviewer refresh
    114112    puts stderr "Deleted line Layer, Added OSM layer"
    115113}
     
    122120
    123121    # Update map
    124     $mapviewer delete
    125     $mapviewer add $map
     122    $mapviewer refresh
    126123    puts stderr "Added colorramp layer"
    127124}
     
    134131
    135132    # Update map
    136     $mapviewer delete
    137     $mapviewer add $map
     133    $mapviewer refresh
    138134    puts stderr "Added line layer"
    139135}
  • branches/multichoice/examples/mapviewer/layers/remove_single_layer.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
     
    8485
    8586    # Update the map
    86     $mapviewer delete
    87     $mapviewer add $map
     87    $mapviewer refresh
    8888}
    8989
  • branches/multichoice/examples/mapviewer/ogr/ogr_csv_icon_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
     
    2526}
    2627
    27 # create an feature point layer from a csv file using the OGR driver
     28# create a feature icon layer from a csv file using the OGR driver
    2829# the longitude and latitude fields must be named "longitude" and
    2930# "latitude" respectively
  • branches/multichoice/examples/mapviewer/ogr/ogr_csv_points_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/ogr/ogr_csv_to_shp_icon_example.tcl

    r6214 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/ogr/ogr_shape_line_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/placard/Makefile.in

    r6209 r6371  
    1717FILES           = \
    1818                  $(srcdir)/placard_example.tcl \
     19                  $(srcdir)/placard_disable_example.tcl \
    1920                  $(srcdir)/station_clean.csv
    2021
  • branches/multichoice/examples/mapviewer/placard/placard_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/select/select_feature_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
     
    78source [file join $commondir geovis_settings.tcl]
    89
    9 # this method is called when a user clicks on a icon in the map
    10 # the method is used at the bottom of this example
    11 # the callback is called with two arguments:
    12 # option - should be one of "annotation", "clear", "feature"
    13 proc handler {option {args ""}} {
     10# This method is called when a user modifies the selection in the map view.
     11# This callback is installed in the viewer using setSelectCallback in the code below.
     12# The callback has two arguments:
     13#   option - should be one of "annotation", "clear", "feature", "region"
     14#   args - depends on option, see below
     15proc selectHandler {option {args ""}} {
    1416    switch $option {
    1517        "annotation" {
    16             # pass
     18            # An annotation (not in a feature layer) was selected, the single argument
     19            # is a list of the selected annotation names.
    1720        }
    1821        "clear" {
    19             # previously selected features have been unselected.
    20             # no arguments associated with this option.
     22            # Previously selected features or annotations have been deselected.
     23            # No arguments.
     24            puts "select clear"
    2125        }
    2226        "feature" {
    23             # a feature was selected, the server returns 4 values about the feature
    24             # that are held in args:
    25             # globalObjId - the global object identifier
    26             # featureIdList - a single value or list of feature identifiers.
    27             #                 if multiple features are returned, they arei
    28             #                 enclosed in curly brackets.
    29             # numFeaturesInLayer - the number of features in the layer
    30             # layerName - the name of the layer the features were found in.
    31             #             only features from a single layer can be selected
    32             #             at a time.
    33             foreach {globalObjId featureIdList numFeaturesInLayer layerName} $args break
    34             puts "handler caught\
    35                 globalObjId=\"$globalObjId\"\
    36                 featureIdList=\"$featureIdList\"\
    37                 numFeaturesInLayer=\"$numFeaturesInLayer\"\
    38                 layerName=\"$layerName\""
     27            # The feature selection set changed, the arguments are:
     28            #   op - "add", "delete" or "set"
     29            #   featureIdList - a list of feature identifiers.
     30            #   layerName - the name of the layer the features were found in.
     31            foreach {op featureIdList layerName} $args break
     32            switch $op {
     33                "add" {
     34                    puts "select feature add:\nfeatureIDList=\"$featureIdList\"\nlayerName=\"$layerName\""
     35                }
     36                "delete" {
     37                    puts "select feature delete:\nfeatureIDList=\"$featureIdList\"\nlayerName=\"$layerName\""
     38                }
     39                "set" {
     40                    puts "select feature set:\nfeatureIDList=\"$featureIdList\"\nlayerName=\"$layerName\""
     41                }
     42                default {
     43                    error "bad op \"$op\": should be one of: add, delete or set"
     44                }
     45            }
     46        }
     47        "region" {
     48            # An area defined by two wgs84 corner points was selected.
     49            # Here x is wgs84 decimal degrees longitude and y is wgs84 decimal degrees latitude.
     50            foreach {xmin ymin xmax ymax} $args break
     51            puts "select region: ($xmin, $ymin) - ($xmax, $ymax)"
    3952        }
    4053        default {
    41             error "bad option \"$option\": should be one of annotation,\
    42                 clean, or feature"
     54            error "bad option \"$option\": should be one of: annotation, clear, feature or region"
    4355        }
    4456    }
     
    8799"
    88100
    89 # create a map object
     101# Create a map object
    90102set map [Rappture::Map #auto]
    91103
    92 # add all layers to the map object
     104# Add all layers to the map object
    93105$map addLayer image \
    94106    osm [array get osmParams] \
     
    102114    $stylesheet
    103115
    104 # add a map to the vis client
     116# Add a map to the vis client
    105117$mapviewer scale $map
    106118$mapviewer add $map
    107119
    108120
    109 # set the proc/method to be called when a feature is selected on the map.
    110 # in this case we give the full path to the previously defined
    111 # procedure named "handler". for an itcl class method, you may need to
    112 # use itcl::code to get the full path of the  callback method:
    113 # for example: [itcl::code $this handler]
    114 $mapviewer setSelectCallback ::handler
     121# Set the proc/method to be called when a feature is selected on the map.
     122# In this case we give the full path to the previously defined
     123# procedure named "selectHandler". For an itcl class method, you may need to
     124# use itcl::code to get the full path of the callback method, e.g.
     125# [itcl::code $this selectHandler]
     126$mapviewer setSelectCallback ::selectHandler
  • branches/multichoice/examples/mapviewer/tms/tms_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/wms/wms_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/examples/mapviewer/xyz/xyz_example.tcl

    r6209 r6371  
     1package require Tk
    12package require Rappture
    23package require RapptureGUI
  • branches/multichoice/gui/apps/launcher.tcl

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

    r6251 r6371  
    7878                $(srcdir)/mainwin.tcl \
    7979                $(srcdir)/map.tcl \
     80                $(srcdir)/mapentry.tcl \
    8081                $(srcdir)/mapviewer.tcl \
    8182                $(srcdir)/mesh.tcl \
  • branches/multichoice/gui/scripts/controls.tcl

    r6251 r6371  
    178178        drawing {
    179179            Rappture::DrawingEntry $w $_owner $path
     180        }
     181        map {
     182            Rappture::MapEntry $w $_owner $path
    180183        }
    181184        image {
     
    280283    $_owner widgetfor $path $w
    281284
    282     if {[lsearch {control group drawing separator note} $type] < 0} {
     285    if {[lsearch {control group drawing map separator note} $type] < 0} {
    283286        # make a label for this control
    284287        set label [$w label]
  • branches/multichoice/gui/scripts/flowvisviewer.tcl

    r6241 r6371  
    127127
    128128    private variable _arcball ""
    129     private variable _dlist ""         ;# list of data objects
    130     private variable _obj2ovride       ;# maps dataobj => style override
    131     private variable _datasets         ;# contains all the dataobj-component
    132                                        ;# to volumes in the server
    133     private variable _dataset2style    ;# maps dataobj-component to transfunc
    134     private variable _style2datasets   ;# maps tf back to list of
     129    private variable _dlist "";         # list of data objects
     130    private variable _obj2ovride;       # maps dataobj => style override
     131    private variable _datasets;         # maps dataobj-component
     132                                        # to volumes in the server
     133    private variable _dataset2style;    # maps dataobj-component to transfunc
     134    private variable _style2datasets;   # maps tf back to list of
    135135                                        # dataobj-components using the tf.
    136     private variable _dataset2flow     ;# Maps dataobj-component to a flow.
    137 
    138     private variable _reset 1          ;# Connection to server has been reset.
    139     private variable _click            ;# Info used for rotate operations.
    140     private variable _limits           ;# Autoscale min/max for all axes
    141     private variable _view             ;# View params for 3D view
    142     private variable _isomarkers       ;# array of isosurface level values 0..1
     136    private variable _dataset2flow;     # Maps dataobj-component to a flow.
     137
     138    private variable _reset 1;          # Connection to server has been reset.
     139    private variable _click;            # Info used for rotate operations.
     140    private variable _limits;           # Autoscale min/max for all axes
     141    private variable _view;             # View params for 3D view
     142    private variable _isomarkers;       # array of isosurface level values 0..1
    143143    private variable _settings
    144     private variable _activeTf ""      ;# Currently active transfer function
    145     private variable _first ""         ;# This is the topmost volume.
    146     private variable _volcomponents    ;# Maps component name to list of
    147                                        ;# dataobj-component tags
    148     private variable _componentsList   ;# List of components found
     144    private variable _activeTf "";      # Currently active transfer function
     145    private variable _first "";         # This is the topmost volume.
     146    private variable _volcomponents;    # Maps component name to list of
     147                                        # dataobj-component tags
     148    private variable _componentsList;   # List of components found
    149149    private variable _nextToken 0
    150150    private variable _icon 0
     
    156156    private variable _gotoPending 0
    157157
    158     private common _downloadPopup      ;# download options from popup
     158    private common _downloadPopup;      # download options from popup
    159159    private common _hardcopy
    160160}
     
    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\""
     
    10951095        DoResize
    10961096    }
    1097 
     1097    if { $_reset } {
     1098        InitSettings -background -axesvisible -gridvisible
     1099    }
    10981100    set _first ""
    10991101    foreach dataobj [get -objects] {
     
    11481150
    11491151    if { $_reset } {
    1150         InitSettings -axesvisible -gridvisible \
    1151             -opacity -light2side -isosurfaceshading \
     1152        InitSettings -opacity -light2side -isosurfaceshading \
    11521153            -ambient -diffuse -specularlevel -specularexponent
    11531154
     
    28152816    radiobutton $inner.image_button -text "Image File" \
    28162817        -variable [itcl::scope _downloadPopup(format)] \
    2817         -font "Arial 9 " \
     2818        -font "Arial 9" \
    28182819        -value image
    28192820    Rappture::Tooltip::for $inner.image_button \
  • branches/multichoice/gui/scripts/gauge.tcl

    r6021 r6371  
    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/multichoice/gui/scripts/map.tcl

    r6139 r6371  
    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 }
     66    public method setDescription { description }
    5267    public method setExtents { xmin ymin xmax ymax {srs "wgs84"} }
    5368    public method setLabel { label }
    5469    public method setPlacardConfig { layerName attrlist style padding }
    5570    public method setProjection { projection }
     71    public method setScript { layerName script }
    5672    public method setStyle { style }
     73    public method setStylesheet { layerName stylesheet }
    5774    public method setToolInfo { id name command title revision }
    5875    public method setType { type }
     
    6986    private variable _tree "";         # Tree of information about the map.
    7087    private variable _isValid 0;
     88    private variable _dirty;
     89    array set _dirty {
     90        viewpoints 0
     91    }
    7192    private common _nextSelector 0;
    7293    private common _layerTypes
     
    147168    # Set global map properties
    148169    setLabel [$map get "about.label"]
     170    setDescription [$map get "about.description"]
    149171    setAttribution [$map get "about.attribution"]
    150172
     
    506528}
    507529
     530itcl::body Rappture::Map::setDescription { description } {
     531    $_tree set root "description" $description
     532}
     533
    508534itcl::body Rappture::Map::setAttribution { attribution } {
    509535    $_tree set root "attribution" $attribution
     
    623649            array set selector $selectorItem
    624650            if { [info exists selector(id)] } {
    625                 set id $selector(id)
     651                set selectorId $selector(id)
    626652            } else {
    627                 set id "selector[incr _nextSelector]"
    628             }
    629             set snode [$_tree insert $sparent -label $id]
     653                set selectorId "selector[incr _nextSelector]"
     654            }
     655            set snode [$_tree insert $sparent -label $selectorId]
    630656            foreach key { name style styleExpression query queryBounds queryOrderBy } {
    631657                if {[info exists selector($key)]} {
     
    759785        }
    760786    }
     787    set _dirty($id) 1
    761788    return $id
    762789}
     
    798825    }
    799826    $_tree delete $id
     827    array unset _dirty $layerName
    800828}
    801829
     
    862890}
    863891
     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
    864919# ----------------------------------------------------------------------
    865920# USAGE: selectors
     
    898953        return 1
    899954    }
     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
    900988}
    901989
     
    9651053        $_tree set $child z $info(altitude)
    9661054    }
     1055    set _dirty(viewpoints) 1
    9671056}
    9681057
     
    9731062    }
    9741063    $_tree delete $id
     1064    set _dirty(viewpoints) 1
    9751065}
    9761066
  • branches/multichoice/gui/scripts/mapviewer.tcl

    r6225 r6371  
    3636    inherit Rappture::VisViewer
    3737
     38    itk_option define -map map Map ""
    3839    itk_option define -plotforeground plotForeground Foreground ""
    3940    itk_option define -plotbackground plotBackground Background ""
     
    5253    public method add {dataobj {settings ""}}
    5354    public method camera {option args}
    54     public method delete {args}
     55    public method clear {args}
     56    public method delete {args} { eval hide $args }
    5557    public method disconnect {}
    5658    public method download {option args}
    5759    public method get {args}
     60    public method hide {args}
    5861    public method isconnected {}
    5962    public method parameters {title args} { # do nothing }
     63    public method placard {option args}
     64    public method refresh {} {
     65        Rebuild
     66        # Temporary hack to fix one frame delay in update
     67        SendCmd "imgflush"
     68        SendCmd "renderer render"
     69    }
    6070    public method scale {args}
    6171    public method select {option {args ""}}
     
    103113    private method GetImage { args }
    104114    private method GetNormalizedMouse { x y }
    105     private method GoToViewpoint { dataobj viewpoint }
     115    private method GoToViewpoint { dataobj viewpoint {duration 2.0} }
    106116    private method InitSettings { args  }
    107117    private method MapIsGeocentric {}
     
    689699
    690700# ----------------------------------------------------------------------
    691 # USAGE: delete ?<dataobj1> <dataobj2> ...?
    692 #
    693 # Clients use this to delete a dataobj from the plot.  If no dataobjs
    694 # are specified, then all dataobjs are deleted.  No data objects are
    695 # deleted.  They are only removed from the display list.
    696 # ----------------------------------------------------------------------
    697 itcl::body Rappture::MapViewer::delete {args} {
     701# USAGE: hide ?<dataobj1> <dataobj2> ...?
     702#
     703# Clients use this to hide a dataobj from the plot.  If no dataobjs are
     704# specified, then all dataobjs are hidden.
     705# ----------------------------------------------------------------------
     706itcl::body Rappture::MapViewer::hide {args} {
    698707    DebugTrace "Enter"
    699708    if { [llength $args] == 0} {
    700709        set args $_dlist
    701710    }
    702     # Delete all specified dataobjs
     711    # Mark all specified dataobjs as hidden
    703712    set changed 0
    704713    foreach dataobj $args {
     
    715724        }
    716725        array unset _obj2ovride $dataobj-*
     726        set changed 1
     727    }
     728    # If anything changed, then rebuild the plot
     729    if { $changed } {
     730        $_dispatcher event -idle !rebuild
     731    }
     732}
     733
     734# ----------------------------------------------------------------------
     735# USAGE: clear ?<dataobj1> <dataobj2> ...?
     736#
     737# Clients use this to permanently clear a dataobj from the plot and the
     738# render server.  If no dataobjs are specified, then all dataobjs are
     739# cleared.
     740# ----------------------------------------------------------------------
     741itcl::body Rappture::MapViewer::clear {args} {
     742    DebugTrace "Enter"
     743    if { [llength $args] == 0} {
     744        set args [concat $_dlist $_hidden]
     745    }
     746    # Delete all specified dataobjs
     747    set changed 0
     748    foreach dataobj $args {
     749        set found 0
     750        set dpos [lsearch -exact $_dlist $dataobj]
     751        if { $dpos >= 0 } {
     752            set found 1
     753        }
     754        set hpos [lsearch -exact $_hidden $dataobj]
     755        if { $hpos >= 0 } {
     756            set found 1
     757        }
     758        if { !$found } {
     759            continue
     760        }
     761        foreach tag [array names _layers -glob $dataobj-*] {
     762            SendCmd "map layer delete $tag"
     763        }
     764        if { [info commands $dataobj] == $dataobj } {
     765            # Remove the layers from the client and server.
     766            foreach layer [$dataobj layers] {
     767                if { ![$dataobj layer $layer shared] } {
     768                    # Remove shared layer if no other objects have it?
     769                }
     770            }
     771        }
     772        if { $dpos >= 0 } {
     773            # Remove it from the dataobj list.
     774            set _dlist [lreplace $_dlist $dpos $dpos]
     775        }
     776        if { $hpos >= 0 } {
     777            # Remove it from the hidden list.
     778            set _hidden [lreplace $_hidden $hpos $hpos]
     779        }
     780        array unset _obj2ovride $dataobj-*
     781        array unset _layers $dataobj-*
     782        array unset _opacity $dataobj-*
     783        array unset _visibility $dataobj-*
    717784        set changed 1
    718785    }
     
    797864            return $dlist
    798865        }
    799         -image {
     866        "-image" {
    800867            if {[llength $args] < 2} {
    801868                error "wrong # args: should be \"get -image view|legend\""
     
    9891056
    9901057# ----------------------------------------------------------------------
     1058# USAGE: placard enable <state> <layerName>
     1059#
     1060# Clients use this method to enable/disable display of a feature placard
     1061# when a feature is clicked/selected.
     1062# ----------------------------------------------------------------------
     1063itcl::body Rappture::MapViewer::placard {option args} {
     1064    switch $option {
     1065        enable {
     1066            if {[llength $args] != 2} {
     1067                error "wrong $ args: should be \"enable <boolean> <layerName>\""
     1068            }
     1069            set state [lindex $args 0]
     1070            set layerName [lindex $args 1]
     1071            if {![info exists _layers($layerName)]} {
     1072                error "Unknown layer \"$layerName\""
     1073            }
     1074            if {![string is boolean $state]} {
     1075                error "argument to placard enable must be boolean"
     1076            }
     1077            SendCmd "placard enable $state $layerName"
     1078        }
     1079        default {
     1080            error "bad option \"$option\": should be enable"
     1081        }
     1082    }
     1083}
     1084
     1085# ----------------------------------------------------------------------
    9911086# USAGE: download coming
    9921087# USAGE: download controls <downloadCommand>
     
    13781473                set _layers($tag) 1
    13791474                SetLayerStyle $dataobj $layer
    1380             }
     1475            } elseif { [$dataobj dirty $layer] } {
     1476                # Recreate layer
     1477                # FIXME: retain layer order
     1478                SendCmd "map layer delete $tag"
     1479                SetLayerStyle $dataobj $layer
     1480            }
     1481            $dataobj dirty $layer 0
    13811482            # Don't change visibility of shared/base layers
    13821483            if { !$info(shared) } {
     
    17611862                $_click(y) == $y} {
    17621863                SendCmd "map box clear"
     1864            } else {
     1865                SendCmd "map box end $x $y"
    17631866            }
    17641867        }
     
    22802383            Camera reset
    22812384        }
     2385        "viewpoint" {
     2386            if {[llength $args] < 1} {
     2387                error "wrong # args to camera viewpoint"
     2388            }
     2389            set vpopt [lindex $args 0]
     2390            switch -- $vpopt {
     2391                "go" {
     2392                    if {[llength $args] < 3} {
     2393                        error "wrong # of args to camera viewpoint go"
     2394                    }
     2395                    foreach {dataobj viewpoint} [lrange $args 1 end] break
     2396                    GoToViewpoint $dataobj $viewpoint
     2397                }
     2398                default {
     2399                    error "Unknown camera viewpoint option \"$vpopt\""
     2400                }
     2401            }
     2402        }
    22822403        "zoom" {
    22832404            if {[llength $args] < 1} {
     
    24152536}
    24162537
    2417 itcl::body Rappture::MapViewer::GoToViewpoint { dataobj viewpoint } {
     2538itcl::body Rappture::MapViewer::GoToViewpoint { dataobj viewpoint {duration 2.0}} {
    24182539    array set view [subst {
    24192540        x 0
     
    24362557        set _view(pitch) -90
    24372558    }
    2438     set duration 2.0
    24392559    SendCmd [list camera set $_view(x) $_view(y) $_view(z) $_view(heading) $_view(pitch) $_view(distance) $duration $_view(srs) $_view(verticalDatum)]
    24402560}
     
    26942814                }
    26952815            }
    2696             set format ""
    2697             set wfsType ""
    26982816            SendStylesheetFiles $info(stylesheet)
    2699             if { [info exists info(ogr.connection)] } {
    2700                 set cmd [list map layer add $tag feature db $format $info(ogr.layer) $info(ogr.connection) $info(cache) $info(stylesheet) $script $selectors]
    2701                 if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    2702                     lappend cmd $style(-minrange) $style(-maxrange)
    2703                 }
    2704             } else {
    2705                 set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(ogr.url) $info(cache) $info(stylesheet) $script $selectors]
    2706                 if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    2707                     lappend cmd $style(-minrange) $style(-maxrange)
    2708                 }
    2709                 SendFiles $info(ogr.url)
     2817            set ssSize [string length $info(stylesheet)]
     2818            set scriptSize [string length $script]
     2819            set selectorsSize [string length $selectors]
     2820            switch -- $info(driver) {
     2821                "ogr" {
     2822                    if { [info exists info(ogr.connection)] } {
     2823                        set cmd [list map layer add $tag feature db {} $info(ogr.layer) $info(ogr.connection) $info(cache) $ssSize $scriptSize $selectorsSize]
     2824                        if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2825                            lappend cmd $style(-minrange) $style(-maxrange)
     2826                        }
     2827                    } else {
     2828                        set cmd [list map layer add $tag feature $info(driver) {} {} $info(ogr.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2829                        if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2830                            lappend cmd $style(-minrange) $style(-maxrange)
     2831                        }
     2832                        SendFiles $info(ogr.url)
     2833                    }
     2834                }
     2835                "tfs" {
     2836                    set format "json"
     2837                    if {[info exists info(tfs.format)]} {
     2838                        set format $info(tfs.format)
     2839                    }
     2840                    set cmd [list map layer add $tag feature $info(driver) $format {} $info(tfs.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2841                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2842                        lappend cmd $style(-minrange) $style(-maxrange)
     2843                    }
     2844                }
     2845                "wfs" {
     2846                    set format "json"
     2847                    if {[info exists info(wfs.format)]} {
     2848                        set format $info(wfs.format)
     2849                    }
     2850                    set wfsType ""
     2851                    if {[info exists info(wfs.typename)]} {
     2852                        set wfsType $info(wfs.typename)
     2853                    }
     2854                    set cmd [list map layer add $tag feature $info(driver) $format $wfsType $info(wfs.url) $info(cache) $ssSize $scriptSize $selectorsSize]
     2855                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2856                        lappend cmd $style(-minrange) $style(-maxrange)
     2857                    }
     2858                }
    27102859            }
    27112860            SendCmd $cmd
     2861            if { $ssSize > 0 }        { SendData $info(stylesheet) }
     2862            if { $scriptSize > 0 }    { SendData $script }
     2863            if { $selectorsSize > 0 } { SendData $selectors }
    27122864            SendCmd "map layer opacity $style(-opacity) $tag"
    27132865        }
     
    31423294    }
    31433295}
     3296
     3297# ----------------------------------------------------------------------
     3298# OPTION: -map
     3299# ----------------------------------------------------------------------
     3300itcl::configbody Rappture::MapViewer::map {
     3301    if {$itk_option(-map) != "" } {
     3302        if {[catch {$itk_option(-map) isa Rappture::Map} valid] != 0 || !$valid} {
     3303            error "bad value \"$itk_option(-map)\": should be Rappture::Map object"
     3304        }
     3305        $this clear
     3306        $this add $itk_option(-map)
     3307        $this scale $itk_option(-map)
     3308    } else {
     3309        $this clear
     3310    }
     3311
     3312    if { [isconnected] } {
     3313        $_dispatcher event -idle !rebuild
     3314    }
     3315}
  • branches/multichoice/gui/scripts/mesh.tcl

    r5659 r6371  
    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/multichoice/gui/scripts/nanovisviewer.tcl

    r6240 r6371  
    119119
    120120    private variable _arcball ""
    121     private variable _dlist ""         ;# list of data objects
    122     private variable _obj2ovride       ;# maps dataobj => style override
    123     private variable _datasets         ;# contains all the dataobj-component
    124                                        ;# to volumes in the server
    125 
    126     private variable _reset 1          ;# Connection to server has been reset.
    127     private variable _click            ;# Info used for rotate operations.
    128     private variable _limits           ;# Autoscale min/max for all axes
    129     private variable _view             ;# View params for 3D view
     121    private variable _dlist "";         # list of data objects
     122    private variable _obj2ovride;       # maps dataobj => style override
     123    private variable _datasets;         # maps dataobj-component
     124                                        # to volumes in the server
     125
     126    private variable _reset 1;          # Connection to server has been reset.
     127    private variable _click;            # Info used for rotate operations.
     128    private variable _limits;           # Autoscale min/max for all axes
     129    private variable _view;             # View params for 3D view
    130130    private variable _parsedFunction
    131131    private variable _transferFunctionEditors
    132132    private variable _settings
    133     private variable _first ""         ;# This is the topmost volume.
    134     private variable _current ""       ;# Currently selected component
    135     private variable _volcomponents    ;# Maps component name to list of
    136                                        ;# dataobj-component tags
    137     private variable _componentsList   ;# List of components found
     133    private variable _first "";         # This is the topmost volume.
     134    private variable _current "";       # Currently selected component
     135    private variable _volcomponents;    # Maps component name to list of
     136                                        # dataobj-component tags
     137    private variable _componentsList;   # List of components found
    138138    private variable _cname2transferFunction
    139139    private variable _cname2defaultcolormap
     
    143143    private variable _resizeLegendPending 0
    144144
    145     private common _downloadPopup      ;# download options from popup
     145    private common _downloadPopup;      # download options from popup
    146146    private common _hardcopy
    147147}
     
    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\""
     
    871871        DoResize
    872872    }
    873 
     873    if { $_reset } {
     874        InitSettings -background -axesvisible -gridvisible
     875    }
    874876    set _first ""
    875877    SendCmd "volume state 0"
     
    926928
    927929    if { $_reset } {
    928         InitSettings -axesvisible -gridvisible \
    929             -opacity -light2side -isosurfaceshading \
     930        InitSettings -opacity -light2side -isosurfaceshading \
    930931            -ambient -diffuse -specularlevel -specularexponent \
    931932            -current
     
    15491550        } else {
    15501551            # $n : absolute value, compute relative
    1551             lappend list  [expr {(double($value)-$min)/($max-$min)]}
     1552            lappend list [expr {(double($value)-$min)/($max-$min)}]
    15521553        }
    15531554    }
     
    20292030    radiobutton $inner.image_button -text "Image File" \
    20302031        -variable [itcl::scope _downloadPopup(format)] \
    2031         -font "Arial 9 " \
     2032        -font "Arial 9" \
    20322033        -value image
    20332034    Rappture::Tooltip::for $inner.image_button \
  • branches/multichoice/gui/scripts/probdisteditor.tcl

    r6021 r6371  
    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/multichoice/gui/scripts/responseviewer.tcl

    r6032 r6371  
    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/multichoice/gui/scripts/transferfunctioneditor.tcl

    r5640 r6371  
    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/multichoice/gui/scripts/visviewer.tcl

    r6052 r6371  
    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/multichoice/gui/scripts/vtkglyphviewer.tcl

    r6235 r6371  
    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      ""
    154     private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    155153    private variable _fields
    156154    private variable _curFldName ""
    157155    private variable _curFldLabel ""
    158156    private variable _curFldComp 3
     157    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    159158    private variable _mouseOver "";     # what called LegendRangeAction:
    160159                                        # vmin or vmax
     
    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"} {
     
    630626        set _dlist [lreplace $_dlist $pos $pos]
    631627        array unset _obj2ovride $dataobj-*
    632         array unset _settings $dataobj-*
    633628        set changed 1
    634629    }
     
    691686            return $dlist
    692687        }
    693         -image {
     688        "-image" {
    694689            if {[llength $args] != 2} {
    695690                error "wrong # args: should be \"get -image view\""
     
    705700        }
    706701        default {
    707             error "bad option \"$op\": should be -objects or -image"
     702            error "bad option \"$op\": should be -objects, -visible or -image"
    708703        }
    709704    }
     
    13231318itcl::body Rappture::VtkGlyphViewer::InitSettings { args } {
    13241319    foreach spec $args {
    1325         if { [info exists _settings($_first${spec})] } {
    1326             # Reset global setting with dataobj specific setting
    1327             set _settings($spec) $_settings($_first${spec})
    1328         }
    13291320        AdjustSetting $spec
    13301321    }
     
    22122203                    SendCmd "camera zoom $_view($what)"
    22132204                }
    2214              }
     2205            }
    22152206        }
    22162207    }
     
    22462237    radiobutton $inner.vtk_button -text "VTK data file" \
    22472238        -variable [itcl::scope _downloadPopup(format)] \
    2248         -font "Arial 9 " \
     2239        -font "Arial 9" \
    22492240        -value vtk
    22502241    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22512242    radiobutton $inner.image_button -text "Image File" \
    22522243        -variable [itcl::scope _downloadPopup(format)] \
    2253         -font "Arial 9 " \
     2244        -font "Arial 9" \
    22542245        -value image
    22552246    Rappture::Tooltip::for $inner.image_button \
  • branches/multichoice/gui/scripts/vtkheightmapviewer.tcl

    r6235 r6371  
    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}
     
    103103    private method Rotate {option x y}
    104104    private method SetCurrentColormap { color }
     105    private method SetCurrentFieldName { dataobj }
    105106    private method SetLegendTip { x y }
    106107    private method SetObjectStyle { dataobj comp }
     
    214215
    215216    array set _settings {
    216         -axisflymode            "static"
     217        -axesvisible            1
    217218        -axislabels             1
    218219        -axisminorticks         1
    219         -axisvisible            1
     220        -axismode               "static"
    220221        -colormap               BCGYR
    221222        -colormapdiscrete       0
     
    243244    array set _changed {
    244245        -colormap               0
     246        -colormapdiscrete       0
     247        -colormapvisible        0
     248        -edges                  0
     249        -isolinecolor           0
     250        -isolinesvisible        0
    245251        -numisolines            0
    246252        -opacity                0
     253        -wireframe              0
    247254    }
    248255    itk_component add view {
     
    255262
    256263    itk_component add fieldmenu {
    257         menu $itk_component(plotarea).menu \
    258             -relief flat \
    259             -tearoff 0
     264        menu $itk_component(plotarea).menu -relief flat -tearoff 0
    260265    } {
    261266        usual
     
    286291    }
    287292    pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
    288     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     293    Rappture::Tooltip::for $itk_component(reset) \
     294        "Reset the view to the default zoom level"
    289295
    290296    itk_component add zoomin {
     
    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"} {
     
    523526        set _dlist [lreplace $_dlist $pos $pos]
    524527        array unset _obj2ovride $dataobj-*
    525         array unset _settings $dataobj-*
    526528        set changed 1
    527529    }
     
    583585            return $dlist
    584586        }
    585         -image {
     587        "-image" {
    586588            if {[llength $args] != 2} {
    587589                error "wrong # args: should be \"get -image view\""
     
    597599        }
    598600        default {
    599             error "bad option \"$op\": should be -objects or -image"
     601            error "bad option \"$op\": should be -objects, -visible or -image"
    600602        }
    601603    }
     
    920922        # Reset the camera and other view parameters
    921923        #
    922         InitSettings -isheightmap -background
     924        InitSettings -isheightmap -background \
     925            -xgrid -ygrid -zgrid -axismode \
     926            -axesvisible -axislabels -axisminorticks
    923927
    924928        # Setting a custom exponent and label format for axes is causing
     
    933937        #SendCmd "axis exp 0 0 0 1"
    934938
     939        SendCmd "axis tickpos outside"
    935940        SendCmd "axis lrot z 90"
    936941        $_arcball quaternion [ViewToQuaternion]
     
    951956
    952957    set _first ""
    953     # Start off with no datasets are visible.
     958    # Start off with no datasets visible.
    954959    SendCmd "dataset visible 0"
    955960    set scale [GetHeightmapScale]
     
    957962        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    958963            set _first $dataobj
     964            SetCurrentFieldName $dataobj
    959965        }
    960966        foreach comp [$dataobj components] {
     
    9981004        }
    9991005    }
    1000     if { $_first != "" } {
    1001         $itk_component(field) choices delete 0 end
    1002         $itk_component(fieldmenu) delete 0 end
    1003         array unset _fields
    1004         set _curFldName ""
    1005         foreach cname [$_first components] {
    1006             foreach fname [$_first fieldnames $cname] {
    1007                 if { [info exists _fields($fname)] } {
    1008                     continue
    1009                 }
    1010                 foreach { label units components } \
    1011                     [$_first fieldinfo $fname] break
    1012                 $itk_component(field) choices insert end "$fname" "$label"
    1013                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1014                     -value $label -variable [itcl::scope _curFldLabel] \
    1015                     -selectcolor red \
    1016                     -activebackground $itk_option(-plotbackground) \
    1017                     -activeforeground $itk_option(-plotforeground) \
    1018                     -font "Arial 8" \
    1019                     -command [itcl::code $this Combo invoke]
    1020                 set _fields($fname) [list $label $units $components]
    1021                 if { $_curFldName == "" } {
    1022                     set _curFldName $fname
    1023                     set _curFldLabel $label
    1024                 }
    1025             }
    1026         }
    1027         $itk_component(field) value $_curFldLabel
    1028     }
     1006
    10291007    InitSettings -stretchtofit -outline
    1030 
    10311008    if { $_reset } {
    1032         SendCmd "axis tickpos outside"
    1033         #SendCmd "axis lformat all %g"
    1034 
    10351009        foreach axis { x y z } {
    10361010            set label ""
     
    10891063        }
    10901064        PanCamera
    1091         InitSettings -xgrid -ygrid -zgrid \
    1092             -axisvisible -axislabels -heightmapscale -field -isheightmap \
    1093             -numisolines
     1065        InitSettings -heightmapscale -field -isheightmap -numisolines
    10941066        if { [array size _fields] < 2 } {
    10951067            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    13311303itcl::body Rappture::VtkHeightmapViewer::InitSettings { args } {
    13321304    foreach spec $args {
    1333         if { [info exists _settings($_first${spec})] } {
    1334             # Reset global setting with dataobj specific setting
    1335             set _settings($spec) $_settings($_first${spec})
    1336         }
    13371305        AdjustSetting $spec
    13381306    }
     
    13511319    }
    13521320    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"
     1321        "-axesvisible" {
     1322            set bool $_settings($what)
     1323            SendCmd "axis visible all $bool"
    13581324        }
    13591325        "-axislabels" {
     
    13651331            SendCmd "axis minticks all $bool"
    13661332        }
    1367         "-axisvisible" {
    1368             set bool $_settings($what)
    1369             SendCmd "axis visible all $bool"
     1333        "-axismode" {
     1334            set mode [$itk_component(axismode) value]
     1335            set mode [$itk_component(axismode) translate $mode]
     1336            set _settings($what) $mode
     1337            SendCmd "axis flymode $mode"
    13701338        }
    13711339        "-background" {
     
    13911359            if { $color == "none" } {
    13921360                if { $_settings(-colormapvisible) } {
     1361                    set _changed(-colormapvisible) 1
    13931362                    SendCmd "heightmap surface 0"
    13941363                    set _settings(-colormapvisible) 0
     
    13961365            } else {
    13971366                if { !$_settings(-colormapvisible) } {
     1367                    set _changed(-colormapvisible) 1
    13981368                    SendCmd "heightmap surface 1"
    13991369                    set _settings(-colormapvisible) 1
     
    14081378            EventuallyRequestLegend
    14091379        }
    1410         "-colormapvisible" {
    1411             set bool $_settings($what)
    1412             SendCmd "heightmap surface $bool"
    1413         }
    14141380        "-colormapdiscrete" {
     1381            set _changed($what) 1
    14151382            set bool $_settings($what)
    14161383            set numColors [expr $_settings(-numisolines) + 1]
     
    14281395            EventuallyRequestLegend
    14291396        }
     1397        "-colormapvisible" {
     1398            set _changed($what) 1
     1399            set bool $_settings($what)
     1400            SendCmd "heightmap surface $bool"
     1401        }
    14301402        "-edges" {
     1403            set _changed($what) 1
    14311404            set bool $_settings($what)
    14321405            SendCmd "heightmap edges $bool"
     
    15741547        }
    15751548        "-isolinecolor" {
     1549            set _changed($what) 1
    15761550            set color [$itk_component(isolinecolor) value]
    15771551            if { $color == "none" } {
    15781552                if { $_settings(-isolinesvisible) } {
     1553                    set _changed(-isolinesvisible) 1
    15791554                    SendCmd "heightmap isolines 0"
    15801555                    set _settings(-isolinesvisible) 0
    15811556                }
    15821557            } else {
     1558                set _settings($what) $color
    15831559                if { !$_settings(-isolinesvisible) } {
     1560                    set _changed(-isolinesvisible) 1
    15841561                    SendCmd "heightmap isolines 1"
    15851562                    set _settings(-isolinesvisible) 1
     
    15901567        }
    15911568        "-isolinesvisible" {
     1569            set _changed($what) 1
    15921570            set bool $_settings($what)
     1571            set color [$itk_component(isolinecolor) value]
     1572            if { $bool && $color != $_settings(-isolinecolor)} {
     1573                $itk_component(isolinecolor) value $_settings(-isolinecolor)
     1574            }
    15931575            SendCmd "heightmap isolines $bool"
    15941576            DrawLegend
     
    16341616        }
    16351617        "-outline" {
     1618            set _changed($what) 1
    16361619            if { $_settings(-isheightmap) } {
    16371620                SendCmd "outline visible 0"
     
    16571640        }
    16581641        "-wireframe" {
     1642            set _changed($what) 1
    16591643            set bool $_settings($what)
    16601644            SendCmd "heightmap wireframe $bool"
     
    17171701        set cmap $_currentColormap
    17181702        if { ![info exists _colormaps($cmap)] } {
    1719            BuildColormap $cmap
    1720            set _colormaps($cmap) 1
     1703            BuildColormap $cmap
     1704            set _colormaps($cmap) 1
    17211705        }
    17221706        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     
    20342018    checkbutton $inner.visible \
    20352019        -text "Axes" \
    2036         -variable [itcl::scope _settings(-axisvisible)] \
    2037         -command [itcl::code $this AdjustSetting -axisvisible] \
     2020        -variable [itcl::scope _settings(-axesvisible)] \
     2021        -command [itcl::code $this AdjustSetting -axesvisible] \
    20382022        -font "Arial 9"
    20392023    checkbutton $inner.labels \
     
    20662050    label $inner.mode_l -text "Mode" -font "Arial 9"
    20672051
    2068     itk_component add axisflymode {
     2052    itk_component add axismode {
    20692053        Rappture::Combobox $inner.mode -width 10 -editable 0
    20702054    }
     
    20742058        "furthest_triad"  "farthest" \
    20752059        "outer_edges"     "outer"
    2076     $itk_component(axisflymode) value $_settings(-axisflymode)
    2077     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     2060    $itk_component(axismode) value $_settings(-axismode)
     2061    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    20782062
    20792063    blt::table $inner \
     
    22122196    radiobutton $inner.vtk_button -text "VTK data file" \
    22132197        -variable [itcl::scope _downloadPopup(format)] \
    2214         -font "Arial 9 " \
     2198        -font "Arial 9" \
    22152199        -value vtk
    22162200    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22172201    radiobutton $inner.image_button -text "Image File" \
    22182202        -variable [itcl::scope _downloadPopup(format)] \
    2219         -font "Arial 9 " \
     2203        -font "Arial 9" \
    22202204        -value image
    22212205    Rappture::Tooltip::for $inner.image_button \
     
    22582242    set tag $dataobj-$comp
    22592243    array set style {
    2260         -color BCGYR
    2261         -levels 10
    2262         -opacity 1.0
     2244        -color            BCGYR
     2245        -colormapdiscrete 0
     2246        -colormapvisible  1
     2247        -edgecolor        black
     2248        -edges            0
     2249        -isolinecolor     black
     2250        -isolinesvisible  1
     2251        -isolinewidth     1.0
     2252        -levels           10
     2253        -linewidth        1.0
     2254        -opacity          1.0
     2255        -outline          0
     2256        -wireframe        0
    22632257    }
    22642258    set stylelist [$dataobj style $comp]
     
    22982292        DrawLegend
    22992293    }
     2294    foreach setting {-edges -outline -wireframe -colormapdiscrete \
     2295                     -colormapvisible -isolinecolor -isolinesvisible} {
     2296        if {$_changed($setting)} {
     2297            # User-modified UI setting overrides style
     2298            set style($setting) $_settings($setting)
     2299        } else {
     2300            # Set UI control to style setting (tool provided or default)
     2301            set _settings($setting) $style($setting)
     2302        }
     2303    }
     2304
    23002305    SendCmd "outline add $tag"
    23012306    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
    2302     SendCmd "outline visible $_settings(-outline) $tag"
     2307    SendCmd "outline visible $style(-outline) $tag"
     2308
    23032309    set scale [GetHeightmapScale]
    23042310    SendCmd "[list heightmap add contourlist $_contourList $scale $tag]"
    23052311    set _comp2scale($tag) $_settings(-heightmapscale)
    2306     SendCmd "heightmap edges $_settings(-edges) $tag"
    2307     SendCmd "heightmap wireframe $_settings(-wireframe) $tag"
     2312    SendCmd "heightmap edges $style(-edges) $tag"
     2313    SendCmd "heightmap linecolor [Color2RGB $style(-edgecolor)] $tag"
     2314    SendCmd "heightmap linewidth $style(-linewidth) $tag"
     2315    SendCmd "heightmap wireframe $style(-wireframe) $tag"
    23082316    SetCurrentColormap $style(-color)
    2309     set color [$itk_component(isolinecolor) value]
    2310     SendCmd "heightmap isolinecolor [Color2RGB $color] $tag"
     2317    if {$style(-colormapdiscrete)} {
     2318        SendCmd "heightmap preinterp 1 $tag"
     2319        set numColors [expr $style(-levels) + 1]
     2320        SendCmd "colormap res $numColors $style(-color)"
     2321    }
     2322    SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag"
     2323    $itk_component(isolinecolor) value $style(-isolinecolor)
     2324    SendCmd "heightmap isolinewidth $style(-isolinewidth) $tag"
    23112325    SendCmd "heightmap lighting $_settings(-isheightmap) $tag"
    2312     SendCmd "heightmap isolines $_settings(-isolinesvisible) $tag"
    2313     SendCmd "heightmap surface $_settings(-colormapvisible) $tag"
     2326    SendCmd "heightmap isolines $style(-isolinesvisible) $tag"
     2327    SendCmd "heightmap surface $style(-colormapvisible) $tag"
    23142328    SendCmd "heightmap opacity $style(-opacity) $tag"
    23152329    set _settings(-opacity) [expr $style(-opacity) * 100.0]
     
    23492363# DrawLegend --
    23502364#
    2351 # Draws the legend in the own canvas on the right side of the plot area.
     2365# Draws the legend in its own canvas on the right side of the plot area.
    23522366#
    23532367itcl::body Rappture::VtkHeightmapViewer::DrawLegend {} {
     
    24372451    }
    24382452
    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]
     2453    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2454    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2455    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    24422456    # Reset the item coordinates according the current size of the plot.
    24432457    if { [info exists _limits($_curFldName)] } {
     
    25532567
    25542568# ----------------------------------------------------------------------
    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} {
     2569# USAGE: LegendTitleAction post
     2570# USAGE: LegendTitleAction enter
     2571# USAGE: LegendTitleAction leave
     2572# USAGE: LegendTitleAction save
     2573#
     2574# Used internally to handle the dropdown list for the fields menu combobox.
     2575# The post option is invoked when the field title is pressed to launch the
     2576# dropdown.  The enter option is invoked when the user mouses over the field
     2577# title. The leave option is invoked when the user moves the mouse away
     2578# from the field title.  The save option is invoked whenever there is a
     2579# selection from the list, to alert the visualization server.
     2580# ----------------------------------------------------------------------
     2581itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} {
    25662582    set c $itk_component(view)
    25672583    switch -- $option {
     
    25732589            tk_popup $itk_component(fieldmenu) $x $y
    25742590        }
    2575         activate {
     2591        enter {
    25762592            $c itemconfigure title -fill red
    25772593        }
    2578         deactivate {
     2594        leave {
    25792595            $c itemconfigure title -fill $itk_option(-plotforeground)
    25802596        }
    2581         invoke {
     2597        save {
    25822598            $itk_component(field) value $_curFldLabel
    25832599            AdjustSetting -field
    25842600        }
    25852601        default {
    2586             error "bad option \"$option\": should be post, unpost, select"
     2602            error "bad option \"$option\": should be post, enter, leave or save"
    25872603        }
    25882604    }
     
    26342650    blt::vector destroy $v
    26352651}
     2652
     2653itcl::body Rappture::VtkHeightmapViewer::SetCurrentFieldName { dataobj } {
     2654    set _first $dataobj
     2655    $itk_component(field) choices delete 0 end
     2656    $itk_component(fieldmenu) delete 0 end
     2657    array unset _fields
     2658    set _curFldName ""
     2659    foreach cname [$_first components] {
     2660        foreach fname [$_first fieldnames $cname] {
     2661            if { [info exists _fields($fname)] } {
     2662                continue
     2663            }
     2664            foreach { label units components } \
     2665                [$_first fieldinfo $fname] break
     2666            $itk_component(field) choices insert end "$fname" "$label"
     2667            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2668                -value $label -variable [itcl::scope _curFldLabel] \
     2669                -selectcolor red \
     2670                -activebackground $itk_option(-plotbackground) \
     2671                -activeforeground $itk_option(-plotforeground) \
     2672                -font "Arial 8" \
     2673                -command [itcl::code $this LegendTitleAction save]
     2674            set _fields($fname) [list $label $units $components]
     2675            if { $_curFldName == "" } {
     2676                set _curFldName $fname
     2677                set _curFldLabel $label
     2678            }
     2679        }
     2680    }
     2681    $itk_component(field) value $_curFldLabel
     2682}
  • branches/multichoice/gui/scripts/vtkimageviewer.tcl

    r6235 r6371  
    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}
     
    100100    private method Rotate {option x y}
    101101    private method SetCurrentColormap { color }
     102    private method SetCurrentFieldName { dataobj }
    102103    private method SetLegendTip { x y }
    103104    private method SetObjectStyle { dataobj comp }
     
    209210
    210211    array set _settings {
    211         -axisflymode            "static"
     212        -axesvisible            1
    212213        -axislabels             1
    213214        -axisminorticks         1
    214         -axisvisible            1
     215        -axismode               "static"
    215216        -backingcolor           white
    216217        -backingvisible         1
     
    243244
    244245    itk_component add fieldmenu {
    245         menu $itk_component(plotarea).menu \
    246             -relief flat \
    247             -tearoff 0
     246        menu $itk_component(plotarea).menu -relief flat -tearoff 0
    248247    } {
    249248        usual
     
    274273    }
    275274    pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
    276     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     275    Rappture::Tooltip::for $itk_component(reset) \
     276        "Reset the view to the default zoom level"
    277277
    278278    itk_component add zoomin {
     
    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"} {
     
    513510        set _dlist [lreplace $_dlist $pos $pos]
    514511        array unset _obj2ovride $dataobj-*
    515         array unset _settings $dataobj-*
    516512        set changed 1
    517513    }
     
    573569            return $dlist
    574570        }
    575         -image {
     571        "-image" {
    576572            if {[llength $args] != 2} {
    577573                error "wrong # args: should be \"get -image view\""
     
    587583        }
    588584        default {
    589             error "bad option \"$op\": should be -objects or -image"
     585            error "bad option \"$op\": should be -objects, -visible or -image"
    590586        }
    591587    }
     
    607603        }
    608604        foreach axis { x y } {
     605            set units [$dataobj hints ${axis}units]
     606            set found($units) 1
    609607            set lim [$dataobj limits $axis]
    610608            if { ![info exists _limits($axis)] } {
     
    621619            }
    622620            set _limits($axis) [list $amin $amax]
    623             set units [$dataobj hints ${axis}units]
    624             set found($units) 1
    625621        }
    626622        foreach { fname lim } [$dataobj fieldlimits] {
     
    903899        DoResize
    904900        if { $_settings(-stretchtofit) } {
    905             AdjustSetting -stretchToFit
     901            AdjustSetting -stretchtofit
    906902        }
    907903    }
     
    910906        # Reset the camera and other view parameters
    911907        #
    912         InitSettings -view3d -background
    913 
     908        InitSettings -view3d -background \
     909            -xgrid -ygrid -zgrid -axismode \
     910            -axesvisible -axislabels -axisminorticks
     911
     912        SendCmd "axis tickpos outside"
    914913        SendCmd "axis lrot z 90"
    915914        $_arcball quaternion [ViewToQuaternion]
     
    930929
    931930    set _first ""
    932     # Start off with no datasets are visible.
     931    # Start off with no datasets visible.
    933932    SendCmd "dataset visible 0"
    934933    foreach dataobj [get -objects] {
    935934        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    936935            set _first $dataobj
     936            SetCurrentFieldName $dataobj
    937937        }
    938938        foreach comp [$dataobj components] {
     
    971971        }
    972972    }
    973     if { $_first != ""  } {
    974         $itk_component(field) choices delete 0 end
    975         $itk_component(fieldmenu) delete 0 end
    976         array unset _fields
    977         set _curFldName ""
    978         foreach cname [$_first components] {
    979             foreach fname [$_first fieldnames $cname] {
    980                 if { [info exists _fields($fname)] } {
    981                     continue
    982                 }
    983                 foreach { label units components } \
    984                     [$_first fieldinfo $fname] break
    985                 $itk_component(field) choices insert end "$fname" "$label"
    986                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    987                     -value $label -variable [itcl::scope _curFldLabel] \
    988                     -selectcolor red \
    989                     -activebackground $itk_option(-plotbackground) \
    990                     -activeforeground $itk_option(-plotforeground) \
    991                     -font "Arial 8" \
    992                     -command [itcl::code $this Combo invoke]
    993                 set _fields($fname) [list $label $units $components]
    994                 if { $_curFldName == "" } {
    995                     set _curFldName $fname
    996                     set _curFldLabel $label
    997                 }
    998             }
    999         }
    1000         $itk_component(field) value $_curFldLabel
    1001     }
     973
    1002974    InitSettings -stretchtofit -outline
    1003 
    1004975    if { $_reset } {
    1005         SendCmd "axis tickpos outside"
    1006         #SendCmd "axis lformat all %g"
    1007 
    1008976        foreach axis { x y z } {
    1009977            set label ""
     
    10461014        }
    10471015        PanCamera
    1048         InitSettings -xgrid -ygrid -zgrid \
    1049             -axisvisible -axislabels -field -view3d
     1016        InitSettings -field -view3d
    10501017        if { [array size _fields] < 2 } {
    10511018            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    12781245itcl::body Rappture::VtkImageViewer::InitSettings { args } {
    12791246    foreach spec $args {
    1280         if { [info exists _settings($_first${spec})] } {
    1281             # Reset global setting with dataobj specific setting
    1282             set _settings($spec) $_settings($_first${spec})
    1283         }
    12841247        AdjustSetting $spec
    12851248    }
     
    12981261    }
    12991262    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"
     1263        "-axesvisible" {
     1264            set bool $_settings($what)
     1265            SendCmd "axis visible all $bool"
    13051266        }
    13061267        "-axislabels" {
     
    13121273            SendCmd "axis minticks all $bool"
    13131274        }
    1314         "-axisvisible" {
    1315             set bool $_settings($what)
    1316             SendCmd "axis visible all $bool"
     1275        "-axismode" {
     1276            set mode [$itk_component(axismode) value]
     1277            set mode [$itk_component(axismode) translate $mode]
     1278            set _settings($what) $mode
     1279            SendCmd "axis flymode $mode"
    13171280        }
    13181281        "-background" {
     
    13961359            SendCmd "camera reset"
    13971360            DrawLegend
     1361        }
     1362        "-legendvisible" {
     1363            if { !$_settings($what) } {
     1364                $itk_component(view) delete legend
     1365            }
     1366            DrawLegend
     1367        }
     1368        "-level" {
     1369            set val $_settings($what)
     1370            SendCmd "image level $val"
     1371        }
     1372        "-opacity" {
     1373            set _changed($what) 1
     1374            if { $_settings(-view3d) } {
     1375                set _settings(-saveopacity) $_settings($what)
     1376                set val [expr $_settings($what) * 0.01]
     1377                SendCmd "image opacity $val"
     1378            } else {
     1379                SendCmd "image opacity 1.0"
     1380            }
     1381        }
     1382        "-outline" {
     1383            set bool $_settings($what)
     1384            SendCmd "outline visible $bool"
     1385        }
     1386        "-stretchtofit" {
     1387            set bool $_settings($what)
     1388            if { $bool } {
     1389                if { $_settings(-view3d) } {
     1390                    SendCmd "camera aspect native"
     1391                } else {
     1392                    SendCmd "camera aspect window"
     1393                }
     1394            } else {
     1395                SendCmd "camera aspect native"
     1396            }
    13981397        }
    13991398        "-view3d" {
     
    14511450            set val $_settings($what)
    14521451            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             }
    14891452        }
    14901453        "-xgrid" - "-ygrid" - "-zgrid" {
     
    17981761    checkbutton $inner.visible \
    17991762        -text "Axes" \
    1800         -variable [itcl::scope _settings(-axisvisible)] \
    1801         -command [itcl::code $this AdjustSetting -axisvisible] \
     1763        -variable [itcl::scope _settings(-axesvisible)] \
     1764        -command [itcl::code $this AdjustSetting -axesvisible] \
    18021765        -font "Arial 9"
    18031766    checkbutton $inner.labels \
     
    18301793    label $inner.mode_l -text "Mode" -font "Arial 9"
    18311794
    1832     itk_component add axisflymode {
     1795    itk_component add axismode {
    18331796        Rappture::Combobox $inner.mode -width 10 -editable 0
    18341797    }
     
    18381801        "furthest_triad"  "farthest" \
    18391802        "outer_edges"     "outer"
    1840     $itk_component(axisflymode) value $_settings(-axisflymode)
    1841     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1803    $itk_component(axismode) value $_settings(-axismode)
     1804    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    18421805
    18431806    blt::table $inner \
     
    19761939    radiobutton $inner.vtk_button -text "VTK data file" \
    19771940        -variable [itcl::scope _downloadPopup(format)] \
    1978         -font "Arial 9 " \
     1941        -font "Arial 9" \
    19791942        -value vtk
    19801943    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    19811944    radiobutton $inner.image_button -text "Image File" \
    19821945        -variable [itcl::scope _downloadPopup(format)] \
    1983         -font "Arial 9 " \
     1946        -font "Arial 9" \
    19841947        -value image
    19851948    Rappture::Tooltip::for $inner.image_button \
     
    20492012    if { [info exists style(-stretchtofit)] } {
    20502013        set _settings(-stretchtofit) $style(-stretchtofit)
    2051         AdjustSetting -stretchToFit
     2014        AdjustSetting -stretchtofit
    20522015    }
    20532016    SendCmd "outline add $tag"
     
    20952058# DrawLegend --
    20962059#
    2097 #       Draws the legend in the own canvas on the right side of the plot area.
     2060# Draws the legend in its own canvas on the right side of the plot area.
    20982061#
    20992062itcl::body Rappture::VtkImageViewer::DrawLegend {} {
     
    21562119    set x1 [expr $x2 - ($iw*12)/10]
    21572120
    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]
     2121    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2122    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2123    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21612124    # Reset the item coordinates according the current size of the plot.
    21622125    if { [info exists _limits($_curFldName)] } {
     
    22722235
    22732236# ----------------------------------------------------------------------
    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} {
     2237# USAGE: LegendTitleAction post
     2238# USAGE: LegendTitleAction enter
     2239# USAGE: LegendTitleAction leave
     2240# USAGE: LegendTitleAction save
     2241#
     2242# Used internally to handle the dropdown list for the fields menu combobox.
     2243# The post option is invoked when the field title is pressed to launch the
     2244# dropdown.  The enter option is invoked when the user mouses over the field
     2245# title. The leave option is invoked when the user moves the mouse away
     2246# from the field title.  The save option is invoked whenever there is a
     2247# selection from the list, to alert the visualization server.
     2248# ----------------------------------------------------------------------
     2249itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} {
    22852250    set c $itk_component(view)
    22862251    switch -- $option {
     
    22922257            tk_popup $itk_component(fieldmenu) $x $y
    22932258        }
    2294         activate {
     2259        enter {
    22952260            $c itemconfigure title -fill red
    22962261        }
    2297         deactivate {
     2262        leave {
    22982263            $c itemconfigure title -fill $itk_option(-plotforeground)
    22992264        }
    2300         invoke {
     2265        save {
    23012266            $itk_component(field) value $_curFldLabel
    23022267            AdjustSetting -field
    23032268        }
    23042269        default {
    2305             error "bad option \"$option\": should be post, unpost, select"
     2270            error "bad option \"$option\": should be post, enter, leave or save"
    23062271        }
    23072272    }
     
    23282293    set _view(-zoom) 1.0
    23292294}
     2295
     2296itcl::body Rappture::VtkImageViewer::SetCurrentFieldName { dataobj } {
     2297    set _first $dataobj
     2298    $itk_component(field) choices delete 0 end
     2299    $itk_component(fieldmenu) delete 0 end
     2300    array unset _fields
     2301    set _curFldName ""
     2302    foreach cname [$_first components] {
     2303        foreach fname [$_first fieldnames $cname] {
     2304            if { [info exists _fields($fname)] } {
     2305                continue
     2306            }
     2307            foreach { label units components } \
     2308                [$_first fieldinfo $fname] break
     2309            $itk_component(field) choices insert end "$fname" "$label"
     2310            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2311                -value $label -variable [itcl::scope _curFldLabel] \
     2312                -selectcolor red \
     2313                -activebackground $itk_option(-plotbackground) \
     2314                -activeforeground $itk_option(-plotforeground) \
     2315                -font "Arial 8" \
     2316                -command [itcl::code $this LegendTitleAction save]
     2317            set _fields($fname) [list $label $units $components]
     2318            if { $_curFldName == "" } {
     2319                set _curFldName $fname
     2320                set _curFldLabel $label
     2321            }
     2322        }
     2323    }
     2324    $itk_component(field) value $_curFldLabel
     2325}
  • branches/multichoice/gui/scripts/vtkisosurfaceviewer.tcl

    r6235 r6371  
    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      ""
    163     private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    164162    private variable _fields
    165163    private variable _curFldName ""
    166164    private variable _curFldLabel ""
     165    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    167166    private variable _mouseOver "";     # what called LegendRangeAction:
    168167                                        # vmin or vmax
     
    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"} {
     
    657653        set _dlist [lreplace $_dlist $pos $pos]
    658654        array unset _obj2ovride $dataobj-*
    659         array unset _settings $dataobj-*
    660655        set changed 1
    661656    }
     
    718713            return $dlist
    719714        }
    720         -image {
     715        "-image" {
    721716            if {[llength $args] != 2} {
    722717                error "wrong # args: should be \"get -image view\""
     
    732727        }
    733728        default {
    734             error "bad option \"$op\": should be -objects or -image"
     729            error "bad option \"$op\": should be -objects, -visible or -image"
    735730        }
    736731    }
     
    13501345itcl::body Rappture::VtkIsosurfaceViewer::InitSettings { args } {
    13511346    foreach spec $args {
    1352         if { [info exists _settings($_first${spec})] } {
    1353             # Reset global setting with dataobj specific setting
    1354             set _settings($spec) $_settings($_first${spec})
    1355         }
    13561347        AdjustSetting $spec
    13571348    }
     
    15051496        }
    15061497        "-isolinecolor" {
    1507             set color [$itk_component(isolineColor) value]
     1498            set color [$itk_component(isolinecolor) value]
    15081499            set _settings($what) $color
    15091500            DrawLegend
     
    17411732
    17421733    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1743     itk_component add isolineColor {
     1734    itk_component add isolinecolor {
    17441735        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    17451736    }
     
    17561747        "none"               "none"
    17571748
    1758     $itk_component(isolineColor) value "white"
     1749    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    17591750    bind $inner.linecolor <<Value>> \
    17601751        [itcl::code $this AdjustSetting -isolinecolor]
     
    21842175                    SendCmd "camera zoom $_view($what)"
    21852176                }
    2186              }
     2177            }
    21872178        }
    21882179    }
     
    22182209    radiobutton $inner.vtk_button -text "VTK data file" \
    22192210        -variable [itcl::scope _downloadPopup(format)] \
    2220         -font "Arial 9 " \
     2211        -font "Arial 9" \
    22212212        -value vtk
    22222213    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22232214    radiobutton $inner.image_button -text "Image File" \
    22242215        -variable [itcl::scope _downloadPopup(format)] \
    2225         -font "Arial 9 " \
     2216        -font "Arial 9" \
    22262217        -value image
    22272218    Rappture::Tooltip::for $inner.image_button \
     
    22592250    array set style {
    22602251        -color                  BCGYR
     2252        -constcolor             white
    22612253        -cutplaneedges          0
    22622254        -cutplanelighting       1
     
    22842276        set style(-opacity) 1.0
    22852277    }
     2278    set style(-constcolor) $itk_option(-plotforeground)
    22862279    array set style [$dataobj style $comp]
    22872280    #DebugTrace [array get style]
     
    23152308    }
    23162309    if { $_currentColormap == "" } {
    2317         SetCurrentColormap $style(-color)
    23182310        $itk_component(colormap) value $style(-color)
    23192311    }
     
    23432335
    23442336    SendCmd "cutplane add $tag"
    2345     SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
     2337    SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag"
    23462338    foreach axis {x y z} {
    23472339        set pos [expr $style(-${axis}cutplaneposition) * 0.01]
     
    23592351
    23602352    SendCmd "outline add $tag"
    2361     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     2353    SendCmd "outline color [Color2RGB $style(-constcolor)] $tag"
    23622354    SendCmd "outline visible $style(-outline) $tag"
    23632355
     
    23672359    SendCmd "contour3d edges $style(-edges) $tag"
    23682360    set _settings(-isosurfaceedges) $style(-edges)
    2369     #SendCmd "contour3d color [Color2RGB $style(-color)] $tag"
     2361    #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag"
    23702362    SendCmd "contour3d lighting $style(-lighting) $tag"
    23712363    set _settings(-isosurfacelighting) $style(-lighting)
  • branches/multichoice/gui/scripts/vtkmeshviewer.tcl

    r6202 r6371  
    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/multichoice/gui/scripts/vtkstreamlinesviewer.tcl

    r6236 r6371  
    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}
    106106    private method SetCurrentColormap { color }
     107    private method SetCurrentFieldName { dataobj }
    107108    private method SetLegendTip { x y }
    108109    private method SetObjectStyle { dataobj comp }
     
    145146    private variable _curFldName ""
    146147    private variable _curFldLabel ""
    147     private variable _field ""
     148    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    148149    private variable _streamlinesLength 0
    149150    private variable _numSeeds 200
    150     private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    151151
    152152    private common _downloadPopup;      # download options from popup
     
    301301    }
    302302    pack $itk_component(reset) -side top -padx 2 -pady 2
    303     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     303    Rappture::Tooltip::for $itk_component(reset) \
     304        "Reset the view to the default zoom level"
    304305
    305306    itk_component add zoomin {
     
    552553    }
    553554    array set params $settings
    554     set params(-description) ""
    555     set params(-param) ""
    556     array set params $settings
    557555
    558556    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    592590        set _dlist [lreplace $_dlist $pos $pos]
    593591        array unset _obj2ovride $dataobj-*
    594         array unset _settings $dataobj-*
    595592        set changed 1
    596593    }
     
    653650            return $dlist
    654651        }
    655         -image {
     652        "-image" {
    656653            if {[llength $args] != 2} {
    657654                error "wrong # args: should be \"get -image view\""
     
    667664        }
    668665        default {
    669             error "bad option \"$op\": should be -objects or -image"
     666            error "bad option \"$op\": should be -objects, -visible or -image"
    670667        }
    671668    }
     
    982979        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    983980            set _first $dataobj
     981            SetCurrentFieldName $dataobj
    984982        }
    985983        foreach comp [$dataobj components] {
     
    10271025            }
    10281026        }
    1029         $itk_component(field) choices delete 0 end
    1030         $itk_component(fieldmenu) delete 0 end
    1031         array unset _fields
    1032         set _curFldName ""
    1033         set _curFldLabel ""
    1034         foreach cname [$_first components] {
    1035             foreach fname [$_first fieldnames $cname] {
    1036                 if { [info exists _fields($fname)] } {
    1037                     continue
    1038                 }
    1039                 foreach { label units components } \
    1040                     [$_first fieldinfo $fname] break
    1041                 $itk_component(field) choices insert end "$fname" "$label"
    1042                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1043                     -value $label -variable [itcl::scope _curFldLabel] \
    1044                     -selectcolor red \
    1045                     -activebackground $itk_option(-plotbackground) \
    1046                     -activeforeground $itk_option(-plotforeground) \
    1047                     -font "Arial 8" \
    1048                     -command [itcl::code $this Combo invoke]
    1049                 set _fields($fname) [list $label $units $components]
    1050                 if { $_curFldName == "" && $components == 3 } {
    1051                     set _curFldName $fname
    1052                     set _curFldLabel $label
    1053                 }
    1054             }
    1055         }
    1056         $itk_component(field) value $_curFldLabel
    10571027    }
    10581028
     
    12991269itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
    13001270    foreach spec $args {
    1301         if { [info exists _settings($_first${spec})] } {
    1302             # Reset global setting with dataobj specific setting
    1303             set _settings($spec) $_settings($_first${spec})
    1304         }
    13051271        AdjustSetting $spec
    13061272    }
     
    20682034    radiobutton $inner.vtk_button -text "VTK data file" \
    20692035        -variable [itcl::scope _downloadPopup(format)] \
    2070         -font "Helvetica 9 " \
     2036        -font "Arial 9" \
    20712037        -value vtk
    20722038    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    21852151
    21862152# ----------------------------------------------------------------------
    2187 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2153# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    21882154#
    21892155# Invoked automatically whenever the "legend" command comes in from
     
    21912157# specified <size> will follow.
    21922158# ----------------------------------------------------------------------
    2193 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {
     2159itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } {
    21942160    set _legendPending 0
    21952161    set _title $title
     
    22552221            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    22562222        }
    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]
     2223        $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2224        $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2225        $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    22602226        # Reset the item coordinates according the current size of the plot.
    22612227        $c itemconfigure title -text $title
     
    23802346
    23812347# ----------------------------------------------------------------------
    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} {
     2348# USAGE: LegendTitleAction post
     2349# USAGE: LegendTitleAction enter
     2350# USAGE: LegendTitleAction leave
     2351# USAGE: LegendTitleAction save
     2352#
     2353# Used internally to handle the dropdown list for the fields menu combobox.
     2354# The post option is invoked when the field title is pressed to launch the
     2355# dropdown.  The enter option is invoked when the user mouses over the field
     2356# title. The leave option is invoked when the user moves the mouse away
     2357# from the field title.  The save option is invoked whenever there is a
     2358# selection from the list, to alert the visualization server.
     2359# ----------------------------------------------------------------------
     2360itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} {
    23932361    set c $itk_component(view)
    23942362    switch -- $option {
     
    24002368            tk_popup $itk_component(fieldmenu) $x $y
    24012369        }
    2402         activate {
     2370        enter {
    24032371            $c itemconfigure title -fill red
    24042372        }
    2405         deactivate {
     2373        leave {
    24062374            $c itemconfigure title -fill white
    24072375        }
    2408         invoke {
     2376        save {
    24092377            $itk_component(field) value $_curFldLabel
    24102378            AdjustSetting -field
    24112379        }
    24122380        default {
    2413             error "bad option \"$option\": should be post, unpost, select"
     2381            error "bad option \"$option\": should be post, enter, leave or save"
    24142382        }
    24152383    }
     
    24362404    set _view(-zoom) 1.0
    24372405}
     2406
     2407itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } {
     2408    set _first $dataobj
     2409    $itk_component(field) choices delete 0 end
     2410    $itk_component(fieldmenu) delete 0 end
     2411    array unset _fields
     2412    set _curFldName ""
     2413    set _curFldLabel ""
     2414    foreach cname [$_first components] {
     2415        foreach fname [$_first fieldnames $cname] {
     2416            if { [info exists _fields($fname)] } {
     2417                continue
     2418            }
     2419            foreach { label units components } \
     2420                [$_first fieldinfo $fname] break
     2421            $itk_component(field) choices insert end "$fname" "$label"
     2422            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2423                -value $label -variable [itcl::scope _curFldLabel] \
     2424                -selectcolor red \
     2425                -activebackground $itk_option(-plotbackground) \
     2426                -activeforeground $itk_option(-plotforeground) \
     2427                -font "Arial 8" \
     2428                -command [itcl::code $this LegendTitleAction save]
     2429            set _fields($fname) [list $label $units $components]
     2430            if { $_curFldName == "" && $components == 3 } {
     2431                set _curFldName $fname
     2432                set _curFldLabel $label
     2433            }
     2434        }
     2435    }
     2436    $itk_component(field) value $_curFldLabel
     2437}
  • branches/multichoice/gui/scripts/vtksurfaceviewer.tcl

    r6235 r6371  
    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 ""
    142     private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    143141    private variable _fields
    144142    private variable _curFldName ""
    145143    private variable _curFldLabel ""
     144    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    146145
    147146    private common _downloadPopup;      # download options from popup
     
    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"} {
     
    513509        set _dlist [lreplace $_dlist $pos $pos]
    514510        array unset _obj2ovride $dataobj-*
    515         array unset _settings $dataobj-*
    516511        set changed 1
    517512    }
     
    574569            return $dlist
    575570        }
    576         -image {
     571        "-image" {
    577572            if {[llength $args] != 2} {
    578573                error "wrong # args: should be \"get -image view\""
     
    588583        }
    589584        default {
    590             error "bad option \"$op\": should be -objects or -image"
     585            error "bad option \"$op\": should be -objects, -visible or -image"
    591586        }
    592587    }
     
    11941189itcl::body Rappture::VtkSurfaceViewer::InitSettings { args } {
    11951190    foreach spec $args {
    1196         if { [info exists _settings($_first${spec})] } {
    1197             # Reset global setting with dataobj specific setting
    1198             set _settings($spec) $_settings($_first${spec})
    1199         }
    12001191        AdjustSetting $spec
    12011192    }
     
    13181309        "-isolinecolor" {
    13191310            set _changed($what) 1
    1320             set color [$itk_component(isolineColor) value]
    1321             set _settings($what) $color
    1322             SendCmd "contour2d linecolor [Color2RGB $color]"
     1311            set color [$itk_component(isolinecolor) value]
     1312            if { $color == "none" } {
     1313                if { $_settings(-isolinesvisible) } {
     1314                    set _changed(-isolinesvisible) 1
     1315                    foreach tag [CurrentDatasets -visible] {
     1316                        SendCmd "contour2d visible 0 $tag"
     1317                    }
     1318                    set _settings(-isolinesvisible) 0
     1319                }
     1320            } else {
     1321                set _settings($what) $color
     1322                if { !$_settings(-isolinesvisible) } {
     1323                    set _changed(-isolinesvisible) 1
     1324                    foreach tag [CurrentDatasets -visible] {
     1325                        SendCmd "contour2d visible 1 $tag"
     1326                    }
     1327                    set _settings(-isolinesvisible) 1
     1328                }
     1329                SendCmd "contour2d linecolor [Color2RGB $color]"
     1330            }
    13231331            DrawLegend
    13241332        }
     
    13281336            SendCmd "contour2d visible 0"
    13291337            if { $bool } {
     1338                if { [$itk_component(isolinecolor) value] != $_settings(-isolinecolor)} {
     1339                    $itk_component(isolinecolor) value $_settings(-isolinecolor)
     1340                }
    13301341                foreach tag [CurrentDatasets -visible] {
    13311342                    SendCmd "contour2d visible $bool $tag"
     
    15461557
    15471558    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1548     itk_component add isolineColor {
     1559    itk_component add isolinecolor {
    15491560        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    15501561    }
     
    15611572        "none"               "none"
    15621573
    1563     $itk_component(isolineColor) value "white"
     1574    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    15641575    bind $inner.linecolor <<Value>> \
    15651576        [itcl::code $this AdjustSetting -isolinecolor]
     
    17971808                    SendCmd "camera zoom $_view($what)"
    17981809                }
    1799              }
     1810            }
    18001811        }
    18011812    }
     
    18311842    radiobutton $inner.vtk_button -text "VTK data file" \
    18321843        -variable [itcl::scope _downloadPopup(format)] \
    1833         -font "Arial 9 " \
     1844        -font "Arial 9" \
    18341845        -value vtk
    18351846    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    18361847    radiobutton $inner.image_button -text "Image File" \
    18371848        -variable [itcl::scope _downloadPopup(format)] \
    1838         -font "Arial 9 " \
     1849        -font "Arial 9" \
    18391850        -value image
    18401851    Rappture::Tooltip::for $inner.image_button \
     
    21702181    }
    21712182
    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]
     2183    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2184    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2185    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21752186    # Reset the item coordinates according the current size of the plot.
    21762187    $c itemconfigure title -text $title
     
    21972208
    21982209# ----------------------------------------------------------------------
    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} {
     2210# USAGE: LegendTitleAction post
     2211# USAGE: LegendTitleAction enter
     2212# USAGE: LegendTitleAction leave
     2213# USAGE: LegendTitleAction save
     2214#
     2215# Used internally to handle the dropdown list for the fields menu combobox.
     2216# The post option is invoked when the field title is pressed to launch the
     2217# dropdown.  The enter option is invoked when the user mouses over the field
     2218# title. The leave option is invoked when the user moves the mouse away
     2219# from the field title.  The save option is invoked whenever there is a
     2220# selection from the list, to alert the visualization server.
     2221# ----------------------------------------------------------------------
     2222itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} {
    22102223    set c $itk_component(view)
    22112224    switch -- $option {
     
    22192232            tk_popup $itk_component(fieldmenu) $x $y
    22202233        }
    2221         activate {
     2234        enter {
    22222235            $c itemconfigure title -fill red
    22232236        }
    2224         deactivate {
     2237        leave {
    22252238            $c itemconfigure title -fill $itk_option(-plotforeground)
    22262239        }
    2227         invoke {
     2240        save {
    22282241            $itk_component(field) value $_curFldLabel
    22292242            AdjustSetting -field
    22302243        }
    22312244        default {
    2232             error "bad option \"$option\": should be post, unpost, select"
     2245            error "bad option \"$option\": should be post, enter, leave or save"
    22332246        }
    22342247    }
     
    23202333                -activeforeground $itk_option(-plotforeground) \
    23212334                -font "Arial 8" \
    2322                 -command [itcl::code $this Combo invoke]
     2335                -command [itcl::code $this LegendTitleAction save]
    23232336            set _fields($fname) [list $label $units $components]
    23242337            if { $_curFldName == "" } {
  • branches/multichoice/gui/scripts/vtkviewer.tcl

    r6203 r6371  
    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"} {
     
    634631        set _dlist [lreplace $_dlist $pos $pos]
    635632        array unset _obj2ovride $dataobj-*
    636         array unset _settings $dataobj-*
    637633        set changed 1
    638634    }
     
    695691            return $dlist
    696692        }
    697         -image {
     693        "-image" {
    698694            if {[llength $args] != 2} {
    699695                error "wrong # args: should be \"get -image view\""
     
    709705        }
    710706        default {
    711             error "bad option \"$op\": should be -objects or -image"
     707            error "bad option \"$op\": should be -objects, -visible or -image"
    712708        }
    713709    }
     
    25882584    radiobutton $inner.vtk_button -text "VTK data file" \
    25892585        -variable [itcl::scope _downloadPopup(format)] \
    2590         -font "Helvetica 9 " \
     2586        -font "Arial 9" \
    25912587        -value vtk
    25922588    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    28662862
    28672863# ----------------------------------------------------------------------
    2868 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2864# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    28692865#
    28702866# Invoked automatically whenever the "legend" command comes in from
     
    28722868# specified <size> will follow.
    28732869# ----------------------------------------------------------------------
    2874 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {
    2875     set _limits(vmin) $vmin
    2876     set _limits(vmax) $vmax
     2870itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } {
     2871    set _limits(vmin) $min
     2872    set _limits(vmax) $max
    28772873    set _title $title
    28782874    if { [IsConnected] } {
  • branches/multichoice/gui/scripts/vtkvolumeviewer.tcl

    r6235 r6371  
    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 {}
     
    115115    private method Rotate {option x y}
    116116    private method SendTransferFunctions {}
     117    private method SetCurrentFieldName { dataobj }
    117118    private method SetInitialTransferFunction { dataobj cname }
    118119    private method SetLegendTip { x y }
     
    240241    array set _settings {
    241242        -axesvisible            1
    242         -axisflymode            static
    243243        -axislabels             1
    244244        -axisminorticks         1
     245        -axismode               "static"
    245246        -background             black
    246247        -color                  "default"
     
    536537    }
    537538    array set params $settings
    538     set params(-description) ""
    539     set params(-param) ""
    540     array set params $settings
    541539
    542540    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    577575        set _dlist [lreplace $_dlist $pos $pos]
    578576        array unset _obj2ovride $dataobj-*
    579         array unset _settings $dataobj-*
    580577        set changed 1
    581578    }
     
    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
     
    10201017        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    10211018            set _first $dataobj
     1019            SetCurrentFieldName $dataobj
    10221020        }
    10231021        foreach cname [$dataobj components] {
     
    10661064            }
    10671065        }
    1068         $itk_component(field) choices delete 0 end
    1069         $itk_component(fieldmenu) delete 0 end
    1070         array unset _fields
    1071         set _curFldName ""
    1072         foreach cname [$_first components] {
    1073             foreach fname [$_first fieldnames $cname] {
    1074                 if { [info exists _fields($fname)] } {
    1075                     continue
    1076                 }
    1077                 foreach { label units components } \
    1078                     [$_first fieldinfo $fname] break
    1079                 # Only scalar fields are valid
    1080                 if {$_allowMultiComponent || $components == 1} {
    1081                     $itk_component(field) choices insert end "$fname" "$label"
    1082                     $itk_component(fieldmenu) add radiobutton -label "$label" \
    1083                         -value $label -variable [itcl::scope _curFldLabel] \
    1084                         -selectcolor red \
    1085                         -activebackground $itk_option(-plotbackground) \
    1086                         -activeforeground $itk_option(-plotforeground) \
    1087                         -font "Arial 8" \
    1088                         -command [itcl::code $this Combo invoke]
    1089                     set _fields($fname) [list $label $units $components]
    1090                     if { $_curFldName == "" } {
    1091                         set _curFldName $fname
    1092                         set _curFldLabel $label
    1093                     }
    1094                 }
    1095             }
    1096         }
    1097         $itk_component(field) value $_curFldLabel
    10981066    }
    10991067
     
    13311299itcl::body Rappture::VtkVolumeViewer::InitSettings { args } {
    13321300    foreach spec $args {
    1333         if { [info exists _settings($_first${spec})] } {
    1334             # Reset global setting with dataobj specific setting
    1335             set _settings($spec) $_settings($_first${spec})
    1336         }
    13371301        AdjustSetting $spec
    13381302    }
     
    13511315    }
    13521316    switch -- $what {
    1353         "-current" {
    1354             set cname [$itk_component(volcomponents) value]
    1355             SwitchComponent $cname
     1317        "-axesvisible" {
     1318            set bool $_settings($what)
     1319            SendCmd "axis visible all $bool"
     1320        }
     1321        "-axislabels" {
     1322            set bool $_settings($what)
     1323            SendCmd "axis labels all $bool"
     1324        }
     1325        "-axisminorticks" {
     1326            set bool $_settings($what)
     1327            SendCmd "axis minticks all $bool"
     1328        }
     1329        "-axismode" {
     1330            set mode [$itk_component(axismode) value]
     1331            set mode [$itk_component(axismode) translate $mode]
     1332            set _settings($what) $mode
     1333            SendCmd "axis flymode $mode"
    13561334        }
    13571335        "-background" {
     
    13681346            DrawLegend
    13691347        }
    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             }
     1348        "-color" {
     1349            set color [$itk_component(colormap) value]
     1350            set _settings($what) $color
     1351            set _settings($_current${what}) $color
     1352            ResetColormap $_current $color
     1353        }
     1354        "-current" {
     1355            set cname [$itk_component(volcomponents) value]
     1356            SwitchComponent $cname
    15011357        }
    15021358        "-cutplanelighting" {
     
    15241380            }
    15251381        }
    1526         "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
    1527             set axis [string range $what 1 1]
     1382        "-cutplanesvisible" {
    15281383            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             }
    15361384            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
     1385                SendCmd "$_cutplaneCmd visible $bool $dataset"
     1386            }
    15571387        }
    15581388        "-field" {
     
    15841414            SendCmd "camera reset"
    15851415            DrawLegend
     1416        }
     1417        "-legendvisible" {
     1418            set bool $_settings($what)
     1419            if { $bool } {
     1420                blt::table $itk_component(plotarea) \
     1421                    1,0 $itk_component(legend) -fill x
     1422            } else {
     1423                blt::table forget $itk_component(legend)
     1424            }
     1425        }
     1426        "-volumeambient" {
     1427            # Other parts of the code use the -volumeambient setting to
     1428            # tell if the component settings have been initialized
     1429            if { ![info exists _settings($_current${what})] } {
     1430                InitComponentSettings $_current
     1431            }
     1432            set val $_settings($what)
     1433            set _settings($_current${what}) $val
     1434            set ambient [expr {0.01*$val}]
     1435            foreach tag [GetDatasetsWithComponent $_current] {
     1436                SendCmd "volume shading ambient $ambient $tag"
     1437            }
     1438        }
     1439        "-volumeblendmode" {
     1440            set val [$itk_component(blendmode) value]
     1441            set mode [$itk_component(blendmode) translate $val]
     1442            set _settings($what) $mode
     1443            set _settings($_current${what}) $mode
     1444            foreach tag [GetDatasetsWithComponent $_current] {
     1445                SendCmd "volume blendmode $mode $tag"
     1446            }
     1447        }
     1448        "-volumediffuse" {
     1449            set val $_settings($what)
     1450            set _settings($_current${what}) $val
     1451            set diffuse [expr {0.01*$val}]
     1452            foreach tag [GetDatasetsWithComponent $_current] {
     1453                SendCmd "volume shading diffuse $diffuse $tag"
     1454            }
     1455        }
     1456        "-volumelighting" {
     1457            set bool $_settings($what)
     1458            set _settings($_current${what}) $bool
     1459            foreach tag [GetDatasetsWithComponent $_current] {
     1460                SendCmd "volume lighting $bool $tag"
     1461            }
     1462        }
     1463        "-volumeopacity" {
     1464            set val $_settings($what)
     1465            set _settings($_current${what}) $val
     1466            set val [expr {0.01*$val}]
     1467            foreach tag [GetDatasetsWithComponent $_current] {
     1468                SendCmd "volume opacity $val $tag"
     1469            }
     1470        }
     1471        "-volumeoutline" {
     1472            set bool $_settings($what)
     1473            SendCmd "outline visible 0"
     1474            foreach tag [GetDatasetsWithComponent $_current] {
     1475                SendCmd "outline visible $bool $tag"
     1476            }
     1477        }
     1478        "-volumequality" {
     1479            set val $_settings($what)
     1480            set _settings($_current${what}) $val
     1481            set val [expr {0.01*$val}]
     1482            foreach tag [GetDatasetsWithComponent $_current] {
     1483                SendCmd "volume quality $val $tag"
     1484            }
     1485        }
     1486        "-volumespecularlevel" - "-volumespecularexponent" {
     1487            set val $_settings($what)
     1488            set _settings($_current${what}) $val
     1489            set level [expr {0.01*$val}]
     1490            set exp $_settings($what)
     1491            foreach tag [GetDatasetsWithComponent $_current] {
     1492                SendCmd "volume shading specular $level $exp $tag"
     1493            }
     1494        }
     1495        "-volumethickness" {
     1496            set _settings($_current${what}) $_settings($what)
     1497            updateTransferFunctions
     1498        }
     1499        "-volumevisible" {
     1500            set bool $_settings($what)
     1501            set _settings($_current${what}) $bool
     1502            # Only the data objects in the array _obj2ovride(*-raise) are
     1503            # in the working set and can be displayed on screen. The global
     1504            # volume control determines whether they are visible.
     1505            #
     1506            # Note: The use of the current component is a hold over from
     1507            #       nanovis.  If we can't display more than one volume,
     1508            #       we don't have to limit the effects to a specific
     1509            #       component.
     1510            foreach tag [GetDatasetsWithComponent $_current] {
     1511                foreach {dataobj cname} [split $tag -] break
     1512                if { [info exists _obj2ovride($dataobj-raise)] } {
     1513                    SendCmd "volume visible $bool $tag"
     1514                }
     1515            }
     1516            if { $bool } {
     1517                Rappture::Tooltip::for $itk_component(volume) \
     1518                    "Hide the volume"
     1519            } else {
     1520                Rappture::Tooltip::for $itk_component(volume) \
     1521                    "Show the volume"
     1522            }
     1523        }
     1524        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
     1525            set axis [string range $what 1 1]
     1526            set bool $_settings($what)
     1527            if { $bool } {
     1528                $itk_component(${axis}CutScale) configure -state normal \
     1529                    -troughcolor white
     1530            } else {
     1531                $itk_component(${axis}CutScale) configure -state disabled \
     1532                    -troughcolor grey82
     1533            }
     1534            foreach dataset [CurrentDatasets -visible] {
     1535                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
     1536            }
     1537        }
     1538        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1539            set axis [string range $what 1 1]
     1540            set pos [expr $_settings($what) * 0.01]
     1541            foreach dataset [CurrentDatasets -visible] {
     1542                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
     1543            }
     1544            set _cutplanePending 0
     1545        }
     1546        "-xgrid" - "-ygrid" - "-zgrid" {
     1547            set axis [string range $what 1 1]
     1548            set bool $_settings($what)
     1549            SendCmd "axis grid $axis $bool"
    15861550        }
    15871551        default {
     
    19081872        "furthest_triad"  "farthest" \
    19091873        "outer_edges"     "outer"
    1910     $itk_component(axismode) value $_settings(-axisflymode)
    1911     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1874    $itk_component(axismode) value $_settings(-axismode)
     1875    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    19121876
    19131877    blt::table $inner \
     
    21742138    radiobutton $inner.vtk_button -text "VTK data file" \
    21752139        -variable [itcl::scope _downloadPopup(format)] \
    2176         -font "Helvetica 9 " \
     2140        -font "Arial 9" \
    21772141        -value vtk
    21782142    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    22522216
    22532217# ----------------------------------------------------------------------
    2254 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2218# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    22552219#
    22562220# Invoked automatically whenever the "legend" command comes in from
     
    22582222# specified <size> will follow.
    22592223# ----------------------------------------------------------------------
    2260 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
     2224itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } {
    22612225    if { [isconnected] } {
    22622226        set bytes [ReceiveBytes $size]
     
    24282392
    24292393# ----------------------------------------------------------------------
    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} {
     2394# USAGE: LegendTitleAction post
     2395# USAGE: LegendTitleAction enter
     2396# USAGE: LegendTitleAction leave
     2397# USAGE: LegendTitleAction save
     2398#
     2399# Used internally to handle the dropdown list for the fields menu combobox.
     2400# The post option is invoked when the field title is pressed to launch the
     2401# dropdown.  The enter option is invoked when the user mouses over the field
     2402# title. The leave option is invoked when the user moves the mouse away
     2403# from the field title.  The save option is invoked whenever there is a
     2404# selection from the list, to alert the visualization server.
     2405# ----------------------------------------------------------------------
     2406itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} {
    24412407    set c $itk_component(view)
    24422408    switch -- $option {
     
    24482414            tk_popup $itk_component(fieldmenu) $x $y
    24492415        }
    2450         activate {
     2416        enter {
    24512417            $c itemconfigure title -fill red
    24522418        }
    2453         deactivate {
     2419        leave {
    24542420            $c itemconfigure title -fill $itk_option(-plotforeground)
    24552421        }
    2456         invoke {
     2422        save {
    24572423            $itk_component(field) value $_curFldLabel
    24582424            AdjustSetting -field
    24592425        }
    24602426        default {
    2461             error "bad option \"$option\": should be post, unpost, select"
     2427            error "bad option \"$option\": should be post, enter, leave or save"
    24622428        }
    24632429    }
     
    25102476        } else {
    25112477            # $n : absolute value, compute relative
    2512             lappend list  [expr {(double($value)-$min)/($max-$min)]}
     2478            lappend list [expr {(double($value)-$min)/($max-$min)}]
    25132479        }
    25142480    }
     
    28652831    return [ColorsToColormap $color]
    28662832}
     2833
     2834itcl::body Rappture::VtkVolumeViewer::SetCurrentFieldName { dataobj } {
     2835    set _first $dataobj
     2836    $itk_component(field) choices delete 0 end
     2837    $itk_component(fieldmenu) delete 0 end
     2838    array unset _fields
     2839    set _curFldName ""
     2840    foreach cname [$_first components] {
     2841        foreach fname [$_first fieldnames $cname] {
     2842            if { [info exists _fields($fname)] } {
     2843                continue
     2844            }
     2845            foreach { label units components } \
     2846                [$_first fieldinfo $fname] break
     2847            # Only scalar fields are valid
     2848            if {$_allowMultiComponent || $components == 1} {
     2849                $itk_component(field) choices insert end "$fname" "$label"
     2850                $itk_component(fieldmenu) add radiobutton -label "$label" \
     2851                    -value $label -variable [itcl::scope _curFldLabel] \
     2852                    -selectcolor red \
     2853                    -activebackground $itk_option(-plotbackground) \
     2854                    -activeforeground $itk_option(-plotforeground) \
     2855                    -font "Arial 8" \
     2856                    -command [itcl::code $this LegendTitleAction save]
     2857                set _fields($fname) [list $label $units $components]
     2858                if { $_curFldName == "" } {
     2859                    set _curFldName $fname
     2860                    set _curFldLabel $label
     2861                }
     2862            }
     2863        }
     2864    }
     2865    $itk_component(field) value $_curFldLabel
     2866}
  • branches/multichoice/lang/tcl/scripts/library.tcl

    r6021 r6371  
    7575            close $fid
    7676        } errs] != 0 } {
     77            global errorInfo
    7778            puts stderr "can't open \"$fname\": errs=$errs errorInfo=$errorInfo"
    7879        }
     
    9091            close $fid
    9192        } errs] != 0 } {
     93            global errorInfo
    9294            puts stderr "can't open \"$fname\": errs=$errs errorInfo=$errorInfo"
    9395        }
     
    10671069# ----------------------------------------------------------------------
    10681070itcl::body Rappture::LibraryObj::uq_get_vars {{tfile ""}} {
    1069     set varout \[
    1070     set varlist []
     1071    set varout "\["
     1072    set varlist {}
    10711073
    10721074    if {$tfile == ""} {
  • branches/multichoice/lang/tcl/scripts/task.tcl

    r6217 r6371  
    218218
    219219    # write out the driver.xml file for the tool
    220     set file "driver[pid].xml"
     220    global rapptureInfo
     221    set file [file join $rapptureInfo(cwd) "driver[pid].xml"]
    221222    set status [catch {
    222223        set fid [open $file w]
     
    578579                set rdir $_resources(-resultdir)
    579580            } else {
    580                 set rdir "."
     581                global rapptureInfo
     582                set rdir $rapptureInfo(cwd)
    581583            }
    582584        } elseif {$resultdir ne ""} {
  • branches/multichoice/puq/puq.sh.in

    r6191 r6371  
    2121script=$1
    2222shift
    23 exec ${python} ${puq_exec_prefix}/${script}.py $*
     23exec ${python} ${puq_exec_prefix}/${script}.py "$@"
    2424
  • branches/multichoice/tester/scripts/main.tcl

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