Changeset 3922 for trunk


Ignore:
Timestamp:
Sep 13, 2013 6:36:28 AM (11 years ago)
Author:
gah
Message:

fix: add units and label method to cloud object

File:
1 edited

Legend:

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

    r3921 r3922  
    2121    private variable _cloud "";         # lib obj representing this cloud
    2222    private variable _units "m m m" ;   # system of units for x, y, z
     23    private variable _axis2label;       #
     24    private variable _axis2units;       #
    2325    private variable _limits;           # limits x, y, z
    2426    private common _xp2obj ;            # Used for fetch/release ref counting
     
    112114    set _cloud [$xmlobj element -as object $path]
    113115
    114     set u [$_cloud get units]
    115     if {"" != $u} {
    116         while {[llength $u] < 3} {
    117             lappend u [lindex $u end]
    118         }
    119         set _units $u
     116    set _units [$_cloud get units]
     117    set first [lindex $_units 0]
     118    foreach u $_units axis { x y z } {
     119        if { $u != "" } {
     120            set _axis2units($axis) $u
     121        } else {
     122            set _axis2units($axis) $first
     123        }
     124    }
     125    foreach label [$_cloud get labels] axis { x y z } {
     126        if { $label != "" } {
     127            set _axis2labels($axis) $label
     128        } else {
     129            set _axis2labels($axis) [string toupper $axis]
     130        }
    120131    }
    121132
     
    246257#
    247258itcl::body Rappture::Cloud::units { axis } {
    248     if { [info exists _hints(${axis}units)] } {
    249         return $_hints(${axis}units)
    250     }
    251     return ""
     259    if { ![info exists _axis2units($axis)] } {
     260        return ""
     261    }
     262    return $_axis2units($axis)
    252263}
    253264
     
    258269#
    259270itcl::body Rappture::Cloud::label { axis } {
    260     if { [info exists _hints(${axis}label)] } {
    261         return $_hints(${axis}label)
    262     }
    263     return ""
     271    if { ![info exists axis2label($axis)] } {
     272        return ""
     273    }
     274    return $axis2label($axis)
    264275}
    265276
Note: See TracChangeset for help on using the changeset viewer.