Ignore:
Timestamp:
Jun 27, 2014, 3:25:53 AM (10 years ago)
Author:
ldelgass
Message:

Add method to get list of colormaps

File:
1 edited

Legend:

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

    r4391 r4446  
    4242    #private variable _idleTimeout 5000;    # 5 seconds
    4343    #private variable _idleTimeout 0;       # No timeout
     44
    4445    protected variable _maxConnects 100
    4546    protected variable _outbuf       ;    # buffer for outgoing commands
     
    8485    protected method Connect { servers }
    8586    protected method Disconnect {}
    86     protected method EnableWaitDialog { bool }
     87    protected method EnableWaitDialog { timeout }
    8788    protected method Euler2XYZ { theta phi psi }
    8889    protected method Flush {}
     90    protected method GetColormapList { args }
    8991    protected method HandleError { args }
    9092    protected method HandleOk { args }
     
    388390#
    389391#   Helper routine called from a file event to send data when the
    390 #   connection is writable (i.e. not blocked).  Sets a magic
    391 #   variable _done($this) when we're done.
     392#   connection is writable (i.e. not blocked).  Sets a magic variable
     393#   _done($this) when we're done.
    392394#
    393395itcl::body Rappture::VisViewer::SendHelper {} {
     
    404406#
    405407#   Helper routine called from a file event to send data when the
    406 #   connection is writable (i.e. not blocked).  Sends data in chunks
    407 #   of 8k (or less).  Sets magic variable _done($this) to indicate
    408 #   that we're either finished (success) or could not send bytes to
    409 #   the server (failure).
     408#   connection is writable (i.e. not blocked).  Sends data in chunks of 8k
     409#   (or less).  Sets magic variable _done($this) to indicate that we're
     410#   either finished (success) or could not send bytes to the server
     411#   (failure).
    410412#
    411413itcl::body Rappture::VisViewer::SendHelper.old {} {
     
    504506# ReceiveHelper --
    505507#
    506 #   Helper routine called from a file event when the connection is
    507 #   readable (i.e. a command response has been sent by the rendering
    508 #   server.  Reads the incoming command and executes it in a safe
    509 #   interpreter to handle the action.
     508#   Helper routine called from a file event when the connection is readable
     509#   (i.e. a command response has been sent by the rendering server.  Reads
     510#   the incoming command and executes it in a safe interpreter to handle the
     511#   action.
    510512#
    511513#       Note: This routine currently only handles command responses from
     
    561563# Color2RGB --
    562564#
    563 #   Converts a color name to a list of r,g,b values needed for the
    564 #   engine.  Each r/g/b component is scaled in the # range 0-1.
     565#   Converts a color name to a list of r,g,b values needed for the engine.
     566#   Each r/g/b component is scaled in the # range 0-1.
    565567#
    566568itcl::body Rappture::VisViewer::Color2RGB {color} {
     
    610612#
    611613#     Echoes received data to clients interested in this widget.  If the
    612 #     -receivecommand option is set, then it is invoked in the global
    613 #     scope with the <channel> and <data> values as arguments.  Otherwise,
    614 #     this does nothing.
     614#     -receivecommand option is set, then it is invoked in the global scope
     615#     with the <channel> and <data> values as arguments.  Otherwise, this
     616#     does nothing.
    615617#
    616618itcl::body Rappture::VisViewer::ReceiveEcho {channel {data ""}} {
     
    630632        set inner [frame $itk_component(plotarea).view.splash]
    631633        $inner configure -relief raised -bd 2
    632         label $inner.text1 -text "Rendering...\nPlease wait." \
     634        label $inner.text1 -text "Working...\nPlease wait." \
    633635            -font "Arial 10"
    634636        label $inner.icon
     
    873875}
    874876
     877itcl::body Rappture::VisViewer::GetColormapList { args } {
     878    array set opts {
     879        -includeDefault 0
     880        -includeElementDefault 0
     881        -includeNone 0
     882    }
     883    if {[llength $args] > 0} {
     884        foreach opt $args {
     885            set opts($opt) 1
     886        }
     887    }
     888    set colormaps [list]
     889    if {$opts(-includeDefault)} {
     890        lappend colormaps "default" "default"
     891    }
     892    if {$opts(-includeElementDefault)} {
     893        lappend colormaps "elementDefault" "elementDefault"
     894    }
     895   lappend colormaps \
     896        "BCGYR"              "BCGYR"            \
     897        "BGYOR"              "BGYOR"            \
     898        "blue-to-brown"      "blue-to-brown"    \
     899        "blue-to-orange"     "blue-to-orange"   \
     900        "blue-to-grey"       "blue-to-grey"     \
     901        "green-to-magenta"   "green-to-magenta" \
     902        "greyscale"          "greyscale"        \
     903        "nanohub"            "nanohub"          \
     904        "rainbow"            "rainbow"          \
     905        "spectral"           "spectral"         \
     906        "ROYGB"              "ROYGB"            \
     907        "RYGCB"              "RYGCB"            \
     908        "white-to-blue"      "white-to-blue"    \
     909        "brown-to-blue"      "brown-to-blue"    \
     910        "grey-to-blue"       "grey-to-blue"     \
     911        "orange-to-blue"     "orange-to-blue"
     912    if {$opts(-includeNone)} {
     913        lappend colormaps "none" "none"
     914    }
     915    return $colormaps
     916}
    875917
    876918itcl::body Rappture::VisViewer::ColorsToColormap { colors } {
     
    900942            }
    901943        }
    902         "blue" {
     944        "white-to-blue" {
    903945            return {
    904946                0.0                     0.900 1.000 1.000
Note: See TracChangeset for help on using the changeset viewer.