[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Graph/Line/ -> Array.php (source)

   1  <?php
   2  
   3  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   4  
   5  /**
   6   * Image_Graph - PEAR PHP OO Graph Rendering Utility.
   7   *
   8   * PHP versions 4 and 5
   9   *
  10   * LICENSE: This library is free software; you can redistribute it and/or modify
  11   * it under the terms of the GNU Lesser General Public License as published by
  12   * the Free Software Foundation; either version 2.1 of the License, or (at your
  13   * option) any later version. This library is distributed in the hope that it
  14   * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  15   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  16   * General Public License for more details. You should have received a copy of
  17   * the GNU Lesser General Public License along with this library; if not, write
  18   * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19   * 02111-1307 USA
  20   *
  21   * @category   Images
  22   * @package    Image_Graph
  23   * @subpackage Line
  24   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  25   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  26   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  27   * @version    CVS: $Id: Array.php,v 1.7 2005/02/21 20:49:42 nosey Exp $
  28   * @link       http://pear.php.net/package/Image_Graph
  29   */
  30  
  31  /**
  32   * Include file Image/Graph/Common.php
  33   */
  34  require_once  'Image/Graph/Common.php';
  35  
  36  /**
  37   * A sequential array of linestyles.
  38   *
  39   * This is used for multiple objects within the same element with different line
  40   * styles. This is done by adding multiple line styles to a LineArrray
  41   * structure. The linearray will then when requested return the 'next' linestyle
  42   * in sequential order. It is possible to specify ID tags to each linestyle,
  43   * which is used to make sure some data uses a specific linestyle (i.e. in a
  44   * multiple-/stackedbarchart you name the {@link Image_Graph_Dataset}s and uses
  45   * this name as ID tag when adding the dataset's associated linestyle to the
  46   * linearray.
  47   *
  48   * @category   Images
  49   * @package    Image_Graph
  50   * @subpackage Line
  51   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  52   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  53   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  54   * @version    Release: 0.7.2
  55   * @link       http://pear.php.net/package/Image_Graph
  56   */
  57  class Image_Graph_Line_Array extends Image_Graph_Common
  58  {
  59  
  60      /**
  61       * The fill array
  62       * @var array
  63       * @access private
  64       */
  65      var $_lineStyles = array ();
  66  
  67      /**
  68       * Add a line style to the array
  69       *
  70       * @param Image_Graph_Line $style The style to add
  71       */
  72      function add(& $style, $id = false)
  73      {
  74          if (is_a($style, 'Image_Graph_Element')) {
  75              parent::add($style);
  76          }
  77          if ($id === false) {
  78              $this->_lineStyles[] =& $style;
  79          } else {
  80              $this->_lineStyles[$id] =& $style;
  81          }
  82          reset($this->_lineStyles);
  83  
  84      }
  85  
  86      /**
  87       * Add a color to the array
  88       *
  89       * @param int $color The color
  90       * @param string $id The id or name of the color
  91       */
  92      function addColor($color, $id = false)
  93      {
  94          if ($id !== false) {
  95              $this->_lineStyles[$id] = $color;
  96          } else {
  97              $this->_lineStyles[] = $color;
  98          }
  99          reset($this->_lineStyles);
 100      }
 101  
 102      /**
 103       * Return the linestyle
 104       *
 105       * @return int A GD Linestyle
 106       * @access private
 107       */
 108      function _getLineStyle($ID = false)
 109      {
 110          if (($ID === false) || (!isset($this->_lineStyles[$ID]))) {
 111              $ID = key($this->_lineStyles);
 112              if (!next($this->_lineStyles)) {
 113                  reset($this->_lineStyles);
 114              }
 115          }
 116          $lineStyle =& $this->_lineStyles[$ID];
 117  
 118          if (is_object($lineStyle)) {
 119              return $lineStyle->_getLineStyle($ID);
 120          } elseif ($lineStyle !== null) {
 121              return $lineStyle;
 122          } else {
 123              return parent::_getLineStyle($ID);
 124          }
 125      }
 126  
 127  }
 128  
 129  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7