Ignore:
Timestamp:
Sep 12, 2013, 12:13:53 PM (11 years ago)
Author:
gah
Message:

fix axis labels for contour/heightmap

File:
1 edited

Legend:

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

    r3702 r3917  
    2727    private variable _dim       0;      # Dimension of mesh (1, 2, or 3)
    2828    private variable _type "";          # Indicates the type of mesh.
    29     private variable _units "m m m" ;   # System of units for x, y, z
     29    private variable _axis2units;       # System of units for x, y, z
     30    private variable _axis2labels;      #
    3031    private variable _limits        ;   # Array of mesh limits. Keys are
    3132                                        # xmin, xmax, ymin, ymax, ...
     
    4647    public method dimensions {}
    4748    public method limits {which}
     49    public method units { axis }
     50    public method label { axis }
    4851    public method hints {{key ""}}
    4952    public method isvalid {} {
     
    149152        set _limits($axis) ""
    150153    }
    151     set u [$_mesh get units]
    152     if {"" != $u} {
    153         while {[llength $u] < 3} {
    154             lappend u [lindex $u end]
    155         }
    156         set _units $u
     154    set units [$_mesh get units]
     155    set first [lindex $units 0]
     156    foreach u $units axis { x y z } {
     157        if { $u != "" } {
     158            set _axis2units($axis) $u
     159        } else {
     160            set _axis2units($axis) $first
     161        }
     162    }
     163    foreach label [$_mesh get labels] axis { x y z } {
     164        if { $label != "" } {
     165            set _axis2labels($axis) $label
     166        } else {
     167            set _axis2labels($axis) [string toupper $axis]
     168        }
    157169    }
    158170
     
    237249itcl::body Rappture::Mesh::points {} {
    238250    return ""
     251}
     252
     253#
     254# units --
     255#
     256#       Returns the units of the given axis.
     257#
     258itcl::body Rappture::Mesh::units { axis } {
     259    if { ![info exists _axis2units($axis)] } {
     260        return ""
     261    }
     262    return $_axis2units($axis)
     263}
     264
     265#
     266# label --
     267#
     268#       Returns the label of the given axis.
     269#
     270itcl::body Rappture::Mesh::label { axis } {
     271    if { ![info exists axis2label($axis)] } {
     272        return ""
     273    }
     274    return $axis2label($axis)
    239275}
    240276
Note: See TracChangeset for help on using the changeset viewer.