Ignore:
Timestamp:
Sep 14, 2009 2:14:22 PM (15 years ago)
Author:
gah
Message:

Added cartoon image, changed molecule representation controls, added print options, relabel duplicate xy elements

File:
1 edited

Legend:

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

    r1527 r1562  
    9191    protected method _hilite {state x y}
    9292    protected method _axis {option args}
    93     protected method _getAxes {xydata}
     93    protected method _getAxes {curve}
    9494    protected method _getLineMarkerOptions { style }
    9595    protected method _getTextMarkerOptions { style }
     
    435435
    436436    catch {unset _limits}
    437     foreach xydata $args {
     437    foreach curve $args {
    438438        # find the axes for this curve (e.g., {x y2})
    439         foreach {map(x) map(y)} [_getAxes $xydata] break
     439        foreach {map(x) map(y)} [_getAxes $curve] break
    440440
    441441        foreach axis {x y} {
     
    444444                # store results -- ex: _limits(x2log-min)
    445445                set id $map($axis)$type
    446                 foreach {min max} [$xydata limits $axis$type] break
     446                foreach {min max} [$curve limits $axis$type] break
    447447                if {"" != $min && "" != $max} {
    448448                    if {![info exists _limits($id-min)]} {
     
    460460            }
    461461
    462             if {[$xydata hints ${axis}scale] == "log"} {
     462            if {[$curve hints ${axis}scale] == "log"} {
    463463                _axis scale $map($axis) log
    464464            }
     
    633633    set anum(x) 0
    634634    set anum(y) 0
    635     foreach xydata [get] {
     635    foreach curve [get] {
    636636        foreach ax {x y} {
    637             set label [$xydata hints ${ax}label]
     637            set label [$curve hints ${ax}label]
    638638            if {"" != $label} {
    639639                if {![info exists _label2axis($ax-$label)]} {
     
    651651
    652652                    # if this axis has a description, add it as a tooltip
    653                     set desc [string trim [$xydata hints ${ax}desc]]
     653                    set desc [string trim [$curve hints ${ax}desc]]
    654654                    Rappture::Tooltip::text $g-$axis $desc
    655655                }
     
    698698    #
    699699    set count 0
    700     foreach xydata $_clist {
    701         set label [$xydata hints label]
    702         foreach {mapx mapy} [_getAxes $xydata] break
    703 
    704         foreach comp [$xydata components] {
    705             set xv [$xydata mesh $comp]
    706             set yv [$xydata values $comp]
    707 
    708             if {[info exists _curve2color($xydata)]} {
    709                 set color $_curve2color($xydata)
     700    foreach curve $_clist {
     701        set label [$curve hints label]
     702        foreach {mapx mapy} [_getAxes $curve] break
     703
     704        foreach comp [$curve components] {
     705            set xv [$curve mesh $comp]
     706            set yv [$curve values $comp]
     707
     708            if {[info exists _curve2color($curve)]} {
     709                set color $_curve2color($curve)
    710710            } else {
    711                 set color [$xydata hints color]
     711                set color [$curve hints color]
    712712                if {"" == $color} {
    713713                    set color black
     
    715715            }
    716716
    717             if {[info exists _curve2width($xydata)]} {
    718                 set lwidth $_curve2width($xydata)
     717            if {[info exists _curve2width($curve)]} {
     718                set lwidth $_curve2width($curve)
    719719            } else {
    720720                set lwidth 2
    721721            }
    722722
    723             if {[info exists _curve2dashes($xydata)]} {
    724                 set dashes $_curve2dashes($xydata)
     723            if {[info exists _curve2dashes($curve)]} {
     724                set dashes $_curve2dashes($curve)
    725725            } else {
    726726                set dashes ""
     
    736736
    737737            set elem "elem[incr count]"
    738             set _elem2curve($elem) $xydata
    739 
     738            set _elem2curve($elem) $curve
     739            lappend label2elem($label) $elem
    740740            $g element create $elem -x $xv -y $yv \
    741                 -symbol $sym -pixels $pixels -linewidth $lwidth -label $label \
     741                -symbol $sym -pixels $pixels -linewidth $lwidth \
     742                -label $label \
    742743                -color $color -dashes $dashes \
    743744                -mapx $mapx -mapy $mapy
     
    745746    }
    746747
    747     foreach xydata $_clist {
     748    # Fix duplicate labels by appending the simulation number
     749    foreach label [array names label2elem] {
     750        if { [llength $label2elem($label)] == 1 } {
     751            continue
     752        }
     753        foreach elem $label2elem($label) {
     754            set curve $_elem2curve($elem)
     755            scan [$curve hints xmlobj] "::libraryObj%d" suffix
     756            incr suffix
     757            set elabel [format "%s \#%d" $label $suffix]
     758            $g element configure $elem -label $elabel
     759        }
     760    }   
     761
     762    foreach curve $_clist {
    748763        set xmin -Inf
    749764        set ymin -Inf
     
    753768        # Create text/line markers for each *axis.marker specified.
    754769        #
    755         foreach m [$xydata xmarkers] {
     770        foreach m [$curve xmarkers] {
    756771            foreach {at label style} $m break
    757772            set id [$g marker create line -coords [list $at $ymin $at $ymax]]
     
    773788            }
    774789        }
    775         foreach m [$xydata ymarkers] {
     790        foreach m [$curve ymarkers] {
    776791            foreach {at label style} $m break
    777792            set id [$g marker create line -coords [list $xmin $at $xmax $at]]
     
    15211536# x-axis name (x, x2, x3, etc.), and y is the y-axis name.
    15221537# ----------------------------------------------------------------------
    1523 itcl::body Rappture::XyResult::_getAxes {xydata} {
     1538itcl::body Rappture::XyResult::_getAxes {curve} {
    15241539    # rebuild if needed, so we know about the axes
    15251540    if {[$_dispatcher ispending !rebuild]} {
     
    15291544
    15301545    # what is the x axis?  x? x2? x3? ...
    1531     set xlabel [$xydata hints xlabel]
     1546    set xlabel [$curve hints xlabel]
    15321547    if {[info exists _label2axis(x-$xlabel)]} {
    15331548        set mapx $_label2axis(x-$xlabel)
     
    15371552
    15381553    # what is the y axis?  y? y2? y3? ...
    1539     set ylabel [$xydata hints ylabel]
     1554    set ylabel [$curve hints ylabel]
    15401555    if {[info exists _label2axis(y-$ylabel)]} {
    15411556        set mapy $_label2axis(y-$ylabel)
Note: See TracChangeset for help on using the changeset viewer.