Changeset 5798


Ignore:
Timestamp:
Aug 3, 2015 1:40:43 AM (9 years ago)
Author:
ldelgass
Message:

merge r5729 from trunk

Location:
branches/1.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

    • Property svn:mergeinfo changed
      /trunkmerged: 5729
  • branches/1.3/gui/scripts/flowvisviewer.tcl

    r5638 r5798  
    33#  COMPONENT: flowvisviewer - 3D flow rendering
    44#
    5 #  This widget performs volume and flow rendering on 3D scalar/vector datasets.
     5#  This widget performs volume and flow rendering on 3D vector datasets.
    66#  It connects to the Nanovis server running on a rendering farm,
    77#  transmits data, and displays the results.
    88# ======================================================================
    99#  AUTHOR:  Michael McLennan, Purdue University
    10 #  Copyright (c) 2004-2012  HUBzero Foundation, LLC
     10#  Copyright (c) 2004-2015  HUBzero Foundation, LLC
    1111#
    1212#  See the file "license.terms" for information on usage and
     
    172172    set _serverType "nanovis"
    173173
    174     # Draw legend event
     174    #DebugOn
     175    EnableWaitDialog 900
     176
     177    # Rebuild event
     178    $_dispatcher register !rebuild
     179    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
     180
     181    # Resize event
     182    $_dispatcher register !resize
     183    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     184
     185    # Legend event
    175186    $_dispatcher register !legend
    176187    $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"
     
    180191    $_dispatcher dispatch $this !send_transfunc \
    181192        "[itcl::code $this SendTransferFunctions]; list"
    182 
    183     # Rebuild event
    184     $_dispatcher register !rebuild
    185     $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    186 
    187     # Resize event
    188     $_dispatcher register !resize
    189     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    190193
    191194    $_dispatcher register !play
     
    212215    # Initialize the view to some default parameters.
    213216    array set _view {
    214         -qw      0.853553
    215         -qx      -0.353553
    216         -qy      0.353553
    217         -qz      0.146447
    218         -xpan    0
    219         -ypan    0
    220         -zoom    1.0
     217        -qw       0.853553
     218        -qx       -0.353553
     219        -qy       0.353553
     220        -qz       0.146447
     221        -xpan     0
     222        -ypan     0
     223        -zoom     1.0
    221224    }
    222225    set _arcball [blt::arcball create 100 100]
     
    266269    }]
    267270
    268     itk_component add 3dview {
     271    itk_component add view {
    269272        label $itk_component(plotarea).view -image $_image(plot) \
    270273            -highlightthickness 0 -borderwidth 0
     
    273276        ignore -highlightthickness -borderwidth  -background
    274277    }
    275     bind $itk_component(3dview) <Control-F1> [itcl::code $this ToggleConsole]
     278    bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole]
    276279
    277280    set f [$itk_component(main) component controls]
     
    317320            -onimage [Rappture::icon volume-on] \
    318321            -offimage [Rappture::icon volume-off] \
    319             -command [itcl::code $this AdjustSetting -volume] \
    320             -variable [itcl::scope _settings(-volume)]
     322            -variable [itcl::scope _settings(-volume)] \
     323            -command [itcl::code $this AdjustSetting -volume]
    321324    }
    322325    $itk_component(volume) select
     
    362365    # the server.  So the panewindow uses the tiny size.
    363366    set w 10000
    364     pack forget $itk_component(3dview)
     367    pack forget $itk_component(view)
    365368    blt::table $itk_component(plotarea) \
    366         0,0 $itk_component(3dview) -fill both -reqwidth $w \
     369        0,0 $itk_component(view) -fill both -reqwidth $w \
    367370        1,0 $itk_component(legend) -fill x
    368371    blt::table configure $itk_component(plotarea) r1 -resize none
     
    511514    blt::table configure $itk_component(flowcontrols) r0 -pady 1
    512515    # Bindings for rotation via mouse
    513     bind $itk_component(3dview) <ButtonPress-1> \
     516    bind $itk_component(view) <ButtonPress-1> \
    514517        [itcl::code $this Rotate click %x %y]
    515     bind $itk_component(3dview) <B1-Motion> \
     518    bind $itk_component(view) <B1-Motion> \
    516519        [itcl::code $this Rotate drag %x %y]
    517     bind $itk_component(3dview) <ButtonRelease-1> \
     520    bind $itk_component(view) <ButtonRelease-1> \
    518521        [itcl::code $this Rotate release %x %y]
    519522
    520     bind $itk_component(3dview) <Configure> \
     523    bind $itk_component(view) <Configure> \
    521524        [itcl::code $this EventuallyResize %w %h]
    522525
    523526    # Bindings for panning via mouse
    524     bind $itk_component(3dview) <ButtonPress-2> \
     527    bind $itk_component(view) <ButtonPress-2> \
    525528        [itcl::code $this Pan click %x %y]
    526     bind $itk_component(3dview) <B2-Motion> \
     529    bind $itk_component(view) <B2-Motion> \
    527530        [itcl::code $this Pan drag %x %y]
    528     bind $itk_component(3dview) <ButtonRelease-2> \
     531    bind $itk_component(view) <ButtonRelease-2> \
    529532        [itcl::code $this Pan release %x %y]
    530533
    531534    # Bindings for panning via keyboard
    532     bind $itk_component(3dview) <KeyPress-Left> \
     535    bind $itk_component(view) <KeyPress-Left> \
    533536        [itcl::code $this Pan set -10 0]
    534     bind $itk_component(3dview) <KeyPress-Right> \
     537    bind $itk_component(view) <KeyPress-Right> \
    535538        [itcl::code $this Pan set 10 0]
    536     bind $itk_component(3dview) <KeyPress-Up> \
     539    bind $itk_component(view) <KeyPress-Up> \
    537540        [itcl::code $this Pan set 0 -10]
    538     bind $itk_component(3dview) <KeyPress-Down> \
     541    bind $itk_component(view) <KeyPress-Down> \
    539542        [itcl::code $this Pan set 0 10]
    540     bind $itk_component(3dview) <Shift-KeyPress-Left> \
     543    bind $itk_component(view) <Shift-KeyPress-Left> \
    541544        [itcl::code $this Pan set -2 0]
    542     bind $itk_component(3dview) <Shift-KeyPress-Right> \
     545    bind $itk_component(view) <Shift-KeyPress-Right> \
    543546        [itcl::code $this Pan set 2 0]
    544     bind $itk_component(3dview) <Shift-KeyPress-Up> \
     547    bind $itk_component(view) <Shift-KeyPress-Up> \
    545548        [itcl::code $this Pan set 0 -2]
    546     bind $itk_component(3dview) <Shift-KeyPress-Down> \
     549    bind $itk_component(view) <Shift-KeyPress-Down> \
    547550        [itcl::code $this Pan set 0 2]
    548551
    549552    # Bindings for zoom via keyboard
    550     bind $itk_component(3dview) <KeyPress-Prior> \
     553    bind $itk_component(view) <KeyPress-Prior> \
    551554        [itcl::code $this Zoom out]
    552     bind $itk_component(3dview) <KeyPress-Next> \
     555    bind $itk_component(view) <KeyPress-Next> \
    553556        [itcl::code $this Zoom in]
    554557
    555     bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)"
     558    bind $itk_component(view) <Enter> "focus $itk_component(view)"
    556559
    557560    if {[string equal "x11" [tk windowingsystem]]} {
    558561        # Bindings for zoom via mouse
    559         bind $itk_component(3dview) <4> [itcl::code $this Zoom out]
    560         bind $itk_component(3dview) <5> [itcl::code $this Zoom in]
     562        bind $itk_component(view) <4> [itcl::code $this Zoom out]
     563        bind $itk_component(view) <5> [itcl::code $this Zoom in]
    561564    }
    562565
     
    565568    eval itk_initialize $args
    566569
    567     EnableWaitDialog 900
    568570    Connect
    569571}
     
    626628# ----------------------------------------------------------------------
    627629# USAGE: get ?-objects?
    628 # USAGE: get ?-image 3dview|legend?
     630# USAGE: get ?-image view|legend?
    629631#
    630632# Clients use this to query the list of objects being plotted, in
     
    656658        -image {
    657659            if {[llength $args] != 2} {
    658                 error "wrong # args: should be \"get -image 3dview|legend\""
     660                error "wrong # args: should be \"get -image view|legend\""
    659661            }
    660662            switch -- [lindex $args end] {
    661                 3dview {
     663                view {
    662664                    return $_image(plot)
    663665                }
     
    666668                }
    667669                default {
    668                     error "bad image name \"[lindex $args end]\": should be 3dview or legend"
     670                    error "bad image name \"[lindex $args end]\": should be view or legend"
    669671                }
    670672            }
     
    679681# USAGE: delete ?<dataobj1> <dataobj2> ...?
    680682#
    681 #       Clients use this to delete a dataobj from the plot.  If no dataobjs
    682 #       are specified, then all dataobjs are deleted.  No data objects are
    683 #       deleted.  They are only removed from the display list.
    684 #
     683# Clients use this to delete a dataobj from the plot.  If no dataobjs
     684# are specified, then all dataobjs are deleted.  No data objects are
     685# deleted.  They are only removed from the display list.
    685686# ----------------------------------------------------------------------
    686687itcl::body Rappture::FlowvisViewer::delete {args} {
     
    881882        }
    882883
    883         set w [winfo width $itk_component(3dview)]
    884         set h [winfo height $itk_component(3dview)]
     884        set w [winfo width $itk_component(view)]
     885        set h [winfo height $itk_component(view)]
    885886        EventuallyResize $w $h
    886887    }
     
    891892# isconnected --
    892893#
    893 #       Indicates if we are currently connected to the visualization server.
     894# Indicates if we are currently connected to the visualization server.
    894895#
    895896itcl::body Rappture::FlowvisViewer::isconnected {} {
     
    907908# Disconnect --
    908909#
    909 #       Clients use this method to disconnect from the current rendering
    910 #       server.
     910# Clients use this method to disconnect from the current rendering server.
    911911#
    912912itcl::body Rappture::FlowvisViewer::Disconnect {} {
     
    10331033# ReceiveLegend --
    10341034#
    1035 #       The procedure is the response from the render server to each "legend"
    1036 #       command.  The server sends back a "legend" command invoked our
    1037 #       the slave interpreter.  The purpose is to collect data of the image
    1038 #       representing the legend in the canvas.  In addition, the
    1039 #       active transfer function is displayed.
     1035# The procedure is the response from the render server to each "legend"
     1036# command.  The server sends back a "legend" command invoked our
     1037# the slave interpreter.  The purpose is to collect data of the image
     1038# representing the legend in the canvas.  In addition, the
     1039# active transfer function is displayed.
    10401040#
    10411041itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } {
     
    10531053# ReceiveData --
    10541054#
    1055 #       The procedure is the response from the render server to each "data
    1056 #       follows" command.  The server sends back a "data" command invoked our
    1057 #       the slave interpreter.  The purpose is to collect the min/max of the
    1058 #       volume sent to the render server.  Since the client (flowvisviewer)
    1059 #       doesn't parse 3D data formats, we rely on the server (nanovis) to
    1060 #       tell us what the limits are.  Once we've received the limits to all
    1061 #       the data we've sent (tracked by _recvdDatasets) we can then determine
    1062 #       what the transfer functions are for these volumes.
     1055# The procedure is the response from the render server to each "data
     1056# follows" command.  The server sends back a "data" command invoked our
     1057# the slave interpreter.  The purpose is to collect the min/max of the
     1058# volume sent to the render server.  Since the client (flowvisviewer)
     1059# doesn't parse 3D data formats, we rely on the server (nanovis) to
     1060# tell us what the limits are.  Once we've received the limits to all
     1061# the data we've sent (tracked by _recvdDatasets) we can then determine
     1062# what the transfer functions are for these volumes.
    10631063#
    10641064#
     
    11041104# ----------------------------------------------------------------------
    11051105itcl::body Rappture::FlowvisViewer::Rebuild {} {
    1106     set w [winfo width $itk_component(3dview)]
    1107     set h [winfo height $itk_component(3dview)]
     1106    set w [winfo width $itk_component(view)]
     1107    set h [winfo height $itk_component(view)]
    11081108    if { $w < 2 || $h < 2 } {
    11091109        update
     
    12151215            NameTransferFunction $dataobj $cname
    12161216        }
     1217        set _reset 0
    12171218    }
    12181219
     
    12461247    StopBufferingCommands
    12471248    blt::busy release $itk_component(hull)
    1248     set _reset 0
    12491249}
    12501250
     
    13441344    switch -- $option {
    13451345        click {
    1346             $itk_component(3dview) configure -cursor fleur
     1346            $itk_component(view) configure -cursor fleur
    13471347            set _click(x) $x
    13481348            set _click(y) $y
     
    13521352                Rotate click $x $y
    13531353            } else {
    1354                 set w [winfo width $itk_component(3dview)]
    1355                 set h [winfo height $itk_component(3dview)]
     1354                set w [winfo width $itk_component(view)]
     1355                set h [winfo height $itk_component(view)]
    13561356                if {$w <= 0 || $h <= 0} {
    13571357                    return
     
    13801380        release {
    13811381            Rotate drag $x $y
    1382             $itk_component(3dview) configure -cursor ""
     1382            $itk_component(view) configure -cursor ""
    13831383            catch {unset _click}
    13841384        }
     
    13991399itcl::body Rappture::FlowvisViewer::Pan {option x y} {
    14001400    # Experimental stuff
    1401     set w [winfo width $itk_component(3dview)]
    1402     set h [winfo height $itk_component(3dview)]
     1401    set w [winfo width $itk_component(view)]
     1402    set h [winfo height $itk_component(view)]
    14031403    if { $option == "set" } {
    14041404        set x [expr $x / double($w)]
     
    14141414        set _click(x) $x
    14151415        set _click(y) $y
    1416         $itk_component(3dview) configure -cursor hand1
     1416        $itk_component(view) configure -cursor hand1
    14171417    }
    14181418    if { $option == "drag" || $option == "release" } {
     
    14281428    }
    14291429    if { $option == "release" } {
    1430         $itk_component(3dview) configure -cursor ""
     1430        $itk_component(view) configure -cursor ""
    14311431    }
    14321432}
     
    15011501            if { $_settings($what) } {
    15021502                blt::table $itk_component(plotarea) \
    1503                     0,0 $itk_component(3dview) -fill both \
     1503                    0,0 $itk_component(view) -fill both \
    15041504                    1,0 $itk_component(legend) -fill x
    15051505                blt::table configure $itk_component(plotarea) r1 -resize none
     
    16161616# NameTransferFunction --
    16171617#
    1618 #       Creates a transfer function name based on the <style> settings in the
    1619 #       library run.xml file. This placeholder will be used later to create
    1620 #       and send the actual transfer function once the data info has been sent
    1621 #       to us by the render server. [We won't know the volume limits until the
    1622 #       server parses the 3D data and sends back the limits via ReceiveData.]
     1618# Creates a transfer function name based on the <style> settings in the
     1619# library run.xml file. This placeholder will be used later to create
     1620# and send the actual transfer function once the data info has been sent
     1621# to us by the render server. [We won't know the volume limits until the
     1622# server parses the 3D data and sends back the limits via ReceiveData.]
    16231623#
    16241624itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } {
     
    16421642# ComputeTransferFunction --
    16431643#
    1644 #       Computes and sends the transfer function to the render server.  It's
    1645 #       assumed that the volume data limits are known and that the global
    1646 #       transfer-functions slider values have been set up.  Both parts are
    1647 #       needed to compute the relative value (location) of the marker, and
    1648 #       the alpha map of the transfer function.
     1644# Computes and sends the transfer function to the render server.  It's
     1645# assumed that the volume data limits are known and that the global
     1646# transfer-functions slider values have been set up.  Both parts are
     1647# needed to compute the relative value (location) of the marker, and
     1648# the alpha map of the transfer function.
    16491649#
    16501650itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } {
     
    26342634        }
    26352635        "next" {
    2636             if { ![winfo viewable $itk_component(3dview)] } {
     2636            if { ![winfo viewable $itk_component(view)] } {
    26372637                flow stop
    26382638                return
     
    29492949# BuildVolumeComponents --
    29502950#
    2951 #    This is called from the "scale" method which is called when a new
    2952 #    dataset is added or deleted.  It repopulates the dropdown menu of
    2953 #    volume component names.  It sets the current component to the first
    2954 #    component in the list (of components found).  Finally, if there is
    2955 #    only one component, don't display the label or the combobox in the
    2956 #    volume settings tab.
     2951# This is called from the "scale" method which is called when a new
     2952# dataset is added or deleted.  It repopulates the dropdown menu of
     2953# volume component names.  It sets the current component to the first
     2954# component in the list (of components found).  Finally, if there is
     2955# only one component, don't display the label or the combobox in the
     2956# volume settings tab.
    29572957#
    29582958itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} {
     
    29682968# GetDatasetsWithComponents --
    29692969#
    2970 #    Returns a list of all the datasets (known by the combination of their
    2971 #    data object and component name) that match the given component name.
    2972 #    For example, this is used where we want to change the settings of
    2973 #    volumes that have the current component.
     2970# Returns a list of all the datasets (known by the combination of their
     2971# data object and component name) that match the given component name.
     2972# For example, this is used where we want to change the settings of
     2973# volumes that have the current component.
    29742974#
    29752975itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } {
  • branches/1.3/gui/scripts/molvisviewer.tcl

    r5734 r5798  
    88# ======================================================================
    99#  AUTHOR:  Michael McLennan, Purdue University
    10 #  Copyright (c) 2004-2012  HUBzero Foundation, LLC
     10#  Copyright (c) 2004-2015  HUBzero Foundation, LLC
    1111#
    1212#  See the file "license.terms" for information on usage and
     
    230230    }]
    231231
    232     itk_component add 3dview {
     232    itk_component add view {
    233233        label $itk_component(plotarea).view -image $_image(plot) \
    234234            -highlightthickness 0 -borderwidth 0
     
    237237        ignore -highlightthickness -borderwidth  -background
    238238    }
    239     bind $itk_component(3dview) <Control-F1> [itcl::code $this ToggleConsole]
     239    bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole]
    240240
    241241    set f [$itk_component(main) component controls]
     
    312312    BuildSettingsTab
    313313
    314     # HACK ALERT. Initially force a requested width of the 3dview label.
    315 
    316     # It's a chicken-and-the-egg problem.  The size of the 3dview label is set
     314    # HACK ALERT. Initially force a requested width of the view label.
     315
     316    # It's a chicken-and-the-egg problem.  The size of the view label is set
    317317    # from the size of the image retrieved from the server.  But the size of
    318318    # the image is specified by the viewport which is the size of the label.
     
    324324    # (that's why we're using the blt::table to manage the geometry).  It has
    325325    # to be big, because we don't know how big the user may want to stretch
    326     # the window.  This at least forces the sidebarframe to give the 3dview
     326    # the window.  This at least forces the sidebarframe to give the view
    327327    # the maximum size available, which is perfect for an initially closed
    328328    # sidebar.
    329329
    330330    blt::table $itk_component(plotarea) \
    331         0,0 $itk_component(3dview) -fill both -reqwidth 10000
     331        0,0 $itk_component(view) -fill both -reqwidth 10000
    332332    #
    333333    # RENDERING AREA
     
    338338    if { $_useVmouseEvents } {
    339339        # set up bindings to bridge mouse events to server
    340         bind $itk_component(3dview) <ButtonPress> \
     340        bind $itk_component(view) <ButtonPress> \
    341341            [itcl::code $this Vmouse click %b %s %x %y]
    342         bind $itk_component(3dview) <ButtonRelease> \
     342        bind $itk_component(view) <ButtonRelease> \
    343343            [itcl::code $this Vmouse release %b %s %x %y]
    344         bind $itk_component(3dview) <B1-Motion> \
     344        bind $itk_component(view) <B1-Motion> \
    345345            [itcl::code $this Vmouse drag 1 %s %x %y]
    346         bind $itk_component(3dview) <B2-Motion> \
     346        bind $itk_component(view) <B2-Motion> \
    347347            [itcl::code $this Vmouse drag 2 %s %x %y]
    348         bind $itk_component(3dview) <B3-Motion> \
     348        bind $itk_component(view) <B3-Motion> \
    349349            [itcl::code $this Vmouse drag 3 %s %x %y]
    350         bind $itk_component(3dview) <Motion> \
     350        bind $itk_component(view) <Motion> \
    351351            [itcl::code $this Vmouse move 0 %s %x %y]
    352352    } else {
    353353        # set up bindings for rotation with mouse
    354         bind $itk_component(3dview) <ButtonPress-1> \
     354        bind $itk_component(view) <ButtonPress-1> \
    355355            [itcl::code $this Rotate click %x %y]
    356         bind $itk_component(3dview) <B1-Motion> \
     356        bind $itk_component(view) <B1-Motion> \
    357357            [itcl::code $this Rotate drag %x %y]
    358         bind $itk_component(3dview) <ButtonRelease-1> \
     358        bind $itk_component(view) <ButtonRelease-1> \
    359359            [itcl::code $this Rotate release %x %y]
    360360
    361361        # set up bindings for panning with mouse
    362         bind $itk_component(3dview) <ButtonPress-2> \
     362        bind $itk_component(view) <ButtonPress-2> \
    363363            [itcl::code $this Pan click %x %y]
    364         bind $itk_component(3dview) <B2-Motion> \
     364        bind $itk_component(view) <B2-Motion> \
    365365            [itcl::code $this Pan drag %x %y]
    366         bind $itk_component(3dview) <ButtonRelease-2> \
     366        bind $itk_component(view) <ButtonRelease-2> \
    367367            [itcl::code $this Pan release %x %y]
    368368
    369369        # scroll wheel zoom
    370370        if {[string equal "x11" [tk windowingsystem]]} {
    371             bind $itk_component(3dview) <4> [itcl::code $this Zoom out 2]
    372             bind $itk_component(3dview) <5> [itcl::code $this Zoom in 2]
     371            bind $itk_component(view) <4> [itcl::code $this Zoom out 2]
     372            bind $itk_component(view) <5> [itcl::code $this Zoom in 2]
    373373        }
    374374    }
    375375
    376376    # Set up bindings for panning with keyboard
    377     bind $itk_component(3dview) <KeyPress-Left> \
     377    bind $itk_component(view) <KeyPress-Left> \
    378378        [itcl::code $this Pan set -10 0]
    379     bind $itk_component(3dview) <KeyPress-Right> \
     379    bind $itk_component(view) <KeyPress-Right> \
    380380        [itcl::code $this Pan set 10 0]
    381     bind $itk_component(3dview) <KeyPress-Up> \
     381    bind $itk_component(view) <KeyPress-Up> \
    382382        [itcl::code $this Pan set 0 -10]
    383     bind $itk_component(3dview) <KeyPress-Down> \
     383    bind $itk_component(view) <KeyPress-Down> \
    384384        [itcl::code $this Pan set 0 10]
    385     bind $itk_component(3dview) <Shift-KeyPress-Left> \
     385    bind $itk_component(view) <Shift-KeyPress-Left> \
    386386        [itcl::code $this Pan set -50 0]
    387     bind $itk_component(3dview) <Shift-KeyPress-Right> \
     387    bind $itk_component(view) <Shift-KeyPress-Right> \
    388388        [itcl::code $this Pan set 50 0]
    389     bind $itk_component(3dview) <Shift-KeyPress-Up> \
     389    bind $itk_component(view) <Shift-KeyPress-Up> \
    390390        [itcl::code $this Pan set 0 -50]
    391     bind $itk_component(3dview) <Shift-KeyPress-Down> \
     391    bind $itk_component(view) <Shift-KeyPress-Down> \
    392392        [itcl::code $this Pan set 0 50]
    393393
    394394    # Set up bindings for zoom with keyboard
    395     bind $itk_component(3dview) <KeyPress-Prior> \
     395    bind $itk_component(view) <KeyPress-Prior> \
    396396        [itcl::code $this Zoom out 2]
    397     bind $itk_component(3dview) <KeyPress-Next> \
     397    bind $itk_component(view) <KeyPress-Next> \
    398398        [itcl::code $this Zoom in 2]
    399399
    400     bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)"
    401 
    402     bind $itk_component(3dview) <Configure> \
     400    bind $itk_component(view) <Enter> "focus $itk_component(view)"
     401
     402    bind $itk_component(view) <Configure> \
    403403        [itcl::code $this EventuallyResize %w %h]
    404     bind $itk_component(3dview) <Unmap> \
     404    bind $itk_component(view) <Unmap> \
    405405        [itcl::code $this Unmap]
    406     bind $itk_component(3dview) <Map> \
     406    bind $itk_component(view) <Map> \
    407407        [itcl::code $this Map]
    408408
     
    11061106        # Set or restore viewing parameters.  We do this for the first
    11071107        # model and assume this works for everything else.
    1108         set w  [winfo width $itk_component(3dview)]
    1109         set h  [winfo height $itk_component(3dview)]
     1108        set w  [winfo width $itk_component(view)]
     1109        set h  [winfo height $itk_component(view)]
    11101110        SendCmd "reset"
    11111111        SendCmd "screen $w $h"
     
    12401240    }
    12411241    if { $option == "click" } {
    1242         $itk_component(3dview) configure -cursor hand1
     1242        $itk_component(view) configure -cursor hand1
    12431243    }
    12441244    if { $option == "drag" || $option == "release" } {
     
    12531253    set _mevent(y) $y
    12541254    if { $option == "release" } {
    1255         $itk_component(3dview) configure -cursor ""
     1255        $itk_component(view) configure -cursor ""
    12561256    }
    12571257}
     
    13071307        unset _rocker(afterid)
    13081308    }
    1309     if { ![winfo viewable $itk_component(3dview)] } {
     1309    if { ![winfo viewable $itk_component(view)] } {
    13101310        return
    13111311    }
     
    13791379    }
    13801380    if { $option == "click" } {
    1381         $itk_component(3dview) configure -cursor fleur
     1381        $itk_component(view) configure -cursor fleur
    13821382    }
    13831383    if { $option == "drag" || $option == "release" } {
     
    13881388            return
    13891389        }
    1390         set w [winfo width $itk_component(3dview)]
    1391         set h [winfo height $itk_component(3dview)]
     1390        set w [winfo width $itk_component(view)]
     1391        set h [winfo height $itk_component(view)]
    13921392        if {$w <= 0 || $h <= 0} {
    13931393            return
     
    14301430    set _mevent(time) $now
    14311431    if { $option == "release" } {
    1432         $itk_component(3dview) configure -cursor ""
     1432        $itk_component(view) configure -cursor ""
    14331433    }
    14341434}
     
    14521452    switch -- $option {
    14531453        click {
    1454             $itk_component(3dview) configure -cursor fleur
     1454            $itk_component(view) configure -cursor fleur
    14551455            set _click(x) $x
    14561456            set _click(y) $y
     
    14621462                Rotate.old click $x $y
    14631463            } else {
    1464                 set w [winfo width $itk_component(3dview)]
    1465                 set h [winfo height $itk_component(3dview)]
     1464                set w [winfo width $itk_component(view)]
     1465                set h [winfo height $itk_component(view)]
    14661466                if {$w <= 0 || $h <= 0} {
    14671467                    return
     
    15281528        release {
    15291529            Rotate.old drag $x $y
    1530             $itk_component(3dview) configure -cursor ""
     1530            $itk_component(view) configure -cursor ""
    15311531            catch {unset _click}
    15321532        }
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r5615 r5798  
    88# ======================================================================
    99#  AUTHOR:  Michael McLennan, Purdue University
    10 #  Copyright (c) 2004-2012  HUBzero Foundation, LLC
     10#  Copyright (c) 2004-2015  HUBzero Foundation, LLC
    1111#
    1212#  See the file "license.terms" for information on usage and
     
    153153    set _serverType "nanovis"
    154154
    155     # Draw legend event
     155    #DebugOn
     156    EnableWaitDialog 900
     157
     158    # Rebuild event
     159    $_dispatcher register !rebuild
     160    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
     161
     162    # Resize event
     163    $_dispatcher register !resize
     164    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     165
     166    # Legend event
    156167    $_dispatcher register !legend
    157168    $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"
     
    161172    $_dispatcher dispatch $this !send_transfunc \
    162173        "[itcl::code $this SendTransferFunctions]; list"
    163 
    164     # Rebuild event
    165     $_dispatcher register !rebuild
    166     $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    167 
    168     # Resize event
    169     $_dispatcher register !resize
    170     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    171174
    172175    #
     
    179182    # Initialize the view to some default parameters.
    180183    array set _view {
    181         -qw      0.853553
    182         -qx      -0.353553
    183         -qy      0.353553
    184         -qz      0.146447
    185         -xpan    0
    186         -ypan    0
    187         -zoom    1.0
     184        -qw       0.853553
     185        -qx       -0.353553
     186        -qy       0.353553
     187        -qz       0.146447
     188        -xpan     0
     189        -ypan     0
     190        -zoom     1.0
    188191    }
    189192    set _arcball [blt::arcball create 100 100]
     
    192195    set _limits(vmin) 0.0
    193196    set _limits(vmax) 1.0
    194     set _reset 1
    195197
    196198    array set _settings [subst {
     
    223225    }]
    224226
    225     itk_component add 3dview {
     227    itk_component add view {
    226228        label $itk_component(plotarea).view -image $_image(plot) \
    227229            -highlightthickness 0 -borderwidth 0
     
    230232        ignore -highlightthickness -borderwidth  -background
    231233    }
    232     bind $itk_component(3dview) <Control-F1> [itcl::code $this ToggleConsole]
     234    bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole]
    233235
    234236    set f [$itk_component(main) component controls]
     
    274276            -onimage [Rappture::icon volume-on] \
    275277            -offimage [Rappture::icon volume-off] \
    276             -command [itcl::code $this AdjustSetting -volume] \
    277             -variable [itcl::scope _settings(-volume)]
     278            -variable [itcl::scope _settings(-volume)] \
     279            -command [itcl::code $this AdjustSetting -volume]
    278280    }
    279281    $itk_component(volume) select
     
    319321    # the server.  So the panewindow uses the tiny size.
    320322    set w 10000
    321     pack forget $itk_component(3dview)
     323    pack forget $itk_component(view)
    322324    blt::table $itk_component(plotarea) \
    323         0,0 $itk_component(3dview) -fill both -reqwidth $w \
     325        0,0 $itk_component(view) -fill both -reqwidth $w \
    324326        1,0 $itk_component(legend) -fill x
    325327    blt::table configure $itk_component(plotarea) r1 -resize none
    326328
    327329    # Bindings for rotation via mouse
    328     bind $itk_component(3dview) <ButtonPress-1> \
     330    bind $itk_component(view) <ButtonPress-1> \
    329331        [itcl::code $this Rotate click %x %y]
    330     bind $itk_component(3dview) <B1-Motion> \
     332    bind $itk_component(view) <B1-Motion> \
    331333        [itcl::code $this Rotate drag %x %y]
    332     bind $itk_component(3dview) <ButtonRelease-1> \
     334    bind $itk_component(view) <ButtonRelease-1> \
    333335        [itcl::code $this Rotate release %x %y]
    334     bind $itk_component(3dview) <Configure> \
     336    bind $itk_component(view) <Configure> \
    335337        [itcl::code $this EventuallyResize %w %h]
    336338
    337339    # Bindings for panning via mouse
    338     bind $itk_component(3dview) <ButtonPress-2> \
     340    bind $itk_component(view) <ButtonPress-2> \
    339341        [itcl::code $this Pan click %x %y]
    340     bind $itk_component(3dview) <B2-Motion> \
     342    bind $itk_component(view) <B2-Motion> \
    341343        [itcl::code $this Pan drag %x %y]
    342     bind $itk_component(3dview) <ButtonRelease-2> \
     344    bind $itk_component(view) <ButtonRelease-2> \
    343345        [itcl::code $this Pan release %x %y]
    344346
    345347    # Bindings for panning via keyboard
    346     bind $itk_component(3dview) <KeyPress-Left> \
     348    bind $itk_component(view) <KeyPress-Left> \
    347349        [itcl::code $this Pan set -10 0]
    348     bind $itk_component(3dview) <KeyPress-Right> \
     350    bind $itk_component(view) <KeyPress-Right> \
    349351        [itcl::code $this Pan set 10 0]
    350     bind $itk_component(3dview) <KeyPress-Up> \
     352    bind $itk_component(view) <KeyPress-Up> \
    351353        [itcl::code $this Pan set 0 -10]
    352     bind $itk_component(3dview) <KeyPress-Down> \
     354    bind $itk_component(view) <KeyPress-Down> \
    353355        [itcl::code $this Pan set 0 10]
    354     bind $itk_component(3dview) <Shift-KeyPress-Left> \
     356    bind $itk_component(view) <Shift-KeyPress-Left> \
    355357        [itcl::code $this Pan set -2 0]
    356     bind $itk_component(3dview) <Shift-KeyPress-Right> \
     358    bind $itk_component(view) <Shift-KeyPress-Right> \
    357359        [itcl::code $this Pan set 2 0]
    358     bind $itk_component(3dview) <Shift-KeyPress-Up> \
     360    bind $itk_component(view) <Shift-KeyPress-Up> \
    359361        [itcl::code $this Pan set 0 -2]
    360     bind $itk_component(3dview) <Shift-KeyPress-Down> \
     362    bind $itk_component(view) <Shift-KeyPress-Down> \
    361363        [itcl::code $this Pan set 0 2]
    362364
    363365    # Bindings for zoom via keyboard
    364     bind $itk_component(3dview) <KeyPress-Prior> \
     366    bind $itk_component(view) <KeyPress-Prior> \
    365367        [itcl::code $this Zoom out]
    366     bind $itk_component(3dview) <KeyPress-Next> \
     368    bind $itk_component(view) <KeyPress-Next> \
    367369        [itcl::code $this Zoom in]
    368370
    369     bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)"
     371    bind $itk_component(view) <Enter> "focus $itk_component(view)"
    370372
    371373    if {[string equal "x11" [tk windowingsystem]]} {
    372374        # Bindings for zoom via mouse
    373         bind $itk_component(3dview) <4> [itcl::code $this Zoom out]
    374         bind $itk_component(3dview) <5> [itcl::code $this Zoom in]
     375        bind $itk_component(view) <4> [itcl::code $this Zoom out]
     376        bind $itk_component(view) <5> [itcl::code $this Zoom in]
    375377    }
    376378
     
    378380
    379381    eval itk_initialize $args
    380 
    381     EnableWaitDialog 900
    382382    Connect
    383383}
     
    435435# ----------------------------------------------------------------------
    436436# USAGE: get ?-objects?
    437 # USAGE: get ?-image 3dview|legend?
     437# USAGE: get ?-image view|legend?
    438438#
    439439# Clients use this to query the list of objects being plotted, in
     
    465465        -image {
    466466            if {[llength $args] != 2} {
    467                 error "wrong # args: should be \"get -image 3dview|legend\""
     467                error "wrong # args: should be \"get -image view|legend\""
    468468            }
    469469            switch -- [lindex $args end] {
    470                 3dview {
     470                view {
    471471                    return $_image(plot)
    472472                }
     
    475475                }
    476476                default {
    477                     error "bad image name \"[lindex $args end]\": should be 3dview or legend"
     477                    error "bad image name \"[lindex $args end]\": should be view or legend"
    478478                }
    479479            }
     
    488488# USAGE: delete ?<dataobj1> <dataobj2> ...?
    489489#
    490 #       Clients use this to delete a dataobj from the plot.  If no dataobjs
    491 #       are specified, then all dataobjs are deleted.  No data objects are
    492 #       deleted.  They are only removed from the display list.
    493 #
     490# Clients use this to delete a dataobj from the plot.  If no dataobjs
     491# are specified, then all dataobjs are deleted.  No data objects are
     492# deleted.  They are only removed from the display list.
    494493# ----------------------------------------------------------------------
    495494itcl::body Rappture::NanovisViewer::delete {args} {
     
    647646        }
    648647
    649         set w [winfo width $itk_component(3dview)]
    650         set h [winfo height $itk_component(3dview)]
     648        set w [winfo width $itk_component(view)]
     649        set h [winfo height $itk_component(view)]
    651650        EventuallyResize $w $h
    652651    }
     
    657656# isconnected --
    658657#
    659 #       Indicates if we are currently connected to the visualization server.
     658# Indicates if we are currently connected to the visualization server.
    660659#
    661660itcl::body Rappture::NanovisViewer::isconnected {} {
     
    673672# Disconnect --
    674673#
    675 #       Clients use this method to disconnect from the current rendering
    676 #       server.
     674# Clients use this method to disconnect from the current rendering server.
    677675#
    678676itcl::body Rappture::NanovisViewer::Disconnect {} {
     
    814812# ReceiveLegend --
    815813#
    816 #       The procedure is the response from the render server to each "legend"
    817 #       command.  The server sends back a "legend" command invoked our
    818 #       the slave interpreter.  The purpose is to collect data of the image
    819 #       representing the legend in the canvas.  In addition, the
    820 #       active transfer function is displayed.
     814# The procedure is the response from the render server to each "legend"
     815# command.  The server sends back a "legend" command invoked our
     816# the slave interpreter.  The purpose is to collect data of the image
     817# representing the legend in the canvas.  In addition, the
     818# active transfer function is displayed.
    821819#
    822820itcl::body Rappture::NanovisViewer::ReceiveLegend { tf vmin vmax size } {
     
    834832# ReceiveData --
    835833#
    836 #       The procedure is the response from the render server to each "data
    837 #       follows" command.  The server sends back a "data" command invoked our
    838 #       the slave interpreter.  The purpose is to collect the min/max of the
    839 #       volume sent to the render server.  Since the client (nanovisviewer)
    840 #       doesn't parse 3D data formats, we rely on the server (nanovis) to
    841 #       tell us what the limits are.  Once we've received the limits to all
    842 #       the data we've sent (tracked by _recvdDatasets) we can then determine
    843 #       what the transfer functions are for these volumes.
     834# The procedure is the response from the render server to each "data
     835# follows" command.  The server sends back a "data" command invoked our
     836# the slave interpreter.  The purpose is to collect the min/max of the
     837# volume sent to the render server.  Since the client (nanovisviewer)
     838# doesn't parse 3D data formats, we rely on the server (nanovis) to
     839# tell us what the limits are.  Once we've received the limits to all
     840# the data we've sent (tracked by _recvdDatasets) we can then determine
     841# what the transfer functions are for these volumes.
    844842#
    845843#
     
    893891# ----------------------------------------------------------------------
    894892itcl::body Rappture::NanovisViewer::Rebuild {} {
    895     set w [winfo width $itk_component(3dview)]
    896     set h [winfo height $itk_component(3dview)]
     893    set w [winfo width $itk_component(view)]
     894    set h [winfo height $itk_component(view)]
    897895    if { $w < 2 || $h < 2 } {
    898896        update
     
    10041002            }
    10051003        }
     1004        set _reset 0
    10061005    }
    10071006
     
    10251024    StopBufferingCommands
    10261025    blt::busy release $itk_component(hull)
    1027     set _reset 0
    10281026}
    10291027
     
    11231121    switch -- $option {
    11241122        click {
    1125             $itk_component(3dview) configure -cursor fleur
     1123            $itk_component(view) configure -cursor fleur
    11261124            set _click(x) $x
    11271125            set _click(y) $y
     
    11311129                Rotate click $x $y
    11321130            } else {
    1133                 set w [winfo width $itk_component(3dview)]
    1134                 set h [winfo height $itk_component(3dview)]
     1131                set w [winfo width $itk_component(view)]
     1132                set h [winfo height $itk_component(view)]
    11351133                if {$w <= 0 || $h <= 0} {
    11361134                    return
     
    11591157        release {
    11601158            Rotate drag $x $y
    1161             $itk_component(3dview) configure -cursor ""
     1159            $itk_component(view) configure -cursor ""
    11621160            catch {unset _click}
    11631161        }
     
    11781176itcl::body Rappture::NanovisViewer::Pan {option x y} {
    11791177    # Experimental stuff
    1180     set w [winfo width $itk_component(3dview)]
    1181     set h [winfo height $itk_component(3dview)]
     1178    set w [winfo width $itk_component(view)]
     1179    set h [winfo height $itk_component(view)]
    11821180    if { $option == "set" } {
    11831181        set x [expr $x / double($w)]
     
    11931191        set _click(x) $x
    11941192        set _click(y) $y
    1195         $itk_component(3dview) configure -cursor hand1
     1193        $itk_component(view) configure -cursor hand1
    11961194    }
    11971195    if { $option == "drag" || $option == "release" } {
     
    12071205    }
    12081206    if { $option == "release" } {
    1209         $itk_component(3dview) configure -cursor ""
     1207        $itk_component(view) configure -cursor ""
    12101208    }
    12111209}
     
    12731271            if { $_settings($what) } {
    12741272                blt::table $itk_component(plotarea) \
    1275                     0,0 $itk_component(3dview) -fill both \
     1273                    0,0 $itk_component(view) -fill both \
    12761274                    1,0 $itk_component(legend) -fill x
    12771275                blt::table configure $itk_component(plotarea) r1 -resize none
     
    13711369# NameTransferFunction --
    13721370#
    1373 #       Creates a transfer function name based on the <style> settings in the
    1374 #       library run.xml file. This placeholder will be used later to create
    1375 #       and send the actual transfer function once the data info has been sent
    1376 #       to us by the render server. [We won't know the volume limits until the
    1377 #       server parses the 3D data and sends back the limits via ReceiveData.]
     1371# Creates a transfer function name based on the <style> settings in the
     1372# library run.xml file. This placeholder will be used later to create
     1373# and send the actual transfer function once the data info has been sent
     1374# to us by the render server. [We won't know the volume limits until the
     1375# server parses the 3D data and sends back the limits via ReceiveData.]
    13781376#
    13791377#       FIXME: The current way we generate transfer-function names completely
     
    13981396# ComputeTransferFunction --
    13991397#
    1400 #       Computes and sends the transfer function to the render server.  It's
    1401 #       assumed that the volume data limits are known and that the global
    1402 #       transfer-functions slider values have been set up.  Both parts are
    1403 #       needed to compute the relative value (location) of the marker, and
    1404 #       the alpha map of the transfer function.
     1398# Computes and sends the transfer function to the render server.  It's
     1399# assumed that the volume data limits are known and that the global
     1400# transfer-functions slider values have been set up.  Both parts are
     1401# needed to compute the relative value (location) of the marker, and
     1402# the alpha map of the transfer function.
    14051403#
    14061404itcl::body Rappture::NanovisViewer::ComputeTransferFunction { tf } {
  • branches/1.3/gui/scripts/vtkvolumeviewer.tcl

    r5774 r5798  
    537537# USAGE: delete ?<dataobj1> <dataobj2> ...?
    538538#
    539 #       Clients use this to delete a dataobj from the plot.  If no dataobjs
    540 #       are specified, then all dataobjs are deleted.  No data objects are
    541 #       deleted.  They are only removed from the display list.
    542 #
     539# Clients use this to delete a dataobj from the plot.  If no dataobjs
     540# are specified, then all dataobjs are deleted.  No data objects are
     541# deleted.  They are only removed from the display list.
    543542# ----------------------------------------------------------------------
    544543itcl::body Rappture::VtkVolumeViewer::delete {args} {
     
    818817# isconnected --
    819818#
    820 #       Indicates if we are currently connected to the visualization server.
     819# Indicates if we are currently connected to the visualization server.
    821820#
    822821itcl::body Rappture::VtkVolumeViewer::isconnected {} {
     
    834833# Disconnect --
    835834#
    836 #       Clients use this method to disconnect from the current rendering
    837 #       server.
     835# Clients use this method to disconnect from the current rendering server.
    838836#
    839837itcl::body Rappture::VtkVolumeViewer::Disconnect {} {
     
    13141312# AdjustSetting --
    13151313#
    1316 #       Changes/updates a specific setting in the widget.  There are
    1317 #       usually user-setable option.  Commands are sent to the render
    1318 #       server.
     1314# Changes/updates a specific setting in the widget.  There are
     1315# usually user-setable option.  Commands are sent to the render
     1316# server.
    13191317#
    13201318itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} {
     
    15121510# RequestLegend --
    15131511#
    1514 #       Request a new legend from the server.  The size of the legend
    1515 #       is determined from the height of the canvas.
     1512# Request a new legend from the server.  The size of the legend
     1513# is determined from the height of the canvas.
    15161514#
    15171515itcl::body Rappture::VtkVolumeViewer::RequestLegend {} {
     
    24092407# GetDatasetsWithComponent --
    24102408#
    2411 #       Returns a list of all the datasets (known by the combination of
    2412 #       their data object and component name) that match the given
    2413 #       component name.  For example, this is used where we want to change
    2414 #       the settings of volumes that have the current component.
     2409# Returns a list of all the datasets (known by the combination of
     2410# their data object and component name) that match the given
     2411# component name.  For example, this is used where we want to change
     2412# the settings of volumes that have the current component.
    24152413#
    24162414itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } {
Note: See TracChangeset for help on using the changeset viewer.