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

push SendCmd? into base class w/ buffering

File:
1 edited

Legend:

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

    r3418 r3421  
    5959    public method isconnected {}
    6060    public method limits { colormap }
    61     public method sendto { string }
    6261    public method parameters {title args} {
    6362        # do nothing
     
    7978    protected method ReceiveLegend { colormap title vmin vmax size }
    8079    protected method Rotate {option x y}
    81     protected method SendCmd {string}
    8280    protected method Zoom {option}
    8381
     
    109107
    110108    private variable _arcball ""
    111     private variable _outbuf;           # buffer for outgoing commands
    112 
    113109    private variable _dlist "";         # list of data objects
    114110    private variable _allDataObjs
     
    136132    private variable _first ""     ;# This is the topmost dataset.
    137133    private variable _start 0
    138     private variable _buffering 0
    139134    private variable _title ""
    140135
     
    176171    $_dispatcher register !rotate
    177172    $_dispatcher dispatch $this !rotate "[itcl::code $this DoRotate]; list"
    178 
    179     set _outbuf ""
    180173
    181174    #
     
    313306    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    314307
    315     puts stderr "BuildMeshTab"
    316308    if { [catch { BuildMeshTab } errs ]  != 0 } {
    317309        puts stderr "errs=$errs"
    318310    }
    319     puts stderr "BuildMoleculeTab"
    320311    if { [catch { BuildMoleculeTab } errs ]  != 0 } {
    321312        global errorInfo
     
    431422    set _start [clock clicks -milliseconds]
    432423    SendCmd "screen size $_width $_height"
    433     #SendCmd "imgflush"
    434 
    435424    # Must reset camera to have object scaling to take effect.
    436     #SendCmd "camera reset"
    437     #SendCmd "camera zoom $_view(zoom)"
     425    SendCmd "camera reset"
    438426    set _resizePending 0
    439427}
     
    755743
    756744    # disconnected -- no more data sitting on server
    757     set _outbuf ""
    758745    array unset _datasets
    759746    array unset _data
    760747    array unset _colormaps
    761 }
    762 
    763 #
    764 # sendto --
    765 #
    766 itcl::body Rappture::VtkViewer::sendto { bytes } {
    767     SendBytes "$bytes\n"
    768 }
    769 
    770 #
    771 # SendCmd
    772 #
    773 #       Send commands off to the rendering server.  If we're currently
    774 #       sending data objects to the server, buffer the commands to be
    775 #       sent later.
    776 #
    777 itcl::body Rappture::VtkViewer::SendCmd {string} {
    778     if { $_buffering } {
    779         append _outbuf $string "\n"
    780     } else {
    781         SendBytes "$string\n"
    782     }
    783748}
    784749
     
    878843    # be preempted by a server disconnect/reconnect (which automatically
    879844    # generates a new call to Rebuild).   
    880     set _buffering 1
     845    StartBufferingCommands
    881846
    882847    if { $_reset } {
    883         if 1 {
     848        if { $_reportClientInfo } {
    884849            # Tell the server the name of the tool, the version, and dataset
    885850            # that we are rendering.  Have to do it here because we don't know
     
    930895                }
    931896                set length [string length $bytes]
    932                 if 1 {
     897                if { $_reportClientInfo } {
    933898                    set info {}
    934899                    lappend info "tool_id"       [$dataobj hints toolId]
     
    941906                    SendCmd [list "clientinfo" $info]
    942907                }
    943                 append _outbuf "dataset add $tag data follows $length\n"
     908                SendCmd "dataset add $tag data follows $length"
    944909                append _outbuf $bytes
    945910                set _datasets($tag) 1
     
    988953    SendCmd "dataset maprange visible"
    989954       
    990     set _buffering 0;                        # Turn off buffering.
    991955    set _reset 0
    992956
     
    994958    # care.  We're finished here.
    995959    blt::busy hold $itk_component(hull)
    996     SendBytes $_outbuf;                       
     960    StopBufferingCommands
    997961    blt::busy release $itk_component(hull)
    998     set _outbuf "";                        # Clear the buffer.               
    999962}
    1000963
     
    15891552#
    15901553itcl::body Rappture::VtkViewer::BuildColormap { name styles } {
    1591     puts stderr name=$name
    15921554    if { $name ==  "elementDefault" } {
    15931555        return
Note: See TracChangeset for help on using the changeset viewer.