Changeset 5732


Ignore:
Timestamp:
Jun 22, 2015 1:47:32 PM (9 years ago)
Author:
ldelgass
Message:

merge 5729 from trunk

Location:
branches/1.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4

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

    r5655 r5732  
    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
     
    171171    set _serverType "nanovis"
    172172
    173     # Draw legend event
     173    #DebugOn
     174    EnableWaitDialog 900
     175
     176    # Rebuild event
     177    $_dispatcher register !rebuild
     178    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
     179
     180    # Resize event
     181    $_dispatcher register !resize
     182    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     183
     184    # Legend event
    174185    $_dispatcher register !legend
    175186    $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"
     
    179190    $_dispatcher dispatch $this !send_transfunc \
    180191        "[itcl::code $this SendTransferFunctions]; list"
    181 
    182     # Rebuild event
    183     $_dispatcher register !rebuild
    184     $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    185 
    186     # Resize event
    187     $_dispatcher register !resize
    188     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    189192
    190193    $_dispatcher register !play
     
    211214    # Initialize the view to some default parameters.
    212215    array set _view {
    213         -qw      0.853553
    214         -qx      -0.353553
    215         -qy      0.353553
    216         -qz      0.146447
    217         -xpan    0
    218         -ypan    0
    219         -zoom    1.0
     216        -qw       0.853553
     217        -qx       -0.353553
     218        -qy       0.353553
     219        -qz       0.146447
     220        -xpan     0
     221        -ypan     0
     222        -zoom     1.0
    220223    }
    221224    set _arcball [blt::arcball create 100 100]
     
    263266    }]
    264267
    265     itk_component add 3dview {
     268    itk_component add view {
    266269        label $itk_component(plotarea).view -image $_image(plot) \
    267270            -highlightthickness 0 -borderwidth 0
     
    270273        ignore -highlightthickness -borderwidth  -background
    271274    }
    272     bind $itk_component(3dview) <Control-F1> [itcl::code $this ToggleConsole]
     275    bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole]
    273276
    274277    set f [$itk_component(main) component controls]
     
    314317            -onimage [Rappture::icon volume-on] \
    315318            -offimage [Rappture::icon volume-off] \
    316             -command [itcl::code $this AdjustSetting -volume] \
    317             -variable [itcl::scope _settings(-volume)]
     319            -variable [itcl::scope _settings(-volume)] \
     320            -command [itcl::code $this AdjustSetting -volume]
    318321    }
    319322    $itk_component(volume) select
     
    359362    # the server.  So the panewindow uses the tiny size.
    360363    set w 10000
    361     pack forget $itk_component(3dview)
     364    pack forget $itk_component(view)
    362365    blt::table $itk_component(plotarea) \
    363         0,0 $itk_component(3dview) -fill both -reqwidth $w \
     366        0,0 $itk_component(view) -fill both -reqwidth $w \
    364367        1,0 $itk_component(legend) -fill x
    365368    blt::table configure $itk_component(plotarea) r1 -resize none
     
    508511    blt::table configure $itk_component(flowcontrols) r0 -pady 1
    509512    # Bindings for rotation via mouse
    510     bind $itk_component(3dview) <ButtonPress-1> \
     513    bind $itk_component(view) <ButtonPress-1> \
    511514        [itcl::code $this Rotate click %x %y]
    512     bind $itk_component(3dview) <B1-Motion> \
     515    bind $itk_component(view) <B1-Motion> \
    513516        [itcl::code $this Rotate drag %x %y]
    514     bind $itk_component(3dview) <ButtonRelease-1> \
     517    bind $itk_component(view) <ButtonRelease-1> \
    515518        [itcl::code $this Rotate release %x %y]
    516519
    517     bind $itk_component(3dview) <Configure> \
     520    bind $itk_component(view) <Configure> \
    518521        [itcl::code $this EventuallyResize %w %h]
    519522
    520523    # Bindings for panning via mouse
    521     bind $itk_component(3dview) <ButtonPress-2> \
     524    bind $itk_component(view) <ButtonPress-2> \
    522525        [itcl::code $this Pan click %x %y]
    523     bind $itk_component(3dview) <B2-Motion> \
     526    bind $itk_component(view) <B2-Motion> \
    524527        [itcl::code $this Pan drag %x %y]
    525     bind $itk_component(3dview) <ButtonRelease-2> \
     528    bind $itk_component(view) <ButtonRelease-2> \
    526529        [itcl::code $this Pan release %x %y]
    527530
    528531    # Bindings for panning via keyboard
    529     bind $itk_component(3dview) <KeyPress-Left> \
     532    bind $itk_component(view) <KeyPress-Left> \
    530533        [itcl::code $this Pan set -10 0]
    531     bind $itk_component(3dview) <KeyPress-Right> \
     534    bind $itk_component(view) <KeyPress-Right> \
    532535        [itcl::code $this Pan set 10 0]
    533     bind $itk_component(3dview) <KeyPress-Up> \
     536    bind $itk_component(view) <KeyPress-Up> \
    534537        [itcl::code $this Pan set 0 -10]
    535     bind $itk_component(3dview) <KeyPress-Down> \
     538    bind $itk_component(view) <KeyPress-Down> \
    536539        [itcl::code $this Pan set 0 10]
    537     bind $itk_component(3dview) <Shift-KeyPress-Left> \
     540    bind $itk_component(view) <Shift-KeyPress-Left> \
    538541        [itcl::code $this Pan set -2 0]
    539     bind $itk_component(3dview) <Shift-KeyPress-Right> \
     542    bind $itk_component(view) <Shift-KeyPress-Right> \
    540543        [itcl::code $this Pan set 2 0]
    541     bind $itk_component(3dview) <Shift-KeyPress-Up> \
     544    bind $itk_component(view) <Shift-KeyPress-Up> \
    542545        [itcl::code $this Pan set 0 -2]
    543     bind $itk_component(3dview) <Shift-KeyPress-Down> \
     546    bind $itk_component(view) <Shift-KeyPress-Down> \
    544547        [itcl::code $this Pan set 0 2]
    545548
    546549    # Bindings for zoom via keyboard
    547     bind $itk_component(3dview) <KeyPress-Prior> \
     550    bind $itk_component(view) <KeyPress-Prior> \
    548551        [itcl::code $this Zoom out]
    549     bind $itk_component(3dview) <KeyPress-Next> \
     552    bind $itk_component(view) <KeyPress-Next> \
    550553        [itcl::code $this Zoom in]
    551554
    552     bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)"
     555    bind $itk_component(view) <Enter> "focus $itk_component(view)"
    553556
    554557    if {[string equal "x11" [tk windowingsystem]]} {
    555558        # Bindings for zoom via mouse
    556         bind $itk_component(3dview) <4> [itcl::code $this Zoom out]
    557         bind $itk_component(3dview) <5> [itcl::code $this Zoom in]
     559        bind $itk_component(view) <4> [itcl::code $this Zoom out]
     560        bind $itk_component(view) <5> [itcl::code $this Zoom in]
    558561    }
    559562
     
    562565    eval itk_initialize $args
    563566
    564     EnableWaitDialog 900
    565567    Connect
    566568}
     
    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} {
     
    865866        }
    866867
    867         set w [winfo width $itk_component(3dview)]
    868         set h [winfo height $itk_component(3dview)]
     868        set w [winfo width $itk_component(view)]
     869        set h [winfo height $itk_component(view)]
    869870        EventuallyResize $w $h
    870871    }
     
    875876# isconnected --
    876877#
    877 #       Indicates if we are currently connected to the visualization server.
     878# Indicates if we are currently connected to the visualization server.
    878879#
    879880itcl::body Rappture::FlowvisViewer::isconnected {} {
     
    891892# Disconnect --
    892893#
    893 #       Clients use this method to disconnect from the current rendering
    894 #       server.
     894# Clients use this method to disconnect from the current rendering server.
    895895#
    896896itcl::body Rappture::FlowvisViewer::Disconnect {} {
     
    10221022# ReceiveLegend --
    10231023#
    1024 #       The procedure is the response from the render server to each "legend"
    1025 #       command.  The server sends back a "legend" command invoked our
    1026 #       the slave interpreter.  The purpose is to collect data of the image
    1027 #       representing the legend in the canvas.  In addition, the
    1028 #       active transfer function is displayed.
     1024# The procedure is the response from the render server to each "legend"
     1025# command.  The server sends back a "legend" command invoked our
     1026# the slave interpreter.  The purpose is to collect data of the image
     1027# representing the legend in the canvas.  In addition, the
     1028# active transfer function is displayed.
    10291029#
    10301030itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } {
     
    10421042# ReceiveData --
    10431043#
    1044 #       The procedure is the response from the render server to each "data
    1045 #       follows" command.  The server sends back a "data" command invoked our
    1046 #       the slave interpreter.  The purpose was to collect the min/max of the
    1047 #       volume sent to the render server.  This is no longer needed since we
    1048 #       already know the limits.
     1044# The procedure is the response from the render server to each "data
     1045# follows" command.  The server sends back a "data" command invoked our
     1046# the slave interpreter.  The purpose was to collect the min/max of the
     1047# volume sent to the render server.  This is no longer needed since we
     1048# already know the limits.
    10491049#
    10501050itcl::body Rappture::FlowvisViewer::ReceiveData { args } {
     
    10681068# ----------------------------------------------------------------------
    10691069itcl::body Rappture::FlowvisViewer::Rebuild {} {
    1070     set w [winfo width $itk_component(3dview)]
    1071     set h [winfo height $itk_component(3dview)]
     1070    set w [winfo width $itk_component(view)]
     1071    set h [winfo height $itk_component(view)]
    10721072    if { $w < 2 || $h < 2 } {
    10731073        update
     
    11801180        PanCamera
    11811181        SendCmd "camera zoom $_view(-zoom)"
     1182        set _reset 0
    11821183    }
    11831184
     
    11941195    StopBufferingCommands
    11951196    blt::busy release $itk_component(hull)
    1196     set _reset 0
    11971197}
    11981198
     
    12921292    switch -- $option {
    12931293        click {
    1294             $itk_component(3dview) configure -cursor fleur
     1294            $itk_component(view) configure -cursor fleur
    12951295            set _click(x) $x
    12961296            set _click(y) $y
     
    13001300                Rotate click $x $y
    13011301            } else {
    1302                 set w [winfo width $itk_component(3dview)]
    1303                 set h [winfo height $itk_component(3dview)]
     1302                set w [winfo width $itk_component(view)]
     1303                set h [winfo height $itk_component(view)]
    13041304                if {$w <= 0 || $h <= 0} {
    13051305                    return
     
    13281328        release {
    13291329            Rotate drag $x $y
    1330             $itk_component(3dview) configure -cursor ""
     1330            $itk_component(view) configure -cursor ""
    13311331            catch {unset _click}
    13321332        }
     
    13471347itcl::body Rappture::FlowvisViewer::Pan {option x y} {
    13481348    # Experimental stuff
    1349     set w [winfo width $itk_component(3dview)]
    1350     set h [winfo height $itk_component(3dview)]
     1349    set w [winfo width $itk_component(view)]
     1350    set h [winfo height $itk_component(view)]
    13511351    if { $option == "set" } {
    13521352        set x [expr $x / double($w)]
     
    13621362        set _click(x) $x
    13631363        set _click(y) $y
    1364         $itk_component(3dview) configure -cursor hand1
     1364        $itk_component(view) configure -cursor hand1
    13651365    }
    13661366    if { $option == "drag" || $option == "release" } {
     
    13761376    }
    13771377    if { $option == "release" } {
    1378         $itk_component(3dview) configure -cursor ""
     1378        $itk_component(view) configure -cursor ""
    13791379    }
    13801380}
     
    14491449            if { $_settings($what) } {
    14501450                blt::table $itk_component(plotarea) \
    1451                     0,0 $itk_component(3dview) -fill both \
     1451                    0,0 $itk_component(view) -fill both \
    14521452                    1,0 $itk_component(legend) -fill x
    14531453                blt::table configure $itk_component(plotarea) r1 -resize none
     
    15641564# NameTransferFunction --
    15651565#
    1566 #       Creates a transfer function name based on the <style> settings in the
    1567 #       library run.xml file. This placeholder will be used later to create
    1568 #       and send the actual transfer function once the data info has been sent
    1569 #       to us by the render server. [We won't know the volume limits until the
    1570 #       server parses the 3D data and sends back the limits via ReceiveData.]
     1566# Creates a transfer function name based on the <style> settings in the
     1567# library run.xml file. This placeholder will be used later to create
     1568# and send the actual transfer function once the data info has been sent
     1569# to us by the render server. [We won't know the volume limits until the
     1570# server parses the 3D data and sends back the limits via ReceiveData.]
    15711571#
    15721572itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } {
     
    15891589# ComputeTransferFunction --
    15901590#
    1591 #       Computes and sends the transfer function to the render server.  It's
    1592 #       assumed that the volume data limits are known and that the global
    1593 #       transfer-functions slider values have been set up.  Both parts are
    1594 #       needed to compute the relative value (location) of the marker, and
    1595 #       the alpha map of the transfer function.
     1591# Computes and sends the transfer function to the render server.  It's
     1592# assumed that the volume data limits are known and that the global
     1593# transfer-functions slider values have been set up.  Both parts are
     1594# needed to compute the relative value (location) of the marker, and
     1595# the alpha map of the transfer function.
    15961596#
    15971597itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } {
     
    25552555        }
    25562556        "next" {
    2557             if { ![winfo viewable $itk_component(3dview)] } {
     2557            if { ![winfo viewable $itk_component(view)] } {
    25582558                flow stop
    25592559                return
     
    28702870# BuildVolumeComponents --
    28712871#
    2872 #    This is called from the "scale" method which is called when a new
    2873 #    dataset is added or deleted.  It repopulates the dropdown menu of
    2874 #    volume component names.  It sets the current component to the first
    2875 #    component in the list (of components found).  Finally, if there is
    2876 #    only one component, don't display the label or the combobox in the
    2877 #    volume settings tab.
     2872# This is called from the "scale" method which is called when a new
     2873# dataset is added or deleted.  It repopulates the dropdown menu of
     2874# volume component names.  It sets the current component to the first
     2875# component in the list (of components found).  Finally, if there is
     2876# only one component, don't display the label or the combobox in the
     2877# volume settings tab.
    28782878#
    28792879itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} {
     
    28892889# GetDatasetsWithComponents --
    28902890#
    2891 #    Returns a list of all the datasets (known by the combination of their
    2892 #    data object and component name) that match the given component name.
    2893 #    For example, this is used where we want to change the settings of
    2894 #    volumes that have the current component.
     2891# Returns a list of all the datasets (known by the combination of their
     2892# data object and component name) that match the given component name.
     2893# For example, this is used where we want to change the settings of
     2894# volumes that have the current component.
    28952895#
    28962896itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } {
  • branches/1.4/gui/scripts/molvisviewer.tcl

    r5728 r5732  
    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.4/gui/scripts/nanovisviewer.tcl

    r5655 r5732  
    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
     
    158158    set _serverType "nanovis"
    159159
    160     # Draw legend event
     160    #DebugOn
     161    EnableWaitDialog 900
     162
     163    # Rebuild event
     164    $_dispatcher register !rebuild
     165    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
     166
     167    # Resize event
     168    $_dispatcher register !resize
     169    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
     170
     171    # Legend event
    161172    $_dispatcher register !legend
    162173    $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list"
     
    166177    $_dispatcher dispatch $this !send_transfunc \
    167178        "[itcl::code $this SendTransferFunctions]; list"
    168 
    169     # Rebuild event
    170     $_dispatcher register !rebuild
    171     $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    172 
    173     # Resize event
    174     $_dispatcher register !resize
    175     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    176179
    177180    #
     
    184187    # Initialize the view to some default parameters.
    185188    array set _view {
    186         -qw      0.853553
    187         -qx      -0.353553
    188         -qy      0.353553
    189         -qz      0.146447
    190         -xpan    0
    191         -ypan    0
    192         -zoom    1.0
     189        -qw       0.853553
     190        -qx       -0.353553
     191        -qy       0.353553
     192        -qz       0.146447
     193        -xpan     0
     194        -ypan     0
     195        -zoom     1.0
    193196    }
    194197    set _arcball [blt::arcball create 100 100]
    195198    $_arcball quaternion [ViewToQuaternion]
    196 
    197     set _reset 1
    198199
    199200    array set _settings [subst {
     
    227228    }]
    228229
    229     itk_component add 3dview {
     230    itk_component add view {
    230231        label $itk_component(plotarea).view -image $_image(plot) \
    231232            -highlightthickness 0 -borderwidth 0
     
    234235        ignore -highlightthickness -borderwidth  -background
    235236    }
    236     bind $itk_component(3dview) <Control-F1> [itcl::code $this ToggleConsole]
     237    bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole]
    237238
    238239    set f [$itk_component(main) component controls]
     
    278279            -onimage [Rappture::icon volume-on] \
    279280            -offimage [Rappture::icon volume-off] \
    280             -command [itcl::code $this AdjustSetting -volume] \
    281             -variable [itcl::scope _settings(-volume)]
     281            -variable [itcl::scope _settings(-volume)] \
     282            -command [itcl::code $this AdjustSetting -volume]
    282283    }
    283284    $itk_component(volume) select
     
    327328    # the server.  So the panewindow uses the tiny size.
    328329    set w 10000
    329     pack forget $itk_component(3dview)
     330    pack forget $itk_component(view)
    330331    blt::table $itk_component(plotarea) \
    331         0,0 $itk_component(3dview) -fill both -reqwidth $w \
     332        0,0 $itk_component(view) -fill both -reqwidth $w \
    332333        1,0 $itk_component(legend) -fill x
    333334    blt::table configure $itk_component(plotarea) r1 -resize none
    334335
    335336    # Bindings for rotation via mouse
    336     bind $itk_component(3dview) <ButtonPress-1> \
     337    bind $itk_component(view) <ButtonPress-1> \
    337338        [itcl::code $this Rotate click %x %y]
    338     bind $itk_component(3dview) <B1-Motion> \
     339    bind $itk_component(view) <B1-Motion> \
    339340        [itcl::code $this Rotate drag %x %y]
    340     bind $itk_component(3dview) <ButtonRelease-1> \
     341    bind $itk_component(view) <ButtonRelease-1> \
    341342        [itcl::code $this Rotate release %x %y]
    342343
    343     bind $itk_component(3dview) <Configure> \
     344    bind $itk_component(view) <Configure> \
    344345        [itcl::code $this EventuallyResize %w %h]
    345346
    346347    # Bindings for panning via mouse
    347     bind $itk_component(3dview) <ButtonPress-2> \
     348    bind $itk_component(view) <ButtonPress-2> \
    348349        [itcl::code $this Pan click %x %y]
    349     bind $itk_component(3dview) <B2-Motion> \
     350    bind $itk_component(view) <B2-Motion> \
    350351        [itcl::code $this Pan drag %x %y]
    351     bind $itk_component(3dview) <ButtonRelease-2> \
     352    bind $itk_component(view) <ButtonRelease-2> \
    352353        [itcl::code $this Pan release %x %y]
    353354
    354355    # Bindings for panning via keyboard
    355     bind $itk_component(3dview) <KeyPress-Left> \
     356    bind $itk_component(view) <KeyPress-Left> \
    356357        [itcl::code $this Pan set -10 0]
    357     bind $itk_component(3dview) <KeyPress-Right> \
     358    bind $itk_component(view) <KeyPress-Right> \
    358359        [itcl::code $this Pan set 10 0]
    359     bind $itk_component(3dview) <KeyPress-Up> \
     360    bind $itk_component(view) <KeyPress-Up> \
    360361        [itcl::code $this Pan set 0 -10]
    361     bind $itk_component(3dview) <KeyPress-Down> \
     362    bind $itk_component(view) <KeyPress-Down> \
    362363        [itcl::code $this Pan set 0 10]
    363     bind $itk_component(3dview) <Shift-KeyPress-Left> \
     364    bind $itk_component(view) <Shift-KeyPress-Left> \
    364365        [itcl::code $this Pan set -2 0]
    365     bind $itk_component(3dview) <Shift-KeyPress-Right> \
     366    bind $itk_component(view) <Shift-KeyPress-Right> \
    366367        [itcl::code $this Pan set 2 0]
    367     bind $itk_component(3dview) <Shift-KeyPress-Up> \
     368    bind $itk_component(view) <Shift-KeyPress-Up> \
    368369        [itcl::code $this Pan set 0 -2]
    369     bind $itk_component(3dview) <Shift-KeyPress-Down> \
     370    bind $itk_component(view) <Shift-KeyPress-Down> \
    370371        [itcl::code $this Pan set 0 2]
    371372
    372373    # Bindings for zoom via keyboard
    373     bind $itk_component(3dview) <KeyPress-Prior> \
     374    bind $itk_component(view) <KeyPress-Prior> \
    374375        [itcl::code $this Zoom out]
    375     bind $itk_component(3dview) <KeyPress-Next> \
     376    bind $itk_component(view) <KeyPress-Next> \
    376377        [itcl::code $this Zoom in]
    377378
    378     bind $itk_component(3dview) <Enter> "focus $itk_component(3dview)"
     379    bind $itk_component(view) <Enter> "focus $itk_component(view)"
    379380
    380381    if {[string equal "x11" [tk windowingsystem]]} {
    381382        # Bindings for zoom via mouse
    382         bind $itk_component(3dview) <4> [itcl::code $this Zoom out]
    383         bind $itk_component(3dview) <5> [itcl::code $this Zoom in]
     383        bind $itk_component(view) <4> [itcl::code $this Zoom out]
     384        bind $itk_component(view) <5> [itcl::code $this Zoom in]
    384385    }
    385386
     
    387388
    388389    eval itk_initialize $args
    389 
    390     EnableWaitDialog 900
    391390    Connect
    392391}
     
    447446# ----------------------------------------------------------------------
    448447# USAGE: get ?-objects?
    449 # USAGE: get ?-image 3dview|legend?
     448# USAGE: get ?-image view|legend?
    450449#
    451450# Clients use this to query the list of objects being plotted, in
     
    477476        -image {
    478477            if {[llength $args] != 2} {
    479                 error "wrong # args: should be \"get -image 3dview|legend\""
     478                error "wrong # args: should be \"get -image view|legend\""
    480479            }
    481480            switch -- [lindex $args end] {
    482                 3dview {
     481                view {
    483482                    return $_image(plot)
    484483                }
     
    487486                }
    488487                default {
    489                     error "bad image name \"[lindex $args end]\": should be 3dview or legend"
     488                    error "bad image name \"[lindex $args end]\": should be view or legend"
    490489                }
    491490            }
     
    500499# USAGE: delete ?<dataobj1> <dataobj2> ...?
    501500#
    502 #       Clients use this to delete a dataobj from the plot.  If no dataobjs
    503 #       are specified, then all dataobjs are deleted.  No data objects are
    504 #       deleted.  They are only removed from the display list.
    505 #
     501# Clients use this to delete a dataobj from the plot.  If no dataobjs
     502# are specified, then all dataobjs are deleted.  No data objects are
     503# deleted.  They are only removed from the display list.
    506504# ----------------------------------------------------------------------
    507505itcl::body Rappture::NanovisViewer::delete {args} {
     
    679677        }
    680678
    681         set w [winfo width $itk_component(3dview)]
    682         set h [winfo height $itk_component(3dview)]
     679        set w [winfo width $itk_component(view)]
     680        set h [winfo height $itk_component(view)]
    683681        EventuallyResize $w $h
    684682    }
     
    689687# isconnected --
    690688#
    691 #       Indicates if we are currently connected to the visualization server.
     689# Indicates if we are currently connected to the visualization server.
    692690#
    693691itcl::body Rappture::NanovisViewer::isconnected {} {
     
    705703# Disconnect --
    706704#
    707 #       Clients use this method to disconnect from the current rendering
    708 #       server.
     705# Clients use this method to disconnect from the current rendering server.
    709706#
    710707itcl::body Rappture::NanovisViewer::Disconnect {} {
     
    806803# ReceiveLegend --
    807804#
    808 #       The procedure is the response from the render server to each "legend"
    809 #       command.  The server sends back a "legend" command invoked our
    810 #       the slave interpreter.  The purpose is to collect data of the image
    811 #       representing the legend in the canvas.  In addition, the
    812 #       active transfer function is displayed.
     805# The procedure is the response from the render server to each "legend"
     806# command.  The server sends back a "legend" command invoked our
     807# the slave interpreter.  The purpose is to collect data of the image
     808# representing the legend in the canvas.  In addition, the
     809# active transfer function is displayed.
    813810#
    814811itcl::body Rappture::NanovisViewer::ReceiveLegend { cname vmin vmax size } {
     
    826823# ReceiveData --
    827824#
    828 #       The procedure is the response from the render server to each "data
    829 #       follows" command.  The server sends back a "data" command invoked our
    830 #       the slave interpreter.  The purpose was to collect the min/max of the
    831 #       volume sent to the render server.  This is no longer needed since we
    832 #       already know the limits.
     825# The procedure is the response from the render server to each "data
     826# follows" command.  The server sends back a "data" command invoked our
     827# the slave interpreter.  The purpose was to collect the min/max of the
     828# volume sent to the render server.  This is no longer needed since we
     829# already know the limits.
    833830#
    834831itcl::body Rappture::NanovisViewer::ReceiveData { args } {
     
    852849# ----------------------------------------------------------------------
    853850itcl::body Rappture::NanovisViewer::Rebuild {} {
    854     set w [winfo width $itk_component(3dview)]
    855     set h [winfo height $itk_component(3dview)]
     851    set w [winfo width $itk_component(view)]
     852    set h [winfo height $itk_component(view)]
    856853    if { $w < 2 || $h < 2 } {
    857854        update
     
    958955        PanCamera
    959956        SendCmd "camera zoom $_view(-zoom)"
     957        set _reset 0
    960958    }
    961959
     
    970968    StopBufferingCommands
    971969    blt::busy release $itk_component(hull)
    972     set _reset 0
    973970}
    974971
     
    10681065    switch -- $option {
    10691066        click {
    1070             $itk_component(3dview) configure -cursor fleur
     1067            $itk_component(view) configure -cursor fleur
    10711068            set _click(x) $x
    10721069            set _click(y) $y
     
    10761073                Rotate click $x $y
    10771074            } else {
    1078                 set w [winfo width $itk_component(3dview)]
    1079                 set h [winfo height $itk_component(3dview)]
     1075                set w [winfo width $itk_component(view)]
     1076                set h [winfo height $itk_component(view)]
    10801077                if {$w <= 0 || $h <= 0} {
    10811078                    return
     
    11041101        release {
    11051102            Rotate drag $x $y
    1106             $itk_component(3dview) configure -cursor ""
     1103            $itk_component(view) configure -cursor ""
    11071104            catch {unset _click}
    11081105        }
     
    11231120itcl::body Rappture::NanovisViewer::Pan {option x y} {
    11241121    # Experimental stuff
    1125     set w [winfo width $itk_component(3dview)]
    1126     set h [winfo height $itk_component(3dview)]
     1122    set w [winfo width $itk_component(view)]
     1123    set h [winfo height $itk_component(view)]
    11271124    if { $option == "set" } {
    11281125        set x [expr $x / double($w)]
     
    11381135        set _click(x) $x
    11391136        set _click(y) $y
    1140         $itk_component(3dview) configure -cursor hand1
     1137        $itk_component(view) configure -cursor hand1
    11411138    }
    11421139    if { $option == "drag" || $option == "release" } {
     
    11521149    }
    11531150    if { $option == "release" } {
    1154         $itk_component(3dview) configure -cursor ""
     1151        $itk_component(view) configure -cursor ""
    11551152    }
    11561153}
     
    12241221            if { $_settings($what) } {
    12251222                blt::table $itk_component(plotarea) \
    1226                     0,0 $itk_component(3dview) -fill both \
     1223                    0,0 $itk_component(view) -fill both \
    12271224                    1,0 $itk_component(legend) -fill x
    12281225                blt::table configure $itk_component(plotarea) r1 -resize none
     
    13481345# NameTransferFunction --
    13491346#
    1350 #       Creates a transfer function name based on the <style> settings in the
    1351 #       library run.xml file. This placeholder will be used later to create
    1352 #       and send the actual transfer function once the data info has been sent
    1353 #       to us by the render server. [We won't know the volume limits until the
    1354 #       server parses the 3D data and sends back the limits via ReceiveData.]
     1347# Creates a transfer function name based on the <style> settings in the
     1348# library run.xml file. This placeholder will be used later to create
     1349# and send the actual transfer function once the data info has been sent
     1350# to us by the render server. [We won't know the volume limits until the
     1351# server parses the 3D data and sends back the limits via ReceiveData.]
    13551352#
    13561353itcl::body Rappture::NanovisViewer::NameTransferFunction { dataobj cname } {
     
    13831380# ComputeTransferFunction --
    13841381#
    1385 #       Computes and sends the transfer function to the render server.  It's
    1386 #       assumed that the volume data limits are known and that the global
    1387 #       transfer-functions slider values have been set up.  Both parts are
    1388 #       needed to compute the relative value (location) of the marker, and
    1389 #       the alpha map of the transfer function.
     1382# Computes and sends the transfer function to the render server.  It's
     1383# assumed that the volume data limits are known and that the global
     1384# transfer-functions slider values have been set up.  Both parts are
     1385# needed to compute the relative value (location) of the marker, and
     1386# the alpha map of the transfer function.
    13901387#
    13911388itcl::body Rappture::NanovisViewer::ComputeTransferFunction { cname } {
     
    20452042# InitComponentSettings --
    20462043#
    2047 #    Initializes the volume settings for a specific component. This should
    2048 #    match what's used as global settings above. This is called the first
    2049 #    time we try to switch to a given component in SwitchComponent below.
     2044# Initializes the volume settings for a specific component. This should
     2045# match what's used as global settings above. This is called the first
     2046# time we try to switch to a given component in SwitchComponent below.
    20502047#
    20512048itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } {
     
    20682065# SwitchComponent --
    20692066#
    2070 #    This is called when the current component is changed by the dropdown
    2071 #    menu in the volume tab.  It synchronizes the global volume settings
    2072 #    with the settings of the new current component.
     2067# This is called when the current component is changed by the dropdown
     2068# menu in the volume tab.  It synchronizes the global volume settings
     2069# with the settings of the new current component.
    20732070#
    20742071itcl::body Rappture::NanovisViewer::SwitchComponent { cname } {
     
    20902087# BuildVolumeComponents --
    20912088#
    2092 #    This is called from the "scale" method which is called when a new
    2093 #    dataset is added or deleted.  It repopulates the dropdown menu of
    2094 #    volume component names.  It sets the current component to the first
    2095 #    component in the list (of components found).  Finally, if there is
    2096 #    only one component, don't display the label or the combobox in the
    2097 #    volume settings tab.
     2089# This is called from the "scale" method which is called when a new
     2090# dataset is added or deleted.  It repopulates the dropdown menu of
     2091# volume component names.  It sets the current component to the first
     2092# component in the list (of components found).  Finally, if there is
     2093# only one component, don't display the label or the combobox in the
     2094# volume settings tab.
    20982095#
    20992096itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} {
     
    21212118# GetDatasetsWithComponents --
    21222119#
    2123 #    Returns a list of all the datasets (known by the combination of their
    2124 #    data object and component name) that match the given component name.
    2125 #    For example, this is used where we want to change the settings of
    2126 #    volumes that have the current component.
     2120# Returns a list of all the datasets (known by the combination of their
     2121# data object and component name) that match the given component name.
     2122# For example, this is used where we want to change the settings of
     2123# volumes that have the current component.
    21272124#
    21282125itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } {
     
    21432140# HideAllMarkers --
    21442141#
    2145 #    Hide all the markers in all the transfer functions.  Can't simply
    2146 #    delete and recreate markers from the <style> since the user may have
    2147 #    created, deleted, or moved markers.
     2142# Hide all the markers in all the transfer functions.  Can't simply
     2143# delete and recreate markers from the <style> since the user may have
     2144# created, deleted, or moved markers.
    21482145#
    21492146itcl::body Rappture::NanovisViewer::HideAllMarkers {} {
  • branches/1.4/gui/scripts/vtkvolumeviewer.tcl

    r5469 r5732  
    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 {} {
     
    13191317# AdjustSetting --
    13201318#
    1321 #       Changes/updates a specific setting in the widget.  There are
    1322 #       usually user-setable option.  Commands are sent to the render
    1323 #       server.
     1319# Changes/updates a specific setting in the widget.  There are
     1320# usually user-setable option.  Commands are sent to the render
     1321# server.
    13241322#
    13251323itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} {
     
    15171515# RequestLegend --
    15181516#
    1519 #       Request a new legend from the server.  The size of the legend
    1520 #       is determined from the height of the canvas.
     1517# Request a new legend from the server.  The size of the legend
     1518# is determined from the height of the canvas.
    15211519#
    15221520itcl::body Rappture::VtkVolumeViewer::RequestLegend {} {
     
    24142412# GetDatasetsWithComponent --
    24152413#
    2416 #       Returns a list of all the datasets (known by the combination of
    2417 #       their data object and component name) that match the given
    2418 #       component name.  For example, this is used where we want to change
    2419 #       the settings of volumes that have the current component.
     2414# Returns a list of all the datasets (known by the combination of
     2415# their data object and component name) that match the given
     2416# component name.  For example, this is used where we want to change
     2417# the settings of volumes that have the current component.
    24202418#
    24212419itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } {
Note: See TracChangeset for help on using the changeset viewer.