~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/atobj/anm-obj.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # anm-obj.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1993-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 #
 31 # $Header: /usr/mash/src/repository/mash/mash-1/tcl/atobj/anm-obj.tcl,v 1.6 2002/02/03 04:25:26 lim Exp $
 32 
 33 
 34 Class AnmObj
 35 
 36 AnmObj instproc init {eId {sT 0} {eT inf}} {
 37         $self instvar eId_ eT_ sT_
 38         set eId_ $eId
 39         set sT_ $sT
 40         set eT_ $eT
 41         if {$eT_ == "inf"} {
 42                 $self set isStatic_ 1
 43         } else {
 44                 $self set isStatic_ 0
 45         }
 46 }
 47 
 48 AnmObj instproc destroy {} { $self next }
 49 
 50 AnmObj instproc isStatic {} {
 51         return [$self set isStatic_]
 52 }
 53 
 54 AnmObj instproc draw {t} {
 55 }
 56 
 57 AnmObj instproc update {time} {
 58         if [$self isStatic] return
 59         if { $time < [$self set sT_] || $time > [$self set eT_] } {
 60                 $self remove
 61         }
 62 }
 63 
 64 AnmObj instproc inRange {t} {
 65         $self instvar sT_ eT_
 66         return [expr $t >= $sT_ && $t <= $eT_]
 67 }
 68 
 69 # bbox is in the form [left top right bottom]
 70 AnmObj instproc set_bbox {bbox} { $self set bbox_ $bbox }
 71 
 72 AnmObj instproc eId {} {
 73         return [$self set eId_]
 74 }
 75 
 76 # updates bboxVar of the caller to contain bboxVar and this AnmObj
 77 AnmObj instproc merge {bboxVar} {
 78         $self instvar bbox_
 79         if ![info exists bbox_] return
 80 
 81         upvar $bboxVar newBBox
 82         foreach {bxmin bymin bxmax bymax} $bbox_ \
 83                         {xmin ymin xmax ymax} $newBBox {
 84                 set newBBox [list \
 85                                 [expr ($bxmin < $xmin) ? $bxmin : $xmin] \
 86                                 [expr ($bymin < $ymin) ? $bymin : $ymin] \
 87                                 [expr ($bxmax > $xmax) ? $bxmax : $xmax] \
 88                                 [expr ($bymax > $ymax) ? $bymax : $ymax]]
 89         }
 90 }
 91 
 92 AnmObj instproc set_drawboard {drawboard wgt} {
 93         $self instvar drawboard_ parent_
 94         set drawboard_ $wgt
 95         set parent_ $drawboard
 96 }
 97 
 98 # NOTE: there should be no instvar declarations in this procedure,
 99 #       as a bug in otcl/tcl causes duplicate free's
100 AnmObj instproc remove {} {
101         # parent will delete this object after remove
102         [$self set parent_] remove [$self set eId_]
103 }
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.