Exemplo n.º 1
0
 public function drawXYAxisScale()
 {
     dashedrectangle($this->im, $this->shiftXleft + $this->shiftXCaption - 1, $this->shiftY - 1, $this->sizeX + $this->shiftXleft + $this->shiftXCaption, $this->sizeY + $this->shiftY + 1, $this->getColor($this->graphtheme['gridcolor'], 0));
     if ($this->yaxisleft) {
         imageline($this->im, $this->shiftXleft + $this->shiftXCaption - 1, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaption - 1, $this->sizeY + $this->shiftY + 4, $this->getColor($this->graphtheme['gridbordercolor'], 0));
         imagefilledpolygon($this->im, array($this->shiftXleft + $this->shiftXCaption - 4, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaption + 2, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaption - 1, $this->shiftY - 10), 3, $this->getColor('White'));
         imagepolygon($this->im, array($this->shiftXleft + $this->shiftXCaption - 4, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaption + 2, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaption - 1, $this->shiftY - 10), 3, $this->getColor($this->graphtheme['gridbordercolor'], 0));
     }
     if ($this->yaxisright) {
         $color = $this->getColor($this->graphtheme['gridbordercolor'], 0);
         imageline($this->im, $this->sizeX + $this->shiftXleft + $this->shiftXCaption, $this->shiftY - 5, $this->sizeX + $this->shiftXleft + $this->shiftXCaption, $this->sizeY + $this->shiftY + 4, $color);
         imagefilledpolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaption - 3, $this->shiftY - 5, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 3, $this->shiftY - 5, $this->sizeX + $this->shiftXleft + $this->shiftXCaption, $this->shiftY - 10), 3, $this->getColor('White'));
         imagepolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaption - 3, $this->shiftY - 5, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 3, $this->shiftY - 5, $this->sizeX + $this->shiftXleft + $this->shiftXCaption, $this->shiftY - 10), 3, $color);
     }
     imageline($this->im, $this->shiftXleft + $this->shiftXCaption - 4, $this->sizeY + $this->shiftY + 1, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 5, $this->sizeY + $this->shiftY + 1, $this->getColor($this->graphtheme['gridbordercolor'], 0));
     imagefilledpolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaption + 5, $this->sizeY + $this->shiftY - 2, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 5, $this->sizeY + $this->shiftY + 4, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 10, $this->sizeY + $this->shiftY + 1), 3, $this->getColor('White'));
     imagepolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaption + 5, $this->sizeY + $this->shiftY - 2, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 5, $this->sizeY + $this->shiftY + 4, $this->sizeX + $this->shiftXleft + $this->shiftXCaption + 10, $this->sizeY + $this->shiftY + 1), 3, $this->getColor($this->graphtheme['gridbordercolor'], 0));
 }
