- Timestamp:
- Dec 1, 2008 12:17:26 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/nanovisviewer.tcl
r1247 r1248 119 119 private variable isomarkers_ ;# array of isosurface level values 0..1 120 120 private common settings_ 121 private variable activeId_ "" ;# The currently active volume. This 121 private variable activeTf_ "" ;# The currently active transfer function. 122 # This 122 123 # indicates which isomarkers and transfer 123 124 # function to use when changing markers, … … 827 828 _send "up $axis" 828 829 } 829 # The active volume is by default the first component of the first830 # data object. This assumes that the data is always successfully831 # transferred.830 # The active transfer function is by default the first component of 831 # the first data object. This assumes that the data is always 832 # successfully transferred. 832 833 set comp [lindex [$first components] 0] 833 set active Id_ $_obj2id($first-$comp)834 set activeTf_ $_id2style($_obj2id($first-$comp)) 834 835 } 835 836 foreach key [array names _obj2id *-*] { … … 868 869 # ---------------------------------------------------------------------- 869 870 itcl::body Rappture::NanovisViewer::_SendTransferFunctions {} { 871 if { $activeTf_ == "" } { 872 return 873 } 874 set tf $activeTf_ 870 875 set first [lindex [get] 0] 871 876 872 877 # Insure that the global opacity and thickness settings (in the slider 873 # settings widgets) are used for the transfer-function used by the active874 # v olume. Update the values in the settings_ varible.878 # settings widgets) are used for the active transfer-function. Update the 879 # values in the settings_ varible. 875 880 set inner [$itk_component(controls).panel component inner] 876 set tf $_id2style($activeId_)877 881 set value [$inner.scales.opacity get] 878 882 set opacity [expr { double($value) * 0.01 }] … … 916 920 # the slave interpreter. The purpose is to collect data of the image 917 921 # representing the legend in the canvas. In addition, the isomarkers 918 # of the active volumeare displayed.922 # of the active transfer function are displayed. 919 923 # 920 924 # I don't know is this is the right place to display the isomarkers. … … 947 951 [itcl::code $this _AddIsoMarker %x %y] 948 952 } 949 # Display the markers used by the active volume.950 set tf $ _id2style($activeId_)953 # Display the markers used by the active transfer function. 954 set tf $activeTf_ 951 955 952 956 array set limits [GetLimits $tf] … … 1101 1105 set ivol $_obj2id($first-$comp) 1102 1106 1103 set tf _id2style($ivol)1104 1105 1107 foreach comp [$first components] { 1106 1108 foreach ivol $_obj2id($first-$comp) { … … 1434 1436 } 1435 1437 opacity { 1436 if {[isconnected] && $active Id_ != "" } {1438 if {[isconnected] && $activeTf_ != "" } { 1437 1439 set val [$inner.scales.opacity get] 1438 1440 set sval [expr { 0.01 * double($val) }] 1439 set tf $ _id2style($activeId_)1441 set tf $activeTf_ 1440 1442 set settings_($this-$tf-opacity) $sval 1441 1443 UpdateTransferFunctions … … 1444 1446 1445 1447 thickness { 1446 if {[isconnected] && $active Id_ != "" } {1448 if {[isconnected] && $activeTf_ != "" } { 1447 1449 set val [$inner.scales.thickness get] 1448 1450 # Scale values between 0.00001 and 0.01000 1449 1451 set sval [expr {0.0001*double($val)}] 1450 set tf $ _id2style($activeId_)1452 set tf $activeTf_ 1451 1453 set settings_($this-$tf-thickness) $sval 1452 1454 UpdateTransferFunctions … … 1490 1492 set w [expr {[winfo width $itk_component(legend)]-20}] 1491 1493 set h [expr {[winfo height $itk_component(legend)]-20-$lineht}] 1492 set ivol $activeId_ 1493 if {$w > 0 && $h > 0 && "" != $ivol} { 1494 _send "legend $ivol $w $h" 1494 if {$w > 0 && $h > 0 && "" != $activeTf_} { 1495 _send "legend $activeTf_ $w $h" 1495 1496 } else { 1496 1497 # Can't do this as this will remove the items associated with the … … 1765 1766 1766 1767 itcl::body Rappture::NanovisViewer::_AddIsoMarker { x y } { 1767 if { $active Id_ == "" } {1768 error "active volumeisn't set"1769 } 1770 set tf $ _id2style($activeId_)1768 if { $activeTf_ == "" } { 1769 error "active transfer function isn't set" 1770 } 1771 set tf $activeTf_ 1771 1772 set c $itk_component(legend) 1772 1773 set m [IsoMarker \#auto $c $this $tf] -
trunk/packages/vizservers/nanovis/Command.cpp
r1240 r1248 923 923 if (objc != 4) { 924 924 Tcl_AppendResult(interp, "wrong # args: should be \"", 925 Tcl_GetString(objv[0]), " volIndex width height\"", (char*)NULL); 926 return TCL_ERROR; 927 } 928 929 Volume *volPtr; 930 if (GetVolumeFromObj(interp, objv[1], &volPtr) != TCL_OK) { 931 return TCL_ERROR; 932 } 925 Tcl_GetString(objv[0]), " transfunc width height\"", (char*)NULL); 926 return TCL_ERROR; 927 } 928 929 const char *string = Tcl_GetString(objv[1]); 933 930 TransferFunction *tf; 934 tf = NanoVis:: vol_renderer->get_volume_shading(volPtr);931 tf = NanoVis::get_transfunc(string); 935 932 if (tf == NULL) { 936 Tcl_AppendResult(interp, " no transfer function defined for volume \"",937 Tcl_GetString(objv[1]), "\"",(char*)NULL);933 Tcl_AppendResult(interp, "unknown transfer function \"", string, "\"", 934 (char*)NULL); 938 935 return TCL_ERROR; 939 936 } 940 937 const char *label; 941 938 label = Tcl_GetString(objv[1]); 942 943 939 int w, h; 944 940 if ((Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK) || 945 941 (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)) { 946 942 return TCL_ERROR; 947 }948 if (volPtr->update_pending) {949 NanoVis::SetVolumeRanges();950 943 } 951 944 NanoVis::render_legend(tf, -
trunk/packages/vizservers/nanovis/nanovis.cpp
r1247 r1248 2193 2193 DoExit(0); 2194 2194 } else { 2195 fcntl(0, F_SETFL, flags); 2196 return; 2195 break; 2197 2196 } 2198 2197 } … … 2220 2219 const char *string; 2221 2220 int nBytes; 2222 2223 string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &nBytes); 2221 int count; 2222 2223 string = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); 2224 nBytes = strlen(string); 2224 2225 struct iovec iov[3]; 2225 2226 iov[0].iov_base = (char *)"NanoVis Server Error: "; … … 2227 2228 iov[1].iov_base = (char *)string; 2228 2229 iov[1].iov_len = nBytes; 2229 iov[2].iov_base = (char *)'\n';2230 iov[2].iov_len = 1;2231 2230 iov[2].iov_len = 1; 2231 iov[2].iov_base = (char *)'\n'; 2232 writev(0, iov, 3); 2232 2233 if (debug_flag) { 2233 2234 fprintf(stderr, "leaving xinetd_listen\n");
Note: See TracChangeset
for help on using the changeset viewer.