genTextMarkerRectangle_ method

RectElement genTextMarkerRectangle_ (String id, String stroke, int deltay)

Adds a text marker rectangle to the left of the text with id, with the fill color defined by stroke. The rectangle is added to legendArea, deltay defines the rectangles y coordinate offset from legendArea's origin.

Implementation

RectElement genTextMarkerRectangle_(String id, String stroke, int deltay) {
  RectElement r = new RectElement();

  int rectHeight = int.parse(attrMap[LEGEND_ID][LegA.COLORED_RECT_HEIGHT]);
  int rectWidth = colored_rect_width;

  int rectX =
      rectbordersize; // rel.to legendArea, rectY, rectWidth, rectHeight;

  int f = int.parse(attrMap[LEGEND_ID][LegA.FONT_SIZE]);
  int rectY = deltay + f ~/ 2;

  r.attributes[SVG.X] = "$rectX";
  r.attributes[SVG.Y] = "${rectY}";
  r.attributes[SVG.WIDTH] = "$rectWidth";
  r.attributes[SVG.HEIGHT] = "$rectHeight";
  r.attributes[SVG.FILL] = stroke;
  return r;
}