cvs: pear /Image_GIS GIS.php package.xml /Image_GIS/GIS LineSet.php Parser.php Renderer.php /Image_GIS/GIS/Parser E00.php /Image_GIS/GIS/Renderer
GD.php SVG.php
| From: | Sebastian Bergmann | Date: | Tue, 16 Mar 2004 08:05:56 +0000 |
| Subject: | cvs: pear /Image_GIS GIS.php package.xml /Image_GIS/GIS LineSet.php Parser.php Renderer.php /Image_GIS/GIS/Parser E00.php /Image_GIS/GIS/Renderer GD.php SVG.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-17446@lists.php.net to get a copy of this message | ||
sebastian Tue Mar 16 03:05:56 2004 EDT
Modified files:
/pear/Image_GIS GIS.php package.xml
/pear/Image_GIS/GIS LineSet.php Parser.php Renderer.php
/pear/Image_GIS/GIS/Parser E00.php
/pear/Image_GIS/GIS/Renderer GD.php SVG.php
Log:
Initial commit of PHP 5 syntax change.
http://cvs.php.net/diff.php/pear/Image_GIS/GIS.php?r1=1.15&r2=1.16&ty=u Index: pear/Image_GIS/GIS.php diff -u pear/Image_GIS/GIS.php:1.15 pear/Image_GIS/GIS.php:1.16 --- pear/Image_GIS/GIS.php:1.15 Fri Mar 5 05:34:06 2004 +++ pear/Image_GIS/GIS.php Tue Mar 16 03:05:53 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: GIS.php,v 1.15 2004/03/05 10:34:06 sebastian Exp $ +// $Id: GIS.php,v 1.16 2004/03/16 08:05:53 sebastian Exp $ // require_once 'Image/Color.php'; @@ -56,7 +56,7 @@ * $map->saveImage('kiel.png'); * ?> * -* @version $Revision: 1.15 $ +* @version $Revision: 1.16 $ * @since Image_GIS 1.0.0 */ class Image_GIS { @@ -65,21 +65,21 @@ * * @var boolean $debug */ - var $debug; + private $debug; /** * Image_GIS_Parser sub-class object. * * @var Image_GIS_Parser $parser */ - var $parser; + private $parser; /** * Image_GIS_Renderer sub-class object. * * @var Image_GIS_Renderer $renderer */ - var $renderer; + private $renderer; /** * Constructor. @@ -87,7 +87,7 @@ * @param array $parameters * @access public */ - function Image_GIS($parameters = array()) { + public function Image_GIS($parameters = array()) { $this->debug = isset($parameters['debug']) ? $parameters['debug'] : false; $this->setParser( @@ -123,7 +123,7 @@ * @return boolean * @access public */ - function addDataFile($dataFile, $color) { + public function addDataFile($dataFile, $color) { return $this->parser->addDataFile($dataFile, $color); } @@ -134,7 +134,7 @@ * @access public * @since Image_GIS 1.0.1 */ - function getRange() { + public function getRange() { return $this->renderer->getRange(); } @@ -143,7 +143,7 @@ * * @access public */ - function render() { + public function render() { $this->renderer->render($this->parser->parse()); } @@ -154,7 +154,7 @@ * @return boolean * @access public */ - function saveImage($filename) { + public function saveImage($filename) { $this->render(); return $this->renderer->saveImage($filename); @@ -168,8 +168,8 @@ * @param boolean $cache * @access public */ - function setParser($parser, $cache) { - $this->parser = &Image_GIS_Parser::factory($parser, $cache, $this->debug); + public function setParser($parser, $cache) { + $this->parser = Image_GIS_Parser::factory($parser, $cache, $this->debug); } /** @@ -181,7 +181,7 @@ * @param float $y2 * @access public */ - function setRange($x1, $x2, $y1, $y2) { + public function setRange($x1, $x2, $y1, $y2) { $this->renderer->setRange($x1, $x2, $y1, $y2); } @@ -192,8 +192,8 @@ * @param string $renderer * @access public */ - function setRenderer($renderer, $width, $height) { - $this->renderer = &Image_GIS_Renderer::factory($renderer, $width, $height, $this->debug); + public function setRenderer($renderer, $width, $height) { + $this->renderer = Image_GIS_Renderer::factory($renderer, $width, $height, $this->debug); } /** @@ -201,9 +201,8 @@ * * @access public */ - function showImage() { + public function showImage() { $this->render(); - $this->renderer->showImage(); } } http://cvs.php.net/diff.php/pear/Image_GIS/package.xml?r1=1.13&r2=1.14&ty=u Index: pear/Image_GIS/package.xml diff -u pear/Image_GIS/package.xml:1.13 pear/Image_GIS/package.xml:1.14 --- pear/Image_GIS/package.xml:1.13 Tue Jan 6 14:59:02 2004 +++ pear/Image_GIS/package.xml Tue Mar 16 03:05:53 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package version="1.0"> - <name>Image_GIS</name> + <name>Image_GIS2</name> <summary>Visualization of GIS data.</summary> <description> Generating maps on demand can be a hard job as most often you don't @@ -28,31 +28,14 @@ </maintainers> <license>PHP License</license> <release> - <version>1.1.0</version> + <version>2.0.0</version> <state>stable</state> - <date>2004-01-06</date> + <date>2004-MM-DD</date> <notes> <![CDATA[ -+ Added caching of parsed data files. - -+ Added getRange() method to the Image_GIS and Image_GIS_Renderer - classes. - -* Changed the Image_GIS constructor to accept an associative - parameter array as its only argument. - - Note: This breaks backwards compatibility. - -* The SVG renderer now uses the XML_SVG package instead of the - XML_Tree package. +* Refactored using PHP 5 syntax. -* Factored the handling of Line Sets out into a separate class. - -* Fixed handling of negative coordinates. - -* Fixed a bug that kept a debugging message from beeing printed. - -* Fixed incompatibilities with PHP 5. +! PHP 5.0.0 (or higher) is now required. ]]> </notes> <filelist> @@ -84,6 +67,35 @@ </release> <changelog> <release> + <version>1.1.0</version> + <state>stable</state> + <date>2004-01-06</date> + <notes> +<![CDATA[ ++ Added caching of parsed data files. + ++ Added getRange() method to the Image_GIS and Image_GIS_Renderer + classes. + +* Changed the Image_GIS constructor to accept an associative + parameter array as its only argument. + + Note: This breaks backwards compatibility. + +* The SVG renderer now uses the XML_SVG package instead of the + XML_Tree package. + +* Factored the handling of Line Sets out into a separate class. + +* Fixed handling of negative coordinates. + +* Fixed a bug that kept a debugging message from beeing printed. + +* Fixed incompatibilities with PHP 5. +]]> + </notes> + </release> + <release> <version>1.0.0</version> <state>stable</state> <date>2002-12-30</date> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/LineSet.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_GIS/GIS/LineSet.php diff -u pear/Image_GIS/GIS/LineSet.php:1.2 pear/Image_GIS/GIS/LineSet.php:1.3 --- pear/Image_GIS/GIS/LineSet.php:1.2 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/LineSet.php Tue Mar 16 03:05:54 2004 @@ -13,30 +13,30 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: LineSet.php,v 1.2 2004/01/01 10:31:37 sebastian Exp $ +// $Id: LineSet.php,v 1.3 2004/03/16 08:05:54 sebastian Exp $ // /** * A Set of Lines. * -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ * @since Image_GIS 1.0.1 */ class Image_GIS_LineSet { /** * @var array $color */ - var $color = 'black'; + public $color = 'black'; /** * @var array $lines */ - var $lines = array(); + public $lines = array(); /** * @var array $min */ - var $min = array( + public $min = array( 'x' => 0, 'y' => 0 ); @@ -44,7 +44,7 @@ /** * @var array $max */ - var $max = array( + public $max = array( 'x' => 0, 'y' => 0 ); @@ -55,7 +55,7 @@ * @param string $color * @access public */ - function Image_GIS_LineSet($color = 'black') { + public function Image_GIS_LineSet($color = 'black') { $this->color = $color; } @@ -68,7 +68,7 @@ * @param float $y2 * @access public */ - function addLine($x1, $y1, $x2, $y2) { + public function addLine($x1, $y1, $x2, $y2) { $this->lines[] = array($x1, $y1, $x2, $y2); $this->min['x'] = min($this->min['x'], $x1, $x2); http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Parser.php?r1=1.10&r2=1.11&ty=u Index: pear/Image_GIS/GIS/Parser.php diff -u pear/Image_GIS/GIS/Parser.php:1.10 pear/Image_GIS/GIS/Parser.php:1.11 --- pear/Image_GIS/GIS/Parser.php:1.10 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/Parser.php Tue Mar 16 03:05:54 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.10 2004/01/01 10:31:37 sebastian Exp $ +// $Id: Parser.php,v 1.11 2004/03/16 08:05:54 sebastian Exp $ // require_once 'Cache/Lite.php'; @@ -22,37 +22,37 @@ /** * Parser Base Class. * -* @version $Revision: 1.10 $ +* @version $Revision: 1.11 $ * @since Image_GIS 1.0.0 */ -class Image_GIS_Parser { +abstract class Image_GIS_Parser { /** * Cache. * * @var Cache_Lite $cache */ - var $cache = NULL; + protected $cache = NULL; /** * Data Files. * * @var array $dataFiles */ - var $dataFiles = array(); + protected $dataFiles = array(); /** * Set to TRUE to enable debugging. * * @var boolean $debug */ - var $debug; + protected $debug; /** * Line Set. * * @var array $lineSets */ - var $lineSets = array(); + protected $lineSets = array(); /** * Constructor. @@ -61,7 +61,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Parser($cache, $debug) { + public function Image_GIS_Parser($cache, $debug) { if ($cache) { $this->cache = new Cache_Lite; } @@ -78,7 +78,7 @@ * @return object * @access public */ - function &factory($parser, $cache, $debug) { + public static function factory($parser, $cache, $debug) { include_once 'Image/GIS/Parser/' . $parser . '.php'; $class = 'Image_GIS_Parser_' . $parser; @@ -94,7 +94,7 @@ * @param mixed $color * @access public */ - function addDataFile($dataFile, $color) { + public function addDataFile($dataFile, $color) { $this->dataFiles[$dataFile] = $color; } @@ -104,7 +104,7 @@ * @access public * @return array */ - function parse() { + public function parse() { foreach ($this->dataFiles as $dataFile => $color) { $cacheID = md5($dataFile . '_' . $color); $lineSet = false; @@ -137,6 +137,6 @@ * @access public * @abstract */ - function parseFile($dataFile, $color) { /* abstract */ } + public abstract function parseFile($dataFile, $color); } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer.php?r1=1.9&r2=1.10&ty=u Index: pear/Image_GIS/GIS/Renderer.php diff -u pear/Image_GIS/GIS/Renderer.php:1.9 pear/Image_GIS/GIS/Renderer.php:1.10 --- pear/Image_GIS/GIS/Renderer.php:1.9 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/Renderer.php Tue Mar 16 03:05:54 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: Renderer.php,v 1.9 2004/01/01 10:31:37 sebastian Exp $ +// $Id: Renderer.php,v 1.10 2004/03/16 08:05:54 sebastian Exp $ // require_once 'Image/Color.php'; @@ -21,40 +21,41 @@ /** * Renderer Base Class. * -* @version $Revision: 1.9 $ +* @version $Revision: 1.10 $ * @since Image_GIS 1.0.0 +* @abstract */ -class Image_GIS_Renderer { +abstract class Image_GIS_Renderer { /** * Set to TRUE to enable debugging. * * @var boolean $debug */ - var $debug; + protected $debug; /** * @var array $min */ - var $min = false; + protected $min = false; /** * @var array $max */ - var $max = false; + protected $max = false; /** * Width of the image. * * @var integer $width */ - var $width; + protected $width; /** * Height of the image. * * @var integer $height */ - var $height; + protected $height; /** * Constructor. @@ -64,7 +65,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer($width, $height, $debug) { + public function Image_GIS_Renderer($width, $height, $debug) { $this->debug = $debug; if ($width < 0 || @@ -91,7 +92,7 @@ * @return object * @access public */ - function &factory($renderer, $width, $height, $debug) { + public static function factory($renderer, $width, $height, $debug) { if (@include_once('Image/GIS/Renderer/' . $renderer . '.php')) { $class = 'Image_GIS_Renderer_' . $renderer; $object = new $class($width, $height, $debug); @@ -111,7 +112,7 @@ * @param mixed $color * @access public */ - function drawClippedLine($x1, $y1, $x2, $y2, $color) { + public function drawClippedLine($x1, $y1, $x2, $y2, $color) { if (($x1 > $this->max['x'] || $x1 < $this->min['x'] || $y1 > $this->max['y'] || @@ -151,7 +152,7 @@ * @access public * @since Image_GIS 1.0.1 */ - function getRange() { + public function getRange() { return array( $this->min['x'], $this->max['x'], @@ -167,7 +168,7 @@ * @param string $direction * @access public */ - function polar2image($polarCoordinate, $direction) { + public function polar2image($polarCoordinate, $direction) { switch ($direction) { case 'x': { return ($polarCoordinate - $this->min[$direction]) * @@ -189,7 +190,7 @@ * @param array $lineSets * @access public */ - function render($lineSets) { + public function render($lineSets) { if ($this->min == false || $this->max == false) { $this->min = array( 'x' => 0, @@ -225,7 +226,7 @@ * @param float $y2 * @access public */ - function setRange($x1, $x2, $y1, $y2) { + public function setRange($x1, $x2, $y1, $y2) { $this->min = array('x' => $x1, 'y' => $y1); $this->max = array('x' => $x2, 'y' => $y2); } @@ -244,7 +245,7 @@ * @access public * @abstract */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { /* abstract */ } + public abstract function drawLine($x1, $y1, $x2, $y2, $r, $g, $b); /** * Saves the rendered image to a given file. @@ -254,7 +255,7 @@ * @access public * @abstract */ - function saveImage($filename) { /* abstract */ } + public abstract function saveImage($filename); /** * Shows the rendered image. @@ -262,6 +263,6 @@ * @access public * @abstract */ - function showImage() { /* abstract */ } + public abstract function showImage(); } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Parser/E00.php?r1=1.9&r2=1.10&ty=u Index: pear/Image_GIS/GIS/Parser/E00.php diff -u pear/Image_GIS/GIS/Parser/E00.php:1.9 pear/Image_GIS/GIS/Parser/E00.php:1.10 --- pear/Image_GIS/GIS/Parser/E00.php:1.9 Mon Jan 5 11:21:39 2004 +++ pear/Image_GIS/GIS/Parser/E00.php Tue Mar 16 03:05:55 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: E00.php,v 1.9 2004/01/05 16:21:39 ostborn Exp $ +// $Id: E00.php,v 1.10 2004/03/16 08:05:55 sebastian Exp $ // require_once 'Image/GIS/LineSet.php'; @@ -22,7 +22,7 @@ /** * E00 Parser. * -* @version $Revision: 1.9 $ +* @version $Revision: 1.10 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Parser_E00 extends Image_GIS_Parser { @@ -33,7 +33,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Parser_E00($cache, $debug) { + public function Image_GIS_Parser_E00($cache, $debug) { $this->Image_GIS_Parser($cache, $debug); } @@ -45,15 +45,15 @@ * @return mixed * @access public */ - function parseFile($dataFile, $color) { + public function parseFile($dataFile, $color) { $lineSet = new Image_GIS_LineSet($color); if ($fp = @fopen($dataFile, 'r')) { $numRecords = 0; - $ln = 0; + $lineNum = 0; while(0 || $line = fgets($fp, 1024)) { - $ln ++; + $lineNum++; if ($numRecords == 0 && preg_match("#^\s+([0-9]+)\s+([-0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)#", $line, $a)) { @@ -97,13 +97,13 @@ $numRecords--; } - else if ($ln > 2) { - if ($this->debug) { - printf( - 'Died at: %s<br />', - $ln - ); - } + else if ($lineNum > 2) { + if ($this->debug) { + printf( + 'Died at: %s<br />', + $lineNum + ); + } break; } http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer/GD.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_GIS/GIS/Renderer/GD.php diff -u pear/Image_GIS/GIS/Renderer/GD.php:1.4 pear/Image_GIS/GIS/Renderer/GD.php:1.5 --- pear/Image_GIS/GIS/Renderer/GD.php:1.4 Thu Jan 1 05:31:39 2004 +++ pear/Image_GIS/GIS/Renderer/GD.php Tue Mar 16 03:05:56 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: GD.php,v 1.4 2004/01/01 10:31:39 sebastian Exp $ +// $Id: GD.php,v 1.5 2004/03/16 08:05:56 sebastian Exp $ // require_once 'Image/GIS/Renderer.php'; @@ -21,23 +21,23 @@ /** * GD Renderer. * -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Renderer_GD extends Image_GIS_Renderer { /** - * GD Image Palette. + * GD Image Ressource. * - * @var array $palette + * @var ressource $image */ - var $palette = array(); + private $image; /** - * GD Image Ressource. + * GD Image Palette. * - * @var ressource $img + * @var array $palette */ - var $img; + private $palette = array(); /** * Constructor. @@ -47,19 +47,19 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer_GD($width, $height, $debug) { + public function __construct($width, $height, $debug) { if (is_file($width)) { - $this->img = imagecreatefrompng($width); - $width = imagesx($this->img); - $height = imagesy($this->img); + $this->image = imagecreatefrompng($width); - $this->Image_GIS_Renderer($width, $height, $debug); + $width = imagesx($this->image); + $height = imagesy($this->image); } else { - $this->Image_GIS_Renderer($width, $height, $debug); + $this->image = imagecreate($this->width, $this->height); - $this->img = imagecreate($this->width, $this->height); - imagecolorallocate($this->img, 255, 255, 255); + imagecolorallocate($this->image, 255, 255, 255); } + + $this->Image_GIS_Renderer($width, $height, $debug); } /** @@ -75,13 +75,13 @@ * @param float $b * @access public */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { + public function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { if (!isset($this->palette[$r][$g][$b])) { - $this->palette[$r][$g][$b] = imagecolorallocate($this->img, $r, $g, $b); + $this->palette[$r][$g][$b] = imagecolorallocate($this->image, $r, $g, $b); } imageline( - $this->img, + $this->image, $x1, $y1, $x2, @@ -97,8 +97,8 @@ * @return boolean * @access public */ - function saveImage($filename) { - return imagepng($this->img, $filename); + public function saveImage($filename) { + return imagepng($this->image, $filename); } /** @@ -106,9 +106,9 @@ * * @access public */ - function showImage() { + public function showImage() { header('Content-Type: image/png'); - imagepng($this->img); + imagepng($this->image); } } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer/SVG.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_GIS/GIS/Renderer/SVG.php diff -u pear/Image_GIS/GIS/Renderer/SVG.php:1.5 pear/Image_GIS/GIS/Renderer/SVG.php:1.6 --- pear/Image_GIS/GIS/Renderer/SVG.php:1.5 Thu Jan 1 05:31:39 2004 +++ pear/Image_GIS/GIS/Renderer/SVG.php Tue Mar 16 03:05:56 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: SVG.php,v 1.5 2004/01/01 10:31:39 sebastian Exp $ +// $Id: SVG.php,v 1.6 2004/03/16 08:05:56 sebastian Exp $ // require_once 'Image/GIS/Renderer.php'; @@ -22,7 +22,7 @@ /** * SVG Renderer. * -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Renderer_SVG extends Image_GIS_Renderer { @@ -31,14 +31,14 @@ * * @var XML_SVG $svg */ - var $svg; + private $svg; /** * SVG Groups. * * @var XML_SVG_Group[] */ - var $svgGroups = array(); + private $svgGroups = array(); /** * Constructor. @@ -48,7 +48,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer_SVG($width, $height, $debug) { + public function __construct($width, $height, $debug) { $this->Image_GIS_Renderer($width, $height, $debug); $this->svg = new XML_SVG_Document( @@ -72,7 +72,7 @@ * @param float $b * @access public */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { + public function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { $group = md5($r . $g . $b); if (!isset($this->svgGroups[$group])) { @@ -110,7 +110,7 @@ * @return boolean * @access public */ - function saveImage($filename) { + public function saveImage($filename) { if ($fp = @fopen($filename, 'w')) { @fputs($fp, $this->svg->bufferObject()); @fclose($fp); @@ -126,7 +126,7 @@ * * @access public */ - function showImage() { + public function showImage() { $this->svg->printElement(); } }
http://cvs.php.net/diff.php/pear/Image_GIS/GIS.php?r1=1.15&r2=1.16&ty=u Index: pear/Image_GIS/GIS.php diff -u pear/Image_GIS/GIS.php:1.15 pear/Image_GIS/GIS.php:1.16 --- pear/Image_GIS/GIS.php:1.15 Fri Mar 5 05:34:06 2004 +++ pear/Image_GIS/GIS.php Tue Mar 16 03:05:53 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: GIS.php,v 1.15 2004/03/05 10:34:06 sebastian Exp $ +// $Id: GIS.php,v 1.16 2004/03/16 08:05:53 sebastian Exp $ // require_once 'Image/Color.php'; @@ -56,7 +56,7 @@ * $map->saveImage('kiel.png'); * ?> * -* @version $Revision: 1.15 $ +* @version $Revision: 1.16 $ * @since Image_GIS 1.0.0 */ class Image_GIS { @@ -65,21 +65,21 @@ * * @var boolean $debug */ - var $debug; + private $debug; /** * Image_GIS_Parser sub-class object. * * @var Image_GIS_Parser $parser */ - var $parser; + private $parser; /** * Image_GIS_Renderer sub-class object. * * @var Image_GIS_Renderer $renderer */ - var $renderer; + private $renderer; /** * Constructor. @@ -87,7 +87,7 @@ * @param array $parameters * @access public */ - function Image_GIS($parameters = array()) { + public function Image_GIS($parameters = array()) { $this->debug = isset($parameters['debug']) ? $parameters['debug'] : false; $this->setParser( @@ -123,7 +123,7 @@ * @return boolean * @access public */ - function addDataFile($dataFile, $color) { + public function addDataFile($dataFile, $color) { return $this->parser->addDataFile($dataFile, $color); } @@ -134,7 +134,7 @@ * @access public * @since Image_GIS 1.0.1 */ - function getRange() { + public function getRange() { return $this->renderer->getRange(); } @@ -143,7 +143,7 @@ * * @access public */ - function render() { + public function render() { $this->renderer->render($this->parser->parse()); } @@ -154,7 +154,7 @@ * @return boolean * @access public */ - function saveImage($filename) { + public function saveImage($filename) { $this->render(); return $this->renderer->saveImage($filename); @@ -168,8 +168,8 @@ * @param boolean $cache * @access public */ - function setParser($parser, $cache) { - $this->parser = &Image_GIS_Parser::factory($parser, $cache, $this->debug); + public function setParser($parser, $cache) { + $this->parser = Image_GIS_Parser::factory($parser, $cache, $this->debug); } /** @@ -181,7 +181,7 @@ * @param float $y2 * @access public */ - function setRange($x1, $x2, $y1, $y2) { + public function setRange($x1, $x2, $y1, $y2) { $this->renderer->setRange($x1, $x2, $y1, $y2); } @@ -192,8 +192,8 @@ * @param string $renderer * @access public */ - function setRenderer($renderer, $width, $height) { - $this->renderer = &Image_GIS_Renderer::factory($renderer, $width, $height, $this->debug); + public function setRenderer($renderer, $width, $height) { + $this->renderer = Image_GIS_Renderer::factory($renderer, $width, $height, $this->debug); } /** @@ -201,9 +201,8 @@ * * @access public */ - function showImage() { + public function showImage() { $this->render(); - $this->renderer->showImage(); } } http://cvs.php.net/diff.php/pear/Image_GIS/package.xml?r1=1.13&r2=1.14&ty=u Index: pear/Image_GIS/package.xml diff -u pear/Image_GIS/package.xml:1.13 pear/Image_GIS/package.xml:1.14 --- pear/Image_GIS/package.xml:1.13 Tue Jan 6 14:59:02 2004 +++ pear/Image_GIS/package.xml Tue Mar 16 03:05:53 2004 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package version="1.0"> - <name>Image_GIS</name> + <name>Image_GIS2</name> <summary>Visualization of GIS data.</summary> <description> Generating maps on demand can be a hard job as most often you don't @@ -28,31 +28,14 @@ </maintainers> <license>PHP License</license> <release> - <version>1.1.0</version> + <version>2.0.0</version> <state>stable</state> - <date>2004-01-06</date> + <date>2004-MM-DD</date> <notes> <![CDATA[ -+ Added caching of parsed data files. - -+ Added getRange() method to the Image_GIS and Image_GIS_Renderer - classes. - -* Changed the Image_GIS constructor to accept an associative - parameter array as its only argument. - - Note: This breaks backwards compatibility. - -* The SVG renderer now uses the XML_SVG package instead of the - XML_Tree package. +* Refactored using PHP 5 syntax. -* Factored the handling of Line Sets out into a separate class. - -* Fixed handling of negative coordinates. - -* Fixed a bug that kept a debugging message from beeing printed. - -* Fixed incompatibilities with PHP 5. +! PHP 5.0.0 (or higher) is now required. ]]> </notes> <filelist> @@ -84,6 +67,35 @@ </release> <changelog> <release> + <version>1.1.0</version> + <state>stable</state> + <date>2004-01-06</date> + <notes> +<![CDATA[ ++ Added caching of parsed data files. + ++ Added getRange() method to the Image_GIS and Image_GIS_Renderer + classes. + +* Changed the Image_GIS constructor to accept an associative + parameter array as its only argument. + + Note: This breaks backwards compatibility. + +* The SVG renderer now uses the XML_SVG package instead of the + XML_Tree package. + +* Factored the handling of Line Sets out into a separate class. + +* Fixed handling of negative coordinates. + +* Fixed a bug that kept a debugging message from beeing printed. + +* Fixed incompatibilities with PHP 5. +]]> + </notes> + </release> + <release> <version>1.0.0</version> <state>stable</state> <date>2002-12-30</date> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/LineSet.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_GIS/GIS/LineSet.php diff -u pear/Image_GIS/GIS/LineSet.php:1.2 pear/Image_GIS/GIS/LineSet.php:1.3 --- pear/Image_GIS/GIS/LineSet.php:1.2 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/LineSet.php Tue Mar 16 03:05:54 2004 @@ -13,30 +13,30 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: LineSet.php,v 1.2 2004/01/01 10:31:37 sebastian Exp $ +// $Id: LineSet.php,v 1.3 2004/03/16 08:05:54 sebastian Exp $ // /** * A Set of Lines. * -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ * @since Image_GIS 1.0.1 */ class Image_GIS_LineSet { /** * @var array $color */ - var $color = 'black'; + public $color = 'black'; /** * @var array $lines */ - var $lines = array(); + public $lines = array(); /** * @var array $min */ - var $min = array( + public $min = array( 'x' => 0, 'y' => 0 ); @@ -44,7 +44,7 @@ /** * @var array $max */ - var $max = array( + public $max = array( 'x' => 0, 'y' => 0 ); @@ -55,7 +55,7 @@ * @param string $color * @access public */ - function Image_GIS_LineSet($color = 'black') { + public function Image_GIS_LineSet($color = 'black') { $this->color = $color; } @@ -68,7 +68,7 @@ * @param float $y2 * @access public */ - function addLine($x1, $y1, $x2, $y2) { + public function addLine($x1, $y1, $x2, $y2) { $this->lines[] = array($x1, $y1, $x2, $y2); $this->min['x'] = min($this->min['x'], $x1, $x2); http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Parser.php?r1=1.10&r2=1.11&ty=u Index: pear/Image_GIS/GIS/Parser.php diff -u pear/Image_GIS/GIS/Parser.php:1.10 pear/Image_GIS/GIS/Parser.php:1.11 --- pear/Image_GIS/GIS/Parser.php:1.10 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/Parser.php Tue Mar 16 03:05:54 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: Parser.php,v 1.10 2004/01/01 10:31:37 sebastian Exp $ +// $Id: Parser.php,v 1.11 2004/03/16 08:05:54 sebastian Exp $ // require_once 'Cache/Lite.php'; @@ -22,37 +22,37 @@ /** * Parser Base Class. * -* @version $Revision: 1.10 $ +* @version $Revision: 1.11 $ * @since Image_GIS 1.0.0 */ -class Image_GIS_Parser { +abstract class Image_GIS_Parser { /** * Cache. * * @var Cache_Lite $cache */ - var $cache = NULL; + protected $cache = NULL; /** * Data Files. * * @var array $dataFiles */ - var $dataFiles = array(); + protected $dataFiles = array(); /** * Set to TRUE to enable debugging. * * @var boolean $debug */ - var $debug; + protected $debug; /** * Line Set. * * @var array $lineSets */ - var $lineSets = array(); + protected $lineSets = array(); /** * Constructor. @@ -61,7 +61,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Parser($cache, $debug) { + public function Image_GIS_Parser($cache, $debug) { if ($cache) { $this->cache = new Cache_Lite; } @@ -78,7 +78,7 @@ * @return object * @access public */ - function &factory($parser, $cache, $debug) { + public static function factory($parser, $cache, $debug) { include_once 'Image/GIS/Parser/' . $parser . '.php'; $class = 'Image_GIS_Parser_' . $parser; @@ -94,7 +94,7 @@ * @param mixed $color * @access public */ - function addDataFile($dataFile, $color) { + public function addDataFile($dataFile, $color) { $this->dataFiles[$dataFile] = $color; } @@ -104,7 +104,7 @@ * @access public * @return array */ - function parse() { + public function parse() { foreach ($this->dataFiles as $dataFile => $color) { $cacheID = md5($dataFile . '_' . $color); $lineSet = false; @@ -137,6 +137,6 @@ * @access public * @abstract */ - function parseFile($dataFile, $color) { /* abstract */ } + public abstract function parseFile($dataFile, $color); } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer.php?r1=1.9&r2=1.10&ty=u Index: pear/Image_GIS/GIS/Renderer.php diff -u pear/Image_GIS/GIS/Renderer.php:1.9 pear/Image_GIS/GIS/Renderer.php:1.10 --- pear/Image_GIS/GIS/Renderer.php:1.9 Thu Jan 1 05:31:37 2004 +++ pear/Image_GIS/GIS/Renderer.php Tue Mar 16 03:05:54 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: Renderer.php,v 1.9 2004/01/01 10:31:37 sebastian Exp $ +// $Id: Renderer.php,v 1.10 2004/03/16 08:05:54 sebastian Exp $ // require_once 'Image/Color.php'; @@ -21,40 +21,41 @@ /** * Renderer Base Class. * -* @version $Revision: 1.9 $ +* @version $Revision: 1.10 $ * @since Image_GIS 1.0.0 +* @abstract */ -class Image_GIS_Renderer { +abstract class Image_GIS_Renderer { /** * Set to TRUE to enable debugging. * * @var boolean $debug */ - var $debug; + protected $debug; /** * @var array $min */ - var $min = false; + protected $min = false; /** * @var array $max */ - var $max = false; + protected $max = false; /** * Width of the image. * * @var integer $width */ - var $width; + protected $width; /** * Height of the image. * * @var integer $height */ - var $height; + protected $height; /** * Constructor. @@ -64,7 +65,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer($width, $height, $debug) { + public function Image_GIS_Renderer($width, $height, $debug) { $this->debug = $debug; if ($width < 0 || @@ -91,7 +92,7 @@ * @return object * @access public */ - function &factory($renderer, $width, $height, $debug) { + public static function factory($renderer, $width, $height, $debug) { if (@include_once('Image/GIS/Renderer/' . $renderer . '.php')) { $class = 'Image_GIS_Renderer_' . $renderer; $object = new $class($width, $height, $debug); @@ -111,7 +112,7 @@ * @param mixed $color * @access public */ - function drawClippedLine($x1, $y1, $x2, $y2, $color) { + public function drawClippedLine($x1, $y1, $x2, $y2, $color) { if (($x1 > $this->max['x'] || $x1 < $this->min['x'] || $y1 > $this->max['y'] || @@ -151,7 +152,7 @@ * @access public * @since Image_GIS 1.0.1 */ - function getRange() { + public function getRange() { return array( $this->min['x'], $this->max['x'], @@ -167,7 +168,7 @@ * @param string $direction * @access public */ - function polar2image($polarCoordinate, $direction) { + public function polar2image($polarCoordinate, $direction) { switch ($direction) { case 'x': { return ($polarCoordinate - $this->min[$direction]) * @@ -189,7 +190,7 @@ * @param array $lineSets * @access public */ - function render($lineSets) { + public function render($lineSets) { if ($this->min == false || $this->max == false) { $this->min = array( 'x' => 0, @@ -225,7 +226,7 @@ * @param float $y2 * @access public */ - function setRange($x1, $x2, $y1, $y2) { + public function setRange($x1, $x2, $y1, $y2) { $this->min = array('x' => $x1, 'y' => $y1); $this->max = array('x' => $x2, 'y' => $y2); } @@ -244,7 +245,7 @@ * @access public * @abstract */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { /* abstract */ } + public abstract function drawLine($x1, $y1, $x2, $y2, $r, $g, $b); /** * Saves the rendered image to a given file. @@ -254,7 +255,7 @@ * @access public * @abstract */ - function saveImage($filename) { /* abstract */ } + public abstract function saveImage($filename); /** * Shows the rendered image. @@ -262,6 +263,6 @@ * @access public * @abstract */ - function showImage() { /* abstract */ } + public abstract function showImage(); } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Parser/E00.php?r1=1.9&r2=1.10&ty=u Index: pear/Image_GIS/GIS/Parser/E00.php diff -u pear/Image_GIS/GIS/Parser/E00.php:1.9 pear/Image_GIS/GIS/Parser/E00.php:1.10 --- pear/Image_GIS/GIS/Parser/E00.php:1.9 Mon Jan 5 11:21:39 2004 +++ pear/Image_GIS/GIS/Parser/E00.php Tue Mar 16 03:05:55 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: E00.php,v 1.9 2004/01/05 16:21:39 ostborn Exp $ +// $Id: E00.php,v 1.10 2004/03/16 08:05:55 sebastian Exp $ // require_once 'Image/GIS/LineSet.php'; @@ -22,7 +22,7 @@ /** * E00 Parser. * -* @version $Revision: 1.9 $ +* @version $Revision: 1.10 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Parser_E00 extends Image_GIS_Parser { @@ -33,7 +33,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Parser_E00($cache, $debug) { + public function Image_GIS_Parser_E00($cache, $debug) { $this->Image_GIS_Parser($cache, $debug); } @@ -45,15 +45,15 @@ * @return mixed * @access public */ - function parseFile($dataFile, $color) { + public function parseFile($dataFile, $color) { $lineSet = new Image_GIS_LineSet($color); if ($fp = @fopen($dataFile, 'r')) { $numRecords = 0; - $ln = 0; + $lineNum = 0; while(0 || $line = fgets($fp, 1024)) { - $ln ++; + $lineNum++; if ($numRecords == 0 && preg_match("#^\s+([0-9]+)\s+([-0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)#", $line, $a)) { @@ -97,13 +97,13 @@ $numRecords--; } - else if ($ln > 2) { - if ($this->debug) { - printf( - 'Died at: %s<br />', - $ln - ); - } + else if ($lineNum > 2) { + if ($this->debug) { + printf( + 'Died at: %s<br />', + $lineNum + ); + } break; } http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer/GD.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_GIS/GIS/Renderer/GD.php diff -u pear/Image_GIS/GIS/Renderer/GD.php:1.4 pear/Image_GIS/GIS/Renderer/GD.php:1.5 --- pear/Image_GIS/GIS/Renderer/GD.php:1.4 Thu Jan 1 05:31:39 2004 +++ pear/Image_GIS/GIS/Renderer/GD.php Tue Mar 16 03:05:56 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: GD.php,v 1.4 2004/01/01 10:31:39 sebastian Exp $ +// $Id: GD.php,v 1.5 2004/03/16 08:05:56 sebastian Exp $ // require_once 'Image/GIS/Renderer.php'; @@ -21,23 +21,23 @@ /** * GD Renderer. * -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Renderer_GD extends Image_GIS_Renderer { /** - * GD Image Palette. + * GD Image Ressource. * - * @var array $palette + * @var ressource $image */ - var $palette = array(); + private $image; /** - * GD Image Ressource. + * GD Image Palette. * - * @var ressource $img + * @var array $palette */ - var $img; + private $palette = array(); /** * Constructor. @@ -47,19 +47,19 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer_GD($width, $height, $debug) { + public function __construct($width, $height, $debug) { if (is_file($width)) { - $this->img = imagecreatefrompng($width); - $width = imagesx($this->img); - $height = imagesy($this->img); + $this->image = imagecreatefrompng($width); - $this->Image_GIS_Renderer($width, $height, $debug); + $width = imagesx($this->image); + $height = imagesy($this->image); } else { - $this->Image_GIS_Renderer($width, $height, $debug); + $this->image = imagecreate($this->width, $this->height); - $this->img = imagecreate($this->width, $this->height); - imagecolorallocate($this->img, 255, 255, 255); + imagecolorallocate($this->image, 255, 255, 255); } + + $this->Image_GIS_Renderer($width, $height, $debug); } /** @@ -75,13 +75,13 @@ * @param float $b * @access public */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { + public function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { if (!isset($this->palette[$r][$g][$b])) { - $this->palette[$r][$g][$b] = imagecolorallocate($this->img, $r, $g, $b); + $this->palette[$r][$g][$b] = imagecolorallocate($this->image, $r, $g, $b); } imageline( - $this->img, + $this->image, $x1, $y1, $x2, @@ -97,8 +97,8 @@ * @return boolean * @access public */ - function saveImage($filename) { - return imagepng($this->img, $filename); + public function saveImage($filename) { + return imagepng($this->image, $filename); } /** @@ -106,9 +106,9 @@ * * @access public */ - function showImage() { + public function showImage() { header('Content-Type: image/png'); - imagepng($this->img); + imagepng($this->image); } } ?> http://cvs.php.net/diff.php/pear/Image_GIS/GIS/Renderer/SVG.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_GIS/GIS/Renderer/SVG.php diff -u pear/Image_GIS/GIS/Renderer/SVG.php:1.5 pear/Image_GIS/GIS/Renderer/SVG.php:1.6 --- pear/Image_GIS/GIS/Renderer/SVG.php:1.5 Thu Jan 1 05:31:39 2004 +++ pear/Image_GIS/GIS/Renderer/SVG.php Tue Mar 16 03:05:56 2004 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: SVG.php,v 1.5 2004/01/01 10:31:39 sebastian Exp $ +// $Id: SVG.php,v 1.6 2004/03/16 08:05:56 sebastian Exp $ // require_once 'Image/GIS/Renderer.php'; @@ -22,7 +22,7 @@ /** * SVG Renderer. * -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ * @since Image_GIS 1.0.0 */ class Image_GIS_Renderer_SVG extends Image_GIS_Renderer { @@ -31,14 +31,14 @@ * * @var XML_SVG $svg */ - var $svg; + private $svg; /** * SVG Groups. * * @var XML_SVG_Group[] */ - var $svgGroups = array(); + private $svgGroups = array(); /** * Constructor. @@ -48,7 +48,7 @@ * @param boolean $debug * @access public */ - function Image_GIS_Renderer_SVG($width, $height, $debug) { + public function __construct($width, $height, $debug) { $this->Image_GIS_Renderer($width, $height, $debug); $this->svg = new XML_SVG_Document( @@ -72,7 +72,7 @@ * @param float $b * @access public */ - function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { + public function drawLine($x1, $y1, $x2, $y2, $r, $g, $b) { $group = md5($r . $g . $b); if (!isset($this->svgGroups[$group])) { @@ -110,7 +110,7 @@ * @return boolean * @access public */ - function saveImage($filename) { + public function saveImage($filename) { if ($fp = @fopen($filename, 'w')) { @fputs($fp, $this->svg->bufferObject()); @fclose($fp); @@ -126,7 +126,7 @@ * * @access public */ - function showImage() { + public function showImage() { $this->svg->printElement(); } }