Changeset 3371 for trunk/gui


Ignore:
Timestamp:
Feb 27, 2013, 7:45:07 AM (12 years ago)
Author:
gah
Message:

Move ColorsToColormap? into base VisViewer? class

Location:
trunk/gui/scripts
Files:
7 edited

Legend:

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

    r3370 r3371  
    110110    private method BuildViewTab {}
    111111    private method BuildVolumeTab {}
    112     private method ColorsToColormap { colors }
    113112    private method ResetColormap { color }
    114113    private method ComputeTransferFunc { tf }
     
    12531252# ----------------------------------------------------------------------
    12541253itcl::body Rappture::NanovisViewer::AdjustSetting {what {value ""}} {
     1254    if {![isconnected]} {
     1255        return
     1256    }
    12551257    switch -- $what {
    12561258        light {
    1257             if {[isconnected]} {
    1258                 set val $_settings($this-light)
    1259                 set diffuse [expr {0.01*$val}]
    1260                 set ambient [expr {1.0-$diffuse}]
    1261                 set specularLevel 0.3
    1262                 set specularExp 90.0
    1263                 SendCmd "volume shading ambient $ambient"
    1264                 SendCmd "volume shading diffuse $diffuse"
    1265                 SendCmd "volume shading specularLevel $specularLevel"
    1266                 SendCmd "volume shading specularExp $specularExp"
     1259            set val $_settings($this-light)
     1260            set diffuse [expr {0.01*$val}]
     1261            set ambient [expr {1.0-$diffuse}]
     1262            set specularLevel 0.3
     1263            set specularExp 90.0
     1264            SendCmd "volume shading ambient $ambient"
     1265            SendCmd "volume shading diffuse $diffuse"
     1266            SendCmd "volume shading specularLevel $specularLevel"
     1267            SendCmd "volume shading specularExp $specularExp"
     1268        }
     1269        light2side {
     1270            set val $_settings($this-light2side)
     1271            SendCmd "volume shading light2side $val"
     1272        }
     1273        transp {
     1274            set val $_settings($this-transp)
     1275            set sval [expr { 0.01 * double($val) }]
     1276            SendCmd "volume shading opacity $sval"
     1277        }
     1278        opacity {
     1279            set val $_settings($this-opacity)
     1280            set sval [expr { 0.01 * double($val) }]
     1281            foreach tf [array names _activeTfs] {
     1282                set _settings($this-$tf-opacity) $sval
     1283                set _activeTfs($tf) 0
    12671284            }
    1268         }
    1269         light2side {
    1270             if {[isconnected]} {
    1271                 set val $_settings($this-light2side)
    1272                 SendCmd "volume shading light2side $val"
    1273             }
    1274         }
    1275         transp {
    1276             if {[isconnected]} {
    1277                 set val $_settings($this-transp)
    1278                 set sval [expr { 0.01 * double($val) }]
    1279                 SendCmd "volume shading opacity $sval"
    1280             }
    1281         }
    1282         opacity {
    1283             if {[isconnected] && [array size _activeTfs] > 0 } {
    1284                 set val $_settings($this-opacity)
    1285                 set sval [expr { 0.01 * double($val) }]
    1286                 foreach tf [array names _activeTfs] {
    1287                     set _settings($this-$tf-opacity) $sval
    1288                     set _activeTfs($tf) 0
    1289                 }
    1290                 updatetransferfuncs
    1291             }
     1285            updatetransferfuncs
    12921286        }
    12931287        thickness {
    1294             if {[isconnected] && [array names _activeTfs] > 0 } {
     1288            if { [array names _activeTfs] > 0 } {
    12951289                set val $_settings($this-thickness)
    12961290                # Scale values between 0.00001 and 0.01000
     
    13041298        }
    13051299        "outline" {
    1306             if {[isconnected]} {
    1307                 SendCmd "volume outline state $_settings($this-outline)"
    1308             }
     1300            SendCmd "volume outline state $_settings($this-outline)"
    13091301        }
    13101302        "isosurface" {
    1311             if {[isconnected]} {
    1312                 SendCmd "volume shading isosurface $_settings($this-isosurface)"
    1313             }
     1303            SendCmd "volume shading isosurface $_settings($this-isosurface)"
    13141304        }
    13151305        "colormap" {
    13161306            set color [$itk_component(colormap) value]
    13171307            set _settings(colormap) $color
     1308            # Only set the colormap on the first volume. Ignore the others.
    13181309            #ResetColormap $color
    13191310        }
    13201311        "grid" {
    1321             if { [isconnected] } {
    1322                 SendCmd "grid visible $_settings($this-grid)"
    1323             }
     1312            SendCmd "grid visible $_settings($this-grid)"
    13241313        }
    13251314        "axes" {
    1326             if { [isconnected] } {
    1327                 SendCmd "axis visible $_settings($this-axes)"
    1328             }
     1315            SendCmd "axis visible $_settings($this-axes)"
    13291316        }
    13301317        "legend" {
     
    13391326        }
    13401327        "volume" {
    1341             if { [isconnected] } {
    1342                 set datasets [CurrentDatasets -cutplanes]
    1343                 SendCmd "volume data state $_settings($this-volume) $datasets"
    1344             }
     1328            set datasets [CurrentDatasets -cutplanes]
     1329            SendCmd "volume data state $_settings($this-volume) $datasets"
    13451330        }
    13461331        "xcutplane" - "ycutplane" - "zcutplane" {
    13471332            set axis [string range $what 0 0]
    13481333            set bool $_settings($this-$what)
    1349             if { [isconnected] } {
    1350                 set datasets [CurrentDatasets -cutplanes]
    1351                 set tag [lindex $datasets 0]
    1352                 SendCmd "cutplane state $bool $axis $tag"
    1353             }
     1334            set datasets [CurrentDatasets -cutplanes]
     1335            set tag [lindex $datasets 0]
     1336            SendCmd "cutplane state $bool $axis $tag"
    13541337            if { $bool } {
    13551338                $itk_component(${axis}CutScale) configure -state normal \
     
    14221405
    14231406
    1424 itcl::body Rappture::NanovisViewer::ColorsToColormap { colors } {
    1425     switch -- $colors {
    1426         "grey-to-blue" {
    1427             return {
    1428                 0.0                      0.200 0.200 0.200
    1429                 0.14285714285714285      0.400 0.400 0.400
    1430                 0.2857142857142857       0.600 0.600 0.600
    1431                 0.42857142857142855      0.900 0.900 0.900
    1432                 0.5714285714285714       0.800 1.000 1.000
    1433                 0.7142857142857143       0.600 1.000 1.000
    1434                 0.8571428571428571       0.400 0.900 1.000
    1435                 1.0                      0.000 0.600 0.800
    1436             }
    1437         }
    1438         "blue-to-grey" {
    1439             return {
    1440                 0.0                     0.000 0.600 0.800
    1441                 0.14285714285714285     0.400 0.900 1.000
    1442                 0.2857142857142857      0.600 1.000 1.000
    1443                 0.42857142857142855     0.800 1.000 1.000
    1444                 0.5714285714285714      0.900 0.900 0.900
    1445                 0.7142857142857143      0.600 0.600 0.600
    1446                 0.8571428571428571      0.400 0.400 0.400
    1447                 1.0                     0.200 0.200 0.200
    1448             }
    1449         }
    1450         "blue" {
    1451             return {
    1452                 0.0                     0.900 1.000 1.000
    1453                 0.1111111111111111      0.800 0.983 1.000
    1454                 0.2222222222222222      0.700 0.950 1.000
    1455                 0.3333333333333333      0.600 0.900 1.000
    1456                 0.4444444444444444      0.500 0.833 1.000
    1457                 0.5555555555555556      0.400 0.750 1.000
    1458                 0.6666666666666666      0.300 0.650 1.000
    1459                 0.7777777777777778      0.200 0.533 1.000
    1460                 0.8888888888888888      0.100 0.400 1.000
    1461                 1.0                     0.000 0.250 1.000
    1462             }
    1463         }
    1464         "brown-to-blue" {
    1465             return {
    1466                 0.0                             0.200   0.100   0.000
    1467                 0.09090909090909091             0.400   0.187   0.000
    1468                 0.18181818181818182             0.600   0.379   0.210
    1469                 0.2727272727272727              0.800   0.608   0.480
    1470                 0.36363636363636365             0.850   0.688   0.595
    1471                 0.45454545454545453             0.950   0.855   0.808
    1472                 0.5454545454545454              0.800   0.993   1.000
    1473                 0.6363636363636364              0.600   0.973   1.000
    1474                 0.7272727272727273              0.400   0.940   1.000
    1475                 0.8181818181818182              0.200   0.893   1.000
    1476                 0.9090909090909091              0.000   0.667   0.800
    1477                 1.0                             0.000   0.480   0.600
    1478             }
    1479         }
    1480         "blue-to-brown" {
    1481             return {
    1482                 0.0                             0.000   0.480   0.600
    1483                 0.09090909090909091             0.000   0.667   0.800
    1484                 0.18181818181818182             0.200   0.893   1.000
    1485                 0.2727272727272727              0.400   0.940   1.000
    1486                 0.36363636363636365             0.600   0.973   1.000
    1487                 0.45454545454545453             0.800   0.993   1.000
    1488                 0.5454545454545454              0.950   0.855   0.808
    1489                 0.6363636363636364              0.850   0.688   0.595
    1490                 0.7272727272727273              0.800   0.608   0.480
    1491                 0.8181818181818182              0.600   0.379   0.210
    1492                 0.9090909090909091              0.400   0.187   0.000
    1493                 1.0                             0.200   0.100   0.000
    1494             }
    1495         }
    1496         "blue-to-orange" {
    1497             return {
    1498                 0.0                             0.000   0.167   1.000
    1499                 0.09090909090909091             0.100   0.400   1.000
    1500                 0.18181818181818182             0.200   0.600   1.000
    1501                 0.2727272727272727              0.400   0.800   1.000
    1502                 0.36363636363636365             0.600   0.933   1.000
    1503                 0.45454545454545453             0.800   1.000   1.000
    1504                 0.5454545454545454              1.000   1.000   0.800
    1505                 0.6363636363636364              1.000   0.933   0.600
    1506                 0.7272727272727273              1.000   0.800   0.400
    1507                 0.8181818181818182              1.000   0.600   0.200
    1508                 0.9090909090909091              1.000   0.400   0.100
    1509                 1.0                             1.000   0.167   0.000
    1510             }
    1511         }
    1512         "orange-to-blue" {
    1513             return {
    1514                 0.0                             1.000   0.167   0.000
    1515                 0.09090909090909091             1.000   0.400   0.100
    1516                 0.18181818181818182             1.000   0.600   0.200
    1517                 0.2727272727272727              1.000   0.800   0.400
    1518                 0.36363636363636365             1.000   0.933   0.600
    1519                 0.45454545454545453             1.000   1.000   0.800
    1520                 0.5454545454545454              0.800   1.000   1.000
    1521                 0.6363636363636364              0.600   0.933   1.000
    1522                 0.7272727272727273              0.400   0.800   1.000
    1523                 0.8181818181818182              0.200   0.600   1.000
    1524                 0.9090909090909091              0.100   0.400   1.000
    1525                 1.0                             0.000   0.167   1.000
    1526             }
    1527         }
    1528         "rainbow" {
    1529             set clist {
    1530                 "#EE82EE"
    1531                 "#4B0082"
    1532                 "blue"
    1533                 "#008000"
    1534                 "yellow"
    1535                 "#FFA500"
    1536                 "red"
    1537             }
    1538         }
    1539         "BGYOR" {
    1540             set clist {
    1541                 "blue"
    1542                 "#008000"
    1543                 "yellow"
    1544                 "#FFA500"
    1545                 "red"
    1546             }
    1547         }
    1548         "ROYGB" {
    1549             set clist {
    1550                 "red"
    1551                 "#FFA500"
    1552                 "yellow"
    1553                 "#008000"
    1554                 "blue"
    1555             }
    1556         }
    1557         "RYGCB" {
    1558             set clist {
    1559                 "red"
    1560                 "yellow"
    1561                 "green"
    1562                 "cyan"
    1563                 "blue"
    1564             }
    1565         }
    1566         "BCGYR" {
    1567             set clist {
    1568                 "blue"
    1569                 "cyan"
    1570                 "green"
    1571                 "yellow"
    1572                 "red"
    1573             }
    1574         }
    1575         "spectral" {
    1576             return {
    1577                 0.0 0.150 0.300 1.000
    1578                 0.1 0.250 0.630 1.000
    1579                 0.2 0.450 0.850 1.000
    1580                 0.3 0.670 0.970 1.000
    1581                 0.4 0.880 1.000 1.000
    1582                 0.5 1.000 1.000 0.750
    1583                 0.6 1.000 0.880 0.600
    1584                 0.7 1.000 0.680 0.450
    1585                 0.8 0.970 0.430 0.370
    1586                 0.9 0.850 0.150 0.196
    1587                 1.0 0.650 0.000 0.130
    1588             }
    1589         }
    1590         "green-to-magenta" {
    1591             return {
    1592                 0.0 0.000 0.316 0.000
    1593                 0.06666666666666667 0.000 0.526 0.000
    1594                 0.13333333333333333 0.000 0.737 0.000
    1595                 0.2 0.000 0.947 0.000
    1596                 0.26666666666666666 0.316 1.000 0.316
    1597                 0.3333333333333333 0.526 1.000 0.526
    1598                 0.4 0.737 1.000 0.737
    1599                 0.4666666666666667 1.000 1.000 1.000
    1600                 0.5333333333333333 1.000 0.947 1.000
    1601                 0.6 1.000 0.737 1.000
    1602                 0.6666666666666666 1.000 0.526 1.000
    1603                 0.7333333333333333 1.000 0.316 1.000
    1604                 0.8 0.947 0.000 0.947
    1605                 0.8666666666666667 0.737 0.000 0.737
    1606                 0.9333333333333333 0.526 0.000 0.526
    1607                 1.0 0.316 0.000 0.316
    1608             }
    1609         }
    1610         "greyscale" {
    1611             return {
    1612                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1613             }
    1614         }
    1615         "nanohub" {
    1616             set clist "white yellow green cyan blue magenta"
    1617         }
    1618         default {
    1619             set clist [split $colors ":"]
    1620         }
    1621     }
    1622     set cmap {}
    1623     if { [llength $clist] == 1 } {
    1624         set rgb [Color2RGB $clist]
    1625         append cmap "0.0 $rgb 1.0 $rgb"
    1626     } else {
    1627         for {set i 0} {$i < [llength $clist]} {incr i} {
    1628             set x [expr {double($i)/([llength $clist]-1)}]
    1629             set color [lindex $clist $i]
    1630             append cmap "$x [Color2RGB $color] "
    1631         }
    1632     }
    1633     return $cmap
    1634 }
    16351407
    16361408#
     
    16451417itcl::body Rappture::NanovisViewer::ComputeTransferFunc { tf } {
    16461418    array set style {
    1647         -color rainbow
     1419        -color nanovis
    16481420        -levels 6
    16491421        -opacity 1.0
  • trunk/gui/scripts/visviewer.tcl

    r3367 r3371  
    7373    private method SendDebugCommand {}
    7474
     75    protected method CheckConnection {}
    7576    protected method Color2RGB { color }
     77    protected method ColorsToColormap { colors }
    7678    protected method Connect { servers }
    77     protected method CheckConnection {}
    7879    protected method Disconnect {}
    7980    protected method Euler2XYZ { theta phi psi }
     
    816817}
    817818
     819
     820itcl::body Rappture::VisViewer::ColorsToColormap { colors } {
     821    switch -- $colors {
     822        "grey-to-blue" {
     823            return {
     824                0.0                      0.200 0.200 0.200
     825                0.14285714285714285      0.400 0.400 0.400
     826                0.2857142857142857       0.600 0.600 0.600
     827                0.42857142857142855      0.900 0.900 0.900
     828                0.5714285714285714       0.800 1.000 1.000
     829                0.7142857142857143       0.600 1.000 1.000
     830                0.8571428571428571       0.400 0.900 1.000
     831                1.0                      0.000 0.600 0.800
     832            }
     833        }
     834        "blue-to-grey" {
     835            return {
     836                0.0                     0.000 0.600 0.800
     837                0.14285714285714285     0.400 0.900 1.000
     838                0.2857142857142857      0.600 1.000 1.000
     839                0.42857142857142855     0.800 1.000 1.000
     840                0.5714285714285714      0.900 0.900 0.900
     841                0.7142857142857143      0.600 0.600 0.600
     842                0.8571428571428571      0.400 0.400 0.400
     843                1.0                     0.200 0.200 0.200
     844            }
     845        }
     846        "blue" {
     847            return {
     848                0.0                     0.900 1.000 1.000
     849                0.1111111111111111      0.800 0.983 1.000
     850                0.2222222222222222      0.700 0.950 1.000
     851                0.3333333333333333      0.600 0.900 1.000
     852                0.4444444444444444      0.500 0.833 1.000
     853                0.5555555555555556      0.400 0.750 1.000
     854                0.6666666666666666      0.300 0.650 1.000
     855                0.7777777777777778      0.200 0.533 1.000
     856                0.8888888888888888      0.100 0.400 1.000
     857                1.0                     0.000 0.250 1.000
     858            }
     859        }
     860        "brown-to-blue" {
     861            return {
     862                0.0                             0.200   0.100   0.000
     863                0.09090909090909091             0.400   0.187   0.000
     864                0.18181818181818182             0.600   0.379   0.210
     865                0.2727272727272727              0.800   0.608   0.480
     866                0.36363636363636365             0.850   0.688   0.595
     867                0.45454545454545453             0.950   0.855   0.808
     868                0.5454545454545454              0.800   0.993   1.000
     869                0.6363636363636364              0.600   0.973   1.000
     870                0.7272727272727273              0.400   0.940   1.000
     871                0.8181818181818182              0.200   0.893   1.000
     872                0.9090909090909091              0.000   0.667   0.800
     873                1.0                             0.000   0.480   0.600
     874            }
     875        }
     876        "blue-to-brown" {
     877            return {
     878                0.0                             0.000   0.480   0.600
     879                0.09090909090909091             0.000   0.667   0.800
     880                0.18181818181818182             0.200   0.893   1.000
     881                0.2727272727272727              0.400   0.940   1.000
     882                0.36363636363636365             0.600   0.973   1.000
     883                0.45454545454545453             0.800   0.993   1.000
     884                0.5454545454545454              0.950   0.855   0.808
     885                0.6363636363636364              0.850   0.688   0.595
     886                0.7272727272727273              0.800   0.608   0.480
     887                0.8181818181818182              0.600   0.379   0.210
     888                0.9090909090909091              0.400   0.187   0.000
     889                1.0                             0.200   0.100   0.000
     890            }
     891        }
     892        "blue-to-orange" {
     893            return {
     894                0.0                             0.000   0.167   1.000
     895                0.09090909090909091             0.100   0.400   1.000
     896                0.18181818181818182             0.200   0.600   1.000
     897                0.2727272727272727              0.400   0.800   1.000
     898                0.36363636363636365             0.600   0.933   1.000
     899                0.45454545454545453             0.800   1.000   1.000
     900                0.5454545454545454              1.000   1.000   0.800
     901                0.6363636363636364              1.000   0.933   0.600
     902                0.7272727272727273              1.000   0.800   0.400
     903                0.8181818181818182              1.000   0.600   0.200
     904                0.9090909090909091              1.000   0.400   0.100
     905                1.0                             1.000   0.167   0.000
     906            }
     907        }
     908        "orange-to-blue" {
     909            return {
     910                0.0                             1.000   0.167   0.000
     911                0.09090909090909091             1.000   0.400   0.100
     912                0.18181818181818182             1.000   0.600   0.200
     913                0.2727272727272727              1.000   0.800   0.400
     914                0.36363636363636365             1.000   0.933   0.600
     915                0.45454545454545453             1.000   1.000   0.800
     916                0.5454545454545454              0.800   1.000   1.000
     917                0.6363636363636364              0.600   0.933   1.000
     918                0.7272727272727273              0.400   0.800   1.000
     919                0.8181818181818182              0.200   0.600   1.000
     920                0.9090909090909091              0.100   0.400   1.000
     921                1.0                             0.000   0.167   1.000
     922            }
     923        }
     924        "rainbow" {
     925            set clist {
     926                "#EE82EE"
     927                "#4B0082"
     928                "blue"
     929                "#008000"
     930                "yellow"
     931                "#FFA500"
     932                "red"
     933            }
     934        }
     935        "BGYOR" {
     936            set clist {
     937                "blue"
     938                "#008000"
     939                "yellow"
     940                "#FFA500"
     941                "red"
     942            }
     943        }
     944        "ROYGB" {
     945            set clist {
     946                "red"
     947                "#FFA500"
     948                "yellow"
     949                "#008000"
     950                "blue"
     951            }
     952        }
     953        "RYGCB" {
     954            set clist {
     955                "red"
     956                "yellow"
     957                "green"
     958                "cyan"
     959                "blue"
     960            }
     961        }
     962        "BCGYR" {
     963            set clist {
     964                "blue"
     965                "cyan"
     966                "green"
     967                "yellow"
     968                "red"
     969            }
     970        }
     971        "spectral" {
     972            return {
     973                0.0 0.150 0.300 1.000
     974                0.1 0.250 0.630 1.000
     975                0.2 0.450 0.850 1.000
     976                0.3 0.670 0.970 1.000
     977                0.4 0.880 1.000 1.000
     978                0.5 1.000 1.000 0.750
     979                0.6 1.000 0.880 0.600
     980                0.7 1.000 0.680 0.450
     981                0.8 0.970 0.430 0.370
     982                0.9 0.850 0.150 0.196
     983                1.0 0.650 0.000 0.130
     984            }
     985        }
     986        "green-to-magenta" {
     987            return {
     988                0.0 0.000 0.316 0.000
     989                0.06666666666666667 0.000 0.526 0.000
     990                0.13333333333333333 0.000 0.737 0.000
     991                0.2 0.000 0.947 0.000
     992                0.26666666666666666 0.316 1.000 0.316
     993                0.3333333333333333 0.526 1.000 0.526
     994                0.4 0.737 1.000 0.737
     995                0.4666666666666667 1.000 1.000 1.000
     996                0.5333333333333333 1.000 0.947 1.000
     997                0.6 1.000 0.737 1.000
     998                0.6666666666666666 1.000 0.526 1.000
     999                0.7333333333333333 1.000 0.316 1.000
     1000                0.8 0.947 0.000 0.947
     1001                0.8666666666666667 0.737 0.000 0.737
     1002                0.9333333333333333 0.526 0.000 0.526
     1003                1.0 0.316 0.000 0.316
     1004            }
     1005        }
     1006        "greyscale" {
     1007            return {
     1008                0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
     1009            }
     1010        }
     1011        "nanohub" {
     1012            set clist "white yellow green cyan blue magenta"
     1013        }
     1014        default {
     1015            set clist [split $colors ":"]
     1016        }
     1017    }
     1018    set cmap {}
     1019    if { [llength $clist] == 1 } {
     1020        set rgb [Color2RGB $clist]
     1021        append cmap "0.0 $rgb 1.0 $rgb"
     1022    } else {
     1023        for {set i 0} {$i < [llength $clist]} {incr i} {
     1024            set x [expr {double($i)/([llength $clist]-1)}]
     1025            set color [lindex $clist $i]
     1026            append cmap "$x [Color2RGB $color] "
     1027        }
     1028    }
     1029    return $cmap
     1030}
  • trunk/gui/scripts/vtkheightmapviewer.tcl

    r3355 r3371  
    9292    private method BuildContourTab {}
    9393    private method BuildDownloadPopup { widget command }
    94     private method ColorsToColormap { color }
    9594    private method Combo { option }
    9695    private method ConvertToVtkData { dataobj comp }
     
    16711670}
    16721671
    1673 itcl::body Rappture::VtkHeightmapViewer::ColorsToColormap { colors } {
    1674     switch -- $colors {
    1675         "grey-to-blue" {
    1676             return {
    1677                 0.0                      0.200 0.200 0.200
    1678                 0.14285714285714285      0.400 0.400 0.400
    1679                 0.2857142857142857       0.600 0.600 0.600
    1680                 0.42857142857142855      0.900 0.900 0.900
    1681                 0.5714285714285714       0.800 1.000 1.000
    1682                 0.7142857142857143       0.600 1.000 1.000
    1683                 0.8571428571428571       0.400 0.900 1.000
    1684                 1.0                      0.000 0.600 0.800
    1685             }
    1686         }
    1687         "blue-to-grey" {
    1688             return {
    1689                 0.0                     0.000 0.600 0.800
    1690                 0.14285714285714285     0.400 0.900 1.000
    1691                 0.2857142857142857      0.600 1.000 1.000
    1692                 0.42857142857142855     0.800 1.000 1.000
    1693                 0.5714285714285714      0.900 0.900 0.900
    1694                 0.7142857142857143      0.600 0.600 0.600
    1695                 0.8571428571428571      0.400 0.400 0.400
    1696                 1.0                     0.200 0.200 0.200
    1697             }
    1698         }
    1699         "blue" {
    1700             return {
    1701                 0.0                     0.900 1.000 1.000
    1702                 0.1111111111111111      0.800 0.983 1.000
    1703                 0.2222222222222222      0.700 0.950 1.000
    1704                 0.3333333333333333      0.600 0.900 1.000
    1705                 0.4444444444444444      0.500 0.833 1.000
    1706                 0.5555555555555556      0.400 0.750 1.000
    1707                 0.6666666666666666      0.300 0.650 1.000
    1708                 0.7777777777777778      0.200 0.533 1.000
    1709                 0.8888888888888888      0.100 0.400 1.000
    1710                 1.0                     0.000 0.250 1.000
    1711             }
    1712         }
    1713         "brown-to-blue" {
    1714             return {
    1715                 0.0                             0.200   0.100   0.000
    1716                 0.09090909090909091             0.400   0.187   0.000
    1717                 0.18181818181818182             0.600   0.379   0.210
    1718                 0.2727272727272727              0.800   0.608   0.480
    1719                 0.36363636363636365             0.850   0.688   0.595
    1720                 0.45454545454545453             0.950   0.855   0.808
    1721                 0.5454545454545454              0.800   0.993   1.000
    1722                 0.6363636363636364              0.600   0.973   1.000
    1723                 0.7272727272727273              0.400   0.940   1.000
    1724                 0.8181818181818182              0.200   0.893   1.000
    1725                 0.9090909090909091              0.000   0.667   0.800
    1726                 1.0                             0.000   0.480   0.600
    1727             }
    1728         }
    1729         "blue-to-brown" {
    1730             return {
    1731                 0.0                             0.000   0.480   0.600
    1732                 0.09090909090909091             0.000   0.667   0.800
    1733                 0.18181818181818182             0.200   0.893   1.000
    1734                 0.2727272727272727              0.400   0.940   1.000
    1735                 0.36363636363636365             0.600   0.973   1.000
    1736                 0.45454545454545453             0.800   0.993   1.000
    1737                 0.5454545454545454              0.950   0.855   0.808
    1738                 0.6363636363636364              0.850   0.688   0.595
    1739                 0.7272727272727273              0.800   0.608   0.480
    1740                 0.8181818181818182              0.600   0.379   0.210
    1741                 0.9090909090909091              0.400   0.187   0.000
    1742                 1.0                             0.200   0.100   0.000
    1743             }
    1744         }
    1745         "blue-to-orange" {
    1746             return {
    1747                 0.0                             0.000   0.167   1.000
    1748                 0.09090909090909091             0.100   0.400   1.000
    1749                 0.18181818181818182             0.200   0.600   1.000
    1750                 0.2727272727272727              0.400   0.800   1.000
    1751                 0.36363636363636365             0.600   0.933   1.000
    1752                 0.45454545454545453             0.800   1.000   1.000
    1753                 0.5454545454545454              1.000   1.000   0.800
    1754                 0.6363636363636364              1.000   0.933   0.600
    1755                 0.7272727272727273              1.000   0.800   0.400
    1756                 0.8181818181818182              1.000   0.600   0.200
    1757                 0.9090909090909091              1.000   0.400   0.100
    1758                 1.0                             1.000   0.167   0.000
    1759             }
    1760         }
    1761         "orange-to-blue" {
    1762             return {
    1763                 0.0                             1.000   0.167   0.000
    1764                 0.09090909090909091             1.000   0.400   0.100
    1765                 0.18181818181818182             1.000   0.600   0.200
    1766                 0.2727272727272727              1.000   0.800   0.400
    1767                 0.36363636363636365             1.000   0.933   0.600
    1768                 0.45454545454545453             1.000   1.000   0.800
    1769                 0.5454545454545454              0.800   1.000   1.000
    1770                 0.6363636363636364              0.600   0.933   1.000
    1771                 0.7272727272727273              0.400   0.800   1.000
    1772                 0.8181818181818182              0.200   0.600   1.000
    1773                 0.9090909090909091              0.100   0.400   1.000
    1774                 1.0                             0.000   0.167   1.000
    1775             }
    1776         }
    1777         "rainbow" {
    1778             set clist {
    1779                 "#EE82EE"
    1780                 "#4B0082"
    1781                 "blue"
    1782                 "#008000"
    1783                 "yellow"
    1784                 "#FFA500"
    1785                 "red"
    1786             }
    1787         }
    1788         "BGYOR" {
    1789             set clist {
    1790                 "blue"
    1791                 "#008000"
    1792                 "yellow"
    1793                 "#FFA500"
    1794                 "red"
    1795             }
    1796         }
    1797         "ROYGB" {
    1798             set clist {
    1799                 "red"
    1800                 "#FFA500"
    1801                 "yellow"
    1802                 "#008000"
    1803                 "blue"
    1804             }
    1805         }
    1806         "RYGCB" {
    1807             set clist {
    1808                 "red"
    1809                 "yellow"
    1810                 "green"
    1811                 "cyan"
    1812                 "blue"
    1813             }
    1814         }
    1815         "BCGYR" {
    1816             set clist {
    1817                 "blue"
    1818                 "cyan"
    1819                 "green"
    1820                 "yellow"
    1821                 "red"
    1822             }
    1823         }
    1824         "spectral" {
    1825             return {
    1826                 0.0 0.150 0.300 1.000
    1827                 0.1 0.250 0.630 1.000
    1828                 0.2 0.450 0.850 1.000
    1829                 0.3 0.670 0.970 1.000
    1830                 0.4 0.880 1.000 1.000
    1831                 0.5 1.000 1.000 0.750
    1832                 0.6 1.000 0.880 0.600
    1833                 0.7 1.000 0.680 0.450
    1834                 0.8 0.970 0.430 0.370
    1835                 0.9 0.850 0.150 0.196
    1836                 1.0 0.650 0.000 0.130
    1837             }
    1838         }
    1839         "green-to-magenta" {
    1840             return {
    1841                 0.0 0.000 0.316 0.000
    1842                 0.06666666666666667 0.000 0.526 0.000
    1843                 0.13333333333333333 0.000 0.737 0.000
    1844                 0.2 0.000 0.947 0.000
    1845                 0.26666666666666666 0.316 1.000 0.316
    1846                 0.3333333333333333 0.526 1.000 0.526
    1847                 0.4 0.737 1.000 0.737
    1848                 0.4666666666666667 1.000 1.000 1.000
    1849                 0.5333333333333333 1.000 0.947 1.000
    1850                 0.6 1.000 0.737 1.000
    1851                 0.6666666666666666 1.000 0.526 1.000
    1852                 0.7333333333333333 1.000 0.316 1.000
    1853                 0.8 0.947 0.000 0.947
    1854                 0.8666666666666667 0.737 0.000 0.737
    1855                 0.9333333333333333 0.526 0.000 0.526
    1856                 1.0 0.316 0.000 0.316
    1857             }
    1858         }
    1859         "greyscale" {
    1860             return {
    1861                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1862             }
    1863         }
    1864         "nanohub" {
    1865             set clist "white yellow green cyan blue magenta"
    1866         }
    1867         default {
    1868             set clist $colors
    1869         }
    1870     }
    1871     set cmap {}
    1872     for {set i 0} {$i < [llength $clist]} {incr i} {
    1873         set x [expr {double($i)/([llength $clist]-1)}]
    1874         set color [lindex $clist $i]
    1875         append cmap "$x [Color2RGB $color] "
    1876     }
    1877     return $cmap
    1878 }
    18791672
    18801673#
  • trunk/gui/scripts/vtkisosurfaceviewer.tcl

    r3358 r3371  
    104104    private method PanCamera {}
    105105    private method RequestLegend {}
    106     private method ColorsToColormap { color }
    107106    private method SetLegendTip { x y }
    108107    private method SetObjectStyle { dataobj comp }
     
    15471546}
    15481547
    1549 itcl::body Rappture::VtkIsosurfaceViewer::ColorsToColormap { colors } {
    1550     switch -- $colors {
    1551         "grey-to-blue" {
    1552             return {
    1553                 0.0                      0.200 0.200 0.200
    1554                 0.14285714285714285      0.400 0.400 0.400
    1555                 0.2857142857142857       0.600 0.600 0.600
    1556                 0.42857142857142855      0.900 0.900 0.900
    1557                 0.5714285714285714       0.800 1.000 1.000
    1558                 0.7142857142857143       0.600 1.000 1.000
    1559                 0.8571428571428571       0.400 0.900 1.000
    1560                 1.0                      0.000 0.600 0.800
    1561             }
    1562         }
    1563         "blue-to-grey" {
    1564             return {
    1565                 0.0                     0.000 0.600 0.800
    1566                 0.14285714285714285     0.400 0.900 1.000
    1567                 0.2857142857142857      0.600 1.000 1.000
    1568                 0.42857142857142855     0.800 1.000 1.000
    1569                 0.5714285714285714      0.900 0.900 0.900
    1570                 0.7142857142857143      0.600 0.600 0.600
    1571                 0.8571428571428571      0.400 0.400 0.400
    1572                 1.0                     0.200 0.200 0.200
    1573             }
    1574         }
    1575         "blue" {
    1576             return {
    1577                 0.0                     0.900 1.000 1.000
    1578                 0.1111111111111111      0.800 0.983 1.000
    1579                 0.2222222222222222      0.700 0.950 1.000
    1580                 0.3333333333333333      0.600 0.900 1.000
    1581                 0.4444444444444444      0.500 0.833 1.000
    1582                 0.5555555555555556      0.400 0.750 1.000
    1583                 0.6666666666666666      0.300 0.650 1.000
    1584                 0.7777777777777778      0.200 0.533 1.000
    1585                 0.8888888888888888      0.100 0.400 1.000
    1586                 1.0                     0.000 0.250 1.000
    1587             }
    1588         }
    1589         "brown-to-blue" {
    1590             return {
    1591                 0.0                             0.200   0.100   0.000
    1592                 0.09090909090909091             0.400   0.187   0.000
    1593                 0.18181818181818182             0.600   0.379   0.210
    1594                 0.2727272727272727              0.800   0.608   0.480
    1595                 0.36363636363636365             0.850   0.688   0.595
    1596                 0.45454545454545453             0.950   0.855   0.808
    1597                 0.5454545454545454              0.800   0.993   1.000
    1598                 0.6363636363636364              0.600   0.973   1.000
    1599                 0.7272727272727273              0.400   0.940   1.000
    1600                 0.8181818181818182              0.200   0.893   1.000
    1601                 0.9090909090909091              0.000   0.667   0.800
    1602                 1.0                             0.000   0.480   0.600
    1603             }
    1604         }
    1605         "blue-to-brown" {
    1606             return {
    1607                 0.0                             0.000   0.480   0.600
    1608                 0.09090909090909091             0.000   0.667   0.800
    1609                 0.18181818181818182             0.200   0.893   1.000
    1610                 0.2727272727272727              0.400   0.940   1.000
    1611                 0.36363636363636365             0.600   0.973   1.000
    1612                 0.45454545454545453             0.800   0.993   1.000
    1613                 0.5454545454545454              0.950   0.855   0.808
    1614                 0.6363636363636364              0.850   0.688   0.595
    1615                 0.7272727272727273              0.800   0.608   0.480
    1616                 0.8181818181818182              0.600   0.379   0.210
    1617                 0.9090909090909091              0.400   0.187   0.000
    1618                 1.0                             0.200   0.100   0.000
    1619             }
    1620         }
    1621         "blue-to-orange" {
    1622             return {
    1623                 0.0                             0.000   0.167   1.000
    1624                 0.09090909090909091             0.100   0.400   1.000
    1625                 0.18181818181818182             0.200   0.600   1.000
    1626                 0.2727272727272727              0.400   0.800   1.000
    1627                 0.36363636363636365             0.600   0.933   1.000
    1628                 0.45454545454545453             0.800   1.000   1.000
    1629                 0.5454545454545454              1.000   1.000   0.800
    1630                 0.6363636363636364              1.000   0.933   0.600
    1631                 0.7272727272727273              1.000   0.800   0.400
    1632                 0.8181818181818182              1.000   0.600   0.200
    1633                 0.9090909090909091              1.000   0.400   0.100
    1634                 1.0                             1.000   0.167   0.000
    1635             }
    1636         }
    1637         "orange-to-blue" {
    1638             return {
    1639                 0.0                             1.000   0.167   0.000
    1640                 0.09090909090909091             1.000   0.400   0.100
    1641                 0.18181818181818182             1.000   0.600   0.200
    1642                 0.2727272727272727              1.000   0.800   0.400
    1643                 0.36363636363636365             1.000   0.933   0.600
    1644                 0.45454545454545453             1.000   1.000   0.800
    1645                 0.5454545454545454              0.800   1.000   1.000
    1646                 0.6363636363636364              0.600   0.933   1.000
    1647                 0.7272727272727273              0.400   0.800   1.000
    1648                 0.8181818181818182              0.200   0.600   1.000
    1649                 0.9090909090909091              0.100   0.400   1.000
    1650                 1.0                             0.000   0.167   1.000
    1651             }
    1652         }
    1653         "rainbow" {
    1654             set clist {
    1655                 "#EE82EE"
    1656                 "#4B0082"
    1657                 "blue"
    1658                 "#008000"
    1659                 "yellow"
    1660                 "#FFA500"
    1661                 "red"
    1662             }
    1663         }
    1664         "BGYOR" {
    1665             set clist {
    1666                 "blue"
    1667                 "#008000"
    1668                 "yellow"
    1669                 "#FFA500"
    1670                 "red"
    1671             }
    1672         }
    1673         "ROYGB" {
    1674             set clist {
    1675                 "red"
    1676                 "#FFA500"
    1677                 "yellow"
    1678                 "#008000"
    1679                 "blue"
    1680             }
    1681         }
    1682         "RYGCB" {
    1683             set clist {
    1684                 "red"
    1685                 "yellow"
    1686                 "green"
    1687                 "cyan"
    1688                 "blue"
    1689             }
    1690         }
    1691         "BCGYR" {
    1692             set clist {
    1693                 "blue"
    1694                 "cyan"
    1695                 "green"
    1696                 "yellow"
    1697                 "red"
    1698             }
    1699         }
    1700         "spectral" {
    1701             return {
    1702                 0.0 0.150 0.300 1.000
    1703                 0.1 0.250 0.630 1.000
    1704                 0.2 0.450 0.850 1.000
    1705                 0.3 0.670 0.970 1.000
    1706                 0.4 0.880 1.000 1.000
    1707                 0.5 1.000 1.000 0.750
    1708                 0.6 1.000 0.880 0.600
    1709                 0.7 1.000 0.680 0.450
    1710                 0.8 0.970 0.430 0.370
    1711                 0.9 0.850 0.150 0.196
    1712                 1.0 0.650 0.000 0.130
    1713             }
    1714         }
    1715         "green-to-magenta" {
    1716             return {
    1717                 0.0 0.000 0.316 0.000
    1718                 0.06666666666666667 0.000 0.526 0.000
    1719                 0.13333333333333333 0.000 0.737 0.000
    1720                 0.2 0.000 0.947 0.000
    1721                 0.26666666666666666 0.316 1.000 0.316
    1722                 0.3333333333333333 0.526 1.000 0.526
    1723                 0.4 0.737 1.000 0.737
    1724                 0.4666666666666667 1.000 1.000 1.000
    1725                 0.5333333333333333 1.000 0.947 1.000
    1726                 0.6 1.000 0.737 1.000
    1727                 0.6666666666666666 1.000 0.526 1.000
    1728                 0.7333333333333333 1.000 0.316 1.000
    1729                 0.8 0.947 0.000 0.947
    1730                 0.8666666666666667 0.737 0.000 0.737
    1731                 0.9333333333333333 0.526 0.000 0.526
    1732                 1.0 0.316 0.000 0.316
    1733             }
    1734         }
    1735         "greyscale" {
    1736             return {
    1737                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1738             }
    1739         }
    1740         "nanohub" {
    1741             set clist "white yellow green cyan blue magenta"
    1742         }
    1743         default {
    1744             set clist $colors
    1745         }
    1746     }
    1747     set cmap {}
    1748     for {set i 0} {$i < [llength $clist]} {incr i} {
    1749         set x [expr {double($i)/([llength $clist]-1)}]
    1750         set color [lindex $clist $i]
    1751         append cmap "$x [Color2RGB $color] "
    1752     }
    1753     return $cmap
    1754 }
    1755 
    17561548#
    17571549# BuildColormap --
     
    17591551itcl::body Rappture::VtkIsosurfaceViewer::BuildColormap { name stylelist } {
    17601552    array set style $stylelist
    1761 parray style
    17621553    set cmap [ColorsToColormap $style(-color)]
    17631554    if { [llength $cmap] == 0 } {
     
    27352526}
    27362527
    2737 itcl::body Rappture::VtkIsosurfaceViewer::ColorsToColormap { colors } {
    2738     switch -- $colors {
    2739         "grey-to-blue" {
    2740             return {
    2741                 0.0                      0.200 0.200 0.200
    2742                 0.14285714285714285      0.400 0.400 0.400
    2743                 0.2857142857142857       0.600 0.600 0.600
    2744                 0.42857142857142855      0.900 0.900 0.900
    2745                 0.5714285714285714       0.800 1.000 1.000
    2746                 0.7142857142857143       0.600 1.000 1.000
    2747                 0.8571428571428571       0.400 0.900 1.000
    2748                 1.0                      0.000 0.600 0.800
    2749             }
    2750         }
    2751         "blue-to-grey" {
    2752             return {
    2753                 0.0                     0.000 0.600 0.800
    2754                 0.14285714285714285     0.400 0.900 1.000
    2755                 0.2857142857142857      0.600 1.000 1.000
    2756                 0.42857142857142855     0.800 1.000 1.000
    2757                 0.5714285714285714      0.900 0.900 0.900
    2758                 0.7142857142857143      0.600 0.600 0.600
    2759                 0.8571428571428571      0.400 0.400 0.400
    2760                 1.0                     0.200 0.200 0.200
    2761             }
    2762         }
    2763         "blue" {
    2764             return {
    2765                 0.0                     0.900 1.000 1.000
    2766                 0.1111111111111111      0.800 0.983 1.000
    2767                 0.2222222222222222      0.700 0.950 1.000
    2768                 0.3333333333333333      0.600 0.900 1.000
    2769                 0.4444444444444444      0.500 0.833 1.000
    2770                 0.5555555555555556      0.400 0.750 1.000
    2771                 0.6666666666666666      0.300 0.650 1.000
    2772                 0.7777777777777778      0.200 0.533 1.000
    2773                 0.8888888888888888      0.100 0.400 1.000
    2774                 1.0                     0.000 0.250 1.000
    2775             }
    2776         }
    2777         "brown-to-blue" {
    2778             return {
    2779                 0.0                             0.200   0.100   0.000
    2780                 0.09090909090909091             0.400   0.187   0.000
    2781                 0.18181818181818182             0.600   0.379   0.210
    2782                 0.2727272727272727              0.800   0.608   0.480
    2783                 0.36363636363636365             0.850   0.688   0.595
    2784                 0.45454545454545453             0.950   0.855   0.808
    2785                 0.5454545454545454              0.800   0.993   1.000
    2786                 0.6363636363636364              0.600   0.973   1.000
    2787                 0.7272727272727273              0.400   0.940   1.000
    2788                 0.8181818181818182              0.200   0.893   1.000
    2789                 0.9090909090909091              0.000   0.667   0.800
    2790                 1.0                             0.000   0.480   0.600
    2791             }
    2792         }
    2793         "blue-to-brown" {
    2794             return {
    2795                 0.0                             0.000   0.480   0.600
    2796                 0.09090909090909091             0.000   0.667   0.800
    2797                 0.18181818181818182             0.200   0.893   1.000
    2798                 0.2727272727272727              0.400   0.940   1.000
    2799                 0.36363636363636365             0.600   0.973   1.000
    2800                 0.45454545454545453             0.800   0.993   1.000
    2801                 0.5454545454545454              0.950   0.855   0.808
    2802                 0.6363636363636364              0.850   0.688   0.595
    2803                 0.7272727272727273              0.800   0.608   0.480
    2804                 0.8181818181818182              0.600   0.379   0.210
    2805                 0.9090909090909091              0.400   0.187   0.000
    2806                 1.0                             0.200   0.100   0.000
    2807             }
    2808         }
    2809         "blue-to-orange" {
    2810             return {
    2811                 0.0                             0.000   0.167   1.000
    2812                 0.09090909090909091             0.100   0.400   1.000
    2813                 0.18181818181818182             0.200   0.600   1.000
    2814                 0.2727272727272727              0.400   0.800   1.000
    2815                 0.36363636363636365             0.600   0.933   1.000
    2816                 0.45454545454545453             0.800   1.000   1.000
    2817                 0.5454545454545454              1.000   1.000   0.800
    2818                 0.6363636363636364              1.000   0.933   0.600
    2819                 0.7272727272727273              1.000   0.800   0.400
    2820                 0.8181818181818182              1.000   0.600   0.200
    2821                 0.9090909090909091              1.000   0.400   0.100
    2822                 1.0                             1.000   0.167   0.000
    2823             }
    2824         }
    2825         "orange-to-blue" {
    2826             return {
    2827                 0.0                             1.000   0.167   0.000
    2828                 0.09090909090909091             1.000   0.400   0.100
    2829                 0.18181818181818182             1.000   0.600   0.200
    2830                 0.2727272727272727              1.000   0.800   0.400
    2831                 0.36363636363636365             1.000   0.933   0.600
    2832                 0.45454545454545453             1.000   1.000   0.800
    2833                 0.5454545454545454              0.800   1.000   1.000
    2834                 0.6363636363636364              0.600   0.933   1.000
    2835                 0.7272727272727273              0.400   0.800   1.000
    2836                 0.8181818181818182              0.200   0.600   1.000
    2837                 0.9090909090909091              0.100   0.400   1.000
    2838                 1.0                             0.000   0.167   1.000
    2839             }
    2840         }
    2841         "rainbow" {
    2842             set clist {
    2843                 "#EE82EE"
    2844                 "#4B0082"
    2845                 "blue"
    2846                 "#008000"
    2847                 "yellow"
    2848                 "#FFA500"
    2849                 "red"
    2850             }
    2851         }
    2852         "BGYOR" {
    2853             set clist {
    2854                 "blue"
    2855                 "#008000"
    2856                 "yellow"
    2857                 "#FFA500"
    2858                 "red"
    2859             }
    2860         }
    2861         "ROYGB" {
    2862             set clist {
    2863                 "red"
    2864                 "#FFA500"
    2865                 "yellow"
    2866                 "#008000"
    2867                 "blue"
    2868             }
    2869         }
    2870         "RYGCB" {
    2871             set clist {
    2872                 "red"
    2873                 "yellow"
    2874                 "green"
    2875                 "cyan"
    2876                 "blue"
    2877             }
    2878         }
    2879         "BCGYR" {
    2880             set clist {
    2881                 "blue"
    2882                 "cyan"
    2883                 "green"
    2884                 "yellow"
    2885                 "red"
    2886             }
    2887         }
    2888         "spectral" {
    2889             return {
    2890                 0.0 0.150 0.300 1.000
    2891                 0.1 0.250 0.630 1.000
    2892                 0.2 0.450 0.850 1.000
    2893                 0.3 0.670 0.970 1.000
    2894                 0.4 0.880 1.000 1.000
    2895                 0.5 1.000 1.000 0.750
    2896                 0.6 1.000 0.880 0.600
    2897                 0.7 1.000 0.680 0.450
    2898                 0.8 0.970 0.430 0.370
    2899                 0.9 0.850 0.150 0.196
    2900                 1.0 0.650 0.000 0.130
    2901             }
    2902         }
    2903         "green-to-magenta" {
    2904             return {
    2905                 0.0 0.000 0.316 0.000
    2906                 0.06666666666666667 0.000 0.526 0.000
    2907                 0.13333333333333333 0.000 0.737 0.000
    2908                 0.2 0.000 0.947 0.000
    2909                 0.26666666666666666 0.316 1.000 0.316
    2910                 0.3333333333333333 0.526 1.000 0.526
    2911                 0.4 0.737 1.000 0.737
    2912                 0.4666666666666667 1.000 1.000 1.000
    2913                 0.5333333333333333 1.000 0.947 1.000
    2914                 0.6 1.000 0.737 1.000
    2915                 0.6666666666666666 1.000 0.526 1.000
    2916                 0.7333333333333333 1.000 0.316 1.000
    2917                 0.8 0.947 0.000 0.947
    2918                 0.8666666666666667 0.737 0.000 0.737
    2919                 0.9333333333333333 0.526 0.000 0.526
    2920                 1.0 0.316 0.000 0.316
    2921             }
    2922         }
    2923         "greyscale" {
    2924             return {
    2925                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    2926             }
    2927         }
    2928         "nanohub" {
    2929             set clist "white yellow green cyan blue magenta"
    2930         }
    2931         default {
    2932             set clist $colors
    2933         }
    2934     }
    2935     set cmap {}
    2936     for {set i 0} {$i < [llength $clist]} {incr i} {
    2937         set x [expr {double($i)/([llength $clist]-1)}]
    2938         set color [lindex $clist $i]
    2939         append cmap "$x [Color2RGB $color] "
    2940     }
    2941     return $cmap
    2942 }
    2943 
    29442528#
    29452529# BuildColormap --
  • trunk/gui/scripts/vtkstreamlinesviewer.tcl

    r3330 r3371  
    108108    private method SetColormap { dataobj comp }
    109109    private method ChangeColormap { dataobj comp color }
    110     private method ColorsToColormap { color }
    111110    private method SetLegendTip { x y }
    112111    private method SetObjectStyle { dataobj comp }
     
    16701669}
    16711670
    1672 itcl::body Rappture::VtkStreamlinesViewer::ColorsToColormap { colors } {
    1673     switch -- $colors {
    1674         "grey-to-blue" {
    1675             return {
    1676                 0.0                      0.200 0.200 0.200
    1677                 0.14285714285714285      0.400 0.400 0.400
    1678                 0.2857142857142857       0.600 0.600 0.600
    1679                 0.42857142857142855      0.900 0.900 0.900
    1680                 0.5714285714285714       0.800 1.000 1.000
    1681                 0.7142857142857143       0.600 1.000 1.000
    1682                 0.8571428571428571       0.400 0.900 1.000
    1683                 1.0                      0.000 0.600 0.800
    1684             }
    1685         }
    1686         "blue-to-grey" {
    1687             return {
    1688                 0.0                     0.000 0.600 0.800
    1689                 0.14285714285714285     0.400 0.900 1.000
    1690                 0.2857142857142857      0.600 1.000 1.000
    1691                 0.42857142857142855     0.800 1.000 1.000
    1692                 0.5714285714285714      0.900 0.900 0.900
    1693                 0.7142857142857143      0.600 0.600 0.600
    1694                 0.8571428571428571      0.400 0.400 0.400
    1695                 1.0                     0.200 0.200 0.200
    1696             }
    1697         }
    1698         "blue" {
    1699             return {
    1700                 0.0                     0.900 1.000 1.000
    1701                 0.1111111111111111      0.800 0.983 1.000
    1702                 0.2222222222222222      0.700 0.950 1.000
    1703                 0.3333333333333333      0.600 0.900 1.000
    1704                 0.4444444444444444      0.500 0.833 1.000
    1705                 0.5555555555555556      0.400 0.750 1.000
    1706                 0.6666666666666666      0.300 0.650 1.000
    1707                 0.7777777777777778      0.200 0.533 1.000
    1708                 0.8888888888888888      0.100 0.400 1.000
    1709                 1.0                     0.000 0.250 1.000
    1710             }
    1711         }
    1712         "brown-to-blue" {
    1713             return {
    1714                 0.0                             0.200   0.100   0.000
    1715                 0.09090909090909091             0.400   0.187   0.000
    1716                 0.18181818181818182             0.600   0.379   0.210
    1717                 0.2727272727272727              0.800   0.608   0.480
    1718                 0.36363636363636365             0.850   0.688   0.595
    1719                 0.45454545454545453             0.950   0.855   0.808
    1720                 0.5454545454545454              0.800   0.993   1.000
    1721                 0.6363636363636364              0.600   0.973   1.000
    1722                 0.7272727272727273              0.400   0.940   1.000
    1723                 0.8181818181818182              0.200   0.893   1.000
    1724                 0.9090909090909091              0.000   0.667   0.800
    1725                 1.0                             0.000   0.480   0.600
    1726             }
    1727         }
    1728         "blue-to-brown" {
    1729             return {
    1730                 0.0                             0.000   0.480   0.600
    1731                 0.09090909090909091             0.000   0.667   0.800
    1732                 0.18181818181818182             0.200   0.893   1.000
    1733                 0.2727272727272727              0.400   0.940   1.000
    1734                 0.36363636363636365             0.600   0.973   1.000
    1735                 0.45454545454545453             0.800   0.993   1.000
    1736                 0.5454545454545454              0.950   0.855   0.808
    1737                 0.6363636363636364              0.850   0.688   0.595
    1738                 0.7272727272727273              0.800   0.608   0.480
    1739                 0.8181818181818182              0.600   0.379   0.210
    1740                 0.9090909090909091              0.400   0.187   0.000
    1741                 1.0                             0.200   0.100   0.000
    1742             }
    1743         }
    1744         "blue-to-orange" {
    1745             return {
    1746                 0.0                             0.000   0.167   1.000
    1747                 0.09090909090909091             0.100   0.400   1.000
    1748                 0.18181818181818182             0.200   0.600   1.000
    1749                 0.2727272727272727              0.400   0.800   1.000
    1750                 0.36363636363636365             0.600   0.933   1.000
    1751                 0.45454545454545453             0.800   1.000   1.000
    1752                 0.5454545454545454              1.000   1.000   0.800
    1753                 0.6363636363636364              1.000   0.933   0.600
    1754                 0.7272727272727273              1.000   0.800   0.400
    1755                 0.8181818181818182              1.000   0.600   0.200
    1756                 0.9090909090909091              1.000   0.400   0.100
    1757                 1.0                             1.000   0.167   0.000
    1758             }
    1759         }
    1760         "orange-to-blue" {
    1761             return {
    1762                 0.0                             1.000   0.167   0.000
    1763                 0.09090909090909091             1.000   0.400   0.100
    1764                 0.18181818181818182             1.000   0.600   0.200
    1765                 0.2727272727272727              1.000   0.800   0.400
    1766                 0.36363636363636365             1.000   0.933   0.600
    1767                 0.45454545454545453             1.000   1.000   0.800
    1768                 0.5454545454545454              0.800   1.000   1.000
    1769                 0.6363636363636364              0.600   0.933   1.000
    1770                 0.7272727272727273              0.400   0.800   1.000
    1771                 0.8181818181818182              0.200   0.600   1.000
    1772                 0.9090909090909091              0.100   0.400   1.000
    1773                 1.0                             0.000   0.167   1.000
    1774             }
    1775         }
    1776         "rainbow" {
    1777             set clist {
    1778                 "#EE82EE"
    1779                 "#4B0082"
    1780                 "blue"
    1781                 "#008000"
    1782                 "yellow"
    1783                 "#FFA500"
    1784                 "red"
    1785             }
    1786         }
    1787         "BGYOR" {
    1788             set clist {
    1789                 "blue"
    1790                 "#008000"
    1791                 "yellow"
    1792                 "#FFA500"
    1793                 "red"
    1794             }
    1795         }
    1796         "ROYGB" {
    1797             set clist {
    1798                 "red"
    1799                 "#FFA500"
    1800                 "yellow"
    1801                 "#008000"
    1802                 "blue"
    1803             }
    1804         }
    1805         "RYGCB" {
    1806             set clist {
    1807                 "red"
    1808                 "yellow"
    1809                 "green"
    1810                 "cyan"
    1811                 "blue"
    1812             }
    1813         }
    1814         "BCGYR" {
    1815             set clist {
    1816                 "blue"
    1817                 "cyan"
    1818                 "green"
    1819                 "yellow"
    1820                 "red"
    1821             }
    1822         }
    1823         "spectral" {
    1824             return {
    1825                 0.0 0.150 0.300 1.000
    1826                 0.1 0.250 0.630 1.000
    1827                 0.2 0.450 0.850 1.000
    1828                 0.3 0.670 0.970 1.000
    1829                 0.4 0.880 1.000 1.000
    1830                 0.5 1.000 1.000 0.750
    1831                 0.6 1.000 0.880 0.600
    1832                 0.7 1.000 0.680 0.450
    1833                 0.8 0.970 0.430 0.370
    1834                 0.9 0.850 0.150 0.196
    1835                 1.0 0.650 0.000 0.130
    1836             }
    1837         }
    1838         "green-to-magenta" {
    1839             return {
    1840                 0.0 0.000 0.316 0.000
    1841                 0.06666666666666667 0.000 0.526 0.000
    1842                 0.13333333333333333 0.000 0.737 0.000
    1843                 0.2 0.000 0.947 0.000
    1844                 0.26666666666666666 0.316 1.000 0.316
    1845                 0.3333333333333333 0.526 1.000 0.526
    1846                 0.4 0.737 1.000 0.737
    1847                 0.4666666666666667 1.000 1.000 1.000
    1848                 0.5333333333333333 1.000 0.947 1.000
    1849                 0.6 1.000 0.737 1.000
    1850                 0.6666666666666666 1.000 0.526 1.000
    1851                 0.7333333333333333 1.000 0.316 1.000
    1852                 0.8 0.947 0.000 0.947
    1853                 0.8666666666666667 0.737 0.000 0.737
    1854                 0.9333333333333333 0.526 0.000 0.526
    1855                 1.0 0.316 0.000 0.316
    1856             }
    1857         }
    1858         "greyscale" {
    1859             return {
    1860                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1861             }
    1862         }
    1863         "nanohub" {
    1864             set clist "white yellow green cyan blue magenta"
    1865         }
    1866         default {
    1867             set clist $colors
    1868         }
    1869     }
    1870     set cmap {}
    1871     for {set i 0} {$i < [llength $clist]} {incr i} {
    1872         set x [expr {double($i)/([llength $clist]-1)}]
    1873         set color [lindex $clist $i]
    1874         append cmap "$x [Color2RGB $color] "
    1875     }
    1876     return $cmap
    1877 }
    18781671
    18791672#
  • trunk/gui/scripts/vtkviewer.tcl

    r3330 r3371  
    104104    private method SetColormap { dataobj comp }
    105105    private method ChangeColormap { dataobj comp color }
    106     private method ColorsToColormap { color }
    107106    private method SetLegendTip { x y }
    108107    private method SetObjectStyle { dataobj comp }
     
    15751574}
    15761575
    1577 itcl::body Rappture::VtkViewer::ColorsToColormap { colors } {
    1578     switch -- $colors {
    1579         "grey-to-blue" {
    1580             return {
    1581                 0.0                      0.200 0.200 0.200
    1582                 0.14285714285714285      0.400 0.400 0.400
    1583                 0.2857142857142857       0.600 0.600 0.600
    1584                 0.42857142857142855      0.900 0.900 0.900
    1585                 0.5714285714285714       0.800 1.000 1.000
    1586                 0.7142857142857143       0.600 1.000 1.000
    1587                 0.8571428571428571       0.400 0.900 1.000
    1588                 1.0                      0.000 0.600 0.800
    1589             }
    1590         }
    1591         "blue-to-grey" {
    1592             return {
    1593                 0.0                     0.000 0.600 0.800
    1594                 0.14285714285714285     0.400 0.900 1.000
    1595                 0.2857142857142857      0.600 1.000 1.000
    1596                 0.42857142857142855     0.800 1.000 1.000
    1597                 0.5714285714285714      0.900 0.900 0.900
    1598                 0.7142857142857143      0.600 0.600 0.600
    1599                 0.8571428571428571      0.400 0.400 0.400
    1600                 1.0                     0.200 0.200 0.200
    1601             }
    1602         }
    1603         "blue" {
    1604             return {
    1605                 0.0                     0.900 1.000 1.000
    1606                 0.1111111111111111      0.800 0.983 1.000
    1607                 0.2222222222222222      0.700 0.950 1.000
    1608                 0.3333333333333333      0.600 0.900 1.000
    1609                 0.4444444444444444      0.500 0.833 1.000
    1610                 0.5555555555555556      0.400 0.750 1.000
    1611                 0.6666666666666666      0.300 0.650 1.000
    1612                 0.7777777777777778      0.200 0.533 1.000
    1613                 0.8888888888888888      0.100 0.400 1.000
    1614                 1.0                     0.000 0.250 1.000
    1615             }
    1616         }
    1617         "brown-to-blue" {
    1618             return {
    1619                 0.0                             0.200   0.100   0.000
    1620                 0.09090909090909091             0.400   0.187   0.000
    1621                 0.18181818181818182             0.600   0.379   0.210
    1622                 0.2727272727272727              0.800   0.608   0.480
    1623                 0.36363636363636365             0.850   0.688   0.595
    1624                 0.45454545454545453             0.950   0.855   0.808
    1625                 0.5454545454545454              0.800   0.993   1.000
    1626                 0.6363636363636364              0.600   0.973   1.000
    1627                 0.7272727272727273              0.400   0.940   1.000
    1628                 0.8181818181818182              0.200   0.893   1.000
    1629                 0.9090909090909091              0.000   0.667   0.800
    1630                 1.0                             0.000   0.480   0.600
    1631             }
    1632         }
    1633         "blue-to-brown" {
    1634             return {
    1635                 0.0                             0.000   0.480   0.600
    1636                 0.09090909090909091             0.000   0.667   0.800
    1637                 0.18181818181818182             0.200   0.893   1.000
    1638                 0.2727272727272727              0.400   0.940   1.000
    1639                 0.36363636363636365             0.600   0.973   1.000
    1640                 0.45454545454545453             0.800   0.993   1.000
    1641                 0.5454545454545454              0.950   0.855   0.808
    1642                 0.6363636363636364              0.850   0.688   0.595
    1643                 0.7272727272727273              0.800   0.608   0.480
    1644                 0.8181818181818182              0.600   0.379   0.210
    1645                 0.9090909090909091              0.400   0.187   0.000
    1646                 1.0                             0.200   0.100   0.000
    1647             }
    1648         }
    1649         "blue-to-orange" {
    1650             return {
    1651                 0.0                             0.000   0.167   1.000
    1652                 0.09090909090909091             0.100   0.400   1.000
    1653                 0.18181818181818182             0.200   0.600   1.000
    1654                 0.2727272727272727              0.400   0.800   1.000
    1655                 0.36363636363636365             0.600   0.933   1.000
    1656                 0.45454545454545453             0.800   1.000   1.000
    1657                 0.5454545454545454              1.000   1.000   0.800
    1658                 0.6363636363636364              1.000   0.933   0.600
    1659                 0.7272727272727273              1.000   0.800   0.400
    1660                 0.8181818181818182              1.000   0.600   0.200
    1661                 0.9090909090909091              1.000   0.400   0.100
    1662                 1.0                             1.000   0.167   0.000
    1663             }
    1664         }
    1665         "orange-to-blue" {
    1666             return {
    1667                 0.0                             1.000   0.167   0.000
    1668                 0.09090909090909091             1.000   0.400   0.100
    1669                 0.18181818181818182             1.000   0.600   0.200
    1670                 0.2727272727272727              1.000   0.800   0.400
    1671                 0.36363636363636365             1.000   0.933   0.600
    1672                 0.45454545454545453             1.000   1.000   0.800
    1673                 0.5454545454545454              0.800   1.000   1.000
    1674                 0.6363636363636364              0.600   0.933   1.000
    1675                 0.7272727272727273              0.400   0.800   1.000
    1676                 0.8181818181818182              0.200   0.600   1.000
    1677                 0.9090909090909091              0.100   0.400   1.000
    1678                 1.0                             0.000   0.167   1.000
    1679             }
    1680         }
    1681         "rainbow" {
    1682             set clist {
    1683                 "#EE82EE"
    1684                 "#4B0082"
    1685                 "blue"
    1686                 "#008000"
    1687                 "yellow"
    1688                 "#FFA500"
    1689                 "red"
    1690             }
    1691         }
    1692         "BGYOR" {
    1693             set clist {
    1694                 "blue"
    1695                 "#008000"
    1696                 "yellow"
    1697                 "#FFA500"
    1698                 "red"
    1699             }
    1700         }
    1701         "ROYGB" {
    1702             set clist {
    1703                 "red"
    1704                 "#FFA500"
    1705                 "yellow"
    1706                 "#008000"
    1707                 "blue"
    1708             }
    1709         }
    1710         "RYGCB" {
    1711             set clist {
    1712                 "red"
    1713                 "yellow"
    1714                 "green"
    1715                 "cyan"
    1716                 "blue"
    1717             }
    1718         }
    1719         "BCGYR" {
    1720             set clist {
    1721                 "blue"
    1722                 "cyan"
    1723                 "green"
    1724                 "yellow"
    1725                 "red"
    1726             }
    1727         }
    1728         "spectral" {
    1729             return {
    1730                 0.0 0.150 0.300 1.000
    1731                 0.1 0.250 0.630 1.000
    1732                 0.2 0.450 0.850 1.000
    1733                 0.3 0.670 0.970 1.000
    1734                 0.4 0.880 1.000 1.000
    1735                 0.5 1.000 1.000 0.750
    1736                 0.6 1.000 0.880 0.600
    1737                 0.7 1.000 0.680 0.450
    1738                 0.8 0.970 0.430 0.370
    1739                 0.9 0.850 0.150 0.196
    1740                 1.0 0.650 0.000 0.130
    1741             }
    1742         }
    1743         "green-to-magenta" {
    1744             return {
    1745                 0.0 0.000 0.316 0.000
    1746                 0.06666666666666667 0.000 0.526 0.000
    1747                 0.13333333333333333 0.000 0.737 0.000
    1748                 0.2 0.000 0.947 0.000
    1749                 0.26666666666666666 0.316 1.000 0.316
    1750                 0.3333333333333333 0.526 1.000 0.526
    1751                 0.4 0.737 1.000 0.737
    1752                 0.4666666666666667 1.000 1.000 1.000
    1753                 0.5333333333333333 1.000 0.947 1.000
    1754                 0.6 1.000 0.737 1.000
    1755                 0.6666666666666666 1.000 0.526 1.000
    1756                 0.7333333333333333 1.000 0.316 1.000
    1757                 0.8 0.947 0.000 0.947
    1758                 0.8666666666666667 0.737 0.000 0.737
    1759                 0.9333333333333333 0.526 0.000 0.526
    1760                 1.0 0.316 0.000 0.316
    1761             }
    1762         }
    1763         "greyscale" {
    1764             return {
    1765                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1766             }
    1767         }
    1768         "nanohub" {
    1769             set clist "white yellow green cyan blue magenta"
    1770         }
    1771         default {
    1772             set clist $colors
    1773         }
    1774     }
    1775     set cmap {}
    1776     set numColors [llength $clist]
    1777     for {set i 0} {$i < $numColors} {incr i} {
    1778         if { $numColors > 1 } {
    1779             set x [expr {double($i)/($numColors-1)}]
    1780         } else {
    1781             set x [expr double($i)]
    1782         }
    1783         set color [lindex $clist $i]
    1784         append cmap "$x [Color2RGB $color] "
    1785     }
    1786     return $cmap
    1787 }
    1788 
    17891576#
    17901577# BuildColormap --
  • trunk/gui/scripts/vtkvolumeviewer.tcl

    r3330 r3371  
    108108    private method SetColormap { dataobj comp }
    109109    private method ChangeColormap { dataobj comp color }
    110     private method ColorsToColormap { color }
    111110    private method SetLegendTip { x y }
    112111    private method SetObjectStyle { dataobj comp }
     
    15981597}
    15991598
    1600 itcl::body Rappture::VtkVolumeViewer::ColorsToColormap { colors } {
    1601 puts stderr colors=$colors
    1602     switch -- $colors {
    1603         "grey-to-blue" {
    1604             return {
    1605                 0.0                      0.200 0.200 0.200
    1606                 0.14285714285714285      0.400 0.400 0.400
    1607                 0.2857142857142857       0.600 0.600 0.600
    1608                 0.42857142857142855      0.900 0.900 0.900
    1609                 0.5714285714285714       0.800 1.000 1.000
    1610                 0.7142857142857143       0.600 1.000 1.000
    1611                 0.8571428571428571       0.400 0.900 1.000
    1612                 1.0                      0.000 0.600 0.800
    1613             }
    1614         }
    1615         "blue-to-grey" {
    1616             return {
    1617                 0.0                     0.000 0.600 0.800
    1618                 0.14285714285714285     0.400 0.900 1.000
    1619                 0.2857142857142857      0.600 1.000 1.000
    1620                 0.42857142857142855     0.800 1.000 1.000
    1621                 0.5714285714285714      0.900 0.900 0.900
    1622                 0.7142857142857143      0.600 0.600 0.600
    1623                 0.8571428571428571      0.400 0.400 0.400
    1624                 1.0                     0.200 0.200 0.200
    1625             }
    1626         }
    1627         "blue" {
    1628             return {
    1629                 0.0                     0.900 1.000 1.000
    1630                 0.1111111111111111      0.800 0.983 1.000
    1631                 0.2222222222222222      0.700 0.950 1.000
    1632                 0.3333333333333333      0.600 0.900 1.000
    1633                 0.4444444444444444      0.500 0.833 1.000
    1634                 0.5555555555555556      0.400 0.750 1.000
    1635                 0.6666666666666666      0.300 0.650 1.000
    1636                 0.7777777777777778      0.200 0.533 1.000
    1637                 0.8888888888888888      0.100 0.400 1.000
    1638                 1.0                     0.000 0.250 1.000
    1639             }
    1640         }
    1641         "brown-to-blue" {
    1642             return {
    1643                 0.0                             0.200   0.100   0.000
    1644                 0.09090909090909091             0.400   0.187   0.000
    1645                 0.18181818181818182             0.600   0.379   0.210
    1646                 0.2727272727272727              0.800   0.608   0.480
    1647                 0.36363636363636365             0.850   0.688   0.595
    1648                 0.45454545454545453             0.950   0.855   0.808
    1649                 0.5454545454545454              0.800   0.993   1.000
    1650                 0.6363636363636364              0.600   0.973   1.000
    1651                 0.7272727272727273              0.400   0.940   1.000
    1652                 0.8181818181818182              0.200   0.893   1.000
    1653                 0.9090909090909091              0.000   0.667   0.800
    1654                 1.0                             0.000   0.480   0.600
    1655             }
    1656         }
    1657         "blue-to-brown" {
    1658             return {
    1659                 0.0                             0.000   0.480   0.600
    1660                 0.09090909090909091             0.000   0.667   0.800
    1661                 0.18181818181818182             0.200   0.893   1.000
    1662                 0.2727272727272727              0.400   0.940   1.000
    1663                 0.36363636363636365             0.600   0.973   1.000
    1664                 0.45454545454545453             0.800   0.993   1.000
    1665                 0.5454545454545454              0.950   0.855   0.808
    1666                 0.6363636363636364              0.850   0.688   0.595
    1667                 0.7272727272727273              0.800   0.608   0.480
    1668                 0.8181818181818182              0.600   0.379   0.210
    1669                 0.9090909090909091              0.400   0.187   0.000
    1670                 1.0                             0.200   0.100   0.000
    1671             }
    1672         }
    1673         "blue-to-orange" {
    1674             return {
    1675                 0.0                             0.000   0.167   1.000
    1676                 0.09090909090909091             0.100   0.400   1.000
    1677                 0.18181818181818182             0.200   0.600   1.000
    1678                 0.2727272727272727              0.400   0.800   1.000
    1679                 0.36363636363636365             0.600   0.933   1.000
    1680                 0.45454545454545453             0.800   1.000   1.000
    1681                 0.5454545454545454              1.000   1.000   0.800
    1682                 0.6363636363636364              1.000   0.933   0.600
    1683                 0.7272727272727273              1.000   0.800   0.400
    1684                 0.8181818181818182              1.000   0.600   0.200
    1685                 0.9090909090909091              1.000   0.400   0.100
    1686                 1.0                             1.000   0.167   0.000
    1687             }
    1688         }
    1689         "orange-to-blue" {
    1690             return {
    1691                 0.0                             1.000   0.167   0.000
    1692                 0.09090909090909091             1.000   0.400   0.100
    1693                 0.18181818181818182             1.000   0.600   0.200
    1694                 0.2727272727272727              1.000   0.800   0.400
    1695                 0.36363636363636365             1.000   0.933   0.600
    1696                 0.45454545454545453             1.000   1.000   0.800
    1697                 0.5454545454545454              0.800   1.000   1.000
    1698                 0.6363636363636364              0.600   0.933   1.000
    1699                 0.7272727272727273              0.400   0.800   1.000
    1700                 0.8181818181818182              0.200   0.600   1.000
    1701                 0.9090909090909091              0.100   0.400   1.000
    1702                 1.0                             0.000   0.167   1.000
    1703             }
    1704         }
    1705         "rainbow" {
    1706             set clist {
    1707                 "#EE82EE"
    1708                 "#4B0082"
    1709                 "blue"
    1710                 "#008000"
    1711                 "yellow"
    1712                 "#FFA500"
    1713                 "red"
    1714             }
    1715         }
    1716         "BGYOR" {
    1717             set clist {
    1718                 "blue"
    1719                 "#008000"
    1720                 "yellow"
    1721                 "#FFA500"
    1722                 "red"
    1723             }
    1724         }
    1725         "ROYGB" {
    1726             set clist {
    1727                 "red"
    1728                 "#FFA500"
    1729                 "yellow"
    1730                 "#008000"
    1731                 "blue"
    1732             }
    1733         }
    1734         "RYGCB" {
    1735             set clist {
    1736                 "red"
    1737                 "yellow"
    1738                 "green"
    1739                 "cyan"
    1740                 "blue"
    1741             }
    1742         }
    1743         "BCGYR" {
    1744             set clist {
    1745                 "blue"
    1746                 "cyan"
    1747                 "green"
    1748                 "yellow"
    1749                 "red"
    1750             }
    1751         }
    1752         "spectral" {
    1753             return {
    1754                 0.0 0.150 0.300 1.000
    1755                 0.1 0.250 0.630 1.000
    1756                 0.2 0.450 0.850 1.000
    1757                 0.3 0.670 0.970 1.000
    1758                 0.4 0.880 1.000 1.000
    1759                 0.5 1.000 1.000 0.750
    1760                 0.6 1.000 0.880 0.600
    1761                 0.7 1.000 0.680 0.450
    1762                 0.8 0.970 0.430 0.370
    1763                 0.9 0.850 0.150 0.196
    1764                 1.0 0.650 0.000 0.130
    1765             }
    1766         }
    1767         "green-to-magenta" {
    1768             return {
    1769                 0.0 0.000 0.316 0.000
    1770                 0.06666666666666667 0.000 0.526 0.000
    1771                 0.13333333333333333 0.000 0.737 0.000
    1772                 0.2 0.000 0.947 0.000
    1773                 0.26666666666666666 0.316 1.000 0.316
    1774                 0.3333333333333333 0.526 1.000 0.526
    1775                 0.4 0.737 1.000 0.737
    1776                 0.4666666666666667 1.000 1.000 1.000
    1777                 0.5333333333333333 1.000 0.947 1.000
    1778                 0.6 1.000 0.737 1.000
    1779                 0.6666666666666666 1.000 0.526 1.000
    1780                 0.7333333333333333 1.000 0.316 1.000
    1781                 0.8 0.947 0.000 0.947
    1782                 0.8666666666666667 0.737 0.000 0.737
    1783                 0.9333333333333333 0.526 0.000 0.526
    1784                 1.0 0.316 0.000 0.316
    1785             }
    1786         }
    1787         "greyscale" {
    1788             return {
    1789                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1790             }
    1791         }
    1792         "nanohub" {
    1793             set clist "white yellow green cyan blue magenta"
    1794         }
    1795         default {
    1796             set clist [split $colors :]
    1797         }
    1798     }
    1799     set cmap {}
    1800     set nColors [llength $clist]
    1801     if { $nColors == 1 } {
    1802         append cmap "0.0 [Color2RGB $colors] "
    1803         append cmap "1.0 [Color2RGB $colors] "
    1804     } else {
    1805         for {set i 0} {$i < [llength $clist]} {incr i} {
    1806             set x [expr {double($i)/([llength $clist]-1)}]
    1807             set color [lindex $clist $i]
    1808             append cmap "$x [Color2RGB $color] "
    1809         }
    1810     }
    1811     return $cmap
    1812 }
    1813 
    18141599#
    18151600# BuildColormap --
Note: See TracChangeset for help on using the changeset viewer.