home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Image / Graph / Marker / Icon.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  3.8 KB  |  133 lines

  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 Marker
  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: Icon.php,v 1.8 2005/08/24 20:35:53 nosey Exp $
  28.  * @link       http://pear.php.net/package/Image_Graph
  29.  */
  30.  
  31. /**
  32.  * Include file Image/Graph/Marker.php
  33.  */
  34. require_once 'Image/Graph/Marker.php';
  35.  
  36. /**
  37.  * Data marker using an image as icon.
  38.  *
  39.  * @category   Images
  40.  * @package    Image_Graph
  41.  * @subpackage Marker
  42.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  43.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  44.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  45.  * @version    Release: 0.7.2
  46.  * @link       http://pear.php.net/package/Image_Graph
  47.  */
  48. class Image_Graph_Marker_Icon extends Image_Graph_Marker
  49. {
  50.  
  51.     /**
  52.      * Filename of the image icon
  53.      * @var string
  54.      * @access private
  55.      */
  56.     var $_filename;
  57.  
  58.     /**
  59.      * X Point of the icon to use as data 'center'
  60.      * @var int
  61.      * @access private
  62.      */
  63.     var $_pointX = 0;
  64.  
  65.     /**
  66.      * Y Point of the icon to use as data 'center'
  67.      * @var int
  68.      * @access private
  69.      */
  70.     var $_pointY = 0;
  71.  
  72.     /**
  73.      * Create an icon marker
  74.      *
  75.      * @param string $filename The filename of the icon
  76.      * @param int $width The 'new' width of the icon if it is to be resized
  77.      * @param int $height The 'new' height of the icon if it is to be resized
  78.      */
  79.     function Image_Graph_Marker_Icon($filename, $width = 0, $height = 0)
  80.     {
  81.         parent::Image_Graph_Marker();
  82.         $this->_filename = $filename;
  83.     }
  84.  
  85.     /**
  86.      * Set the X 'center' point of the marker
  87.      *
  88.      * @param int $x The X 'center' point of the marker
  89.      */
  90.     function setPointX($x)
  91.     {
  92.         $this->_pointX = $x;
  93.     }
  94.  
  95.     /**
  96.      * Set the Y 'center' point of the marker
  97.      *
  98.      * @param int $y The Y 'center' point of the marker
  99.      */
  100.     function setPointY($y)
  101.     {
  102.         $this->_pointY = $y;
  103.     }
  104.  
  105.     /**
  106.      * Draw the marker on the canvas
  107.      *
  108.      * @param int $x The X (horizontal) position (in pixels) of the marker on
  109.      *   the canvas
  110.      * @param int $y The Y (vertical) position (in pixels) of the marker on the
  111.      *   canvas
  112.      * @param array $values The values representing the data the marker 'points'
  113.      *   to
  114.      * @access private
  115.      */
  116.     function _drawMarker($x, $y, $values = false)
  117.     {
  118.         parent::_drawMarker($x, $y, $values);
  119.         if ($this->_filename) {
  120.             $this->_canvas->image(
  121.                 array(
  122.                     'x' => $x, 
  123.                     'y' => $y, 
  124.                     'filename' => $this->_filename, 
  125.                     'alignment' => array('horizontal' => 'center', 'vertical' => 'center')
  126.                 )
  127.             );
  128.         }
  129.     }
  130.  
  131. }
  132.  
  133. ?>