Changeset 4336 for trunk/gui/scripts


Ignore:
Timestamp:
Apr 9, 2014, 11:19:10 PM (10 years ago)
Author:
ldelgass
Message:

Add method to VisViewer? to get list of pre-defined colormap names. There was
an issue with the name "blue" since it could also be used for a constant color,
but the named "blue" was actually a white-to-blue ramp, so it is now named
"white-to-blue". Also, some work on expanded color settings for glyph viewer.

Location:
trunk/gui/scripts
Files:
11 edited

Legend:

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

    r4166 r4336  
    22352235        Rappture::Combobox $inner.colormap -width 10 -editable no
    22362236    }
    2237 
    2238     $inner.colormap choices insert end \
    2239         "BCGYR"              "BCGYR"            \
    2240         "BGYOR"              "BGYOR"            \
    2241         "blue"               "blue"             \
    2242         "blue-to-brown"      "blue-to-brown"    \
    2243         "blue-to-orange"     "blue-to-orange"   \
    2244         "blue-to-grey"       "blue-to-grey"     \
    2245         "green-to-magenta"   "green-to-magenta" \
    2246         "greyscale"          "greyscale"        \
    2247         "nanohub"            "nanohub"          \
    2248         "rainbow"            "rainbow"          \
    2249         "spectral"           "spectral"         \
    2250         "ROYGB"              "ROYGB"            \
    2251         "RYGCB"              "RYGCB"            \
    2252         "brown-to-blue"      "brown-to-blue"    \
    2253         "grey-to-blue"       "grey-to-blue"     \
    2254         "orange-to-blue"     "orange-to-blue"   \
    2255         "none"               "none"
    2256 
     2237    $inner.colormap choices insert end [GetColormapList -includeNone]
    22572238    $itk_component(colormap) value "BCGYR"
    22582239    bind $inner.colormap <<Value>> \
  • trunk/gui/scripts/mapviewer.tcl

    r4334 r4336  
    14161416        Rappture::Combobox $inner.palette -width 10 -editable no
    14171417    }
    1418     $inner.palette choices insert end \
    1419         "BCGYR"              "BCGYR"            \
    1420         "BGYOR"              "BGYOR"            \
    1421         "blue"               "blue"             \
    1422         "blue-to-brown"      "blue-to-brown"    \
    1423         "blue-to-orange"     "blue-to-orange"   \
    1424         "blue-to-grey"       "blue-to-grey"     \
    1425         "green-to-magenta"   "green-to-magenta" \
    1426         "greyscale"          "greyscale"        \
    1427         "nanohub"            "nanohub"          \
    1428         "rainbow"            "rainbow"          \
    1429         "spectral"           "spectral"         \
    1430         "ROYGB"              "ROYGB"            \
    1431         "RYGCB"              "RYGCB"            \
    1432         "brown-to-blue"      "brown-to-blue"    \
    1433         "grey-to-blue"       "grey-to-blue"     \
    1434         "orange-to-blue"     "orange-to-blue"   
     1418    $inner.palette choices insert end [GetColormapList]
    14351419
    14361420    $itk_component(terrainpalette) value "BCGYR"
  • trunk/gui/scripts/nanovisviewer.tcl

    r4197 r4336  
    18021802    }
    18031803
    1804     $inner.colormap choices insert end \
    1805         "default"            "default"          \
    1806         "BCGYR"              "BCGYR"            \
    1807         "BGYOR"              "BGYOR"            \
    1808         "blue"               "blue"             \
    1809         "blue-to-brown"      "blue-to-brown"    \
    1810         "blue-to-orange"     "blue-to-orange"   \
    1811         "blue-to-grey"       "blue-to-grey"     \
    1812         "green-to-magenta"   "green-to-magenta" \
    1813         "greyscale"          "greyscale"        \
    1814         "nanohub"            "nanohub"          \
    1815         "rainbow"            "rainbow"          \
    1816         "spectral"           "spectral"         \
    1817         "ROYGB"              "ROYGB"            \
    1818         "RYGCB"              "RYGCB"            \
    1819         "brown-to-blue"      "brown-to-blue"    \
    1820         "grey-to-blue"       "grey-to-blue"     \
    1821         "orange-to-blue"     "orange-to-blue"   \
    1822         "none"               "none"
    1823 
     1804    $inner.colormap choices insert end [GetColormapList -includeDefault -includeNone]
    18241805    bind $inner.colormap <<Value>> \
    18251806        [itcl::code $this AdjustSetting -colormap]
  • trunk/gui/scripts/visviewer.tcl

    r4302 r4336  
    8989    protected method Euler2XYZ { theta phi psi }
    9090    protected method Flush {}
     91    protected method GetColormapList { args }
    9192    protected method HandleError { args }
    9293    protected method HandleOk { args }
     
    884885}
    885886
     887itcl::body Rappture::VisViewer::GetColormapList { args } {
     888    array set opts {
     889        -includeDefault 0
     890        -includeElementDefault 0
     891        -includeNone 0
     892    }
     893    if {[llength $args] > 0} {
     894        foreach opt $args {
     895            set opts($opt) 1
     896        }
     897    }
     898    set colormaps [list]
     899    if {$opts(-includeDefault)} {
     900        lappend colormaps "default" "default"
     901    }
     902    if {$opts(-includeElementDefault)} {
     903        lappend colormaps "elementDefault" "elementDefault"
     904    }
     905    lappend colormaps \
     906        "BCGYR"              "BCGYR"            \
     907        "BGYOR"              "BGYOR"            \
     908        "blue-to-brown"      "blue-to-brown"    \
     909        "blue-to-orange"     "blue-to-orange"   \
     910        "blue-to-grey"       "blue-to-grey"     \
     911        "green-to-magenta"   "green-to-magenta" \
     912        "greyscale"          "greyscale"        \
     913        "nanohub"            "nanohub"          \
     914        "rainbow"            "rainbow"          \
     915        "spectral"           "spectral"         \
     916        "ROYGB"              "ROYGB"            \
     917        "RYGCB"              "RYGCB"            \
     918        "white-to-blue"      "white-to-blue"    \
     919        "brown-to-blue"      "brown-to-blue"    \
     920        "grey-to-blue"       "grey-to-blue"     \
     921        "orange-to-blue"     "orange-to-blue"
     922    if {$opts(-includeNone)} {
     923        lappend colormaps "none" "none"
     924    }
     925    return $colormaps
     926}
    886927
    887928itcl::body Rappture::VisViewer::ColorsToColormap { colors } {
     
    911952            }
    912953        }
    913         "blue" {
     954        "white-to-blue" {
    914955            return {
    915956                0.0                     0.900 1.000 1.000
  • trunk/gui/scripts/vtkglyphviewer.tcl

    r4200 r4336  
    14761476                return
    14771477            }
    1478             #SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1478            #if { ![info exists _limits($_curFldName)] } {
     1479            #    SendCmd "dataset maprange all"
     1480            #} else {
     1481            #    SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1482            #}
    14791483            #SendCmd "cutplane colormode $_colorMode $_curFldName"
    14801484            SendCmd "glyphs colormode $_colorMode $_curFldName"
     
    17211725        Rappture::Combobox $inner.colormap -width 10 -editable no
    17221726    }
    1723     $inner.colormap choices insert end \
    1724         "BCGYR"              "BCGYR"            \
    1725         "BGYOR"              "BGYOR"            \
    1726         "blue"               "blue"             \
    1727         "blue-to-brown"      "blue-to-brown"    \
    1728         "blue-to-orange"     "blue-to-orange"   \
    1729         "blue-to-grey"       "blue-to-grey"     \
    1730         "green-to-magenta"   "green-to-magenta" \
    1731         "greyscale"          "greyscale"        \
    1732         "nanohub"            "nanohub"          \
    1733         "rainbow"            "rainbow"          \
    1734         "spectral"           "spectral"         \
    1735         "ROYGB"              "ROYGB"            \
    1736         "RYGCB"              "RYGCB"            \
    1737         "brown-to-blue"      "brown-to-blue"    \
    1738         "grey-to-blue"       "grey-to-blue"     \
    1739         "orange-to-blue"     "orange-to-blue"   
    1740 
     1727    $inner.colormap choices insert end [GetColormapList -includeNone]
    17411728    $itk_component(colormap) value "BCGYR"
    17421729    bind $inner.colormap <<Value>> \
     
    21472134    # Parse style string.
    21482135    set tag $dataobj-$comp
     2136    set fgColor $itk_option(-plotforeground)
    21492137    array set style {
    2150         -color BCGYR
     2138        -color $fgColor
     2139        -colormap BCGYR
     2140        -colorMode vmag
    21512141        -edgecolor black
    21522142        -edges 0
     
    21602150        -ptsize 1.0
    21612151        -quality 1
    2162         -scaleMode "vmag"
    2163         -shape "arrow"
     2152        -scaleMode vmag
     2153        -shape arrow
    21642154        -wireframe 0
    21652155    }
     
    21692159        set style(-orientGlyphs) 1
    21702160        set style(-scaleMode) "vmag"
     2161        set style(-colorMode) "vmag"
    21712162    } else {
    21722163        set style(-shape) "sphere"
    21732164        set style(-orientGlyphs) 0
    21742165        set style(-scaleMode) "scalar"
     2166        set style(-colorMode) "scalar"
    21752167    }
    21762168    array set style [$dataobj style $comp]
     
    21952187    }
    21962188    if { $_changed(colormap) } {
    2197         set style(-color) $_settings(colormap)
     2189        set style(-colormap) $_settings(colormap)
    21982190    }
    21992191    if { $_currentColormap == "" } {
    2200         $itk_component(colormap) value $style(-color)
     2192        $itk_component(colormap) value $style(-colormap)
    22012193    }
    22022194    set _currentOpacity $style(-opacity)
    22032195    SendCmd "glyphs add $style(-shape) $tag"
    22042196    set _settings(glyphShape) $style(-shape)
     2197    $itk_component(gshape) value $style(-shape)
    22052198    SendCmd "glyphs edges $style(-edges) $tag"
    22062199    # normscale=1 and gscale=1 are defaults
     
    22142207    set _settings(glyphScale) $style(-gscale)
    22152208    SendCmd "outline add $tag"
    2216     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     2209    SendCmd "outline color [Color2RGB $style(-color)] $tag"
    22172210    SendCmd "outline visible $style(-outline) $tag"
    22182211    set _settings(glyphOutline) $style(-outline)
    22192212    set _settings(glyphEdges) $style(-edges)
     2213    if {$style(-colorMode) == "constant" || $style(-colormap) == "none"} {
     2214        SendCmd "glyphs colormode constant {} $tag"
     2215        set _settings(colormapVisible) 0
     2216        set _settings(colormap) "none"
     2217    } else {
     2218        SendCmd "glyphs colormode $style(-colorMode) $_curFldName $tag"
     2219        set _settings(colormapVisible) 1
     2220        set _settings(colormap) $style(-colormap)
     2221        SetCurrentColormap $style(-colormap)
     2222    }
     2223    $itk_component(colormap) value $_settings(colormap)
     2224    set _colorMode $style(-colorMode)
    22202225    # constant color only used if colormode set to constant
    2221     SendCmd "glyphs color [Color2RGB $itk_option(-plotforeground)] $tag"
     2226    SendCmd "glyphs color [Color2RGB $style(-color)] $tag"
    22222227    # Omitting field name for gorient and smode commands
    22232228    # defaults to active scalars or vectors depending on mode
    22242229    SendCmd "glyphs gorient $style(-orientGlyphs) {} $tag"
    22252230    SendCmd "glyphs smode $style(-scaleMode) {} $tag"
     2231    set _settings(glyphScaleMode) $style(-scaleMode)
     2232    $itk_component(scaleMode) value $style(-scaleMode)
    22262233    SendCmd "glyphs quality $style(-quality) $tag"
    22272234    SendCmd "glyphs lighting $style(-lighting) $tag"
     
    22322239    SendCmd "glyphs opacity $_currentOpacity $tag"
    22332240    set _settings(glyphOpacity) $style(-opacity)
    2234     SetCurrentColormap $style(-color)
    22352241    SendCmd "glyphs wireframe $style(-wireframe) $tag"
    22362242    set _settings(glyphWireframe) $style(-wireframe)
  • trunk/gui/scripts/vtkheightmapviewer.tcl

    r4134 r4336  
    19221922        Rappture::Combobox $inner.colormap -width 10 -editable no
    19231923    }
    1924     $inner.colormap choices insert end \
    1925         "BCGYR"              "BCGYR"            \
    1926         "BGYOR"              "BGYOR"            \
    1927         "blue"               "blue"             \
    1928         "blue-to-brown"      "blue-to-brown"    \
    1929         "blue-to-orange"     "blue-to-orange"   \
    1930         "blue-to-grey"       "blue-to-grey"     \
    1931         "green-to-magenta"   "green-to-magenta" \
    1932         "greyscale"          "greyscale"        \
    1933         "nanohub"            "nanohub"          \
    1934         "rainbow"            "rainbow"          \
    1935         "spectral"           "spectral"         \
    1936         "ROYGB"              "ROYGB"            \
    1937         "RYGCB"              "RYGCB"            \
    1938         "brown-to-blue"      "brown-to-blue"    \
    1939         "grey-to-blue"       "grey-to-blue"     \
    1940         "orange-to-blue"     "orange-to-blue"   \
    1941         "none"               "none"
    1942 
     1924    $inner.colormap choices insert end [GetColormapList -includeNone]
    19431925    $itk_component(colormap) value "BCGYR"
    19441926    bind $inner.colormap <<Value>> \
  • trunk/gui/scripts/vtkimageviewer.tcl

    r4076 r4336  
    17011701        Rappture::Combobox $inner.colormap -width 10 -editable no
    17021702    }
    1703     $inner.colormap choices insert end \
    1704         "BCGYR"              "BCGYR"            \
    1705         "BGYOR"              "BGYOR"            \
    1706         "blue"               "blue"             \
    1707         "blue-to-brown"      "blue-to-brown"    \
    1708         "blue-to-orange"     "blue-to-orange"   \
    1709         "blue-to-grey"       "blue-to-grey"     \
    1710         "green-to-magenta"   "green-to-magenta" \
    1711         "greyscale"          "greyscale"        \
    1712         "nanohub"            "nanohub"          \
    1713         "rainbow"            "rainbow"          \
    1714         "spectral"           "spectral"         \
    1715         "ROYGB"              "ROYGB"            \
    1716         "RYGCB"              "RYGCB"            \
    1717         "brown-to-blue"      "brown-to-blue"    \
    1718         "grey-to-blue"       "grey-to-blue"     \
    1719         "orange-to-blue"     "orange-to-blue"   \
    1720         "none"               "none"
     1703    $inner.colormap choices insert end [GetColormapList -includeNone]
    17211704
    17221705    $itk_component(colormap) value "BCGYR"
  • trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r4188 r4336  
    864864        }
    865865        $_image(plot) configure -data $bytes
    866         set time [clock seconds]
    867         set date [clock format $time]
    868         set w [image width $_image(plot)]
    869         set h [image height $_image(plot)]
     866        #set time [clock seconds]
     867        #set date [clock format $time]
     868        #set w [image width $_image(plot)]
     869        #set h [image height $_image(plot)]
    870870        #puts stderr "$date: received image ${w}x${h} image"       
    871871        if { $_start > 0 } {
     
    14701470            }
    14711471            SendCmd "dataset scalar $_curFldName"
    1472             SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1472            if { ![info exists _limits($_curFldName)] } {
     1473                SendCmd "dataset maprange all"
     1474            } else {
     1475                SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1476            }
    14731477            SendCmd "cutplane colormode $_colorMode $_curFldName"
    14741478            SendCmd "contour3d colormode $_colorMode $_curFldName"
     
    16771681        Rappture::Combobox $inner.colormap -width 10 -editable 0
    16781682    }
    1679     $inner.colormap choices insert end \
    1680         "BCGYR"              "BCGYR"            \
    1681         "BGYOR"              "BGYOR"            \
    1682         "blue"               "blue"             \
    1683         "blue-to-brown"      "blue-to-brown"    \
    1684         "blue-to-orange"     "blue-to-orange"   \
    1685         "blue-to-grey"       "blue-to-grey"     \
    1686         "green-to-magenta"   "green-to-magenta" \
    1687         "greyscale"          "greyscale"        \
    1688         "nanohub"            "nanohub"          \
    1689         "rainbow"            "rainbow"          \
    1690         "spectral"           "spectral"         \
    1691         "ROYGB"              "ROYGB"            \
    1692         "RYGCB"              "RYGCB"            \
    1693         "brown-to-blue"      "brown-to-blue"    \
    1694         "grey-to-blue"       "grey-to-blue"     \
    1695         "orange-to-blue"     "orange-to-blue"   
     1683    $inner.colormap choices insert end [GetColormapList]
    16961684
    16971685    $itk_component(colormap) value "BCGYR"
     
    21102098    array set style {
    21112099        -color BCGYR
     2100        -cutplanesvisible 0
     2101        -edgecolor black
    21122102        -edges 0
    2113         -edgecolor black
     2103        -isosurfacevisible 1
     2104        -levels 10
     2105        -lighting 1
    21142106        -linewidth 1.0
    21152107        -opacity 0.6
     2108        -outline 0
     2109        -xcutplanevisible 1
     2110        -xcutplaneposition 50
     2111        -ycutplanevisible 1
     2112        -ycutplaneposition 50
     2113        -zcutplanevisible 1
     2114        -zcutplaneposition 50
    21162115        -wireframe 0
    2117         -lighting 1
    2118         -outline 0
    2119         -levels 10
    2120         -cutplanesvisible 0
    2121         -xcutplanevisible 1
    2122         -ycutplanevisible 1
    2123         -zcutplanevisible 1
    2124         -xcutplaneposition 50
    2125         -ycutplaneposition 50
    2126         -zcutplaneposition 50
    2127         -isosurfacevisible 1
    21282116    }
    21292117    array set style [$dataobj style $comp]
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r4199 r4336  
    14841484            }
    14851485            # Get the new limits because the field changed.
    1486             SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1486            if { ![info exists _limits($_curFldName)] } {
     1487                SendCmd "dataset maprange all"
     1488            } else {
     1489                SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
     1490            }
    14871491            SendCmd "streamlines colormode $_colorMode $_curFldName"
    14881492            SendCmd "cutplane colormode $_colorMode $_curFldName"
     
    17361740        Rappture::Combobox $inner.colormap -width 10 -editable no
    17371741    }
    1738     $inner.colormap choices insert end \
    1739         "BCGYR"              "BCGYR"            \
    1740         "BGYOR"              "BGYOR"            \
    1741         "blue"               "blue"             \
    1742         "blue-to-brown"      "blue-to-brown"    \
    1743         "blue-to-orange"     "blue-to-orange"   \
    1744         "blue-to-grey"       "blue-to-grey"     \
    1745         "green-to-magenta"   "green-to-magenta" \
    1746         "greyscale"          "greyscale"        \
    1747         "nanohub"            "nanohub"          \
    1748         "rainbow"            "rainbow"          \
    1749         "spectral"           "spectral"         \
    1750         "ROYGB"              "ROYGB"            \
    1751         "RYGCB"              "RYGCB"            \
    1752         "brown-to-blue"      "brown-to-blue"    \
    1753         "grey-to-blue"       "grey-to-blue"     \
    1754         "orange-to-blue"     "orange-to-blue"   
     1742    $inner.colormap choices insert end [GetColormapList]
    17551743
    17561744    $itk_component(colormap) value "BCGYR"
  • trunk/gui/scripts/vtkviewer.tcl

    r4199 r4336  
    18571857        Rappture::Combobox $inner.palette -width 10 -editable no
    18581858    }
    1859     $inner.palette choices insert end \
    1860         "BCGYR"              "BCGYR"            \
    1861         "BGYOR"              "BGYOR"            \
    1862         "blue"               "blue"             \
    1863         "blue-to-brown"      "blue-to-brown"    \
    1864         "blue-to-orange"     "blue-to-orange"   \
    1865         "blue-to-grey"       "blue-to-grey"     \
    1866         "green-to-magenta"   "green-to-magenta" \
    1867         "greyscale"          "greyscale"        \
    1868         "nanohub"            "nanohub"          \
    1869         "rainbow"            "rainbow"          \
    1870         "spectral"           "spectral"         \
    1871         "ROYGB"              "ROYGB"            \
    1872         "RYGCB"              "RYGCB"            \
    1873         "brown-to-blue"      "brown-to-blue"    \
    1874         "grey-to-blue"       "grey-to-blue"     \
    1875         "orange-to-blue"     "orange-to-blue"   
    1876 
     1859    $inner.palette choices insert end [GetColormapList]
    18771860    $itk_component(meshpalette) value "BCGYR"
    18781861    bind $inner.palette <<Value>> \
     
    22302213        Rappture::Combobox $inner.palette -width 10 -editable no
    22312214    }
    2232     $inner.palette choices insert end \
    2233         "elementDefault"     "elementDefault"   \
    2234         "BCGYR"              "BCGYR"            \
    2235         "BGYOR"              "BGYOR"            \
    2236         "blue"               "blue"             \
    2237         "blue-to-brown"      "blue-to-brown"    \
    2238         "blue-to-orange"     "blue-to-orange"   \
    2239         "blue-to-grey"       "blue-to-grey"     \
    2240         "green-to-magenta"   "green-to-magenta" \
    2241         "greyscale"          "greyscale"        \
    2242         "nanohub"            "nanohub"          \
    2243         "rainbow"            "rainbow"          \
    2244         "spectral"           "spectral"         \
    2245         "ROYGB"              "ROYGB"            \
    2246         "RYGCB"              "RYGCB"            \
    2247         "brown-to-blue"      "brown-to-blue"    \
    2248         "grey-to-blue"       "grey-to-blue"     \
    2249         "orange-to-blue"     "orange-to-blue"   
    2250 
     2215    $inner.palette choices insert end [GetColormapList -includeElementDefault]
    22512216    $itk_component(moleculepalette) value "elementDefault"
    22522217    bind $inner.palette <<Value>> \
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r4257 r4336  
    18151815        Rappture::Combobox $inner.colormap -width 10 -editable no
    18161816    }
    1817     $inner.colormap choices insert end \
    1818         "default"            "default"          \
    1819         "BCGYR"              "BCGYR"            \
    1820         "BGYOR"              "BGYOR"            \
    1821         "blue"               "blue"             \
    1822         "blue-to-brown"      "blue-to-brown"    \
    1823         "blue-to-orange"     "blue-to-orange"   \
    1824         "blue-to-grey"       "blue-to-grey"     \
    1825         "green-to-magenta"   "green-to-magenta" \
    1826         "greyscale"          "greyscale"        \
    1827         "nanohub"            "nanohub"          \
    1828         "rainbow"            "rainbow"          \
    1829         "spectral"           "spectral"         \
    1830         "ROYGB"              "ROYGB"            \
    1831         "RYGCB"              "RYGCB"            \
    1832         "brown-to-blue"      "brown-to-blue"    \
    1833         "grey-to-blue"       "grey-to-blue"     \
    1834         "orange-to-blue"     "orange-to-blue"   
     1817    $inner.colormap choices insert end [GetColormapList -includeDefault]
    18351818
    18361819    bind $inner.colormap <<Value>> \
Note: See TracChangeset for help on using the changeset viewer.