Exemplo n.º 2
0
function drawMapLinkLabels(&$im, &$map, &$map_info)
{
    global $colors;
    $links = $map['links'];
    $selements = $map['selements'];
    foreach ($links as $lnum => $link) {
        if (empty($link)) {
            continue;
        }
        if (empty($link['label'])) {
            continue;
        }
        $selement = $selements[$link['selementid1']];
        list($x1, $y1) = get_icon_center_by_selement($selement, $map_info[$link['selementid1']]);
        $selement = $selements[$link['selementid2']];
        list($x2, $y2) = get_icon_center_by_selement($selement, $map_info[$link['selementid2']]);
        $drawtype = $link['drawtype'];
        $color = convertColor($im, $link['color']);
        $linktriggers = $link['linktriggers'];
        order_result($linktriggers, 'triggerid');
        if (!empty($linktriggers)) {
            $max_severity = 0;
            $options = array();
            $options['nopermissions'] = 1;
            $options['extendoutput'] = 1;
            $options['triggerids'] = array();
            $triggers = array();
            foreach ($linktriggers as $lt_num => $link_trigger) {
                if ($link_trigger['triggerid'] == 0) {
                    continue;
                }
                $id = $link_trigger['linktriggerid'];
                $triggers[$id] = zbx_array_merge($link_trigger, get_trigger_by_triggerid($link_trigger['triggerid']));
                if ($triggers[$id]['status'] == TRIGGER_STATUS_ENABLED && $triggers[$id]['value'] == TRIGGER_VALUE_TRUE) {
                    if ($triggers[$id]['priority'] >= $max_severity) {
                        $drawtype = $triggers[$id]['drawtype'];
                        $color = convertColor($im, $triggers[$id]['color']);
                        $max_severity = $triggers[$id]['priority'];
                    }
                }
            }
        }
        $label = $link['label'];
        $label = str_replace("\r", '', $label);
        $strings = explode("\n", $label);
        $box_width = 0;
        $box_height = 0;
        foreach ($strings as $snum => $str) {
            $strings[$snum] = resolveMapLabelMacros($str);
        }
        foreach ($strings as $snum => $str) {
            $dims = imageTextSize(8, 0, $str);
            $box_width = $box_width > $dims['width'] ? $box_width : $dims['width'];
            $box_height += $dims['height'] + 2;
        }
        $boxX_left = round(($x1 + $x2) / 2 - $box_width / 2 - 6);
        $boxX_right = round(($x1 + $x2) / 2 + $box_width / 2 + 6);
        $boxY_top = round(($y1 + $y2) / 2 - $box_height / 2 - 4);
        $boxY_bottom = round(($y1 + $y2) / 2 + $box_height / 2 + 2);
        switch ($drawtype) {
            case MAP_LINK_DRAWTYPE_DASHED_LINE:
            case MAP_LINK_DRAWTYPE_DOT:
                dashedrectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color);
                break;
            case MAP_LINK_DRAWTYPE_BOLD_LINE:
                imagerectangle($im, $boxX_left - 1, $boxY_top - 1, $boxX_right + 1, $boxY_bottom + 1, $color);
            case MAP_LINK_DRAWTYPE_LINE:
            default:
                imagerectangle($im, $boxX_left, $boxY_top, $boxX_right, $boxY_bottom, $color);
        }
        imagefilledrectangle($im, $boxX_left + 1, $boxY_top + 1, $boxX_right - 1, $boxY_bottom - 1, $colors['White']);
        $increasey = 4;
        foreach ($strings as $snum => $str) {
            $dims = imageTextSize(8, 0, $str);
            $labelx = ($x1 + $x2) / 2 - $dims['width'] / 2;
            $labely = $boxY_top + $increasey;
            imagetext($im, 8, 0, $labelx, $labely + $dims['height'], $colors['Black'], $str);
            $increasey += $dims['height'] + 2;
        }
    }
}
Exemplo n.º 3
0
 public function drawSmallRectangle()
 {
     dashedrectangle($this->im, $this->shiftXleft + $this->shiftXCaption - 1, $this->shiftY - 1, $this->sizeX + $this->shiftXleft + $this->shiftXCaption - 1, $this->sizeY + $this->shiftY + 1, $this->GetColor('Black No Alpha'));
 }
Exemplo n.º 4
0
 public function drawSmallRectangle()
 {
     imagefilledrectangle($this->im, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->shiftY - 1 + $this->shiftYCaptionTop, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->sizeY + $this->shiftY + 1 + $this->shiftYCaptionTop, $this->getColor($this->graphtheme['graphcolor'], 0));
     dashedrectangle($this->im, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->shiftY - 1 + $this->shiftYCaptionTop, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->sizeY + $this->shiftY + 1 + $this->shiftYCaptionTop, $this->getColor($this->graphtheme['gridcolor'], 0));
     imageline($this->im, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->sizeY + $this->shiftY + 4, $this->getColor($this->graphtheme['gridbordercolor'], 0));
     imagefilledpolygon($this->im, array($this->shiftXleft + $this->shiftXCaptionLeft - 4, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaptionLeft + 2, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->shiftY - 10), 3, $this->getColor('White'));
     imagepolygon($this->im, array($this->shiftXleft + $this->shiftXCaptionLeft - 4, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaptionLeft + 2, $this->shiftY - 5, $this->shiftXleft + $this->shiftXCaptionLeft - 1, $this->shiftY - 10), 3, $this->getColor($this->graphtheme['gridbordercolor'], 0));
     imageline($this->im, $this->shiftXleft + $this->shiftXCaptionLeft - 4, $this->sizeY + $this->shiftY + 1, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 5, $this->sizeY + $this->shiftY + 1, $this->getColor($this->graphtheme['gridbordercolor'], 0));
     imagefilledpolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 5, $this->sizeY + $this->shiftY - 2, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 5, $this->sizeY + $this->shiftY + 4, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 10, $this->sizeY + $this->shiftY + 1), 3, $this->getColor('White'));
     imagepolygon($this->im, array($this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 5, $this->sizeY + $this->shiftY - 2, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 5, $this->sizeY + $this->shiftY + 4, $this->sizeX + $this->shiftXleft + $this->shiftXCaptionLeft + 10, $this->sizeY + $this->shiftY + 1), 3, $this->getColor($this->graphtheme['gridbordercolor'], 0));
 }