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

Source for file Bezier.php

Documentation is available at Bezier.php

  1. <?php
  2.  
  3. /**
  4.  * Bezier class
  5.  *
  6.  * Description: Bezier Series
  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.  * @link http://www.steema.com
  13.  */
  14.   
  15.  class Bezier extends Custom {
  16.      
  17.     //private $bezierStyle = 0;
  18.     private $numBezierPoints 32;
  19.  
  20.     public function Bezier($c=null{
  21.         parent::Custom($c);
  22.         
  23.         //$this->bezierStyle=BezierStyle::$WINDOWS;
  24.         $this->numBezierPoints=32;        
  25.     }
  26.  
  27.     protected function draw({
  28.         // Limitation: points must be 4 + n*3
  29.         //$tmp = $this->getCount();
  30.         $tmp $this->numBezierPoints;
  31.         while ((($tmp 43!= 0{
  32.             $tmp++;
  33.         }
  34.  
  35.         $p Array();
  36.         for $t 0$t $this->getCount()$t++{
  37.             $p[$tnew TeePoint($this->calcXPos($t)$this->calcYPos($t));
  38.         }
  39.  
  40.         // Copy last point to remainder (see limitation above)        
  41.         for $t $this->getCount()$t $tmp$t++{
  42.             $p[$t$p[$this->getCount(1];
  43.         }
  44.  
  45.         $g $this->chart->getGraphics3D();
  46.         $g->getBrush()->setVisible(false);
  47.  
  48.         if (!$this->getLinePen()->getVisible())
  49.             $g->getPen()->setColor(Color::TRANSPARENT());
  50.         else
  51.             $g->setPen($this->getLinePen());
  52. //        }
  53.         if ($this->chart->getAspect()->getView3D()) {
  54.             $g->drawBeziers($this->getMiddleZ()$p);
  55.         else {
  56.             $g->drawBeziers($p);
  57.         }
  58.  
  59.         // Draw pointers...
  60.         if ($this->point->getVisible()) {
  61.             for ($t 0$t $this->getCount()$t++{
  62.                 $this->drawPointer($p[$t]->x$p[$t]->y$this->getValueColor($t)$t);
  63.             }
  64.         }
  65.     }
  66.  
  67.     /**
  68.     * Internal use.
  69.     *
  70.     * @param isEnabled boolean
  71.     */
  72.     public function prepareForGallery($isEnabled{
  73.         parent::prepareForGallery($isEnabled);
  74.         $this->fillSampleValues(7)// 4 + $this->n*3  ( 4  $points + 3 for  $group )
  75.         $this->setColorEach($isEnabled);
  76.         $this->getPointer()->setDraw3D(false);
  77.     }
  78.  
  79.     public function setColor($c{
  80.         parent::setColor($c);
  81.         $this->getLinePen()->setColor($c);
  82.     }
  83.  
  84.     
  85.     public function setNumBezierPoints($value)
  86.     {
  87.         if ($value<2)
  88.           echo 'Number of Bezier points should be > 1';
  89.  
  90.         $this->numBezierPoints=$value;
  91.     }
  92.     
  93.     /*public function setBezierStyle($value)
  94.     {
  95.         if ($this->bezierStyle!=$value)
  96.         {
  97.             $this->bezierStyle=$value;
  98.             $this->repaint();
  99.         }
  100.     }
  101.  
  102.     public function getBezierStyle()
  103.     {
  104.        return $this->bezierStyle;
  105.     }*/
  106.     
  107.     public function getNumBezierPoints()
  108.     {
  109.         return $this->numBezierPoints;
  110.     }
  111.         
  112.     /**
  113.     * Gets descriptive text.
  114.     *
  115.     * @return String 
  116.     */
  117.     public function getDescription({
  118.         return Language::getString("GalleryBezier");
  119.     }
  120. }
  121.  
  122. class BezierStyle {
  123.  
  124.    public static $WINDOWS 0;
  125.    public static $BEZIER3 1;
  126.    public static $BEZIER4 2;
  127.  
  128.    public function BezierStyle()
  129.    {}
  130.  
  131.    public function fromValue($value)
  132.    {
  133.       switch($value)
  134.       {
  135.          case 0:
  136.             return self::$WINDOWS;
  137.          case 1:
  138.             return self::$BEZIER3;
  139.          default:
  140.             return self::$BEZIER4;
  141.       }
  142.    }
  143. }
  144. ?>

Documentation generated on Wed, 16 Jun 2010 12:03:28 +0200 by phpDocumentor 1.4.1