Exemplo n.º 1
0
 /**
  * Draw a pie slice
  *
  * Parameter array:
  * 'x': int X center point
  * 'y': int Y center point
  * 'rx': int X radius
  * 'ry': int Y radius
  * 'v1': int The starting angle (in degrees)
  * 'v2': int The end angle (in degrees)
  * 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
  * 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function pieslice($params)
 {
     if (isset($this->_imageMap)) {
         $this->_imageMap->pieslice($params);
     }
     parent::pieslice($params);
 }
Exemplo n.º 2
0
 /**
  * Draw a pie slice
  *
  * Parameter array:
  * 'x': int X center point
  * 'y': int Y center point
  * 'rx': int X radius
  * 'ry': int Y radius
  * 'v1': int The starting angle (in degrees)
  * 'v2': int The end angle (in degrees)
  * 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
  * 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function pieslice($params)
 {
     $x = $this->_getX($params['x']);
     $y = $this->_getY($params['y']);
     $rx = $this->_getX($params['rx']);
     $ry = $this->_getY($params['ry']);
     $v1 = $this->_getX($params['v1']);
     $v2 = $this->_getY($params['v2']);
     $srx = isset($params['srx']) ? $this->_getX($params['srx']) : false;
     $sry = isset($params['sry']) ? $this->_getX($params['sry']) : false;
     $fillColor = isset($params['fill']) ? $params['line'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $dv = max($v2, $v1) - min($v2, $v1);
     if ($dv >= 360) {
         $this->ellipse($params);
     } else {
         $style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor);
         if ($style != '') {
             $x1 = $x + $rx * cos(deg2rad(min($v1, $v2) % 360));
             $y1 = $y + $ry * sin(deg2rad(min($v1, $v2) % 360));
             $x2 = $x + $rx * cos(deg2rad(max($v1, $v2) % 360));
             $y2 = $y + $ry * sin(deg2rad(max($v1, $v2) % 360));
             $this->_addElement('<path d="' . 'M' . round($x) . ',' . round($y) . ' ' . 'L' . round($x1) . ',' . round($y1) . ' ' . 'A' . round($rx) . ',' . round($ry) . ($dv > 180 ? ' 0 1,1 ' : ' 0 0,1 ') . round($x2) . ',' . round($y2) . ' ' . 'Z" ' . 'style="' . $style . '"' . '/>', $params);
         }
         parent::pieslice($params);
     }
 }
Exemplo n.º 3
0
 /**
  * Draw a pie slice
  *
  * Parameter array:
  * 'x': int X center point
  * 'y': int Y center point
  * 'rx': int X radius
  * 'ry': int Y radius
  * 'v1': int The starting angle (in degrees)
  * 'v2': int The end angle (in degrees)
  * 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
  * 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function pieslice($params)
 {
     $x = $this->_getX($params['x']);
     $y = $this->_getY($params['y']);
     $rx = $this->_getX($params['rx']);
     $ry = $this->_getY($params['ry']);
     $v1 = $this->_getX($params['v1']);
     $v2 = $this->_getY($params['v2']);
     $srx = $this->_getX($params['srx']);
     $sry = $this->_getY($params['sry']);
     $fillColor = isset($params['fill']) ? $params['line'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     // TODO Implement PDFLIB::pieSlice()
     parent::pieslice($params);
 }
Exemplo n.º 4
0
 /**
  * Draw a pie slice
  *
  * Parameter array:
  * 'x': int X center point
  * 'y': int Y center point
  * 'rx': int X radius
  * 'ry': int Y radius
  * 'v1': int The starting angle (in degrees)
  * 'v2': int The end angle (in degrees)
  * 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
  * 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function pieslice($params)
 {
     if (isset($params['url'])) {
         $x = $this->_getX($params['x']);
         $y = $this->_getY($params['y']);
         $rx = $params['rx'];
         $ry = $params['ry'];
         $v1a = $params['v1'];
         $v2a = $params['v2'];
         $v1 = min($v1a, $v2a);
         $v2 = max($v1a, $v2a);
         $srx = isset($params['srx']) ? $params['srx'] : 0;
         $sry = isset($params['sry']) ? $params['sry'] : 0;
         $points = round($x + $srx * cos(deg2rad($v1 % 360))) . ',' . round($y + $sry * sin(deg2rad($v1 % 360))) . ',';
         for ($v = $v1; $v < $v2; $v += 30) {
             $points .= round($x + $rx * cos(deg2rad($v % 360))) . ',' . round($y + $ry * sin(deg2rad($v % 360))) . ',';
         }
         $points .= round($x + $rx * cos(deg2rad($v2 % 360))) . ',' . round($y + $ry * sin(deg2rad($v2 % 360)));
         if ($srx != 0 || $sry != 0) {
             $points .= ',';
             for ($v = $v2; $v > $v1; $v -= 30) {
                 $points .= round($x + $srx * cos(deg2rad($v % 360))) . ',' . round($y + $sry * sin(deg2rad($v % 360))) . ',';
             }
         }
         $this->_addMapTag('polygon', $points, $params);
     }
     parent::pieslice($params);
 }