TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Walls.php

Documentation is available at Walls.php

  1. <?php
  2.  
  3. /**
  4.  * Walls class
  5.  *
  6.  * Description: Chart Walls. Accesses Wall and overall Wall
  7.  * display characteristics
  8.  *
  9.  * @author
  10.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  11.  * @version 1.0
  12.  * @package TeeChartPHP
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class Walls extends TeeBase {
  17.  
  18.     private $back;
  19.     private $bottom;
  20.     private $left;
  21.     private $right;
  22.     private $visible true;
  23.     private $view3D true;
  24.  
  25.     // Interceptors
  26.     function __get$property {
  27.       $method ="get{$property}";
  28.       if method_exists$this$method ) ) {
  29.         return $this->$method();
  30.       }
  31.     }
  32.  
  33.     function __set $property,$value {
  34.       $method ="set{$property}";
  35.       if method_exists$this$method ) ) {
  36.         return $this->$method($value);
  37.       }
  38.     }
  39.  
  40.     /**
  41.      * Defines the Pen and Brush used to fill the left chart side.<br>
  42.      * Available IWall properties are Brush, Color, Dark3D, Gradient, Pen,
  43.      * Size and Transparent.<br>
  44.      * tChart.Aspect.View3D and tChart.Walls.Visible
  45.      * should be true to use tChart.Walls.Back, tChart.Walls.Bottom,
  46.      * tChart.Walls.Left and tChart.Walls.Right.
  47.      *
  48.      * @return LeftWall 
  49.      */
  50.     public function getLeft({
  51.         return $this->left;
  52.     }
  53.  
  54.     public function setLeft($value{
  55.         $this->left $value;
  56.     }
  57.  
  58.     /**
  59.      * Defines the pen and brush used to fill the right chart side.<br>
  60.      * Available IWall properties are Brush, Color, Dark3D, Gradient, Pen,
  61.      * Size and Transparent.<br>
  62.      * tChart.Aspect.View3D and tChart.Walls.Visible
  63.      * should be true to use tChart.Walls.Back, tChart.Walls.Bottom,
  64.      * tChart.Walls.Left and tChart.Walls.Right.
  65.      *
  66.      * @return RightWall 
  67.      */
  68.     public function getRight({
  69.         return $this->right;
  70.     }
  71.  
  72.     public function setRight($value{
  73.         $this->right $value;
  74.     }
  75.  
  76.     /**
  77.      * Defines the pen and brush used to fill the back chart side.<br>
  78.      * Available IWall properties are Brush, Color, Dark3D, Gradient, Pen,
  79.      * Size and Transparent.<br>
  80.      * tChart.Aspect.View3D and tChart.Walls.Visible
  81.      * should be true to use tChart.Walls.Back, tChart.Walls.Bottom,
  82.      * tChart.Walls.Left and tChart.Walls.Right.
  83.      *
  84.      * @return BackWall 
  85.      */
  86.     public function getBack({
  87.         return $this->back;
  88.     }
  89.  
  90.     public function setBack($value{
  91.         $this->back $value;
  92.     }
  93.  
  94.     /**
  95.      * Defines the pen and brush used to fill the bottom chart side.<br>
  96.      * Available IWall properties are Brush, Color, Dark3D, Gradient, Pen,
  97.      * Size and Transparent.<br>
  98.      * tChart.Aspect.View3D and tChart.Walls.Visible
  99.      * should be true to use tChart.Walls.Back, tChart.Walls.Bottom,
  100.      * tChart.Walls.Left and tChart.Walls.Right.
  101.      *
  102.      * @return BottomWall 
  103.      */
  104.     public function getBottom({
  105.         return $this->bottom;
  106.     }
  107.  
  108.     public function setBottom($value{
  109.         $this->bottom $value;
  110.     }
  111.  
  112.     /**
  113.      * Shows / Hides all Chart walls.<br>
  114.      * Visible draws Left and Bottom "walls" to simulate 3D effect.<br>
  115.      * You can control the 3D Wall proportion by using
  116.      * Chart.Aspect.Chart3DPercent.<br>
  117.      * Chart.Aspect.View3D controls (on/off) Walls.Visible. <br>
  118.      * Default value: true
  119.      *
  120.      * @return boolean 
  121.      */
  122.     public function getVisible({
  123.         return $this->visible;
  124.     }
  125.  
  126.     /**
  127.      * Shows / Hides all Chart walls.<br>
  128.      * Default value: true
  129.      *
  130.      * @param value boolean
  131.      */
  132.     public function setVisible($value{
  133.         $this->visible $this->setBooleanProperty($this->visible$value);
  134.     }
  135.  
  136.     /**
  137.      * Shows all Chart walls in 3D.<br>
  138.      * Default value: true
  139.      *
  140.      * @return boolean 
  141.      */
  142.     public function getView3D({
  143.         return $this->view3D;
  144.     }
  145.  
  146.     /**
  147.      * Shows all Chart walls in 3D when true.<br>
  148.      * Default value: true
  149.      *
  150.      * @param value boolean
  151.      */
  152.     public function setView3D($value{
  153.         $this->view3D $this->setBooleanProperty($this->view3D$value);
  154.     }
  155.  
  156.     public function Walls($c{
  157.         parent::__construct($c);
  158.                
  159.         $this->left new LeftWall($c$this);
  160.         $this->right new RightWall($c$this);
  161.         $this->bottom new BottomWall($c$this);
  162.         $this->back new BackWall($c$this);
  163.     }
  164.  
  165.     /**
  166.      * Paints walls at rectangle r.
  167.      *
  168.      * @param IGraphics3D
  169.      * @param Rectangle
  170.      */
  171.     public function paint($g$r{
  172.        
  173.         $old_name TChart::$controlName;
  174.         
  175.         if ($this->back->getVisible()) {
  176.             $this->back->paint($g$r);
  177.         }
  178.         
  179.         TChart::$controlName $old_name;
  180.         
  181.         if ($this->chart->getAspect()->getView3D(&& $this->visible{
  182.             if ($this->left->getVisible()) {
  183.                 $this->left->paint($g$r);
  184.             }
  185.             
  186.             TChart::$controlName $old_name;
  187.             
  188.             if ($this->bottom->getVisible()) {
  189.                 $this->bottom->paint($g$r);
  190.             }
  191.             
  192.             TChart::$controlName $old_name;
  193.             
  194.             if ($this->right->getVisible()) {
  195.                 $this->right->paint($g$r);
  196.             }
  197.         }
  198.     }
  199.  
  200.     /**
  201.      * Calculates the Wall thickness of the specified Axis.
  202.      *
  203.      * @param Axis
  204.      * @return int 
  205.      */
  206.     public function calcWallSize($a{
  207.         if ($this->chart->getAspect()->getView3D(&& $this->getVisible()) {
  208.             if ($a === $this->chart->getAxes()->getLeft()) {
  209.                 return $this->left->getSize();
  210.             else
  211.             if ($a === $this->chart->getAxes()->getBottom()) {
  212.                 return $this->bottom->getSize();
  213.             }
  214.         }
  215.         return 0;
  216.     }
  217.  
  218.     public function setSize($value{
  219.         $this->getLeft()->setSize($value);
  220.         $this->getRight()->setSize($value);
  221.         $this->getBottom()->setSize($value);
  222.         $this->getBack()->setSize($value);
  223.     }
  224.  
  225.     public function setChart($value{
  226.         parent::setChart($value);
  227.  
  228.         $this->getLeft()->setChart($value);
  229.         $this->getRight()->setChart($value);
  230.         $this->getBottom()->setChart($value);
  231.         $this->getBack()->setChart($value);
  232.     }
  233. }
  234.  
  235. /**
  236.  *
  237.  * <p>Title: LeftWall class</p>
  238.  *
  239.  * <p>Description: Wall Panel at left of Chart</p>
  240.  *
  241.  * <p>Copyright (c) 2005-2010 by Steema Software SL. All Rights Reserved.</p>
  242.  *
  243.  * <p>Company: Steema Software SL</p>
  244.  *
  245.  */
  246.  
  247. class LeftWall extends Wall {
  248.  
  249.     function LeftWall($c$w{
  250.         parent::Wall($c);
  251.         $this->getBrush()->setDefaultColor(new Color(255,255,128));
  252.     }
  253.  
  254.     /**
  255.      * Use this method to paint a left wall at rectangle r.
  256.      *
  257.      * @param IGraphics3D
  258.      * @param rect Rectangle
  259.      */
  260.     public function paint($g$rect{
  261.         
  262.         TChart::$controlName .= 'LeftWall_';            
  263.         
  264.         $this->prepareGraphics($g);
  265.         $tmpB $rect->getBottom(+
  266.                    $this->chart->getWalls()->calcWallSize($this->chart->getAxes()->getBottom());
  267.         $w $this->chart->getAspect()->getWidth3D();
  268.  
  269.         if ($this->iSize > 0{
  270.             $g->cube($rect->$this->iSize$rect->y$rect->x$tmpB0$w,
  271.                    $this->getShouldDark());
  272.         else {
  273.             $g->rectangleZ($rect->x$rect->y$tmpB0$w);
  274.         }
  275.     }
  276.  
  277.     /**
  278.      * The color used to fill the LeftWall background.<br>
  279.      * Default value: LIGHT_YELLOW
  280.      *
  281.      *
  282.      * @return Color 
  283.      */
  284.     public function getColor({
  285.         return parent::getColor();
  286.     }
  287.  
  288.     /**
  289.      * Specifies the color used to fill the LeftWall background.<br>
  290.      * Default value: LIGHT_YELLOW
  291.      *
  292.      *
  293.      * @param value Color
  294.      */
  295.     public function setColor($value{
  296.         parent::setColor($value);
  297.     }
  298. }
  299.  
  300.  
  301. /**
  302.  *
  303.  * <p>Title: RightWall class</p>
  304.  *
  305.  * <p>Description: Wall Panel at right of Chart.</p>
  306.  *
  307.  * <p>Copyright (c) 2005-2010 by Steema Software SL. All Rights
  308.  * Reserved.</p>
  309.  *
  310.  * <p>Company: Steema Software SL</p>
  311.  *
  312.  */
  313. class RightWall extends Wall {
  314.  
  315.     function RightWall($c$w{
  316.         parent::Wall($c);
  317.         $this->visible = false;
  318.         $this->getBrush()->setDefaultColor(new Color(255,255,128));
  319.     }
  320.  
  321.     /**
  322.      * Use this method to paint a right wall at rectangle r.
  323.      *
  324.      * @param IGraphics3D
  325.      * @param rect Rectangle
  326.      */
  327.     public function paint($g$rect{
  328.         TChart::$controlName .= 'RightWall_';            
  329.         
  330.         $this->prepareGraphics($g);
  331.  
  332.         $b $rect->getBottom($this->chart->getWalls()->calcWallSize($this->chart->getAxes()->getBottom());
  333.         $w $this->chart->getAspect()->getWidth3D();
  334.  
  335.         if ($this->iSize > 0{
  336.             $g->cube($rect->getRight()$rect->y$rect->getRight($this->iSize$b0,
  337.                    $w $this->getBack()->getSize()$this->getShouldDark());
  338.         else {
  339.             $g->rectangleZ($rect->getRight()$rect->y$b0$w 1);
  340.         }
  341.     }
  342.  
  343.     /**
  344.      * Shows/Hides Right Wall.<br>
  345.      * Default value: false
  346.      *
  347.      * @return boolean 
  348.      */
  349.     public function getVisible({
  350.         return parent::getVisible();
  351.     }
  352.  
  353.     /**
  354.      * Shows/Hides Right Wall.<br>
  355.      * Default value: false
  356.      *
  357.      * @param value boolean
  358.      */
  359.     public function setVisible($value{
  360.         parent::setVisible($value);
  361.     }
  362. }
  363.  
  364.  
  365. /**
  366.  *
  367.  *
  368.  * <p>Title: BackWall class</p>
  369.  *
  370.  * <p>Description: Wall Panel at rear of Chart</p>
  371.  *
  372.  * <p>Copyright (c) 2005-2010 by Steema Software SL. All Rights
  373.  * Reserved.</p>
  374.  *
  375.  * <p>Company: Steema Software SL</p>
  376.  *
  377.  */
  378. class BackWall extends Wall {
  379.  
  380.     function BackWall($c$w{
  381.         parent::Wall($c);
  382.         $this->getBrush()->setDefaultColor(new Color(255,255,128));
  383.         $this->bTransparent = true;
  384.     }
  385.  
  386.     /**
  387.      * Use this method to paint a back wall at rectangle r.
  388.      *
  389.      * @param IGraphics3D
  390.      * @param rect Rectangle
  391.      */
  392.     public function paint($g$rect{
  393.         TChart::$controlName .= 'BackWall_';            
  394.         
  395.         $this->prepareGraphics($g);
  396.  
  397.         if ($this->chart->getAspect()->getView3D()) {
  398.             $w $this->chart->getAspect()->getWidth3D();
  399.             if ($this->iSize > 0{
  400.                 $r $rect;
  401.                 $s $this->chart->getWalls()->calcWallSize($this->chart->getAxes()->getLeft());
  402.                 $r->-= $s;
  403.                 $r->width += $s;
  404.                 $r->height += $this->chart->getWalls()->calcWallSize($this->chart->getAxes()->getBottom());
  405.                 $g->cube($r->getLeft()$r->getTop()$r->getRight(),$r->getBottom()$w$w $this->iSize$this->getShouldDark());
  406.             else {
  407.                 $g->rectangleWithZ($rect$w);
  408.             }
  409.         else {
  410.             $g->rectangle($rect);
  411.         }
  412.     }
  413.  
  414.     protected function shouldSerializeTransparent({
  415.         return !$this->getTransparent();
  416.     }
  417. }
  418.  
  419.  
  420. /**
  421.  *
  422.  * <p>Title: BottomWall class</p>
  423.  *
  424.  * <p>Description: Wall Panel at bottom of Chart.</p>
  425.  *
  426.  * <p>Copyright (c) 2005-2010 by Steema Software SL. All Rights
  427.  * Reserved.</p>
  428.  *
  429.  * <p>Company: Steema Software SL</p>
  430.  *
  431.  */
  432. class BottomWall extends Wall {
  433.  
  434.     function BottomWall($c$w{
  435.         parent::Wall($c);
  436.         $this->setColor(new Color(255,255,255));
  437.     }
  438.  
  439.     /**
  440.      * Use this method to paint a bottom wall at rectangle r.
  441.      *
  442.      * @param IGraphics3D
  443.      * @param rect Rectangle
  444.      */
  445.     public function paint($g$rect{
  446.         
  447.         TChart::$controlName .= 'BottomWall_';
  448.         
  449.         $this->prepareGraphics($g);        
  450.  
  451.         $w $this->chart->getAspect()->getWidth3D();
  452.         if ($this->iSize > 0{
  453.             $r $rect->copy();
  454.             $r->$r->getBottom();
  455.             $r->height $this->iSize;                
  456.             $g->cuber($r0$w$this->getShouldDark());
  457.         else {
  458.             $g->rectangleY($rect->x$rect->getBottom()$rect->getRight()0$w);
  459.         }
  460.     }
  461. }
  462. ?>

Documentation generated on Wed, 16 Jun 2010 12:09:17 +0200 by phpDocumentor 1.4.1