TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Animation.php

Documentation is available at Animation.php

  1. <?php
  2.  
  3. /**
  4.  * Animation class
  5.  *
  6.  * Description: Animation
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage animations
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16.  
  17. class Animation extends TeeBase
  18. {
  19.     public $ClickTolerance = 3;
  20.     public $Part;  /*ChartClickedPart*/    
  21.     private $active true;
  22.     
  23.  
  24.     public function Animation($c=null)
  25.     {
  26.       parent::__construct($c);
  27.       
  28.       if ($this->chart != null)
  29.         $this->getChart()->getAnimations()->add($this);
  30.     }
  31.     
  32.     protected function Dispose($disposing)
  33.     {
  34.       if ($disposing)
  35.       {
  36.         $this->Chart null;
  37.       }
  38.       parent::Dispose($disposing);
  39.     }
  40.  
  41.     static function GetFirstLastSeries($s$AMin$AMax)
  42.     {
  43.       $AMin $s->firstVisible;
  44.       if ($AMin 0$AMin 0;
  45.  
  46.       $AMax $s->lastVisible;
  47.       if ($AMax 0$AMax $s->Count 1;
  48.       else
  49.         if ($AMax >= $s->Count$AMax $s->Count 1// 5.03
  50.  
  51.       return ($s->Count 0&& ($AMin <= $s->Count&& ($AMax <= $s->Count);
  52.     }
  53.  
  54.     public function ToString()
  55.     {
  56.        return $this->Description;
  57.     }
  58.  
  59.     public function getActive()
  60.     {
  61.        return $this->active;
  62.     }
  63.     
  64.     public function setActive($value)
  65.     {
  66.        $this->active($value);
  67.     }
  68.  
  69.     public function SetChart($value)
  70.     {
  71.       if ($this->chart != $value)
  72.       {
  73.         if ($this->chart != null$this->chart->Animations->Remove($this);    //CDI same as for Series.SetChart()
  74.         parent::setChart($value);
  75.         if ($this->chart != null && !$this->InternalUse$this->chart->Animations->Add($this);
  76.         if ($this->chart != null$this->chart->Invalidate();
  77.       }
  78.     }
  79.  
  80.     protected function KeyEvent($e}
  81. /*    protected function ChartEvent($e) 
  82.         {
  83.             if (($e === AfterDrawEventArgs) && $this->drawing)
  84.             {
  85.                 switch (Target)
  86.                 {
  87.                     case ChartClickedPartStyle.None:
  88.                         break;
  89.                     case ChartClickedPartStyle.Legend:
  90.                         break;
  91.                     case ChartClickedPartStyle.Axis:
  92.                         break;
  93.                     case ChartClickedPartStyle.Series:
  94.                         break;
  95.                     case ChartClickedPartStyle.Header:
  96.                         break;
  97.                     case ChartClickedPartStyle.Foot:
  98.                         break;
  99.                     case ChartClickedPartStyle.ChartRect:
  100.                         break;
  101.                     case ChartClickedPartStyle.SeriesMarks:
  102.                         break;
  103.                     case ChartClickedPartStyle.SeriesPointer:
  104.                         DoSeriesPointer();
  105.                         break;
  106.                     case ChartClickedPartStyle.SubHeader:
  107.                         break;
  108.                     case ChartClickedPartStyle.SubFoot:
  109.                         break;
  110.                     case ChartClickedPartStyle.AxisTitle:
  111.                         break;
  112.                     default:
  113.                         break;
  114.                 }
  115.             }
  116.         }
  117.         
  118.     protected internal virtual void SeriesEvent(EventArgs e) { } // MS: v3
  119.                               */
  120.         protected $P;
  121.         protected $drawing = false;
  122.                                 /*
  123.         protected virtual internal void MouseEvent(MouseEventKinds kind, MouseEventArgs e, ref Cursor c)
  124.     {
  125. #if WPF || SILVERLIGHT
  126.       P = e.GetPosition(Chart.Parent.GetControl());
  127. #else
  128.       P = new Point(e.X, e.Y);
  129. #endif
  130.  
  131.       Chart.CalcClickedPart(P, out Part);
  132.  
  133.       switch (kind)
  134.       {
  135.         case MouseEventKinds.Up:
  136.           DoMouseUp(e, ref c);
  137.           break;
  138.  
  139.         case MouseEventKinds.Move:
  140.           DoMouseMove(e, ref c);
  141.           break;
  142.  
  143.         case MouseEventKinds.Down:
  144.           DoMouseDown(e, ref c);
  145.           break;
  146.       }
  147.     }
  148.         
  149.     protected DoMouseDown($e, $c) 
  150.     {
  151.       if (Trigger == AnimationTrigger.MouseClick && Part.Part == Target)
  152.       {
  153.         drawing = true;
  154.       }
  155.       else
  156.       {
  157.         drawing = false;
  158.       }
  159.             if (Trigger == AnimationTrigger.MouseClick)
  160.             {
  161.                 Invalidate();
  162.             }
  163.     }
  164.  
  165.     protected virtual void DoMouseMove(MouseEventArgs e, ref Cursor c) 
  166.         {
  167.             if (Trigger == AnimationTrigger.MouseOver && Part.Part == Target)
  168.             {
  169.                 drawing = true;
  170.             }
  171.             else
  172.             {
  173.                 drawing = false;
  174.             }
  175.  
  176.             if (Trigger == AnimationTrigger.MouseOver)
  177.             {
  178.                 Invalidate();
  179.             }
  180.         }
  181.  
  182.     protected virtual void DoMouseUp(MouseEventArgs e, ref Cursor c) 
  183.     {
  184.  
  185.     }
  186.  
  187.         protected virtual void DoSeriesPointer() { }
  188.  
  189.  
  190.     protected internal virtual void OnDisposing() { }
  191. */
  192.     private $speed 10;
  193.  
  194.     /// <summary>
  195.     /// Gets and sets the speed of the animation effect, in milliseconds.
  196.     /// </summary>
  197.     public function getSpeed()
  198.     {
  199.         return $this->speed;
  200.     }
  201.     
  202.     public function setSpeed($value)
  203.     {
  204.         $this->speed $value;
  205.     }
  206.                     
  207.     //private $target = ChartClickedPartStyle.None;
  208.  
  209.  
  210.     public function /*ChartClickedPartStyle*/ getTarget()
  211.     {
  212.         return $this->target;
  213.     }
  214.     
  215.     public function setTarget($value
  216.     {
  217.         $this->target $value;
  218.     }
  219.  
  220.     private $trigger 1// AnimationTrigger::$MouseOver;
  221.  
  222.  
  223.     public function getTrigger()
  224.     {
  225.         return $this->trigger;
  226.     }
  227.  
  228.     public function setTrigger($value)
  229.     {
  230.         $this->trigger $value;
  231.     }
  232.  
  233.    // public $Description { get { return ""; } }
  234.     //public virtual string Summary { get { return ""; } }
  235.  
  236.     /// <summary>
  237.     /// Creates a new Animation object and sets the Name and Chart properties.
  238.     /// </summary>
  239.     public static function CreateNewAnimation($chart$type)
  240.     {
  241.       $result Self::NewFromType($type);
  242.       //result.Chart = chart;
  243.       //return result;
  244.     }
  245.  
  246.     protected function Assign($t)
  247.     {
  248.       $t->Active $this->Active;
  249.     }
  250.   }
  251.  
  252. {
  253.   public static $MouseClick=0;
  254.   public static $MouseOver=1;
  255. }  
  256. ?>

Documentation generated on Wed, 16 Jun 2010 12:02:26 +0200 by phpDocumentor 1.4.1