Ignore:
Timestamp:
Mar 9, 2015 8:04:58 PM (6 years ago)
Author:
ldelgass
Message:

whitespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r5110 r5115  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22
    33# ----------------------------------------------------------------------
     
    2020#
    2121# FIXME:
    22 #       Need to Add DX readers this client to examine the data before 
     22#       Need to Add DX readers this client to examine the data before
    2323#       it's sent to the server.  This will eliminate 90% of the insanity in
    24 #       computing the limits of all the volumes.  I can rip out all the 
     24#       computing the limits of all the volumes.  I can rip out all the
    2525#       "receive data" "send transfer function" event crap.
    2626#
     
    3030#       when a new volume is drawn (using the default transfer function) and
    3131#       then when the correct transfer function has been sent and linked to
    32 #       the volume. 
     32#       the volume.
    3333#
    3434option add *NanovisViewer.width 4i widgetDefault
     
    7777    public method limits { tf }
    7878    public method overmarker { m x }
    79     public method parameters {title args} { 
    80         # do nothing 
     79    public method parameters {title args} {
     80        # do nothing
    8181    }
    8282    public method rmdupmarker { m x }
     
    110110    private method ResetColormap { color }
    111111    private method ComputeTransferFunc { tf }
    112     private method EventuallyResize { w h } 
    113     private method EventuallyResizeLegend { } 
     112    private method EventuallyResize { w h }
     113    private method EventuallyResizeLegend { }
    114114    private method NameTransferFunc { dataobj comp }
    115115    private method PanCamera {}
     
    125125    private variable _allDataObjs
    126126    private variable _obj2ovride   ;# maps dataobj => style override
    127     private variable _serverDatasets   ;# contains all the dataobj-component 
     127    private variable _serverDatasets   ;# contains all the dataobj-component
    128128                                   ;# to volumes in the server
    129     private variable _serverTfs    ;# contains all the transfer functions 
     129    private variable _serverTfs    ;# contains all the transfer functions
    130130                                   ;# in the server.
    131131    private variable _recvdDatasets    ;# list of data objs to send to server
    132132    private variable _dataset2style    ;# maps dataobj-component to transfunc
    133     private variable _style2datasets   ;# maps tf back to list of 
    134                                     # dataobj-components using the tf.
    135 
    136     private variable _reset 1;          # Connection to server has been reset
     133    private variable _style2datasets   ;# maps tf back to list of
     134                                        # dataobj-components using the tf.
     135
     136    private variable _reset 1      ;# Connection to server has been reset
    137137    private variable _click        ;# info used for rotate operations
    138138    private variable _limits       ;# autoscale min/max for all axes
    139139    private variable _view         ;# view params for 3D view
    140     private variable _isomarkers    ;# array of isosurface level values 0..1
     140    private variable _isomarkers   ;# array of isosurface level values 0..1
    141141    private variable  _settings
    142142    # Array of transfer functions in server.  If 0 the transfer has been
     
    146146    private variable _first ""     ;# This is the topmost volume.
    147147
    148     # This
    149     # indicates which isomarkers and transfer
    150     # function to use when changing markers,
    151     # opacity, or thickness.
    152148    common _downloadPopup          ;# download options from popup
    153149    private common _hardcopy
     
    216212        $this-qy                $_view(qy)
    217213        $this-qz                $_view(qz)
    218         $this-zoom              $_view(zoom)   
     214        $this-zoom              $_view(zoom)
    219215        $this-xpan              $_view(xpan)
    220216        $this-ypan              $_view(ypan)
     
    292288        BuildCameraTab
    293289    } errs] != 0 } {
    294         global errorInfo
     290        global errorInfo
    295291        puts stderr "errs=$errs errorInfo=$errorInfo"
    296292    }
     
    309305        [itcl::code $this EventuallyResizeLegend]
    310306
    311     # Hack around the Tk panewindow.  The problem is that the requested 
     307    # Hack around the Tk panewindow.  The problem is that the requested
    312308    # size of the 3d view isn't set until an image is retrieved from
    313309    # the server.  So the panewindow uses the tiny size.
     
    316312    blt::table $itk_component(plotarea) \
    317313        0,0 $itk_component(3dview) -fill both -reqwidth $w \
    318         1,0 $itk_component(legend) -fill x 
     314        1,0 $itk_component(legend) -fill x
    319315    blt::table configure $itk_component(plotarea) r1 -resize none
    320316
     
    573569            # to the BLT picture image it won't be necessary to decode the
    574570            # image data.
    575             if { [image width $_image(plot)] > 0 && 
     571            if { [image width $_image(plot)] > 0 &&
    576572                 [image height $_image(plot)] > 0 } {
    577573                set bytes [$_image(plot) data -format "jpeg -quality 100"]
     
    599595        return 0
    600596    }
    601     set _reset 1 
     597    set _reset 1
    602598    set result [VisViewer::Connect $_hosts]
    603599    if { $result } {
     
    680676    foreach tag [CurrentDatasets] {
    681677        if { ![info exists _serverDatasets($tag)] || !$_serverDatasets($tag) } {
    682             # The volume hasn't reached the server yet.  How did we get 
     678            # The volume hasn't reached the server yet.  How did we get
    683679            # here?
    684680            puts stderr "Don't have $tag in _serverDatasets"
     
    694690        ComputeTransferFunc $tf
    695691        # FIXME: Need to the send information as to what transfer functions
    696         #        to update so that we only update the transfer function 
    697         #        as necessary.  Right now, all transfer functions are 
     692        #        to update so that we only update the transfer function
     693        #        as necessary.  Right now, all transfer functions are
    698694        #        updated. This makes moving the isomarker slider chunky.
    699695        if { ![info exists _activeTfs($tf)] || !$_activeTfs($tf) } {
     
    722718    ReceiveEcho <<line "<read $info(-bytes) bytes"
    723719    if { $info(-type) == "image" } {
    724         ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"       
     720        ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"
    725721        $_image(plot) configure -data $bytes
    726722    } elseif { $info(-type) == "print" } {
     
    735731#       The procedure is the response from the render server to each "legend"
    736732#       command.  The server sends back a "legend" command invoked our
    737 #       the slave interpreter.  The purpose is to collect data of the image 
     733#       the slave interpreter.  The purpose is to collect data of the image
    738734#       representing the legend in the canvas.  In addition, the isomarkers
    739735#       of the active transfer function are displayed.
    740736#
    741737#       I don't know is this is the right place to display the isomarkers.
    742 #       I don't know all the different paths used to draw the plot. There's 
     738#       I don't know all the different paths used to draw the plot. There's
    743739#       "Rebuild", "add", etc.
    744740#
     
    873869    # Turn on buffering of commands to the server.  We don't want to
    874870    # be preempted by a server disconnect/reconnect (which automatically
    875     # generates a new call to Rebuild).   
     871    # generates a new call to Rebuild).
    876872    StartBufferingCommands
    877873
     
    932928    set _first [lindex [get] 0]
    933929    if { $_reset } {
    934         #
    935         # Reset the camera and other view parameters
    936         #
     930        #
     931        # Reset the camera and other view parameters
     932        #
    937933        set _settings($this-qw)    $_view(qw)
    938934        set _settings($this-qx)    $_view(qx)
    939935        set _settings($this-qy)    $_view(qy)
    940936        set _settings($this-qz)    $_view(qz)
    941         set _settings($this-xpan)  $_view(xpan)
    942         set _settings($this-ypan)  $_view(ypan)
    943         set _settings($this-zoom)  $_view(zoom)
     937        set _settings($this-xpan)  $_view(xpan)
     938        set _settings($this-ypan)  $_view(ypan)
     939        set _settings($this-zoom)  $_view(zoom)
    944940
    945941        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     
    947943        SendCmd "camera orient $q"
    948944        SendCmd "camera reset"
    949         PanCamera
    950         SendCmd "camera zoom $_view(zoom)"
    951         InitSettings light2side light transp isosurface grid axes 
    952        
     945        PanCamera
     946        SendCmd "camera zoom $_view(zoom)"
     947        InitSettings light2side light transp isosurface grid axes
     948
    953949        foreach axis {x y z} {
    954950            # Turn off cutplanes for all volumes
    955951            SendCmd "cutplane state 0 $axis"
    956952        }
    957         if {"" != $_first} {
    958             set axis [$_first hints updir]
    959             if { "" != $axis } {
    960                 SendCmd "up $axis"
    961             }
    962             set location [$_first hints camera]
    963             if { $location != "" } {
    964                 array set _view $location
    965             }
    966         }
     953        if {"" != $_first} {
     954            set axis [$_first hints updir]
     955            if { "" != $axis } {
     956                SendCmd "up $axis"
     957            }
     958            set location [$_first hints camera]
     959            if { $location != "" } {
     960                array set _view $location
     961            }
     962        }
    967963    }
    968964    # Outline seems to need to be reset every update.
     
    971967    SendCmd "volume state 0"
    972968    if {"" != $_first} {
    973         set datasets [array names _serverDatasets $_first-*] 
     969        set datasets [array names _serverDatasets $_first-*]
    974970        if { $datasets != "" } {
    975971            SendCmd "volume state 1 $datasets"
     
    12641260                blt::table $itk_component(plotarea) \
    12651261                    0,0 $itk_component(3dview) -fill both \
    1266                     1,0 $itk_component(legend) -fill x 
     1262                    1,0 $itk_component(legend) -fill x
    12671263                blt::table configure $itk_component(plotarea) r1 -resize none
    12681264            } else {
     
    12711267        }
    12721268        "volume" {
    1273             set datasets [CurrentDatasets -cutplanes] 
     1269            set datasets [CurrentDatasets -cutplanes]
    12741270            SendCmd "volume data state $_settings($this-volume) $datasets"
    12751271        }
     
    12771273            set axis [string range $what 0 0]
    12781274            set bool $_settings($this-$what)
    1279             set datasets [CurrentDatasets -cutplanes] 
     1275            set datasets [CurrentDatasets -cutplanes]
    12801276            set tag [lindex $datasets 0]
    12811277            SendCmd "cutplane state $bool $axis $tag"
     
    13141310        # Can't do this as this will remove the items associated with the
    13151311        # isomarkers.
    1316        
     1312
    13171313        #$itk_component(legend) delete all
    13181314    }
     
    13761372    # reference.
    13771373    #
    1378     # FIXME: The current way we generate transfer-function names completely 
    1379     #        ignores the -markers option.  The problem is that we are forced 
    1380     #        to compute the name from an increasing complex set of values: 
     1374    # FIXME: The current way we generate transfer-function names completely
     1375    #        ignores the -markers option.  The problem is that we are forced
     1376    #        to compute the name from an increasing complex set of values:
    13811377    #        color, levels, marker, opacity.  I think the cow's out of the
    13821378    #        barn on this one.
     
    15061502            set m [Rappture::IsoMarker \#auto $c $this $tf]
    15071503            $m relval $x
    1508             lappend _isomarkers($tf) $m 
     1504            lappend _isomarkers($tf) $m
    15091505        }
    15101506    } else {
     
    15121508            set m [Rappture::IsoMarker \#auto $c $this $tf]
    15131509            $m relval $x
    1514             lappend _isomarkers($tf) $m 
     1510            lappend _isomarkers($tf) $m
    15151511        }
    15161512    }
     
    15191515#
    15201516# The -markers option takes a list of zero or more values (the values
    1521 # may be separated either by spaces or commas) that have the following 
     1517# may be separated either by spaces or commas) that have the following
    15221518# format:
    15231519#
     
    15351531        set n [scan $marker "%g%s" value suffix]
    15361532        if { $n == 2 && $suffix == "%" } {
    1537             # ${n}% : Set relative value. 
     1533            # ${n}% : Set relative value.
    15381534            set value [expr {$value * 0.01}]
    15391535            set m [Rappture::IsoMarker \#auto $c $this $tf]
     
    15501546
    15511547# ----------------------------------------------------------------------
    1552 # USAGE: UndateTransferFuncs 
     1548# USAGE: UndateTransferFuncs
    15531549# ----------------------------------------------------------------------
    15541550itcl::body Rappture::NanovisViewer::updatetransferfuncs {} {
     
    16341630    if { $min != "" } {
    16351631        set _limits(min) $min
    1636     } 
     1632    }
    16371633    if { $max != "" } {
    16381634        set _limits(max) $max
     
    17051701        2,0 $inner.outline  -cspan 2 -anchor w \
    17061702        3,0 $inner.volume  -cspan 2 -anchor w \
    1707         4,0 $inner.legend  -cspan 2 -anchor w 
     1703        4,0 $inner.legend  -cspan 2 -anchor w
    17081704
    17091705    if 0 {
     
    17701766    label $inner.thick -text "Thick" -font $fg
    17711767
    1772     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     1768    label $inner.colormap_l -text "Colormap" -font "Arial 9"
    17731769    itk_component add colormap {
    17741770        Rappture::Combobox $inner.colormap -width 10 -editable no
     
    17921788        "grey-to-blue"       "grey-to-blue"     \
    17931789        "orange-to-blue"     "orange-to-blue"   \
    1794         "none"               "none"
     1790        "none"               "none"
    17951791
    17961792    $itk_component(colormap) value "BCGYR"
     
    19091905        0,1 $itk_component(xCutScale) \
    19101906        0,2 $itk_component(yCutScale) \
    1911         0,3 $itk_component(zCutScale) 
     1907        0,3 $itk_component(zCutScale)
    19121908
    19131909    blt::table configure $inner r0 r1 c* -resize none
     
    20242020}
    20252021
    2026 #  camera -- 
     2022#  camera --
    20272023#
    20282024itcl::body Rappture::NanovisViewer::camera {option args} {
    2029     switch -- $option { 
     2025    switch -- $option {
    20302026        "show" {
    20312027            puts [array get _view]
     
    21012097            -font "Arial 9"
    21022098        Rappture::Tooltip::for $inner.vol$row $info(description)
    2103         blt::table $inner $row,0 $inner.vol$row -anchor w 
     2099        blt::table $inner $row,0 $inner.vol$row -anchor w
    21042100        if { !$_settings($this-volume-$name) } {
    21052101            $inner.vol$row select
    2106         } 
     2102        }
    21072103        incr row
    21082104    }
     
    21102106    blt::table configure $inner r$row -resize expand
    21112107    blt::table configure $inner c3 -resize expand
    2112     event generate [winfo parent [winfo parent $w]] <Configure> 
     2108    event generate [winfo parent [winfo parent $w]] <Configure>
    21132109}
    21142110
     
    21182114}
    21192115
    2120 itcl::body Rappture::NanovisViewer::SetOrientation { side } { 
     2116itcl::body Rappture::NanovisViewer::SetOrientation { side } {
    21212117    array set positions {
    21222118        front "1 0 0 0"
     
    21292125    foreach name { qw qx qy qz } value $positions($side) {
    21302126        set _view($name) $value
    2131     } 
     2127    }
    21322128    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    21332129    $_arcball quaternion $q
    2134     SendCmd "camera orient $q" 
     2130    SendCmd "camera orient $q"
    21352131    SendCmd "camera reset"
    21362132    set _view(xpan) 0
Note: See TracChangeset for help on using the changeset viewer.