Ignore:
Timestamp:
Mar 3, 2013 12:52:51 PM (11 years ago)
Author:
gah
Message:

push SendCmd? into base class w/ buffering

File:
1 edited

Legend:

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

    r3407 r3421  
    7777    public method limits { tf }
    7878    public method overmarker { m x }
    79     public method sendto { string }
    8079    public method parameters {title args} {
    8180        # do nothing
     
    9897    protected method ReceiveLegend { tf vmin vmax size }
    9998    protected method Rotate {option x y}
    100     protected method SendCmd {string}
    10199    protected method SendTransferFuncs {}
    102100    protected method Slice {option args}
     
    124122    private variable _arcball ""
    125123    private variable _useArcball 1
    126     private variable _outbuf       ;# buffer for outgoing commands
    127124
    128125    private variable _dlist ""     ;# list of data objects
     
    149146    private variable _activeTfs
    150147    private variable _first ""     ;# This is the topmost volume.
    151     private variable _buffering 0
    152148
    153149    # This
     
    190186    $_dispatcher register !resize
    191187    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    192 
    193     set _outbuf ""
    194188
    195189    #
     
    644638
    645639    # disconnected -- no more data sitting on server
    646     set _outbuf ""
    647640    array unset _serverDatasets
    648641}
    649 
    650 #
    651 # sendto --
    652 #
    653 itcl::body Rappture::NanovisViewer::sendto { bytes } {
    654     SendBytes "$bytes\n"
    655 }
    656 
    657 #
    658 # SendCmd
    659 #
    660 #       Send commands off to the rendering server.  If we're currently
    661 #       sending data objects to the server, buffer the commands to be
    662 #       sent later.
    663 #
    664 itcl::body Rappture::NanovisViewer::SendCmd {string} {
    665     if { $_buffering } {
    666         append _outbuf $string "\n"
    667     } else {
    668         foreach line [split $string \n] {
    669             SendEcho >>line $line
    670         }
    671         SendBytes "$string\n"
    672     }
    673 }
    674 
    675642
    676643# ----------------------------------------------------------------------
     
    878845    # be preempted by a server disconnect/reconnect (which automatically
    879846    # generates a new call to Rebuild).   
    880     set _buffering 1
     847    StartBufferingCommands
    881848
    882849    # Hide all the isomarkers. Can't remove them. Have to remember the
     
    893860        set _height [winfo height $itk_component(3dview)]
    894861        DoResize
    895         if 1 {
     862        if { $_reportClientInfo } {
    896863            # Tell the server the name of the tool, the version, and
    897864            # dataset that we are rendering.  Have to do it here because
     
    923890                set data [$dataobj values $cname]
    924891                set nbytes [string length $data]
    925                 if 1 {
     892                if { $_reportClientInfo } {
    926893                    set info {}
    927894                    lappend info "tool_id"       [$dataobj hints toolId]
     
    934901                    SendCmd "clientinfo [list $info]"
    935902                }
    936                 append _outbuf "volume data follows $nbytes $tag\n"
     903                SendCmd "volume data follows $nbytes $tag"
    937904                append _outbuf $data
    938905                set _recvdDatasets($tag) 1
     
    1000967        }
    1001968    }
    1002     set _buffering 0;                        # Turn off buffering.
    1003969    # Actually write the commands to the server socket.  If it fails, we don't
    1004970    # care.  We're finished here.
    1005971    blt::busy hold $itk_component(hull)
    1006     SendBytes $_outbuf;                       
     972    StopBufferingCommands
    1007973    blt::busy release $itk_component(hull)
    1008974    set _reset 0
    1009     set _outbuf "";                        # Clear the buffer.               
    1010975}
    1011976
Note: See TracChangeset for help on using the changeset viewer.