Changeset 5126 for trunk


Ignore:
Timestamp:
Mar 13, 2015 11:32:52 PM (9 years ago)
Author:
ldelgass
Message:

normalize whitespace in colormap

File:
1 edited

Legend:

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

    r5069 r5126  
    949949
    950950itcl::body Rappture::VisViewer::ColorsToColormap { colors } {
     951    set cmap {}
    951952    switch -- $colors {
    952953        "grey-to-blue" {
    953             return {
     954            set cmap {
    954955                0.0                      0.200 0.200 0.200
    955956                0.14285714285714285      0.400 0.400 0.400
     
    963964        }
    964965        "blue-to-grey" {
    965             return {
     966            set cmap {
    966967                0.0                     0.000 0.600 0.800
    967968                0.14285714285714285     0.400 0.900 1.000
     
    975976        }
    976977        "white-to-blue" {
    977             return {
     978            set cmap {
    978979                0.0                     0.900 1.000 1.000
    979980                0.1111111111111111      0.800 0.983 1.000
     
    989990        }
    990991        "brown-to-blue" {
    991             return {
     992            set cmap {
    992993                0.0                             0.200   0.100   0.000
    993994                0.09090909090909091             0.400   0.187   0.000
     
    10051006        }
    10061007        "blue-to-brown" {
    1007             return {
     1008            set cmap {
    10081009                0.0                             0.000   0.480   0.600
    10091010                0.09090909090909091             0.000   0.667   0.800
     
    10211022        }
    10221023        "blue-to-orange" {
    1023             return {
     1024            set cmap {
    10241025                0.0                             0.000   0.167   1.000
    10251026                0.09090909090909091             0.100   0.400   1.000
     
    10371038        }
    10381039        "orange-to-blue" {
    1039             return {
     1040            set cmap {
    10401041                0.0                             1.000   0.167   0.000
    10411042                0.09090909090909091             1.000   0.400   0.100
     
    11001101        }
    11011102        "spectral" {
    1102             return {
     1103            set cmap {
    11031104                0.0 0.150 0.300 1.000
    11041105                0.1 0.250 0.630 1.000
     
    11151116        }
    11161117        "green-to-magenta" {
    1117             return {
     1118            set cmap {
    11181119                0.0 0.000 0.316 0.000
    11191120                0.06666666666666667 0.000 0.526 0.000
     
    11351136        }
    11361137        "greyscale" {
    1137             return {
     1138            set cmap {
    11381139                0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    11391140            }
     
    11461147        }
    11471148    }
    1148     set cmap {}
    1149     if { [llength $clist] == 1 } {
    1150         set rgb [Color2RGB $clist]
    1151         append cmap "0.0 $rgb 1.0 $rgb"
     1149    if {$cmap == ""} {
     1150        if { [llength $clist] == 1 } {
     1151            set rgb [Color2RGB $clist]
     1152            append cmap "0.0 $rgb 1.0 $rgb"
     1153        } else {
     1154            for {set i 0} {$i < [llength $clist]} {incr i} {
     1155                set x [expr {double($i)/([llength $clist]-1)}]
     1156                set color [lindex $clist $i]
     1157                append cmap "$x [Color2RGB $color] "
     1158            }
     1159        }
    11521160    } else {
    1153         for {set i 0} {$i < [llength $clist]} {incr i} {
    1154             set x [expr {double($i)/([llength $clist]-1)}]
    1155             set color [lindex $clist $i]
    1156             append cmap "$x [Color2RGB $color] "
    1157         }
    1158     }
    1159     #regsub -all "\n" $cmap " " cmap
     1161        regsub -all "\[ \t\r\n\]+" [string trim $cmap] " " cmap
     1162    }
    11601163    return $cmap
    11611164}
Note: See TracChangeset for help on using the changeset viewer.