Ignore:
Timestamp:
Mar 3, 2013 8:26:31 AM (11 years ago)
Author:
gah
Message:

add number of isolines control

File:
1 edited

Legend:

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

    r3416 r3417  
    6969    protected method Disconnect {}
    7070    protected method DoResize {}
    71     protected method DoContour {}
    7271    protected method DoRotate {}
    7372    protected method AdjustSetting {what {value ""}}
     
    9695    private method DrawLegend { title }
    9796    private method EnterLegend { x y }
    98     private method EventuallyContour { numContours }
    9997    private method EventuallyRequestLegend {}
    10098    private method EventuallyResize { w h }
     
    153151    private variable _height 0
    154152    private variable _resizePending 0
    155     private variable _contourPending 0
     153    private variable _numIsolinesPending 0
    156154    private variable _rotatePending 0
    157155    private variable _legendPending 0
     
    160158    private variable _curFldName ""
    161159    private variable _curFldLabel ""
    162     private variable _numContours 0
    163160    private variable _colorMode "vmag";#  Mode of colormap (vmag or scalar)
    164161}
     
    182179    $_dispatcher register !resize
    183180    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    184 
    185     # Recontour event
    186     $_dispatcher register !contour
    187     $_dispatcher dispatch $this !contour "[itcl::code $this DoContour]; list"
    188181
    189182    # Rotate event
     
    230223        edges                   0
    231224        field                   "Default"
    232         heightmapOpacity        100
    233225        heightmapScale          50
    234226        isHeightmap             0
    235         isolines                10
     227        isolineColor            black
    236228        isolinesVisible         1
    237         isolineColor            black
    238229        legendVisible           1
    239         lighting                0
     230        lighting                1
     231        saveLighting            1
     232        numIsolines             10
     233        opacity                 100
    240234        outline                 0
    241235        wireframe               0
     236        saveOpacity             100
    242237    }]
    243238
     
    424419}
    425420
    426 itcl::body Rappture::VtkHeightmapViewer::DoContour {} {
    427     foreach dataset [CurrentDatasets -all] {
    428         foreach {dataobj comp} [split $dataset -] break
    429         #SendCmd "heightmap numcontours $_numContours $dataset"
    430     }
    431     set _contourPending 0
    432 }
    433 
    434421itcl::body Rappture::VtkHeightmapViewer::EventuallyRequestLegend {} {
    435422    if { !$_legendPending } {
     
    446433        set _resizePending 1
    447434        $_dispatcher event -after 400 !resize
    448     }
    449 }
    450 
    451 itcl::body Rappture::VtkHeightmapViewer::EventuallyContour { numContours } {
    452     set _numContours $numContours
    453     if { !$_contourPending } {
    454         set _contourPending 1
    455         $_dispatcher event -after 600 !contour
    456435    }
    457436}
     
    752731    $_dispatcher cancel !rebuild
    753732    $_dispatcher cancel !resize
    754     $_dispatcher cancel !contour
    755733    $_dispatcher cancel !rotate
    756734    $_dispatcher cancel !legend
     
    10661044        #
    10671045        SendCmd "axis color all [Color2RGB $itk_option(-plotforeground)]"
     1046        SendCmd "dataset color [Color2RGB $itk_option(-plotforeground)]"
    10681047        ResetAxes
    10691048        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     
    10811060        InitSettings axisXGrid axisYGrid axisZGrid \
    10821061            axisVisible axisLabels
    1083         InitSettings heightmapOpacity \
    1084             heightmapScale lighting \
    1085             colormap field outline \
    1086             edges heightmapOpacity wireframe
     1062        InitSettings opacity heightmapScale lighting edges wireframe \
     1063            colormap field outline isHeightmap
    10871064        set _reset 0
    10881065    }
     
    13341311    }
    13351312    switch -- $what {
    1336         "heightmapOpacity" {
    1337             set val $_settings(heightmapOpacity)
    1338             set sval [expr { 0.01 * double($val) }]
    1339             foreach dataset [CurrentDatasets -all] {
    1340                 SendCmd "heightmap opacity $sval $dataset"
    1341             }
    1342         }
    1343         "wireframe" {
    1344             set bool $_settings(wireframe)
    1345             foreach dataset [CurrentDatasets -all] {
    1346                 SendCmd "heightmap wireframe $bool $dataset"
    1347             }
    1348         }
    1349         "colormapVisible" {
    1350             set bool $_settings(colormapVisible)
    1351             foreach dataset [CurrentDatasets -all] {
    1352                 SendCmd "heightmap surface $bool $dataset"
    1353             }
    1354         }
    1355         "isolinesVisible" {
    1356             set bool $_settings(isolinesVisible)
    1357             foreach dataset [CurrentDatasets -all] {
    1358                 SendCmd "heightmap isolines $bool $dataset"
    1359             }
    1360         }
    1361         "lighting" {
    1362             if { $_settings(isHeightmap) } {
    1363                 set bool $_settings(lighting)
    1364                 SendCmd "heightmap lighting $bool"
    1365             } else {
    1366                 SendCmd "heightmap lighting 0"
    1367             }
    1368         }
    1369         "edges" {
    1370             set bool $_settings(edges)
    1371             foreach dataset [CurrentDatasets -all] {
    1372                 SendCmd "heightmap edges $bool $dataset"
    1373             }
    1374         }
    1375         "axisVisible" {
    1376             set bool $_settings(axisVisible)
    1377             SendCmd "axis visible all $bool"
    1378         }
    1379         "axisLabels" {
    1380             set bool $_settings(axisLabels)
    1381             SendCmd "axis labels all $bool"
    1382         }
    1383         "axisXGrid" - "axisYGrid" - "axisZGrid" {
    1384             set axis [string tolower [string range $what 4 4]]
    1385             set bool $_settings($what)
    1386             SendCmd "axis grid $axis $bool"
    1387         }
    13881313        "axisFlymode" {
    13891314            set mode [$itk_component(axisflymode) value]
     
    13921317            SendCmd "axis flymode $mode"
    13931318        }
     1319        "axisLabels" {
     1320            set bool $_settings(axisLabels)
     1321            SendCmd "axis labels all $bool"
     1322        }
    13941323        "axisMinorTicks" {
    13951324            set bool $_settings(axisMinorTicks)
     
    13981327            }
    13991328        }
    1400         "isolines" {
    1401             set n $_settings($what)
    1402             EventuallyContour $n
    1403         }
    1404         "isolinesVisible" {
     1329        "axisVisible" {
     1330            set bool $_settings(axisVisible)
     1331            SendCmd "axis visible all $bool"
     1332        }
     1333        "axisXGrid" - "axisYGrid" - "axisZGrid" {
     1334            set axis [string tolower [string range $what 4 4]]
    14051335            set bool $_settings($what)
    1406             foreach dataset [CurrentDatasets -all] {
    1407                 SendCmd "heightmap isolines $bool $dataset"
    1408             }
    1409         }
    1410         "colormapVisible" {
    1411             set bool $_settings($what)
    1412             foreach dataset [CurrentDatasets -all] {
    1413                 SendCmd "heightmap surface $bool $dataset"
    1414             }
     1336            SendCmd "axis grid $axis $bool"
    14151337        }
    14161338        "background" {
     
    14241346                -plotforeground $fgcolors($bgcolor)
    14251347            $itk_component(view) delete "legend"
    1426             DrawLegend $_curFldName
    1427         }
    1428         "isolineColor" {
    1429             set color [$itk_component(isolinecolor) value]
    1430             if { $color == "none" } {
    1431                 if { $_settings(isolinesVisible) } {
    1432                     SendCmd "heightmap isolines 0"
    1433                     set _settings(isolinesVisible) 0
    1434                 }
    1435             } else {
    1436                 if { !$_settings(isolinesVisible) } {
    1437                     SendCmd "heightmap isolines 1"
    1438                     set _settings(isolinesVisible) 1
    1439                 }
    1440                 SendCmd "heightmap isolinecolor [Color2RGB $color]"
    1441             }
    14421348            DrawLegend $_curFldName
    14431349        }
     
    14621368            EventuallyRequestLegend
    14631369        }
    1464         "heightmapOpacity" {
    1465             set val $_settings(heightmapOpacity)
    1466             set sval [expr { 0.01 * double($val) }]
    1467             foreach dataset [CurrentDatasets -all] {
    1468                 SendCmd "heightmap opacity $sval $dataset"
    1469             }
    1470         }
    1471         "heightmapScale" {
    1472             if { $_settings(isHeightmap) } {
    1473                 set scale [GetHeightmapScale]
    1474                 foreach dataset [CurrentDatasets -all] {
    1475                     SendCmd "heightmap heightscale $scale $dataset"
    1476                     set _comp2scale($dataset) $scale
    1477                 }
    1478                 ResetAxes
    1479             }
    1480         }
    1481         "lighting" {
    1482             if { $_settings(isHeightmap) } {
    1483                 set bool $_settings(lighting)
    1484                 SendCmd "heightmap lighting $bool"
    1485             } else {
    1486                 SendCmd "heightmap lighting 0"
    1487             }
     1370        "colormapVisible" {
     1371            set bool $_settings($what)
     1372            SendCmd "heightmap surface $bool"
     1373        }
     1374        "edges" {
     1375            set bool $_settings(edges)
     1376            SendCmd "heightmap edges $bool"
    14881377        }
    14891378        "field" {
     
    15061395            EventuallyRequestLegend
    15071396        }
     1397        "heightmapScale" {
     1398            if { $_settings(isHeightmap) } {
     1399                set scale [GetHeightmapScale]
     1400                foreach dataset [CurrentDatasets -all] {
     1401                    SendCmd "heightmap heightscale $scale $dataset"
     1402                    set _comp2scale($dataset) $scale
     1403                }
     1404                ResetAxes
     1405            }
     1406        }
     1407        "isHeightmap" {
     1408            set bool $_settings(isHeightmap)
     1409            set c $itk_component(view)
     1410            incr _buffering
     1411            if { $_buffering == 1 } {
     1412                set _outbuf ""
     1413            }
     1414            # Fix heightmap scale: 0 for contours, 1 for heightmaps.
     1415            if { $bool } {
     1416                set _settings(heightmapScale) 50
     1417                set _settings(opacity) $_settings(saveOpacity)
     1418                set _settings(lighting) $_settings(saveLighting)
     1419            } else {
     1420                set _settings(heightmapScale) 0
     1421                set _settings(lighting) 0
     1422                set _settings(opacity) 100
     1423            }
     1424            AdjustSetting lighting
     1425            AdjustSetting opacity
     1426            set scale [GetHeightmapScale]
     1427            foreach dataset [CurrentDatasets -all] {
     1428                SendCmd "heightmap heightscale $scale $dataset"
     1429                set _comp2scale($dataset) $scale
     1430            }
     1431            if { $bool } {
     1432                $itk_component(lighting) configure -state normal
     1433                $itk_component(opacity) configure -state normal
     1434                $itk_component(scale) configure -state normal
     1435                $itk_component(opacity_l) configure -state normal
     1436                $itk_component(scale_l) configure -state normal
     1437                if {$_view(ortho)} {
     1438                    SendCmd "camera mode ortho"
     1439                } else {
     1440                    SendCmd "camera mode persp"
     1441                }
     1442            } else {
     1443                $itk_component(lighting) configure -state disabled
     1444                $itk_component(opacity) configure -state disabled
     1445                $itk_component(scale) configure -state disabled
     1446                $itk_component(opacity_l) configure -state disabled
     1447                $itk_component(scale_l) configure -state disabled
     1448            }
     1449            if {$_settings(stretchToFit)} {
     1450                if {$scale == 0} {
     1451                    SendCmd "camera aspect window"
     1452                } else {
     1453                    SendCmd "camera aspect square"
     1454                }
     1455            }
     1456            SendCmd "camera reset"
     1457            ResetAxes
     1458            if { $bool } {
     1459                set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1460                $_arcball quaternion $q
     1461                SendCmd "camera orient $q"
     1462            } else {
     1463                bind $c <ButtonPress-1> {}
     1464                bind $c <B1-Motion> {}
     1465                bind $c <ButtonRelease-1> {}
     1466                SendCmd "camera mode image"
     1467            }
     1468            # Fix the mouse bindings for rotation/panning and the
     1469            # camera mode. Ideally we'd create a bindtag for these.
     1470            if { $bool } {
     1471                # Bindings for rotation via mouse
     1472                bind $c <ButtonPress-1> \
     1473                    [itcl::code $this Rotate click %x %y]
     1474                bind $c <B1-Motion> \
     1475                    [itcl::code $this Rotate drag %x %y]
     1476                bind $c <ButtonRelease-1> \
     1477                    [itcl::code $this Rotate release %x %y]
     1478            }
     1479            incr _buffering -1
     1480            if { $_buffering == 0 } {
     1481                sendto $_outbuf
     1482                set _outbuf ""
     1483            }
     1484        }
     1485        "isolineColor" {
     1486            set color [$itk_component(isolinecolor) value]
     1487            if { $color == "none" } {
     1488                if { $_settings(isolinesVisible) } {
     1489                    SendCmd "heightmap isolines 0"
     1490                    set _settings(isolinesVisible) 0
     1491                }
     1492            } else {
     1493                if { !$_settings(isolinesVisible) } {
     1494                    SendCmd "heightmap isolines 1"
     1495                    set _settings(isolinesVisible) 1
     1496                }
     1497                SendCmd "heightmap isolinecolor [Color2RGB $color]"
     1498            }
     1499            DrawLegend $_curFldName
     1500        }
     1501        "isolinesVisible" {
     1502            set bool $_settings($what)
     1503            SendCmd "heightmap isolines $bool"
     1504        }
     1505        "legendVisible" {
     1506            if { !$_settings($what) } {
     1507                $itk_component(view) delete legend
     1508            }
     1509            DrawLegend $_curFldName
     1510        }
     1511        "lighting" {
     1512            if { $_settings(isHeightmap) } {
     1513                set _settings(saveLighting) $_settings(lighting)
     1514                set bool $_settings($what)
     1515                SendCmd "heightmap lighting $bool"
     1516            } else {
     1517                SendCmd "heightmap lighting 0"
     1518            }
     1519        }
     1520        "numIsolines" {
     1521            set _settings(numIsolines) [$itk_component(numisolines) value]
     1522            SendCmd "heightmap numcontours $_settings(numIsolines)"
     1523            DrawLegend $_curFldName
     1524        }
     1525        "opacity" {
     1526            if { $_settings(isHeightmap) } {
     1527                set _settings(saveOpacity) $_settings(opacity)
     1528                set val $_settings(opacity)
     1529                set sval [expr { 0.01 * double($val) }]
     1530                SendCmd "heightmap opacity $sval"
     1531            } else {
     1532                SendCmd "heightmap opacity 1"
     1533            }
     1534        }
     1535        "outline" {
     1536            set bool $_settings($what)
     1537            SendCmd "dataset outline $bool"
     1538        }
    15081539        "stretchToFit" {
    1509             set bool $_settings(stretchToFit)
     1540            set bool $_settings($what)
    15101541            if { $bool } {
    15111542                set heightScale [GetHeightmapScale]
     
    15191550            }
    15201551        }
    1521         "outline" {
    1522             set bool $_settings(outline)
    1523             SendCmd "dataset outline $bool"
    1524         }
    1525         "isHeightmap" {
    1526             set bool $_settings(isHeightmap)
    1527             incr _buffering
    1528             if { $_buffering == 1 } {
    1529                 set _outbuf ""
    1530             }
    1531             if { $bool } {
    1532                 $itk_component(lighting) configure -state normal
    1533                 if {$_view(ortho)} {
    1534                     SendCmd "camera mode ortho"
    1535                 } else {
    1536                     SendCmd "camera mode persp"
    1537                 }
    1538             } else {
    1539                 $itk_component(lighting) configure -state disabled
    1540             }
    1541             set _settings(lighting) $bool
    1542             # Fix heightmap scale: 0 for contours, 1 for heightmaps.
    1543             if { $bool } {
    1544                 set _settings(heightmapScale) 50
    1545             } else {
    1546                 set _settings(heightmapScale) 50
    1547             }
    1548             SendCmd "heightmap lighting $bool"
    1549             set scale [GetHeightmapScale]
    1550             foreach dataset [CurrentDatasets -all] {
    1551                 SendCmd "heightmap heightscale $scale $dataset"
    1552                 set _comp2scale($dataset) $scale
    1553             }
    1554             if {$_settings(stretchToFit)} {
    1555                 if {$scale == 0} {
    1556                     SendCmd "camera aspect window"
    1557                 } else {
    1558                     SendCmd "camera aspect square"
    1559                 }
    1560             }
    1561             ResetAxes
    1562             # Fix the mouse bindings for rotation/panning and the
    1563             # camera mode. Ideally we'd create a bindtag for these.
    1564             set c $itk_component(view)
    1565             if { $bool } {
    1566                 # Bindings for rotation via mouse
    1567                 bind $c <ButtonPress-1> \
    1568                     [itcl::code $this Rotate click %x %y]
    1569                 bind $c <B1-Motion> \
    1570                     [itcl::code $this Rotate drag %x %y]
    1571                 bind $c <ButtonRelease-1> \
    1572                     [itcl::code $this Rotate release %x %y]
    1573                 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1574                 $_arcball quaternion $q
    1575                 SendCmd "camera orient $q"
    1576             } else {
    1577                 set _settings(heightmapScale) 0
    1578                 bind $c <ButtonPress-1> {}
    1579                 bind $c <B1-Motion> {}
    1580                 bind $c <ButtonRelease-1> {}
    1581                 SendCmd "camera mode image"
    1582             }
    1583             incr _buffering -1
    1584             if { $_buffering == 0 } {
    1585                 sendto $_outbuf
    1586                 set _outbuf ""
    1587             }
    1588         }
    1589         "legendVisible" {
    1590             if { !$_settings(legendVisible) } {
    1591                 $itk_component(view) delete legend
    1592             }
    1593             DrawLegend $_curFldName
     1552        "wireframe" {
     1553            set bool $_settings($what)
     1554            SendCmd "heightmap wireframe $bool"
    15941555        }
    15951556        default {
     
    16431604        return
    16441605    }
    1645     foreach { vmin vmax } $_limits(v) break
    16461606    foreach { xmin xmax } $_limits(x) break
    16471607    foreach { ymin ymax } $_limits(y) break
     1608    foreach { vmin vmax } $_limits(v) break
    16481609    set dataRange   [expr $vmax - $vmin]
    16491610    set boundsRange [expr $xmax - $xmin]
     
    16951656        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    16961657    }
    1697     if { ![info exists _settings(heightmapOpacity)] } {
    1698         set _settings(heightmapOpacity) $style(-opacity)
    1699     }
    1700     set max $_settings(heightmapOpacity)
     1658    if { ![info exists _settings(opacity)] } {
     1659        set _settings(opacity) $style(-opacity)
     1660    }
     1661    set max $_settings(opacity)
    17011662
    17021663    set wmap "0.0 1.0 1.0 1.0"
     
    17571718
    17581719    set inner [$itk_component(main) insert end \
    1759         -title "Contour Settings" \
    1760         -icon [Rappture::icon volume-on]]
     1720        -title "Contour/Surface Settings" \
     1721        -icon [Rappture::icon contour]]
    17611722    $inner configure -borderwidth 4
    17621723
     
    17821743        ignore -font
    17831744    }
    1784 
    17851745    checkbutton $inner.edges \
    17861746        -text "Edges" \
     
    18671827    bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]
    18681828
    1869     label $inner.opacity_l -text "Opacity" -font "Arial 9"
    1870     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
    1871         -variable [itcl::scope _settings(heightmapOpacity)] \
    1872         -width 10 \
    1873         -showvalue off \
    1874         -command [itcl::code $this AdjustSetting heightmapOpacity]
    1875 
    1876     label $inner.scale_l -text "Scale" -font "Arial 9"
    1877     ::scale $inner.scale -from 0 -to 100 -orient horizontal \
    1878         -variable [itcl::scope _settings(heightmapScale)] \
    1879         -width 10 \
    1880         -showvalue off \
    1881         -command [itcl::code $this AdjustSetting heightmapScale]
     1829    itk_component add opacity_l {
     1830        label $inner.opacity_l -text "Opacity" -font "Arial 9"
     1831    } {
     1832        ignore -font
     1833    }
     1834    itk_component add opacity {
     1835        ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
     1836            -variable [itcl::scope _settings(opacity)] \
     1837            -showvalue off \
     1838            -command [itcl::code $this AdjustSetting opacity]
     1839    }
     1840    itk_component add scale_l {
     1841        label $inner.scale_l -text "Scale" -font "Arial 9"
     1842    } {
     1843        ignore -font
     1844    }
     1845    itk_component add scale {
     1846        ::scale $inner.scale -from 0 -to 100 -orient horizontal \
     1847            -variable [itcl::scope _settings(heightmapScale)] \
     1848            -showvalue off \
     1849            -command [itcl::code $this AdjustSetting heightmapScale]
     1850    }
     1851    label $inner.numisolines_l -text "No. Isolines" -font "Arial 9"
     1852    itk_component add numisolines {
     1853        Rappture::Spinint $inner.numisolines \
     1854            -min 0 -max 50 -font "arial 9"
     1855    }
     1856    $itk_component(numisolines) value $_settings(numIsolines)
     1857    bind $itk_component(numisolines) <<Value>> \
     1858        [itcl::code $this AdjustSetting numIsolines]
    18821859
    18831860    blt::table $inner \
     
    18881865        2,0 $inner.background_l -anchor w -pady 2 \
    18891866        2,1 $inner.background -anchor w -pady 2  -fill x \
    1890         4,0 $inner.legend     -anchor w -pady 2 -cspan 2 \
    1891         5,0 $inner.wireframe  -anchor w -pady 2 -cspan 2\
    1892         6,0 $inner.lighting   -anchor w -pady 2 -cspan 2 \
    1893         7,0 $inner.edges      -anchor w -pady 2 -cspan 2 \
    1894         8,0 $inner.legend     -anchor w -pady 2 -cspan 2 \
    1895         9,0 $inner.stretch    -anchor w -pady 2 -cspan 2 \
    1896         10,0 $inner.outline    -anchor w -pady 2 -cspan 2 \
     1867        3,0 $inner.numisolines_l -anchor w -pady 2 \
     1868        3,1 $inner.numisolines -anchor w -pady 2 \
     1869        4,0 $inner.stretch    -anchor w -pady 2 -cspan 2 \
     1870        5,0 $inner.edges      -anchor w -pady 2 -cspan 2 \
     1871        6,0 $inner.legend     -anchor w -pady 2 -cspan 2 \
     1872        7,0 $inner.wireframe  -anchor w -pady 2 -cspan 2\
     1873        8,0 $inner.outline    -anchor w -pady 2 -cspan 2 \
     1874        10,0 $inner.lighting   -anchor w -pady 2 -cspan 2 \
    18971875        11,0 $inner.opacity_l -anchor w -pady 2 \
    18981876        11,1 $inner.opacity   -fill x   -pady 2 \
     
    19061884    }
    19071885    blt::table configure $inner r* c* -resize none
    1908     blt::table configure $inner r13 c1 -resize expand
     1886    blt::table configure $inner r9 -height .1i
     1887    blt::table configure $inner r14 c1 -resize expand
    19091888}
    19101889
     
    21282107        -edges 0
    21292108        -edgecolor black
    2130         -lighting 1
    21312109        -linewidth 1.0
    21322110        -levels 10
     
    21422120        $itk_component(colormap) value $style(-color)
    21432121    }
    2144     set _numContours $style(-levels)
     2122    set _settings(numIsolines) $style(-levels)
    21452123    set scale [GetHeightmapScale]
    2146     SendCmd "heightmap add numcontours $_numContours $scale $tag"
     2124    SendCmd "heightmap add numcontours $_settings(numIsolines) $scale $tag"
    21472125    set _comp2scale($tag) $_settings(heightmapScale)
    21482126    SendCmd "heightmap edges $_settings(edges) $tag"
     
    22472225    set color [$itk_component(isolinecolor) value]
    22482226    # Draw the isolines on the legend.
    2249     if { $color != "none"  && $_numContours > 0 } {
     2227    if { $color != "none"  && $_settings(numIsolines) > 0 } {
    22502228        set pixels [blt::vector create \#auto]
    22512229        set values [blt::vector create \#auto]
    22522230        set range [image height $_image(legend)]
    22532231        # Order of pixels is max to min (max is at top of legend).
    2254         $pixels seq $ih 0 $_numContours
     2232        $pixels seq $ih 0 $_settings(numIsolines)
    22552233        set offset [expr 2 + $lineht]
    22562234        # If there's a legend title, increase the offset by the line height.
     
    22612239        # Order of values is min to max.
    22622240        foreach { vmin vmax } $_limits(v) break
    2263         $values seq $vmin $vmax $_numContours
     2241        $values seq $vmin $vmax $_settings(numIsolines)
    22642242        set tags "isoline legend"
    22652243        foreach pos [$pixels range 0 end] value [$values range end 0] {
     
    23762354    # Make a swatch of the selected color
    23772355    if { [catch { $_image(legend) get 10 $iy } pixel] != 0 } {
    2378         #puts stderr "out of range: $iy"
    23792356        return
    23802357    }
Note: See TracChangeset for help on using the changeset viewer.