/**
  * Function: updateBoundingBox
  * 
  * Updates the label bounds in the given state.
  */
 function updateLabelBounds($state)
 {
     $cell = $state->cell;
     $style = $state->style;
     if (mxUtils::getValue($style, mxConstants::$STYLE_OVERFLOW) == "fill") {
         $state->labelBounds = new mxRectangle($state->x, $state->y, $state->width, $state->height);
     } else {
         $label = $this->graph->getLabel($cell);
         $vertexBounds = !$this->graph->model->isEdge($cell) ? $state : null;
         $state->labelBounds = mxUtils::getLabelPaintBounds($label, $style, false, $state->absoluteOffset, $vertexBounds, $this->scale);
     }
 }
 /**
  * Function: parseState
  *
  * Parses the bounds, absolute points and label information from the style
  * of the state into its respective fields and returns the label of the
  * cell.
  */
 function parseState($state, $edge)
 {
     $style = $state->style;
     // Parses the bounds
     $state->x = mxUtils::getNumber($style, "x");
     $state->y = mxUtils::getNumber($style, "y");
     $state->width = mxUtils::getNumber($style, "width");
     $state->height = mxUtils::getNumber($style, "height");
     // Parses the absolute points list
     $tmp = mxUtils::getValue($style, "points");
     if (strlen($tmp) > 0) {
         $pts = $this->parsePoints($tmp);
         if (sizeof($pts) > 0) {
             $state->absolutePoints = $pts;
         }
     }
     // Parses the label and label bounds
     $label = mxUtils::getValue($style, "label");
     if ($label != null && strlen($label) > 0) {
         $offset = new mxPoint(mxUtils::getNumber($style, "dx"), mxUtils::getNumber($style, "dy"));
         $vertexBounds = !$edge ? $state : null;
         $state->labelBounds = mxUtils::getLabelPaintBounds($label, $style, mxUtils::getValue($style, "html", false), $offset, $vertexBounds, $this->scale);
     }
     return $label;
 }
 /**
  * Function: drawLabel
  *
  * Draws the specified label using the canvas.
  */
 function drawLabel($isEdge, $attrs)
 {
     $label = mxUtils::getValue($attrs, "label");
     if (isset($label) && strlen($label) > 0) {
         $offset = new mxPoint(mxUtils::getNumber($attrs, "dx"), mxUtils::getNumber($attrs, "dy"));
         $vertexBounds = !$isEdge ? new mxRectangle(mxUtils::getNumber($attrs, "x"), mxUtils::getNumber($attrs, "y"), mxUtils::getNumber($attrs, "width"), mxUtils::getNumber($attrs, "height")) : null;
         $bounds = mxUtils::getLabelPaintBounds($label, $attrs, mxUtils::getValue($attrs, "html", false), $offset, $vertexBounds, $this->scale);
         $this->canvas->drawLabel($label, $bounds->x, $bounds->y, $bounds->width, $bounds->height, $attrs, false);
     }
 }