upload
[pear] / Image / Graph / Marker / Diamond.php
1 <?php\r
2 \r
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */\r
4 \r
5 /**\r
6  * Image_Graph - PEAR PHP OO Graph Rendering Utility.\r
7  *\r
8  * PHP versions 4 and 5\r
9  *\r
10  * LICENSE: This library is free software; you can redistribute it and/or modify\r
11  * it under the terms of the GNU Lesser General Public License as published by\r
12  * the Free Software Foundation; either version 2.1 of the License, or (at your\r
13  * option) any later version. This library is distributed in the hope that it\r
14  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty\r
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser\r
16  * General Public License for more details. You should have received a copy of\r
17  * the GNU Lesser General Public License along with this library; if not, write\r
18  * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\r
19  * 02111-1307 USA\r
20  *\r
21  * @category   Images\r
22  * @package    Image_Graph\r
23  * @subpackage Marker\r
24  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>\r
25  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen\r
26  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1\r
27  * @version    CVS: $Id: Diamond.php,v 1.6 2005/08/03 21:21:55 nosey Exp $\r
28  * @link       http://pear.php.net/package/Image_Graph\r
29  */\r
30 \r
31 /**\r
32  * Include file Image/Graph/Marker.php\r
33  */\r
34 require_once 'Image/Graph/Marker.php';\r
35 \r
36 /**\r
37  * Data marker as a diamond.\r
38  *\r
39  * @category   Images\r
40  * @package    Image_Graph\r
41  * @subpackage Marker\r
42  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>\r
43  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen\r
44  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1\r
45  * @version    Release: 0.7.2\r
46  * @link       http://pear.php.net/package/Image_Graph\r
47  */\r
48 class Image_Graph_Marker_Diamond extends Image_Graph_Marker\r
49 {\r
50 \r
51     /**\r
52      * Draw the marker on the canvas\r
53      *\r
54      * @param int $x The X (horizontal) position (in pixels) of the marker on the canvas\r
55      * @param int $y The Y (vertical) position (in pixels) of the marker on the canvas\r
56      * @param array $values The values representing the data the marker 'points' to\r
57      * @access private\r
58      */\r
59     function _drawMarker($x, $y, $values = false)\r
60     {\r
61         $this->_getFillStyle();\r
62         $this->_getLineStyle();\r
63         $this->_canvas->addVertex(array('x' => $x - $this->_size, 'y' => $y));\r
64         $this->_canvas->addVertex(array('x' => $x, 'y' => $y - $this->_size));\r
65         $this->_canvas->addVertex(array('x' => $x + $this->_size, 'y' => $y));\r
66         $this->_canvas->addVertex(array('x' => $x, 'y' => $y + $this->_size));\r
67         $this->_canvas->polygon(array('connect' => true));\r
68         parent::_drawMarker($x, $y, $values);\r
69     }\r
70 \r
71 }\r
72 \r
73 ?>