Changeset 6371 for branches/multichoice
- Timestamp:
- Jun 2, 2016, 8:19:06 AM (8 years ago)
- Location:
- branches/multichoice
- Files:
-
- 4 deleted
- 49 edited
- 13 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/multichoice
- Property svn:mergeinfo changed
-
branches/multichoice/builder/scripts/templates/clang.tl
r3177 r6371 180 180 $(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) 181 181 182 install: 183 182 184 clean: 183 185 $(RM) @@FILEROOT@@c run*.xml -
branches/multichoice/builder/scripts/templates/fortran77.tl
r3177 r6371 179 179 $(FC) $(FCFLAGS) $(INCLUDES) $< -o $@ $(LIBS) 180 180 181 install: 182 181 183 clean: 182 184 $(RM) @@FILEROOT@@f77 run*.xml -
branches/multichoice/builder/scripts/templates/java.tl
r3177 r6371 126 126 $(JAVAC) $(CLASSPATH) $< 127 127 128 install: 129 128 130 clean: 129 131 $(RM) @@FILEROOT@@.class run*.xml -
branches/multichoice/examples/mapviewer/camera/camera_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/camera/camera_zoom_layer_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/colorramp/colorramp_geotiff_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/colorramp/colorramp_netcdf_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/feature/Makefile.in
r6209 r6371 16 16 destdir = $(prefix)/examples/mapviewer/feature 17 17 FILES = \ 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 \ 22 26 $(srcdir)/feature_selector_query.tcl 23 27 -
branches/multichoice/examples/mapviewer/feature/feature_selector_query.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI … … 27 28 # Parameters for feature layer 28 29 array set ogrParams { 29 url {local://afr_ countries.shp}30 url {local://afr_elas.shp} 30 31 } 31 32 array set countries { -
branches/multichoice/examples/mapviewer/gdal/gdal_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/layers/add_remove_layers.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI … … 79 80 80 81 # Update map 81 $mapviewer delete 82 $mapviewer add $map 82 $mapviewer refresh 83 83 puts stderr "Deleted OSM Layer, Added colorramp" 84 84 } … … 94 94 95 95 # Update map 96 $mapviewer delete 97 $mapviewer add $map 96 $mapviewer refresh 98 97 puts stderr "Deleted colorramp Layer, Added line layer" 99 98 } … … 110 109 111 110 # Update map 112 $mapviewer delete 113 $mapviewer add $map 111 $mapviewer refresh 114 112 puts stderr "Deleted line Layer, Added OSM layer" 115 113 } … … 122 120 123 121 # Update map 124 $mapviewer delete 125 $mapviewer add $map 122 $mapviewer refresh 126 123 puts stderr "Added colorramp layer" 127 124 } … … 134 131 135 132 # Update map 136 $mapviewer delete 137 $mapviewer add $map 133 $mapviewer refresh 138 134 puts stderr "Added line layer" 139 135 } -
branches/multichoice/examples/mapviewer/layers/remove_single_layer.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI … … 84 85 85 86 # Update the map 86 $mapviewer delete 87 $mapviewer add $map 87 $mapviewer refresh 88 88 } 89 89 -
branches/multichoice/examples/mapviewer/ogr/ogr_csv_icon_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI … … 25 26 } 26 27 27 # create a n feature pointlayer from a csv file using the OGR driver28 # create a feature icon layer from a csv file using the OGR driver 28 29 # the longitude and latitude fields must be named "longitude" and 29 30 # "latitude" respectively -
branches/multichoice/examples/mapviewer/ogr/ogr_csv_points_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/ogr/ogr_csv_to_shp_icon_example.tcl
r6214 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/ogr/ogr_shape_line_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/placard/Makefile.in
r6209 r6371 17 17 FILES = \ 18 18 $(srcdir)/placard_example.tcl \ 19 $(srcdir)/placard_disable_example.tcl \ 19 20 $(srcdir)/station_clean.csv 20 21 -
branches/multichoice/examples/mapviewer/placard/placard_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/select/select_feature_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI … … 7 8 source [file join $commondir geovis_settings.tcl] 8 9 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 15 proc selectHandler {option {args ""}} { 14 16 switch $option { 15 17 "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. 17 20 } 18 21 "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" 21 25 } 22 26 "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)" 39 52 } 40 53 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" 43 55 } 44 56 } … … 87 99 " 88 100 89 # create a map object101 # Create a map object 90 102 set map [Rappture::Map #auto] 91 103 92 # add all layers to the map object104 # Add all layers to the map object 93 105 $map addLayer image \ 94 106 osm [array get osmParams] \ … … 102 114 $stylesheet 103 115 104 # add a map to the vis client116 # Add a map to the vis client 105 117 $mapviewer scale $map 106 118 $mapviewer add $map 107 119 108 120 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 defined111 # procedure named " handler". for an itcl class method, you may need to112 # use itcl::code to get the full path of the callback method:113 # for example: [itcl::code $this handler]114 $mapviewer setSelectCallback :: handler121 # 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 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/wms/wms_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/examples/mapviewer/xyz/xyz_example.tcl
r6209 r6371 1 package require Tk 1 2 package require Rappture 2 3 package require RapptureGUI -
branches/multichoice/gui/apps/launcher.tcl
r5663 r6371 42 42 set params(execute) "" 43 43 set params(input) "" 44 45 set rapptureInfo(cwd) [pwd] 44 46 45 47 if {[info exists env(TOOL_PARAMETERS)]} { -
branches/multichoice/gui/scripts/Makefile.in
r6251 r6371 78 78 $(srcdir)/mainwin.tcl \ 79 79 $(srcdir)/map.tcl \ 80 $(srcdir)/mapentry.tcl \ 80 81 $(srcdir)/mapviewer.tcl \ 81 82 $(srcdir)/mesh.tcl \ -
branches/multichoice/gui/scripts/controls.tcl
r6251 r6371 178 178 drawing { 179 179 Rappture::DrawingEntry $w $_owner $path 180 } 181 map { 182 Rappture::MapEntry $w $_owner $path 180 183 } 181 184 image { … … 280 283 $_owner widgetfor $path $w 281 284 282 if {[lsearch {control group drawing separator note} $type] < 0} {285 if {[lsearch {control group drawing map separator note} $type] < 0} { 283 286 # make a label for this control 284 287 set label [$w label] -
branches/multichoice/gui/scripts/flowvisviewer.tcl
r6241 r6371 127 127 128 128 private variable _arcball "" 129 private variable _dlist "" ;# list of data objects130 private variable _obj2ovride ;# maps dataobj => style override131 private variable _datasets ;# contains all thedataobj-component132 ;# to volumes in the server133 private variable _dataset2style ;# maps dataobj-component to transfunc134 private variable _style2datasets ;# maps tf back to list of129 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 135 135 # 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 axes141 private variable _view ;# View params for 3D view142 private variable _isomarkers ;# array of isosurface level values 0..1136 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 143 143 private variable _settings 144 private variable _activeTf "" ;# Currently active transfer function145 private variable _first "" ;# This is the topmost volume.146 private variable _volcomponents ;# Maps component name to list of147 ;# dataobj-component tags148 private variable _componentsList ;# List of components found144 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 149 149 private variable _nextToken 0 150 150 private variable _icon 0 … … 156 156 private variable _gotoPending 0 157 157 158 private common _downloadPopup ;# download options from popup158 private common _downloadPopup; # download options from popup 159 159 private common _hardcopy 160 160 } … … 641 641 set op [lindex $args 0] 642 642 switch -- $op { 643 -objects{643 "-objects" { 644 644 # put the dataobj list in order according to -raise options 645 645 set dlist $_dlist … … 656 656 return $dlist 657 657 } 658 -image{658 "-image" { 659 659 if {[llength $args] != 2} { 660 660 error "wrong # args: should be \"get -image view|legend\"" … … 1095 1095 DoResize 1096 1096 } 1097 1097 if { $_reset } { 1098 InitSettings -background -axesvisible -gridvisible 1099 } 1098 1100 set _first "" 1099 1101 foreach dataobj [get -objects] { … … 1148 1150 1149 1151 if { $_reset } { 1150 InitSettings -axesvisible -gridvisible \ 1151 -opacity -light2side -isosurfaceshading \ 1152 InitSettings -opacity -light2side -isosurfaceshading \ 1152 1153 -ambient -diffuse -specularlevel -specularexponent 1153 1154 … … 2815 2816 radiobutton $inner.image_button -text "Image File" \ 2816 2817 -variable [itcl::scope _downloadPopup(format)] \ 2817 -font "Arial 9 2818 -font "Arial 9" \ 2818 2819 -value image 2819 2820 Rappture::Tooltip::for $inner.image_button \ -
branches/multichoice/gui/scripts/gauge.tcl
r6021 r6371 636 636 $itk_component(spindn) configure -state $itk_option(-state) 637 637 $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 } 638 641 _redraw ;# fix gauge 639 642 } … … 756 759 757 760 $popup configure \ 758 -deactivatecommand [itcl::code $this _pop_uq_deactivate]761 -deactivatecommand [itcl::code $this _pop_uq_deactivate] 759 762 } 760 763 update -
branches/multichoice/gui/scripts/map.tcl
r6139 r6371 31 31 32 32 public method addLayer { type name paramArray driver driverParamArray {stylesheet {}} {script {}} {selectors {}} } 33 public method addSelector { layerName selectorName paramArray } 33 34 public method addViewpoint { name props } 34 35 public method clearExtents {} 35 36 public method deleteLayer { layerName } 37 public method deleteSelector { layerName selectorName } 36 38 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 } 37 50 public method getPlacardConfig { layerName } 38 51 public method hasLayer { layerName } … … 50 63 public method setAttribution { attribution } 51 64 public method setCamera { camera } 65 public method setColormap { layerName colormap } 66 public method setDescription { description } 52 67 public method setExtents { xmin ymin xmax ymax {srs "wgs84"} } 53 68 public method setLabel { label } 54 69 public method setPlacardConfig { layerName attrlist style padding } 55 70 public method setProjection { projection } 71 public method setScript { layerName script } 56 72 public method setStyle { style } 73 public method setStylesheet { layerName stylesheet } 57 74 public method setToolInfo { id name command title revision } 58 75 public method setType { type } … … 69 86 private variable _tree ""; # Tree of information about the map. 70 87 private variable _isValid 0; 88 private variable _dirty; 89 array set _dirty { 90 viewpoints 0 91 } 71 92 private common _nextSelector 0; 72 93 private common _layerTypes … … 147 168 # Set global map properties 148 169 setLabel [$map get "about.label"] 170 setDescription [$map get "about.description"] 149 171 setAttribution [$map get "about.attribution"] 150 172 … … 506 528 } 507 529 530 itcl::body Rappture::Map::setDescription { description } { 531 $_tree set root "description" $description 532 } 533 508 534 itcl::body Rappture::Map::setAttribution { attribution } { 509 535 $_tree set root "attribution" $attribution … … 623 649 array set selector $selectorItem 624 650 if { [info exists selector(id)] } { 625 set id $selector(id)651 set selectorId $selector(id) 626 652 } 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] 630 656 foreach key { name style styleExpression query queryBounds queryOrderBy } { 631 657 if {[info exists selector($key)]} { … … 759 785 } 760 786 } 787 set _dirty($id) 1 761 788 return $id 762 789 } … … 798 825 } 799 826 $_tree delete $id 827 array unset _dirty $layerName 800 828 } 801 829 … … 862 890 } 863 891 892 itcl::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 901 itcl::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 910 itcl::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 864 919 # ---------------------------------------------------------------------- 865 920 # USAGE: selectors … … 898 953 return 1 899 954 } 955 } 956 957 itcl::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 981 itcl::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 900 988 } 901 989 … … 965 1053 $_tree set $child z $info(altitude) 966 1054 } 1055 set _dirty(viewpoints) 1 967 1056 } 968 1057 … … 973 1062 } 974 1063 $_tree delete $id 1064 set _dirty(viewpoints) 1 975 1065 } 976 1066 -
branches/multichoice/gui/scripts/mapviewer.tcl
r6225 r6371 36 36 inherit Rappture::VisViewer 37 37 38 itk_option define -map map Map "" 38 39 itk_option define -plotforeground plotForeground Foreground "" 39 40 itk_option define -plotbackground plotBackground Background "" … … 52 53 public method add {dataobj {settings ""}} 53 54 public method camera {option args} 54 public method delete {args} 55 public method clear {args} 56 public method delete {args} { eval hide $args } 55 57 public method disconnect {} 56 58 public method download {option args} 57 59 public method get {args} 60 public method hide {args} 58 61 public method isconnected {} 59 62 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 } 60 70 public method scale {args} 61 71 public method select {option {args ""}} … … 103 113 private method GetImage { args } 104 114 private method GetNormalizedMouse { x y } 105 private method GoToViewpoint { dataobj viewpoint }115 private method GoToViewpoint { dataobj viewpoint {duration 2.0} } 106 116 private method InitSettings { args } 107 117 private method MapIsGeocentric {} … … 689 699 690 700 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 706 itcl::body Rappture::MapViewer::hide {args} { 698 707 DebugTrace "Enter" 699 708 if { [llength $args] == 0} { 700 709 set args $_dlist 701 710 } 702 # Delete all specified dataobjs711 # Mark all specified dataobjs as hidden 703 712 set changed 0 704 713 foreach dataobj $args { … … 715 724 } 716 725 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 # ---------------------------------------------------------------------- 741 itcl::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-* 717 784 set changed 1 718 785 } … … 797 864 return $dlist 798 865 } 799 -image{866 "-image" { 800 867 if {[llength $args] < 2} { 801 868 error "wrong # args: should be \"get -image view|legend\"" … … 989 1056 990 1057 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 1063 itcl::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 # ---------------------------------------------------------------------- 991 1086 # USAGE: download coming 992 1087 # USAGE: download controls <downloadCommand> … … 1378 1473 set _layers($tag) 1 1379 1474 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 1381 1482 # Don't change visibility of shared/base layers 1382 1483 if { !$info(shared) } { … … 1761 1862 $_click(y) == $y} { 1762 1863 SendCmd "map box clear" 1864 } else { 1865 SendCmd "map box end $x $y" 1763 1866 } 1764 1867 } … … 2280 2383 Camera reset 2281 2384 } 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 } 2282 2403 "zoom" { 2283 2404 if {[llength $args] < 1} { … … 2415 2536 } 2416 2537 2417 itcl::body Rappture::MapViewer::GoToViewpoint { dataobj viewpoint } {2538 itcl::body Rappture::MapViewer::GoToViewpoint { dataobj viewpoint {duration 2.0}} { 2418 2539 array set view [subst { 2419 2540 x 0 … … 2436 2557 set _view(pitch) -90 2437 2558 } 2438 set duration 2.02439 2559 SendCmd [list camera set $_view(x) $_view(y) $_view(z) $_view(heading) $_view(pitch) $_view(distance) $duration $_view(srs) $_view(verticalDatum)] 2440 2560 } … … 2694 2814 } 2695 2815 } 2696 set format ""2697 set wfsType ""2698 2816 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 } 2710 2859 } 2711 2860 SendCmd $cmd 2861 if { $ssSize > 0 } { SendData $info(stylesheet) } 2862 if { $scriptSize > 0 } { SendData $script } 2863 if { $selectorsSize > 0 } { SendData $selectors } 2712 2864 SendCmd "map layer opacity $style(-opacity) $tag" 2713 2865 } … … 3142 3294 } 3143 3295 } 3296 3297 # ---------------------------------------------------------------------- 3298 # OPTION: -map 3299 # ---------------------------------------------------------------------- 3300 itcl::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 211 211 set result [ReadUnstructuredGrid $path] 212 212 } elseif {[$_mesh element "node"] != "" && [$_mesh element "element"] != ""} { 213 puts stderr "WARNING: <node>/<element> mesh is deprecated. Please use an unstructured mesh instead." 213 214 set result [ReadNodesElements $path] 214 215 } … … 1438 1439 array set node2celltype { 1439 1440 3 5 1440 4 101441 4 9 1441 1442 8 12 1442 1443 6 13 … … 1452 1453 set numNodes [llength $nodeList] 1453 1454 if { ![info exists node2celltype($numNodes)] } { 1454 puts stderr "WARNING: bad node s/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" 1455 1456 return 0 1456 1457 } 1457 1458 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 } 1458 1464 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) 1463 1476 set newList {} 1464 1477 foreach i { 0 1 3 2 4 5 7 6 } { -
branches/multichoice/gui/scripts/nanovisviewer.tcl
r6240 r6371 119 119 120 120 private variable _arcball "" 121 private variable _dlist "" ;# list of data objects122 private variable _obj2ovride ;# maps dataobj => style override123 private variable _datasets ;# contains all thedataobj-component124 ;# to volumes in the server125 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 axes129 private variable _view ;# View params for 3D view121 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 130 130 private variable _parsedFunction 131 131 private variable _transferFunctionEditors 132 132 private variable _settings 133 private variable _first "" ;# This is the topmost volume.134 private variable _current "" ;# Currently selected component135 private variable _volcomponents ;# Maps component name to list of136 ;# dataobj-component tags137 private variable _componentsList ;# List of components found133 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 138 138 private variable _cname2transferFunction 139 139 private variable _cname2defaultcolormap … … 143 143 private variable _resizeLegendPending 0 144 144 145 private common _downloadPopup ;# download options from popup145 private common _downloadPopup; # download options from popup 146 146 private common _hardcopy 147 147 } … … 462 462 set op [lindex $args 0] 463 463 switch -- $op { 464 -objects{464 "-objects" { 465 465 # put the dataobj list in order according to -raise options 466 466 set dlist $_dlist … … 477 477 return $dlist 478 478 } 479 -image{479 "-image" { 480 480 if {[llength $args] != 2} { 481 481 error "wrong # args: should be \"get -image view|legend\"" … … 871 871 DoResize 872 872 } 873 873 if { $_reset } { 874 InitSettings -background -axesvisible -gridvisible 875 } 874 876 set _first "" 875 877 SendCmd "volume state 0" … … 926 928 927 929 if { $_reset } { 928 InitSettings -axesvisible -gridvisible \ 929 -opacity -light2side -isosurfaceshading \ 930 InitSettings -opacity -light2side -isosurfaceshading \ 930 931 -ambient -diffuse -specularlevel -specularexponent \ 931 932 -current … … 1549 1550 } else { 1550 1551 # $n : absolute value, compute relative 1551 lappend list [expr {(double($value)-$min)/($max-$min)]}1552 lappend list [expr {(double($value)-$min)/($max-$min)}] 1552 1553 } 1553 1554 } … … 2029 2030 radiobutton $inner.image_button -text "Image File" \ 2030 2031 -variable [itcl::scope _downloadPopup(format)] \ 2031 -font "Arial 9 2032 -font "Arial 9" \ 2032 2033 -value image 2033 2034 Rappture::Tooltip::for $inner.image_button \ -
branches/multichoice/gui/scripts/probdisteditor.tcl
r6021 r6371 19 19 option add *ProbDistEditor*Entry.width 10 widgetDefault 20 20 21 21 itcl::class Rappture::ProbDistEditor { 22 22 inherit itk::Widget 23 23 24 24 itk_option define -fillcolor fillColor FillColor "" 25 25 26 constructor {args} { # defined below } 26 constructor {args} { 27 # defined below 28 } 27 29 public method value {{newval ""}} 28 30 public method mode {{newval ""}} … … 33 35 protected method _apply {op {widget ""}} 34 36 35 protected variable _dispatcher "" ;# dispatcher for !events36 protected variable _mode "" ;# type of distribution function37 protected variable _value ;# data values for mode-detail38 protected variable _uvalue ;# data values for mode-detail with units39 protected variable _umin ;# minimum allowed value for tool with units40 protected variable _umax ;# maximum allowed value for tool with units41 protected variable _units ;# units for min and max37 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 42 44 } 43 45 -
branches/multichoice/gui/scripts/responseviewer.tcl
r6032 r6371 147 147 148 148 itcl::body Rappture::ResponseViewer::_plot_response {var1 var2} { 149 #puts "plotting $var1 vs $var2"150 151 set fname response_result.xml152 153 set rs $_response154 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 } { 155 155 set fp [open "response.err" r] 156 156 set rdata [read $fp] 157 157 close $fp 158 puts "Surrogate Model failed: $res\n$rdata"158 puts stderr "Surrogate Model failed: $res\n$rdata" 159 159 error "Sampling of Surrogate Model failed: $res\n$rdata" 160 160 # FIXME: Maybe put in text box instead of error()? … … 163 163 164 164 set xmlobj [Rappture::library $fname] 165 #puts "xmlobj=$xmlobj"165 #puts stderr "xmlobj=$xmlobj" 166 166 set w $itk_component(frame).field 167 167 -
branches/multichoice/gui/scripts/transferfunctioneditor.tcl
r5640 r6371 42 42 private method GetScreenPosition { name } 43 43 private method LeaveTick { name } 44 private method SetRelativeValue 45 private method GetRelativeValue 44 private method SetRelativeValue { name x } 45 private method GetRelativeValue { name } 46 46 private method RemoveDuplicateMarkers {name x y} 47 47 private method SetScreenPosition { name } … … 225 225 } 226 226 227 itcl::body Rappture::TransferFunctionEditor::GetRelativeValue 227 itcl::body Rappture::TransferFunctionEditor::GetRelativeValue { name } { 228 228 return $_values($name) 229 229 } 230 230 231 itcl::body Rappture::TransferFunctionEditor::SetRelativeValue { name value } { 231 itcl::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 } 232 237 set _values($name) $value 233 238 set x [GetScreenPosition $name] -
branches/multichoice/gui/scripts/visviewer.tcl
r6052 r6371 20 20 itk_option define -receivecommand receiveCommand ReceiveCommand "" 21 21 22 private common _servers ;# array of visualization server lists23 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 commands31 private variable _outbuf ; # buffer for outgoing commands32 private variable _blockOnWrite 0; # Should writes to socket block?33 private variable _initialized34 private variable _isOpen 035 private variable _afterId -136 private variable _icon 037 private variable _trace 0 ; # Protocol tracing for console38 private variable _logging 0 ; # Command logging to file39 # Number of milliseconds to wait before idle timeout. If greater than 0,40 # automatically disconnect from the visualization server when idle timeout41 # is reached.42 private variable _idleTimeout 43200000; # 12 hours43 #private variable _idleTimeout 5000; # 5 seconds44 #private variable _idleTimeout 0; # No timeout45 46 protected variable _debug 047 protected variable _serverType "???";# Type of server.48 protected variable _sid "" ; # socket connection to server49 protected variable _maxConnects 10050 protected variable _buffering 051 protected variable _cmdSeq 0 ; # Command sequence number52 protected variable _dispatcher ""; # dispatcher for !events53 protected variable _hosts "" ; # list of hosts for server54 protected variable _parser "" ; # interpreter for incoming commands55 protected variable _image56 protected variable _hostname57 protected variable _numConnectTries 058 protected variable _debugConsole 059 protected variable _reportClientInfo 160 # Number of milliscends to wait for server reply before displaying wait61 # dialog. If set to 0, dialog is never displayed.62 protected variable _waitTimeout 063 64 22 constructor { args } { 65 23 # defined below … … 68 26 # defined below 69 27 } 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 } 82 57 83 58 protected method CheckConnection {} … … 117 92 protected method ToggleConsole {} 118 93 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 119 124 private proc CheckNameList { namelist } { 120 125 foreach host $namelist { … … 125 130 } 126 131 } 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. 156 156 } 157 157 … … 864 864 -xscrollmode auto -yscrollmode auto 865 865 text $inner.scrl.text \ 866 -font "Arial 9 866 -font "Arial 9" -background white -relief sunken -bd 1 \ 867 867 -height 5 -wrap word -width 60 868 868 $inner.scrl contents $inner.scrl.text -
branches/multichoice/gui/scripts/vtkglyphviewer.tcl
r6235 r6371 102 102 private method ReceiveDataset { args } 103 103 private method ReceiveImage { args } 104 private method ReceiveLegend { colormap title vmin vmax size }104 private method ReceiveLegend { colormap title min max size } 105 105 private method RequestLegend {} 106 106 private method Rotate {option x y} … … 151 151 private variable _rotatePending 0 152 152 private variable _cutplanePending 0 153 private variable _field ""154 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)155 153 private variable _fields 156 154 private variable _curFldName "" 157 155 private variable _curFldLabel "" 158 156 private variable _curFldComp 3 157 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 159 158 private variable _mouseOver ""; # what called LegendRangeAction: 160 159 # vmin or vmax … … 591 590 } 592 591 array set params $settings 593 set params(-description) ""594 set params(-param) ""595 array set params $settings596 592 597 593 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 630 626 set _dlist [lreplace $_dlist $pos $pos] 631 627 array unset _obj2ovride $dataobj-* 632 array unset _settings $dataobj-*633 628 set changed 1 634 629 } … … 691 686 return $dlist 692 687 } 693 -image{688 "-image" { 694 689 if {[llength $args] != 2} { 695 690 error "wrong # args: should be \"get -image view\"" … … 705 700 } 706 701 default { 707 error "bad option \"$op\": should be -objects or -image"702 error "bad option \"$op\": should be -objects, -visible or -image" 708 703 } 709 704 } … … 1323 1318 itcl::body Rappture::VtkGlyphViewer::InitSettings { args } { 1324 1319 foreach spec $args { 1325 if { [info exists _settings($_first${spec})] } {1326 # Reset global setting with dataobj specific setting1327 set _settings($spec) $_settings($_first${spec})1328 }1329 1320 AdjustSetting $spec 1330 1321 } … … 2212 2203 SendCmd "camera zoom $_view($what)" 2213 2204 } 2214 2205 } 2215 2206 } 2216 2207 } … … 2246 2237 radiobutton $inner.vtk_button -text "VTK data file" \ 2247 2238 -variable [itcl::scope _downloadPopup(format)] \ 2248 -font "Arial 9 2239 -font "Arial 9" \ 2249 2240 -value vtk 2250 2241 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2251 2242 radiobutton $inner.image_button -text "Image File" \ 2252 2243 -variable [itcl::scope _downloadPopup(format)] \ 2253 -font "Arial 9 2244 -font "Arial 9" \ 2254 2245 -value image 2255 2246 Rappture::Tooltip::for $inner.image_button \ -
branches/multichoice/gui/scripts/vtkheightmapviewer.tcl
r6235 r6371 71 71 private method BuildDownloadPopup { widget command } 72 72 private method CameraReset {} 73 private method Combo { option }74 73 private method Connect {} 75 74 private method CurrentDatasets {args} … … 88 87 private method IsValidObject { dataobj } 89 88 private method LeaveLegend {} 89 private method LegendTitleAction { option } 90 90 private method MotionLegend { x y } 91 91 private method Pan {option x y} … … 103 103 private method Rotate {option x y} 104 104 private method SetCurrentColormap { color } 105 private method SetCurrentFieldName { dataobj } 105 106 private method SetLegendTip { x y } 106 107 private method SetObjectStyle { dataobj comp } … … 214 215 215 216 array set _settings { 216 -ax isflymode "static"217 -axesvisible 1 217 218 -axislabels 1 218 219 -axisminorticks 1 219 -axis visible 1220 -axismode "static" 220 221 -colormap BCGYR 221 222 -colormapdiscrete 0 … … 243 244 array set _changed { 244 245 -colormap 0 246 -colormapdiscrete 0 247 -colormapvisible 0 248 -edges 0 249 -isolinecolor 0 250 -isolinesvisible 0 245 251 -numisolines 0 246 252 -opacity 0 253 -wireframe 0 247 254 } 248 255 itk_component add view { … … 255 262 256 263 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 260 265 } { 261 266 usual … … 286 291 } 287 292 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" 289 295 290 296 itk_component add zoomin { … … 483 489 } 484 490 array set params $settings 485 set params(-description) ""486 set params(-param) ""487 array set params $settings488 491 489 492 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 523 526 set _dlist [lreplace $_dlist $pos $pos] 524 527 array unset _obj2ovride $dataobj-* 525 array unset _settings $dataobj-*526 528 set changed 1 527 529 } … … 583 585 return $dlist 584 586 } 585 -image{587 "-image" { 586 588 if {[llength $args] != 2} { 587 589 error "wrong # args: should be \"get -image view\"" … … 597 599 } 598 600 default { 599 error "bad option \"$op\": should be -objects or -image"601 error "bad option \"$op\": should be -objects, -visible or -image" 600 602 } 601 603 } … … 920 922 # Reset the camera and other view parameters 921 923 # 922 InitSettings -isheightmap -background 924 InitSettings -isheightmap -background \ 925 -xgrid -ygrid -zgrid -axismode \ 926 -axesvisible -axislabels -axisminorticks 923 927 924 928 # Setting a custom exponent and label format for axes is causing … … 933 937 #SendCmd "axis exp 0 0 0 1" 934 938 939 SendCmd "axis tickpos outside" 935 940 SendCmd "axis lrot z 90" 936 941 $_arcball quaternion [ViewToQuaternion] … … 951 956 952 957 set _first "" 953 # Start off with no datasets arevisible.958 # Start off with no datasets visible. 954 959 SendCmd "dataset visible 0" 955 960 set scale [GetHeightmapScale] … … 957 962 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 958 963 set _first $dataobj 964 SetCurrentFieldName $dataobj 959 965 } 960 966 foreach comp [$dataobj components] { … … 998 1004 } 999 1005 } 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 1029 1007 InitSettings -stretchtofit -outline 1030 1031 1008 if { $_reset } { 1032 SendCmd "axis tickpos outside"1033 #SendCmd "axis lformat all %g"1034 1035 1009 foreach axis { x y z } { 1036 1010 set label "" … … 1089 1063 } 1090 1064 PanCamera 1091 InitSettings -xgrid -ygrid -zgrid \ 1092 -axisvisible -axislabels -heightmapscale -field -isheightmap \ 1093 -numisolines 1065 InitSettings -heightmapscale -field -isheightmap -numisolines 1094 1066 if { [array size _fields] < 2 } { 1095 1067 catch {blt::table forget $itk_component(field) $itk_component(field_l)} … … 1331 1303 itcl::body Rappture::VtkHeightmapViewer::InitSettings { args } { 1332 1304 foreach spec $args { 1333 if { [info exists _settings($_first${spec})] } {1334 # Reset global setting with dataobj specific setting1335 set _settings($spec) $_settings($_first${spec})1336 }1337 1305 AdjustSetting $spec 1338 1306 } … … 1351 1319 } 1352 1320 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" 1358 1324 } 1359 1325 "-axislabels" { … … 1365 1331 SendCmd "axis minticks all $bool" 1366 1332 } 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" 1370 1338 } 1371 1339 "-background" { … … 1391 1359 if { $color == "none" } { 1392 1360 if { $_settings(-colormapvisible) } { 1361 set _changed(-colormapvisible) 1 1393 1362 SendCmd "heightmap surface 0" 1394 1363 set _settings(-colormapvisible) 0 … … 1396 1365 } else { 1397 1366 if { !$_settings(-colormapvisible) } { 1367 set _changed(-colormapvisible) 1 1398 1368 SendCmd "heightmap surface 1" 1399 1369 set _settings(-colormapvisible) 1 … … 1408 1378 EventuallyRequestLegend 1409 1379 } 1410 "-colormapvisible" {1411 set bool $_settings($what)1412 SendCmd "heightmap surface $bool"1413 }1414 1380 "-colormapdiscrete" { 1381 set _changed($what) 1 1415 1382 set bool $_settings($what) 1416 1383 set numColors [expr $_settings(-numisolines) + 1] … … 1428 1395 EventuallyRequestLegend 1429 1396 } 1397 "-colormapvisible" { 1398 set _changed($what) 1 1399 set bool $_settings($what) 1400 SendCmd "heightmap surface $bool" 1401 } 1430 1402 "-edges" { 1403 set _changed($what) 1 1431 1404 set bool $_settings($what) 1432 1405 SendCmd "heightmap edges $bool" … … 1574 1547 } 1575 1548 "-isolinecolor" { 1549 set _changed($what) 1 1576 1550 set color [$itk_component(isolinecolor) value] 1577 1551 if { $color == "none" } { 1578 1552 if { $_settings(-isolinesvisible) } { 1553 set _changed(-isolinesvisible) 1 1579 1554 SendCmd "heightmap isolines 0" 1580 1555 set _settings(-isolinesvisible) 0 1581 1556 } 1582 1557 } else { 1558 set _settings($what) $color 1583 1559 if { !$_settings(-isolinesvisible) } { 1560 set _changed(-isolinesvisible) 1 1584 1561 SendCmd "heightmap isolines 1" 1585 1562 set _settings(-isolinesvisible) 1 … … 1590 1567 } 1591 1568 "-isolinesvisible" { 1569 set _changed($what) 1 1592 1570 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 } 1593 1575 SendCmd "heightmap isolines $bool" 1594 1576 DrawLegend … … 1634 1616 } 1635 1617 "-outline" { 1618 set _changed($what) 1 1636 1619 if { $_settings(-isheightmap) } { 1637 1620 SendCmd "outline visible 0" … … 1657 1640 } 1658 1641 "-wireframe" { 1642 set _changed($what) 1 1659 1643 set bool $_settings($what) 1660 1644 SendCmd "heightmap wireframe $bool" … … 1717 1701 set cmap $_currentColormap 1718 1702 if { ![info exists _colormaps($cmap)] } { 1719 BuildColormap $cmap1720 set _colormaps($cmap) 11703 BuildColormap $cmap 1704 set _colormaps($cmap) 1 1721 1705 } 1722 1706 #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0" … … 2034 2018 checkbutton $inner.visible \ 2035 2019 -text "Axes" \ 2036 -variable [itcl::scope _settings(-ax isvisible)] \2037 -command [itcl::code $this AdjustSetting -ax isvisible] \2020 -variable [itcl::scope _settings(-axesvisible)] \ 2021 -command [itcl::code $this AdjustSetting -axesvisible] \ 2038 2022 -font "Arial 9" 2039 2023 checkbutton $inner.labels \ … … 2066 2050 label $inner.mode_l -text "Mode" -font "Arial 9" 2067 2051 2068 itk_component add axis flymode {2052 itk_component add axismode { 2069 2053 Rappture::Combobox $inner.mode -width 10 -editable 0 2070 2054 } … … 2074 2058 "furthest_triad" "farthest" \ 2075 2059 "outer_edges" "outer" 2076 $itk_component(axis flymode) value $_settings(-axisflymode)2077 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]2060 $itk_component(axismode) value $_settings(-axismode) 2061 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 2078 2062 2079 2063 blt::table $inner \ … … 2212 2196 radiobutton $inner.vtk_button -text "VTK data file" \ 2213 2197 -variable [itcl::scope _downloadPopup(format)] \ 2214 -font "Arial 9 2198 -font "Arial 9" \ 2215 2199 -value vtk 2216 2200 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2217 2201 radiobutton $inner.image_button -text "Image File" \ 2218 2202 -variable [itcl::scope _downloadPopup(format)] \ 2219 -font "Arial 9 2203 -font "Arial 9" \ 2220 2204 -value image 2221 2205 Rappture::Tooltip::for $inner.image_button \ … … 2258 2242 set tag $dataobj-$comp 2259 2243 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 2263 2257 } 2264 2258 set stylelist [$dataobj style $comp] … … 2298 2292 DrawLegend 2299 2293 } 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 2300 2305 SendCmd "outline add $tag" 2301 2306 SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag" 2302 SendCmd "outline visible $_settings(-outline) $tag" 2307 SendCmd "outline visible $style(-outline) $tag" 2308 2303 2309 set scale [GetHeightmapScale] 2304 2310 SendCmd "[list heightmap add contourlist $_contourList $scale $tag]" 2305 2311 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" 2308 2316 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" 2311 2325 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" 2314 2328 SendCmd "heightmap opacity $style(-opacity) $tag" 2315 2329 set _settings(-opacity) [expr $style(-opacity) * 100.0] … … 2349 2363 # DrawLegend -- 2350 2364 # 2351 # Draws the legend in theown 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. 2352 2366 # 2353 2367 itcl::body Rappture::VtkHeightmapViewer::DrawLegend {} { … … 2437 2451 } 2438 2452 2439 $c bind title <ButtonPress> [itcl::code $this Combopost]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] 2442 2456 # Reset the item coordinates according the current size of the plot. 2443 2457 if { [info exists _limits($_curFldName)] } { … … 2553 2567 2554 2568 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 2581 itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} { 2566 2582 set c $itk_component(view) 2567 2583 switch -- $option { … … 2573 2589 tk_popup $itk_component(fieldmenu) $x $y 2574 2590 } 2575 activate{2591 enter { 2576 2592 $c itemconfigure title -fill red 2577 2593 } 2578 deactivate {2594 leave { 2579 2595 $c itemconfigure title -fill $itk_option(-plotforeground) 2580 2596 } 2581 invoke {2597 save { 2582 2598 $itk_component(field) value $_curFldLabel 2583 2599 AdjustSetting -field 2584 2600 } 2585 2601 default { 2586 error "bad option \"$option\": should be post, unpost, select"2602 error "bad option \"$option\": should be post, enter, leave or save" 2587 2603 } 2588 2604 } … … 2634 2650 blt::vector destroy $v 2635 2651 } 2652 2653 itcl::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 70 70 private method BuildImageTab {} 71 71 private method BuildDownloadPopup { widget command } 72 private method Combo { option }73 72 private method Connect {} 74 73 private method CurrentDatasets {args} … … 86 85 private method IsValidObject { dataobj } 87 86 private method LeaveLegend {} 87 private method LegendTitleAction { option } 88 88 private method MotionLegend { x y } 89 89 private method Pan {option x y} … … 100 100 private method Rotate {option x y} 101 101 private method SetCurrentColormap { color } 102 private method SetCurrentFieldName { dataobj } 102 103 private method SetLegendTip { x y } 103 104 private method SetObjectStyle { dataobj comp } … … 209 210 210 211 array set _settings { 211 -ax isflymode "static"212 -axesvisible 1 212 213 -axislabels 1 213 214 -axisminorticks 1 214 -axis visible 1215 -axismode "static" 215 216 -backingcolor white 216 217 -backingvisible 1 … … 243 244 244 245 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 248 247 } { 249 248 usual … … 274 273 } 275 274 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" 277 277 278 278 itk_component add zoomin { … … 473 473 } 474 474 array set params $settings 475 set params(-description) ""476 set params(-param) ""477 array set params $settings478 475 479 476 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 513 510 set _dlist [lreplace $_dlist $pos $pos] 514 511 array unset _obj2ovride $dataobj-* 515 array unset _settings $dataobj-*516 512 set changed 1 517 513 } … … 573 569 return $dlist 574 570 } 575 -image{571 "-image" { 576 572 if {[llength $args] != 2} { 577 573 error "wrong # args: should be \"get -image view\"" … … 587 583 } 588 584 default { 589 error "bad option \"$op\": should be -objects or -image"585 error "bad option \"$op\": should be -objects, -visible or -image" 590 586 } 591 587 } … … 607 603 } 608 604 foreach axis { x y } { 605 set units [$dataobj hints ${axis}units] 606 set found($units) 1 609 607 set lim [$dataobj limits $axis] 610 608 if { ![info exists _limits($axis)] } { … … 621 619 } 622 620 set _limits($axis) [list $amin $amax] 623 set units [$dataobj hints ${axis}units]624 set found($units) 1625 621 } 626 622 foreach { fname lim } [$dataobj fieldlimits] { … … 903 899 DoResize 904 900 if { $_settings(-stretchtofit) } { 905 AdjustSetting -stretch ToFit901 AdjustSetting -stretchtofit 906 902 } 907 903 } … … 910 906 # Reset the camera and other view parameters 911 907 # 912 InitSettings -view3d -background 913 908 InitSettings -view3d -background \ 909 -xgrid -ygrid -zgrid -axismode \ 910 -axesvisible -axislabels -axisminorticks 911 912 SendCmd "axis tickpos outside" 914 913 SendCmd "axis lrot z 90" 915 914 $_arcball quaternion [ViewToQuaternion] … … 930 929 931 930 set _first "" 932 # Start off with no datasets arevisible.931 # Start off with no datasets visible. 933 932 SendCmd "dataset visible 0" 934 933 foreach dataobj [get -objects] { 935 934 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 936 935 set _first $dataobj 936 SetCurrentFieldName $dataobj 937 937 } 938 938 foreach comp [$dataobj components] { … … 971 971 } 972 972 } 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 1002 974 InitSettings -stretchtofit -outline 1003 1004 975 if { $_reset } { 1005 SendCmd "axis tickpos outside"1006 #SendCmd "axis lformat all %g"1007 1008 976 foreach axis { x y z } { 1009 977 set label "" … … 1046 1014 } 1047 1015 PanCamera 1048 InitSettings -xgrid -ygrid -zgrid \ 1049 -axisvisible -axislabels -field -view3d 1016 InitSettings -field -view3d 1050 1017 if { [array size _fields] < 2 } { 1051 1018 catch {blt::table forget $itk_component(field) $itk_component(field_l)} … … 1278 1245 itcl::body Rappture::VtkImageViewer::InitSettings { args } { 1279 1246 foreach spec $args { 1280 if { [info exists _settings($_first${spec})] } {1281 # Reset global setting with dataobj specific setting1282 set _settings($spec) $_settings($_first${spec})1283 }1284 1247 AdjustSetting $spec 1285 1248 } … … 1298 1261 } 1299 1262 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" 1305 1266 } 1306 1267 "-axislabels" { … … 1312 1273 SendCmd "axis minticks all $bool" 1313 1274 } 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" 1317 1280 } 1318 1281 "-background" { … … 1396 1359 SendCmd "camera reset" 1397 1360 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 } 1398 1397 } 1399 1398 "-view3d" { … … 1451 1450 set val $_settings($what) 1452 1451 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 legend1461 }1462 DrawLegend1463 }1464 "-opacity" {1465 set _changed($what) 11466 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 }1489 1452 } 1490 1453 "-xgrid" - "-ygrid" - "-zgrid" { … … 1798 1761 checkbutton $inner.visible \ 1799 1762 -text "Axes" \ 1800 -variable [itcl::scope _settings(-ax isvisible)] \1801 -command [itcl::code $this AdjustSetting -ax isvisible] \1763 -variable [itcl::scope _settings(-axesvisible)] \ 1764 -command [itcl::code $this AdjustSetting -axesvisible] \ 1802 1765 -font "Arial 9" 1803 1766 checkbutton $inner.labels \ … … 1830 1793 label $inner.mode_l -text "Mode" -font "Arial 9" 1831 1794 1832 itk_component add axis flymode {1795 itk_component add axismode { 1833 1796 Rappture::Combobox $inner.mode -width 10 -editable 0 1834 1797 } … … 1838 1801 "furthest_triad" "farthest" \ 1839 1802 "outer_edges" "outer" 1840 $itk_component(axis flymode) value $_settings(-axisflymode)1841 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1803 $itk_component(axismode) value $_settings(-axismode) 1804 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1842 1805 1843 1806 blt::table $inner \ … … 1976 1939 radiobutton $inner.vtk_button -text "VTK data file" \ 1977 1940 -variable [itcl::scope _downloadPopup(format)] \ 1978 -font "Arial 9 1941 -font "Arial 9" \ 1979 1942 -value vtk 1980 1943 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1981 1944 radiobutton $inner.image_button -text "Image File" \ 1982 1945 -variable [itcl::scope _downloadPopup(format)] \ 1983 -font "Arial 9 1946 -font "Arial 9" \ 1984 1947 -value image 1985 1948 Rappture::Tooltip::for $inner.image_button \ … … 2049 2012 if { [info exists style(-stretchtofit)] } { 2050 2013 set _settings(-stretchtofit) $style(-stretchtofit) 2051 AdjustSetting -stretch ToFit2014 AdjustSetting -stretchtofit 2052 2015 } 2053 2016 SendCmd "outline add $tag" … … 2095 2058 # DrawLegend -- 2096 2059 # 2097 # Draws the legend in theown 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. 2098 2061 # 2099 2062 itcl::body Rappture::VtkImageViewer::DrawLegend {} { … … 2156 2119 set x1 [expr $x2 - ($iw*12)/10] 2157 2120 2158 $c bind title <ButtonPress> [itcl::code $this Combopost]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] 2161 2124 # Reset the item coordinates according the current size of the plot. 2162 2125 if { [info exists _limits($_curFldName)] } { … … 2272 2235 2273 2236 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 2249 itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} { 2285 2250 set c $itk_component(view) 2286 2251 switch -- $option { … … 2292 2257 tk_popup $itk_component(fieldmenu) $x $y 2293 2258 } 2294 activate{2259 enter { 2295 2260 $c itemconfigure title -fill red 2296 2261 } 2297 deactivate {2262 leave { 2298 2263 $c itemconfigure title -fill $itk_option(-plotforeground) 2299 2264 } 2300 invoke {2265 save { 2301 2266 $itk_component(field) value $_curFldLabel 2302 2267 AdjustSetting -field 2303 2268 } 2304 2269 default { 2305 error "bad option \"$option\": should be post, unpost, select"2270 error "bad option \"$option\": should be post, enter, leave or save" 2306 2271 } 2307 2272 } … … 2328 2293 set _view(-zoom) 1.0 2329 2294 } 2295 2296 itcl::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 107 107 private method ReceiveDataset { args } 108 108 private method ReceiveImage { args } 109 private method ReceiveLegend { colormap title vmin vmax size }109 private method ReceiveLegend { colormap title min max size } 110 110 private method RequestLegend {} 111 111 private method Rotate {option x y} … … 160 160 private variable _rotatePending 0 161 161 private variable _cutplanePending 0 162 private variable _field ""163 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)164 162 private variable _fields 165 163 private variable _curFldName "" 166 164 private variable _curFldLabel "" 165 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 167 166 private variable _mouseOver ""; # what called LegendRangeAction: 168 167 # vmin or vmax … … 618 617 } 619 618 array set params $settings 620 set params(-description) ""621 set params(-param) ""622 array set params $settings623 619 624 620 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 657 653 set _dlist [lreplace $_dlist $pos $pos] 658 654 array unset _obj2ovride $dataobj-* 659 array unset _settings $dataobj-*660 655 set changed 1 661 656 } … … 718 713 return $dlist 719 714 } 720 -image{715 "-image" { 721 716 if {[llength $args] != 2} { 722 717 error "wrong # args: should be \"get -image view\"" … … 732 727 } 733 728 default { 734 error "bad option \"$op\": should be -objects or -image"729 error "bad option \"$op\": should be -objects, -visible or -image" 735 730 } 736 731 } … … 1350 1345 itcl::body Rappture::VtkIsosurfaceViewer::InitSettings { args } { 1351 1346 foreach spec $args { 1352 if { [info exists _settings($_first${spec})] } {1353 # Reset global setting with dataobj specific setting1354 set _settings($spec) $_settings($_first${spec})1355 }1356 1347 AdjustSetting $spec 1357 1348 } … … 1505 1496 } 1506 1497 "-isolinecolor" { 1507 set color [$itk_component(isoline Color) value]1498 set color [$itk_component(isolinecolor) value] 1508 1499 set _settings($what) $color 1509 1500 DrawLegend … … 1741 1732 1742 1733 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1743 itk_component add isoline Color {1734 itk_component add isolinecolor { 1744 1735 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1745 1736 } … … 1756 1747 "none" "none" 1757 1748 1758 $itk_component(isoline Color) value "white"1749 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1759 1750 bind $inner.linecolor <<Value>> \ 1760 1751 [itcl::code $this AdjustSetting -isolinecolor] … … 2184 2175 SendCmd "camera zoom $_view($what)" 2185 2176 } 2186 2177 } 2187 2178 } 2188 2179 } … … 2218 2209 radiobutton $inner.vtk_button -text "VTK data file" \ 2219 2210 -variable [itcl::scope _downloadPopup(format)] \ 2220 -font "Arial 9 2211 -font "Arial 9" \ 2221 2212 -value vtk 2222 2213 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 2223 2214 radiobutton $inner.image_button -text "Image File" \ 2224 2215 -variable [itcl::scope _downloadPopup(format)] \ 2225 -font "Arial 9 2216 -font "Arial 9" \ 2226 2217 -value image 2227 2218 Rappture::Tooltip::for $inner.image_button \ … … 2259 2250 array set style { 2260 2251 -color BCGYR 2252 -constcolor white 2261 2253 -cutplaneedges 0 2262 2254 -cutplanelighting 1 … … 2284 2276 set style(-opacity) 1.0 2285 2277 } 2278 set style(-constcolor) $itk_option(-plotforeground) 2286 2279 array set style [$dataobj style $comp] 2287 2280 #DebugTrace [array get style] … … 2315 2308 } 2316 2309 if { $_currentColormap == "" } { 2317 SetCurrentColormap $style(-color)2318 2310 $itk_component(colormap) value $style(-color) 2319 2311 } … … 2343 2335 2344 2336 SendCmd "cutplane add $tag" 2345 SendCmd "cutplane color [Color2RGB $ itk_option(-plotforeground)] $tag"2337 SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag" 2346 2338 foreach axis {x y z} { 2347 2339 set pos [expr $style(-${axis}cutplaneposition) * 0.01] … … 2359 2351 2360 2352 SendCmd "outline add $tag" 2361 SendCmd "outline color [Color2RGB $ itk_option(-plotforeground)] $tag"2353 SendCmd "outline color [Color2RGB $style(-constcolor)] $tag" 2362 2354 SendCmd "outline visible $style(-outline) $tag" 2363 2355 … … 2367 2359 SendCmd "contour3d edges $style(-edges) $tag" 2368 2360 set _settings(-isosurfaceedges) $style(-edges) 2369 #SendCmd "contour3d color [Color2RGB $style(-co lor)] $tag"2361 #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag" 2370 2362 SendCmd "contour3d lighting $style(-lighting) $tag" 2371 2363 set _settings(-isosurfacelighting) $style(-lighting) -
branches/multichoice/gui/scripts/vtkmeshviewer.tcl
r6202 r6371 411 411 } 412 412 array set params $settings 413 set params(-description) ""414 set params(-param) ""415 array set params $settings416 413 417 414 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 510 507 return $dlist 511 508 } 512 -image{509 "-image" { 513 510 if {[llength $args] != 2} { 514 511 error "wrong # args: should be \"get -image view\"" … … 524 521 } 525 522 default { 526 error "bad option \"$op\": should be -objects or -image"523 error "bad option \"$op\": should be -objects, -visible or -image" 527 524 } 528 525 } … … 1467 1464 radiobutton $inner.vtk_button -text "VTK data file" \ 1468 1465 -variable [itcl::scope _downloadPopup(format)] \ 1469 -font " Helvetica 9" \1466 -font "Arial 9" \ 1470 1467 -value vtk 1471 1468 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." -
branches/multichoice/gui/scripts/vtkstreamlinesviewer.tcl
r6236 r6371 72 72 private method BuildSurfaceTab {} 73 73 private method DrawLegend {} 74 private method Combo { option }75 74 private method Connect {} 76 75 private method CurrentDatasets {args} … … 91 90 private method IsValidObject { dataobj } 92 91 private method LeaveLegend {} 92 private method LegendTitleAction { option } 93 93 private method MotionLegend { x y } 94 94 private method Pan {option x y} … … 101 101 private method ReceiveDataset { args } 102 102 private method ReceiveImage { args } 103 private method ReceiveLegend { colormap title vmin vmax size }103 private method ReceiveLegend { colormap title min max size } 104 104 private method RequestLegend {} 105 105 private method Rotate {option x y} 106 106 private method SetCurrentColormap { color } 107 private method SetCurrentFieldName { dataobj } 107 108 private method SetLegendTip { x y } 108 109 private method SetObjectStyle { dataobj comp } … … 145 146 private variable _curFldName "" 146 147 private variable _curFldLabel "" 147 private variable _ field ""148 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 148 149 private variable _streamlinesLength 0 149 150 private variable _numSeeds 200 150 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)151 151 152 152 private common _downloadPopup; # download options from popup … … 301 301 } 302 302 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" 304 305 305 306 itk_component add zoomin { … … 552 553 } 553 554 array set params $settings 554 set params(-description) ""555 set params(-param) ""556 array set params $settings557 555 558 556 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 592 590 set _dlist [lreplace $_dlist $pos $pos] 593 591 array unset _obj2ovride $dataobj-* 594 array unset _settings $dataobj-*595 592 set changed 1 596 593 } … … 653 650 return $dlist 654 651 } 655 -image{652 "-image" { 656 653 if {[llength $args] != 2} { 657 654 error "wrong # args: should be \"get -image view\"" … … 667 664 } 668 665 default { 669 error "bad option \"$op\": should be -objects or -image"666 error "bad option \"$op\": should be -objects, -visible or -image" 670 667 } 671 668 } … … 982 979 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 983 980 set _first $dataobj 981 SetCurrentFieldName $dataobj 984 982 } 985 983 foreach comp [$dataobj components] { … … 1027 1025 } 1028 1026 } 1029 $itk_component(field) choices delete 0 end1030 $itk_component(fieldmenu) delete 0 end1031 array unset _fields1032 set _curFldName ""1033 set _curFldLabel ""1034 foreach cname [$_first components] {1035 foreach fname [$_first fieldnames $cname] {1036 if { [info exists _fields($fname)] } {1037 continue1038 }1039 foreach { label units components } \1040 [$_first fieldinfo $fname] break1041 $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 $fname1052 set _curFldLabel $label1053 }1054 }1055 }1056 $itk_component(field) value $_curFldLabel1057 1027 } 1058 1028 … … 1299 1269 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } { 1300 1270 foreach spec $args { 1301 if { [info exists _settings($_first${spec})] } {1302 # Reset global setting with dataobj specific setting1303 set _settings($spec) $_settings($_first${spec})1304 }1305 1271 AdjustSetting $spec 1306 1272 } … … 2068 2034 radiobutton $inner.vtk_button -text "VTK data file" \ 2069 2035 -variable [itcl::scope _downloadPopup(format)] \ 2070 -font " Helvetica 9" \2036 -font "Arial 9" \ 2071 2037 -value vtk 2072 2038 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2185 2151 2186 2152 # ---------------------------------------------------------------------- 2187 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2153 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2188 2154 # 2189 2155 # Invoked automatically whenever the "legend" command comes in from … … 2191 2157 # specified <size> will follow. 2192 2158 # ---------------------------------------------------------------------- 2193 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {2159 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } { 2194 2160 set _legendPending 0 2195 2161 set _title $title … … 2255 2221 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2256 2222 } 2257 $c bind title <ButtonPress> [itcl::code $this Combopost]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] 2260 2226 # Reset the item coordinates according the current size of the plot. 2261 2227 $c itemconfigure title -text $title … … 2380 2346 2381 2347 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 2360 itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} { 2393 2361 set c $itk_component(view) 2394 2362 switch -- $option { … … 2400 2368 tk_popup $itk_component(fieldmenu) $x $y 2401 2369 } 2402 activate{2370 enter { 2403 2371 $c itemconfigure title -fill red 2404 2372 } 2405 deactivate {2373 leave { 2406 2374 $c itemconfigure title -fill white 2407 2375 } 2408 invoke {2376 save { 2409 2377 $itk_component(field) value $_curFldLabel 2410 2378 AdjustSetting -field 2411 2379 } 2412 2380 default { 2413 error "bad option \"$option\": should be post, unpost, select"2381 error "bad option \"$option\": should be post, enter, leave or save" 2414 2382 } 2415 2383 } … … 2436 2404 set _view(-zoom) 1.0 2437 2405 } 2406 2407 itcl::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 69 69 private method BuildDownloadPopup { widget command } 70 70 private method BuildSurfaceTab {} 71 private method Combo { option }72 71 private method Connect {} 73 72 private method CurrentDatasets {args} … … 85 84 private method IsValidObject { dataobj } 86 85 private method LeaveLegend {} 86 private method LegendTitleAction { option } 87 87 private method MotionLegend { x y } 88 88 private method Pan {option x y} … … 95 95 private method ReceiveDataset { args } 96 96 private method ReceiveImage { args } 97 private method ReceiveLegend { colormap title vmin vmax size }97 private method ReceiveLegend { colormap title min max size } 98 98 private method RequestLegend {} 99 99 private method Rotate {option x y} … … 139 139 private variable _legendPending 0 140 140 private variable _rotatePending 0 141 private variable _field ""142 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)143 141 private variable _fields 144 142 private variable _curFldName "" 145 143 private variable _curFldLabel "" 144 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 146 145 147 146 private common _downloadPopup; # download options from popup … … 474 473 } 475 474 array set params $settings 476 set params(-description) ""477 set params(-param) ""478 array set params $settings479 475 480 476 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 513 509 set _dlist [lreplace $_dlist $pos $pos] 514 510 array unset _obj2ovride $dataobj-* 515 array unset _settings $dataobj-*516 511 set changed 1 517 512 } … … 574 569 return $dlist 575 570 } 576 -image{571 "-image" { 577 572 if {[llength $args] != 2} { 578 573 error "wrong # args: should be \"get -image view\"" … … 588 583 } 589 584 default { 590 error "bad option \"$op\": should be -objects or -image"585 error "bad option \"$op\": should be -objects, -visible or -image" 591 586 } 592 587 } … … 1194 1189 itcl::body Rappture::VtkSurfaceViewer::InitSettings { args } { 1195 1190 foreach spec $args { 1196 if { [info exists _settings($_first${spec})] } {1197 # Reset global setting with dataobj specific setting1198 set _settings($spec) $_settings($_first${spec})1199 }1200 1191 AdjustSetting $spec 1201 1192 } … … 1318 1309 "-isolinecolor" { 1319 1310 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 } 1323 1331 DrawLegend 1324 1332 } … … 1328 1336 SendCmd "contour2d visible 0" 1329 1337 if { $bool } { 1338 if { [$itk_component(isolinecolor) value] != $_settings(-isolinecolor)} { 1339 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1340 } 1330 1341 foreach tag [CurrentDatasets -visible] { 1331 1342 SendCmd "contour2d visible $bool $tag" … … 1546 1557 1547 1558 label $inner.linecolor_l -text "Isolines" -font "Arial 9" 1548 itk_component add isoline Color {1559 itk_component add isolinecolor { 1549 1560 Rappture::Combobox $inner.linecolor -width 10 -editable 0 1550 1561 } … … 1561 1572 "none" "none" 1562 1573 1563 $itk_component(isoline Color) value "white"1574 $itk_component(isolinecolor) value $_settings(-isolinecolor) 1564 1575 bind $inner.linecolor <<Value>> \ 1565 1576 [itcl::code $this AdjustSetting -isolinecolor] … … 1797 1808 SendCmd "camera zoom $_view($what)" 1798 1809 } 1799 1810 } 1800 1811 } 1801 1812 } … … 1831 1842 radiobutton $inner.vtk_button -text "VTK data file" \ 1832 1843 -variable [itcl::scope _downloadPopup(format)] \ 1833 -font "Arial 9 1844 -font "Arial 9" \ 1834 1845 -value vtk 1835 1846 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." 1836 1847 radiobutton $inner.image_button -text "Image File" \ 1837 1848 -variable [itcl::scope _downloadPopup(format)] \ 1838 -font "Arial 9 1849 -font "Arial 9" \ 1839 1850 -value image 1840 1851 Rappture::Tooltip::for $inner.image_button \ … … 2170 2181 } 2171 2182 2172 $c bind title <ButtonPress> [itcl::code $this Combopost]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] 2175 2186 # Reset the item coordinates according the current size of the plot. 2176 2187 $c itemconfigure title -text $title … … 2197 2208 2198 2209 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 2222 itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} { 2210 2223 set c $itk_component(view) 2211 2224 switch -- $option { … … 2219 2232 tk_popup $itk_component(fieldmenu) $x $y 2220 2233 } 2221 activate{2234 enter { 2222 2235 $c itemconfigure title -fill red 2223 2236 } 2224 deactivate {2237 leave { 2225 2238 $c itemconfigure title -fill $itk_option(-plotforeground) 2226 2239 } 2227 invoke {2240 save { 2228 2241 $itk_component(field) value $_curFldLabel 2229 2242 AdjustSetting -field 2230 2243 } 2231 2244 default { 2232 error "bad option \"$option\": should be post, unpost, select"2245 error "bad option \"$option\": should be post, enter, leave or save" 2233 2246 } 2234 2247 } … … 2320 2333 -activeforeground $itk_option(-plotforeground) \ 2321 2334 -font "Arial 8" \ 2322 -command [itcl::code $this Combo invoke]2335 -command [itcl::code $this LegendTitleAction save] 2323 2336 set _fields($fname) [list $label $units $components] 2324 2337 if { $_curFldName == "" } { -
branches/multichoice/gui/scripts/vtkviewer.tcl
r6203 r6371 104 104 private method ReceiveDataset { args } 105 105 private method ReceiveImage { args } 106 private method ReceiveLegend { colormap title vmin vmax size }106 private method ReceiveLegend { colormap title min max size } 107 107 private method RequestLegend {} 108 108 private method Rotate {option x y} … … 595 595 } 596 596 array set params $settings 597 set params(-description) ""598 set params(-param) ""599 array set params $settings600 597 601 598 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 634 631 set _dlist [lreplace $_dlist $pos $pos] 635 632 array unset _obj2ovride $dataobj-* 636 array unset _settings $dataobj-*637 633 set changed 1 638 634 } … … 695 691 return $dlist 696 692 } 697 -image{693 "-image" { 698 694 if {[llength $args] != 2} { 699 695 error "wrong # args: should be \"get -image view\"" … … 709 705 } 710 706 default { 711 error "bad option \"$op\": should be -objects or -image"707 error "bad option \"$op\": should be -objects, -visible or -image" 712 708 } 713 709 } … … 2588 2584 radiobutton $inner.vtk_button -text "VTK data file" \ 2589 2585 -variable [itcl::scope _downloadPopup(format)] \ 2590 -font " Helvetica 9" \2586 -font "Arial 9" \ 2591 2587 -value vtk 2592 2588 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2866 2862 2867 2863 # ---------------------------------------------------------------------- 2868 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2864 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2869 2865 # 2870 2866 # Invoked automatically whenever the "legend" command comes in from … … 2872 2868 # specified <size> will follow. 2873 2869 # ---------------------------------------------------------------------- 2874 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {2875 set _limits(vmin) $ vmin2876 set _limits(vmax) $ vmax2870 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } { 2871 set _limits(vmin) $min 2872 set _limits(vmax) $max 2877 2873 set _title $title 2878 2874 if { [IsConnected] } { -
branches/multichoice/gui/scripts/vtkvolumeviewer.tcl
r6235 r6371 74 74 private method BuildVolumeComponents {} 75 75 private method BuildVolumeTab {} 76 private method Combo { option }77 76 private method ComputeAlphamap { cname } 78 77 private method ComputeTransferFunction { cname } … … 97 96 private method IsValidObject { dataobj } 98 97 private method LeaveLegend {} 98 private method LegendTitleAction { option } 99 99 private method MotionLegend { x y } 100 100 private method Pan {option x y} … … 109 109 private method ReceiveDataset { args } 110 110 private method ReceiveImage { args } 111 private method ReceiveLegend { colormap title vmin vmax size }111 private method ReceiveLegend { colormap title min max size } 112 112 private method RemoveMarker { x y } 113 113 private method RequestLegend {} … … 115 115 private method Rotate {option x y} 116 116 private method SendTransferFunctions {} 117 private method SetCurrentFieldName { dataobj } 117 118 private method SetInitialTransferFunction { dataobj cname } 118 119 private method SetLegendTip { x y } … … 240 241 array set _settings { 241 242 -axesvisible 1 242 -axisflymode static243 243 -axislabels 1 244 244 -axisminorticks 1 245 -axismode "static" 245 246 -background black 246 247 -color "default" … … 536 537 } 537 538 array set params $settings 538 set params(-description) ""539 set params(-param) ""540 array set params $settings541 539 542 540 if {$params(-color) == "auto" || $params(-color) == "autoreset"} { … … 577 575 set _dlist [lreplace $_dlist $pos $pos] 578 576 array unset _obj2ovride $dataobj-* 579 array unset _settings $dataobj-*580 577 set changed 1 581 578 } … … 638 635 return $dlist 639 636 } 640 -image{637 "-image" { 641 638 if {[llength $args] != 2} { 642 639 error "wrong # args: should be \"get -image view\"" … … 652 649 } 653 650 default { 654 error "bad option \"$op\": should be -objects or -image"651 error "bad option \"$op\": should be -objects, -visible or -image" 655 652 } 656 653 } … … 1004 1001 set _first "" 1005 1002 InitSettings -background \ 1006 -xgrid -ygrid -zgrid -axis flymode \1003 -xgrid -ygrid -zgrid -axismode \ 1007 1004 -axesvisible -axislabels -axisminorticks 1008 1005 StopBufferingCommands … … 1020 1017 if { [info exists _obj2ovride($dataobj-raise)] && $_first == "" } { 1021 1018 set _first $dataobj 1019 SetCurrentFieldName $dataobj 1022 1020 } 1023 1021 foreach cname [$dataobj components] { … … 1066 1064 } 1067 1065 } 1068 $itk_component(field) choices delete 0 end1069 $itk_component(fieldmenu) delete 0 end1070 array unset _fields1071 set _curFldName ""1072 foreach cname [$_first components] {1073 foreach fname [$_first fieldnames $cname] {1074 if { [info exists _fields($fname)] } {1075 continue1076 }1077 foreach { label units components } \1078 [$_first fieldinfo $fname] break1079 # Only scalar fields are valid1080 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 $fname1092 set _curFldLabel $label1093 }1094 }1095 }1096 }1097 $itk_component(field) value $_curFldLabel1098 1066 } 1099 1067 … … 1331 1299 itcl::body Rappture::VtkVolumeViewer::InitSettings { args } { 1332 1300 foreach spec $args { 1333 if { [info exists _settings($_first${spec})] } {1334 # Reset global setting with dataobj specific setting1335 set _settings($spec) $_settings($_first${spec})1336 }1337 1301 AdjustSetting $spec 1338 1302 } … … 1351 1315 } 1352 1316 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" 1356 1334 } 1357 1335 "-background" { … … 1368 1346 DrawLegend 1369 1347 } 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 1501 1357 } 1502 1358 "-cutplanelighting" { … … 1524 1380 } 1525 1381 } 1526 "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" { 1527 set axis [string range $what 1 1] 1382 "-cutplanesvisible" { 1528 1383 set bool $_settings($what) 1529 if { $bool } {1530 $itk_component(${axis}CutScale) configure -state normal \1531 -troughcolor white1532 } else {1533 $itk_component(${axis}CutScale) configure -state disabled \1534 -troughcolor grey821535 }1536 1384 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 } 1557 1387 } 1558 1388 "-field" { … … 1584 1414 SendCmd "camera reset" 1585 1415 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" 1586 1550 } 1587 1551 default { … … 1908 1872 "furthest_triad" "farthest" \ 1909 1873 "outer_edges" "outer" 1910 $itk_component(axismode) value $_settings(-axis flymode)1911 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axis flymode]1874 $itk_component(axismode) value $_settings(-axismode) 1875 bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode] 1912 1876 1913 1877 blt::table $inner \ … … 2174 2138 radiobutton $inner.vtk_button -text "VTK data file" \ 2175 2139 -variable [itcl::scope _downloadPopup(format)] \ 2176 -font " Helvetica 9" \2140 -font "Arial 9" \ 2177 2141 -value vtk 2178 2142 Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file." … … 2252 2216 2253 2217 # ---------------------------------------------------------------------- 2254 # USAGE: ReceiveLegend <colormap> <title> < vmin> <vmax> <size>2218 # USAGE: ReceiveLegend <colormap> <title> <min> <max> <size> 2255 2219 # 2256 2220 # Invoked automatically whenever the "legend" command comes in from … … 2258 2222 # specified <size> will follow. 2259 2223 # ---------------------------------------------------------------------- 2260 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {2224 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } { 2261 2225 if { [isconnected] } { 2262 2226 set bytes [ReceiveBytes $size] … … 2428 2392 2429 2393 # ---------------------------------------------------------------------- 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 # ---------------------------------------------------------------------- 2406 itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} { 2441 2407 set c $itk_component(view) 2442 2408 switch -- $option { … … 2448 2414 tk_popup $itk_component(fieldmenu) $x $y 2449 2415 } 2450 activate{2416 enter { 2451 2417 $c itemconfigure title -fill red 2452 2418 } 2453 deactivate {2419 leave { 2454 2420 $c itemconfigure title -fill $itk_option(-plotforeground) 2455 2421 } 2456 invoke {2422 save { 2457 2423 $itk_component(field) value $_curFldLabel 2458 2424 AdjustSetting -field 2459 2425 } 2460 2426 default { 2461 error "bad option \"$option\": should be post, unpost, select"2427 error "bad option \"$option\": should be post, enter, leave or save" 2462 2428 } 2463 2429 } … … 2510 2476 } else { 2511 2477 # $n : absolute value, compute relative 2512 lappend list [expr {(double($value)-$min)/($max-$min)]}2478 lappend list [expr {(double($value)-$min)/($max-$min)}] 2513 2479 } 2514 2480 } … … 2865 2831 return [ColorsToColormap $color] 2866 2832 } 2833 2834 itcl::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 75 75 close $fid 76 76 } errs] != 0 } { 77 global errorInfo 77 78 puts stderr "can't open \"$fname\": errs=$errs errorInfo=$errorInfo" 78 79 } … … 90 91 close $fid 91 92 } errs] != 0 } { 93 global errorInfo 92 94 puts stderr "can't open \"$fname\": errs=$errs errorInfo=$errorInfo" 93 95 } … … 1067 1069 # ---------------------------------------------------------------------- 1068 1070 itcl::body Rappture::LibraryObj::uq_get_vars {{tfile ""}} { 1069 set varout \[1070 set varlist []1071 set varout "\[" 1072 set varlist {} 1071 1073 1072 1074 if {$tfile == ""} { -
branches/multichoice/lang/tcl/scripts/task.tcl
r6217 r6371 218 218 219 219 # 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"] 221 222 set status [catch { 222 223 set fid [open $file w] … … 578 579 set rdir $_resources(-resultdir) 579 580 } else { 580 set rdir "." 581 global rapptureInfo 582 set rdir $rapptureInfo(cwd) 581 583 } 582 584 } elseif {$resultdir ne ""} { -
branches/multichoice/puq/puq.sh.in
r6191 r6371 21 21 script=$1 22 22 shift 23 exec ${python} ${puq_exec_prefix}/${script}.py $*23 exec ${python} ${puq_exec_prefix}/${script}.py "$@" 24 24 -
branches/multichoice/tester/scripts/main.tcl
r4127 r6371 148 148 wm title . "Rappture Regression Tester" 149 149 wm geometry . 800x500 150 Rappture::Panes .pw -orientation horizontal -sashcursor sb_h_double_arrow150 Rappture::Panes .pw -orientation horizontal 151 151 pack .pw -expand yes -fill both 152 152 … … 262 262 263 263 # viewer for value diffs where we have a special object viewer 264 Rappture::Panes .testdiffs.body.val2objs -orientation horizontal -sashcursor sb_h_double_arrow264 Rappture::Panes .testdiffs.body.val2objs -orientation horizontal 265 265 266 266 # empty area for the object value viewer
Note: See TracChangeset
for help on using the changeset viewer.