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 / GIS / LineSet.php next >
Encoding:
PHP Script  |  2008-07-02  |  2.5 KB  |  84 lines

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | PEAR :: Image :: GIS :: Line Set                                       |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2002-2004 Jan Kneschke <jan@kneschke.de> and             |
  7. // |                         Sebastian Bergmann <sb@sebastian-bergmann.de>. |
  8. // +------------------------------------------------------------------------+
  9. // | This source file is subject to version 3.00 of the PHP License,        |
  10. // | that is available at http://www.php.net/license/3_0.txt.               |
  11. // | If you did not receive a copy of the PHP license and are unable to     |
  12. // | obtain it through the world-wide-web, please send a note to            |
  13. // | license@php.net so we can mail you a copy immediately.                 |
  14. // +------------------------------------------------------------------------+
  15. //
  16. // $Id: LineSet.php,v 1.7 2004/07/25 13:56:29 sebastian Exp $
  17. //
  18.  
  19. /**
  20.  * A Set of Lines.
  21.  *
  22.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  23.  * @copyright   Copyright © 2002-2004 Jan Kneschke <jan@kneschke.de> and Sebastian Bergmann <sb@sebastian-bergmann.de>
  24.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  25.  * @category    Image
  26.  * @package     Image_GIS
  27.  */
  28. class Image_GIS_LineSet {
  29.     /**
  30.     * @var array $color
  31.     */
  32.     var $color = 'black';
  33.  
  34.     /**
  35.     * @var array $lines
  36.     */
  37.     var $lines = array();
  38.  
  39.     /**
  40.     * @var array $min
  41.     */
  42.     var $min = false;
  43.     /**
  44.     * @var array $max
  45.     */
  46.     var $max = false;
  47.  
  48.     /**
  49.     * Constructor.
  50.     *
  51.     * @param  string $color
  52.     * @access public
  53.     */
  54.     function Image_GIS_LineSet($color = 'black') {
  55.         $this->color = $color;
  56.     }
  57.  
  58.     /**
  59.     * Adds a line to the line set.
  60.     *
  61.     * @param  float $x1
  62.     * @param  float $y1
  63.     * @param  float $x2
  64.     * @param  float $y2
  65.     * @access public
  66.     */
  67.     function addLine($x1, $y1, $x2, $y2) {
  68.         $this->lines[] = array($x1, $y1, $x2, $y2);
  69.  
  70.         if ($this->min == false) {
  71.             $this->min['x'] = min($x1, $x2);
  72.             $this->min['y'] = min($y1, $y2);
  73.             $this->max['x'] = max($x1, $x2);
  74.             $this->max['y'] = max($y1, $y2);
  75.         } else {
  76.             $this->min['x'] = min($this->min['x'], $x1, $x2);
  77.             $this->min['y'] = min($this->min['y'], $y1, $y2);
  78.             $this->max['x'] = max($this->max['x'], $x1, $x2);
  79.             $this->max['y'] = max($this->max['y'], $y1, $y2);
  80.         }
  81.     }
  82. }
  83. ?>
  84.