Source for file Box.php
Documentation is available at Box.php
* $Source: /cvsroot/svggrapher/svggrapher/mains/Box.php,v $
* @version CVS: $Id: Box.php,v 1.3 2007/10/18 16:32:03 geelweb Exp $
* @author Guillaume Luchet. <guillaume@geelweb.org>
* @copyright Copyright (c) 2007, Guillaume Luchet.
* @license http://opensource.org/licenses/bsd-license.php BSD License
* This class is the representation of a box. a box is a rectangular zone with
* abscisse, ordinate, width, height, etc.
* @todo add helper method (translate, rotate, etc)
* @version $Id: Box.php,v 1.3 2007/10/18 16:32:03 geelweb Exp $
* @copyright Copyright (c) 2007, Guillaume Luchet
* @author guillaume luchet <guillaume@geelweb.org>
* @license http://opensource.org/licenses/bsd-license.php BSD License
* Upper left corner abscisse of the box
* Upper left corner ordinate of the box
// Box::__construct() {{{
* 'padding' => array('left'=>10, 'top'=>12)
* @param array $params box params
if(isset
($params['width'])) {
$this->width =
$params['width'];
if(isset
($params['height'])) {
$this->height =
$params['height'];
if(isset
($params['x'])) {
if(isset
($params['y'])) {
if(isset
($params['padding']) &&
is_array($params['padding'])) {
$this->padding =
$params['padding'];
* @param string $property
public function __set($property, $value)
$method =
'set' .
$property;
return $this->$method($value);
return $this->$property =
$value;
* @param string $property
public function __get($property)
$method =
'get' .
$property;
* set the padding property
* - numeric: all the elements of the $padding array take the value
* - comma separated string: the elements take the value of each value in
* the order top, right, bottom, left
* - array of keys / values: for each element of the array, the element of the $padding array
* width the key take the value
* print_r($box->padding); // array('top'=>10, 'right'=>10, 'bottom'=>10, 'left'=>10);
* $box->padding = '4, 5, 1, 10';
* print_r($box->padding); // array('top'=>4, 'right'=>5, 'bottom'=>1, 'left'=>10);
* $box->padding = '5, 10'; // the unspecified values take the last value
* print_r($box->padding); // array('top'=>5, 'right'=>10, 'bottom'=>10, 'left'=>10);
* $box->padding = array('bottom'=>12); // the unspecified values not change
* print_r($box->padding); // array('top'=>5, 'right'=>10, 'bottom'=>12, 'left'=>10);
foreach($this->padding as $k=>
$v) {
for($i=
$n ; $i <
4 ; $i++
) {
foreach($padding as $k=>
$v) {
Documentation generated on Tue, 23 Oct 2007 11:31:53 +0200 by phpDocumentor 1.4.0