Changeset 3409 for trunk/gui/scripts/vtkheightmapviewer.tcl
- Timestamp:
- Mar 2, 2013 1:15:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkheightmapviewer.tcl
r3405 r3409 158 158 private variable _fieldNames {} 159 159 private variable _fields 160 private variable _curFldName "Default" 160 private variable _curFldName "" 161 private variable _curFldLabel "" 161 162 private variable _numContours 0 162 163 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) … … 1012 1013 foreach { label units components } \ 1013 1014 [$_first fieldinfo $fname] break 1014 SendCmd "dataset maprange explicit $_limits(v) $fname"1015 1015 $itk_component(field) choices insert end "$fname" "$label" 1016 1016 $itk_component(fieldmenu) add radiobutton -label "$label" \ 1017 -value $label -variable [itcl::scope _curFld Name] \1017 -value $label -variable [itcl::scope _curFldLabel] \ 1018 1018 -selectcolor red \ 1019 1019 -activebackground $itk_option(-plotbackground) \ … … 1023 1023 set _fields($fname) [list $label $units $components] 1024 1024 set _curFldName $fname 1025 } 1026 } 1027 if { [array size _fields] == 1 } { 1028 set _curFldName [array names _fields] 1029 if { $_curFldName == "" } { 1030 puts stderr "no default name from field" 1031 set _curFldName "Default" 1032 } 1033 } 1034 $itk_component(field) value $_curFldName 1025 set _curFldLabel $label 1026 } 1027 } 1028 $itk_component(field) value $_curFldLabel 1035 1029 } 1036 1030 InitSettings stretchToFit … … 1041 1035 SendCmd "axis lformat $axis %g" 1042 1036 } 1037 1043 1038 foreach axis { x y z } { 1044 1039 set label [$_first hints ${axis}label] … … 1048 1043 set label [string toupper $axis] 1049 1044 } else { 1050 set label [lindex $_fields($_curFldName) 0]1045 set label $_curFldLabel 1051 1046 } 1052 1047 } else { … … 1491 1486 } 1492 1487 "field" { 1493 set new [$itk_component(field) value] 1494 set value [$itk_component(field) translate $new] 1495 set _settings(field) $value 1496 if { [info exists _fields($new)] } { 1497 set _colorMode scalar 1498 set _curFldName $new 1488 set label [$itk_component(field) value] 1489 set fname [$itk_component(field) translate $label] 1490 set _settings(field) $fname 1491 if { [info exists _fields($fname)] } { 1492 foreach { label units components } $_fields($fname) break 1493 if { $components > 1 } { 1494 set _colorMode vmag 1495 } else { 1496 set _colorMode scalar 1497 } 1498 set _curFldName $fname 1499 set _curFldLabel $label 1499 1500 } else { 1500 puts stderr "unknown field \"$ new\""1501 puts stderr "unknown field \"$fname\"" 1501 1502 return 1502 1503 } … … 1610 1611 return 1611 1612 } 1612 if { [info exists _fields($_curFldName)] } {1613 set title [lindex $_fields($_curFldName) 0]1614 if { $title != "component" } {1615 set h [expr $h - ($lineht + 2)]1616 }1617 } else {1618 return1619 }1620 1613 # Set the legend on the first heightmap dataset. 1621 1614 if { $_currentColormap != "" } { … … 1656 1649 set bMin [expr $heightScale * $dataScale * $vmin] 1657 1650 set bMax [expr $heightScale * $dataScale * $vmax] 1658 set fieldName $_curFldName 1659 SendCmd "dataset maprange explicit $_limits(v) $fieldName" 1651 SendCmd "dataset maprange explicit $_limits(v) $_curFldName" 1660 1652 SendCmd "axis bounds z $bMin $bMax" 1661 1653 SendCmd "axis range z $_limits(v)" … … 2440 2432 } 2441 2433 invoke { 2442 $itk_component(field) value $_curFld Name2434 $itk_component(field) value $_curFldLabel 2443 2435 AdjustSetting field 2444 2436 }
Note: See TracChangeset
for help on using the changeset viewer.