Changeset 4458 for branches/1.3


Ignore:
Timestamp:
Jul 3, 2014 9:11:15 AM (6 years ago)
Author:
ldelgass
Message:

Merge from trunk (drawing(3d))

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/drawing.tcl

    r4412 r4458  
    22
    33# ----------------------------------------------------------------------
    4 #  COMPONENT: drawing - 2D drawing of data
     4#  COMPONENT: drawing - 3D drawing of data
    55# ======================================================================
    66#  AUTHOR:  Michael McLennan, Purdue University
     
    2020    private variable _drawing
    2121    private variable _xmlobj
    22     private variable _actors
    2322    private variable _styles
    2423    private variable _shapes
     
    2827    private variable _hints
    2928    private variable _units
    30     private variable _limits
    3129
    3230    constructor {xmlobj path} {
     
    3634        # defined below
    3735    }
    38     public method limits {axis}
     36
    3937    public method label { elem }
    4038    public method type { elem }
     
    6361        set xunits "um"
    6462    }
    65     array set _limits {
    66         xMin 0
    67         xMax 0
    68         yMin 0
    69         yMax 0
    70         zMin 0
    71         zMax 0
    72     }
    7363    # determine the overall size of the device
    7464    foreach elem [$_xmlobj children $path] {
    7565        switch -glob -- $elem {
    76             polygon* {
    77                 set _data($elem) [$_xmlobj get $path.$elem.vtk]
    78                 set _data($elem) [string trim $_data($elem)]
    79                 set _styles($elem) [$_xmlobj get $path.$elem.about.style]
    80                 set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    81                 set _types($elem) polydata
    82             }
    83             polydata* {
     66            # polygon is deprecated in favor of polydata
     67            polygon* - polydata* {
    8468                set _data($elem) [$_xmlobj get $path.$elem.vtk]
    8569                set _data($elem) [string trim $_data($elem)]
     
    8771                set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    8872                set _types($elem) polydata
    89             }
    90             streamlines* {
    91                 set _data($elem) [$_xmlobj get $path.$elem.vtk]
    92                 set _data($elem) [string trim $_data($elem)]
    93                 set _styles($elem) [$_xmlobj get $path.$elem.about.style]
    94                 set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    95                 set _types($elem) streamlines
    9673            }
    9774            glyphs* {
     
    250227
    251228# ----------------------------------------------------------------------
    252 # method limits <axis>
    253 #       Returns a list {min max} representing the limits for the
    254 #       specified axis.
    255 # ----------------------------------------------------------------------
    256 itcl::body Rappture::Drawing::limits {which} {
    257     set min ""
    258     set max ""
    259     foreach key [array names _data] {
    260         set actor $_actors($key)
    261         foreach key { xMin xMax yMin yMax zMin zMax} value [$actor GetBounds] {
    262             set _limits($key) $value
    263         }
    264         break
    265     }   
    266    
    267     foreach key [array names _actors] {
    268         set actor $_actors($key)
    269         foreach { xMin xMax yMin yMax zMin zMax} [$actor GetBounds] break
    270         if { $xMin < $_limits(xMin) } {
    271             set _limits(xMin) $xMin
    272         }
    273         if { $xMax > $_limits(xMax) } {
    274             set _limits(xMax) $xMax
    275         }
    276         if { $yMin < $_limits(yMin) } {
    277             set _limits(yMin) $yMin
    278         }
    279         if { $yMax > $_limits(yMax) } {
    280             set _limits(yMax) $yMax
    281         }
    282         if { $zMin < $_limits(zMin) } {
    283             set _limits(zMin) $zMin
    284         }
    285         if { $zMax > $_limits(zMax) } {
    286             set _limits(zMax) $zMax
    287         }
    288     }
    289     switch -- $which {
    290         x {
    291             set min $_limits(xMin)
    292             set max $_limits(xMax)
    293             set axis "xaxis"
    294         }
    295         y {
    296             set min $_limits(yMin)
    297             set max $_limits(yMax)
    298             set axis "yaxis"
    299         }
    300         v - z {
    301             set min $_limits(zMin)
    302             set max $_limits(zMax)
    303             set axis "zaxis"
    304         }
    305         default {
    306             error "unknown axis description \"$which\""
    307         }
    308     }
    309     return [list $min $max]
    310 }
    311 
    312 # ----------------------------------------------------------------------
    313229# USAGE: hints ?<keyword>?
    314230#
     
    340256    return [array get _hints]
    341257}
    342 
Note: See TracChangeset for help on using the changeset viewer.