Changeset 1248 for trunk


Ignore:
Timestamp:
Dec 1, 2008 12:17:26 PM (15 years ago)
Author:
gah
Message:

Fix for interrupted nanovis session

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/nanovisviewer.tcl

    r1247 r1248  
    119119    private variable isomarkers_    ;# array of isosurface level values 0..1
    120120    private common   settings_
    121     private variable activeId_ ""   ;# The currently active volume.  This
     121    private variable activeTf_ ""  ;# The currently active transfer function. 
     122                                    # This
    122123                                    # indicates which isomarkers and transfer
    123124                                    # function to use when changing markers,
     
    827828            _send "up $axis"
    828829        }
    829         # The active volume is by default the first component of the first
    830         # data object.  This assumes that the data is always successfully
    831         # 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.
    832833        set comp [lindex [$first components] 0]
    833         set activeId_ $_obj2id($first-$comp)
     834        set activeTf_ $_id2style($_obj2id($first-$comp))
    834835    }
    835836    foreach key [array names _obj2id *-*] {
     
    868869# ----------------------------------------------------------------------
    869870itcl::body Rappture::NanovisViewer::_SendTransferFunctions {} {
     871    if { $activeTf_ == "" } {
     872        return
     873    }
     874    set tf $activeTf_
    870875    set first [lindex [get] 0]
    871876
    872877    # Insure that the global opacity and thickness settings (in the slider
    873     # settings widgets) are used for the transfer-function used by the active
    874     # volume.  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.
    875880    set inner [$itk_component(controls).panel component inner]
    876     set tf $_id2style($activeId_)
    877881    set value [$inner.scales.opacity get]
    878882    set opacity [expr { double($value) * 0.01 }]
     
    916920#       the slave interpreter.  The purpose is to collect data of the image
    917921#       representing the legend in the canvas.  In addition, the isomarkers
    918 #       of the active volume are displayed.
     922#       of the active transfer function are displayed.
    919923#
    920924#       I don't know is this is the right place to display the isomarkers.
     
    947951            [itcl::code $this _AddIsoMarker %x %y]
    948952    }
    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_
    951955
    952956    array set limits [GetLimits $tf]
     
    11011105        set ivol $_obj2id($first-$comp)
    11021106       
    1103         set tf _id2style($ivol)
    1104    
    11051107        foreach comp [$first components] {
    11061108            foreach ivol $_obj2id($first-$comp) {
     
    14341436        }
    14351437        opacity {
    1436             if {[isconnected] && $activeId_ != "" } {
     1438            if {[isconnected] && $activeTf_ != "" } {
    14371439                set val [$inner.scales.opacity get]
    14381440                set sval [expr { 0.01 * double($val) }]
    1439                 set tf $_id2style($activeId_)
     1441                set tf $activeTf_
    14401442                set settings_($this-$tf-opacity) $sval
    14411443                UpdateTransferFunctions
     
    14441446
    14451447        thickness {
    1446             if {[isconnected] && $activeId_ != "" } {
     1448            if {[isconnected] && $activeTf_ != "" } {
    14471449                set val [$inner.scales.thickness get]
    14481450                # Scale values between 0.00001 and 0.01000
    14491451                set sval [expr {0.0001*double($val)}]
    1450                 set tf $_id2style($activeId_)
     1452                set tf $activeTf_
    14511453                set settings_($this-$tf-thickness) $sval
    14521454                UpdateTransferFunctions
     
    14901492    set w [expr {[winfo width $itk_component(legend)]-20}]
    14911493    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"
    14951496    } else {
    14961497        # Can't do this as this will remove the items associated with the
     
    17651766
    17661767itcl::body Rappture::NanovisViewer::_AddIsoMarker { x y } {
    1767     if { $activeId_ == "" } {
    1768         error "active volume isn't set"
    1769     }
    1770     set tf $_id2style($activeId_)
     1768    if { $activeTf_ == "" } {
     1769        error "active transfer function isn't set"
     1770    }
     1771    set tf $activeTf_
    17711772    set c $itk_component(legend)
    17721773    set m [IsoMarker \#auto $c $this $tf]
  • trunk/packages/vizservers/nanovis/Command.cpp

    r1240 r1248  
    923923    if (objc != 4) {
    924924        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]);
    933930    TransferFunction *tf;
    934     tf = NanoVis::vol_renderer->get_volume_shading(volPtr);
     931    tf = NanoVis::get_transfunc(string);
    935932    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);
    938935        return TCL_ERROR;
    939936    }
    940937    const char *label;
    941938    label = Tcl_GetString(objv[1]);
    942 
    943939    int w, h;
    944940    if ((Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK) ||
    945941        (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)) {
    946942        return TCL_ERROR;
    947     }
    948     if (volPtr->update_pending) {
    949         NanoVis::SetVolumeRanges();
    950943    }
    951944    NanoVis::render_legend(tf,
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r1247 r1248  
    21932193                    DoExit(0);
    21942194                } else {
    2195                     fcntl(0, F_SETFL, flags);
    2196                     return;
     2195                    break;
    21972196                }
    21982197            }
     
    22202219        const char *string;
    22212220        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);
    22242225        struct iovec iov[3];
    22252226        iov[0].iov_base = (char *)"NanoVis Server Error: ";
     
    22272228        iov[1].iov_base = (char *)string;
    22282229        iov[1].iov_len = nBytes;
    2229         iov[2].iov_base = (char *)'\n';
    2230         iov[2].iov_len = 1;
    2231         writev(0, iov, 3);
     2230        iov[2].iov_len = 1;
     2231        iov[2].iov_base = (char *)'\n';
     2232        writev(0, iov, 3);
    22322233        if (debug_flag) {
    22332234            fprintf(stderr, "leaving xinetd_listen\n");
Note: See TracChangeset for help on using the changeset viewer.