MarkupRenderer

class Communicator.Markup.MarkupRenderer()

This class provides an interface for MarkupItems to draw on the canvas.


Methods

drawCircle

Communicator.Markup.MarkupRenderer.drawCircle(circle)

Renders a circle to the markup layer.

Arguments
  • circle (Communicator.Markup.Shape.Circle()) – the circle to draw.

Return type

Element

Returns

SVG element for the circle. This element is temporary and will not be preserved when the markup is redrawn.

drawCircles

Communicator.Markup.MarkupRenderer.drawCircles(circles)

Renders a collection of circles sharing the same properties to the markup layer.

Arguments
  • circles (Communicator.Markup.Shape.CircleCollection()) – the collection of circle to render.

Return type

[Element]

Returns

an array containing SVG elements for each circle. These elements are temporary and will not be preserved when the markup is redrawn.

drawLine

Communicator.Markup.MarkupRenderer.drawLine(line)

Renders a line to the markup layer.

Arguments
  • line (Communicator.Markup.Shape.Line()) – the line to render.

Return type

Element

Returns

SVG element for the line. This element is temporary and will not be preserved when the markup is redrawn.

drawLines

Communicator.Markup.MarkupRenderer.drawLines(lines)

Renders a collection of lines sharing the same properties to the markup layer.

Arguments
  • lines (Communicator.Markup.Shape.LineCollection()) – the collection of lines to render.

Return type

[Element]

Returns

an array containing SVG elements for each line. These elements are temporary and will not be preserved when the markup is redrawn.

drawPolygon

Communicator.Markup.MarkupRenderer.drawPolygon(polygon)

Renders a polygon to the markup layer.

Arguments
  • polygon (Communicator.Markup.Shape.Polygon()) – the polygon to render.

Return type

Element

Returns

SVG element for the polygon. This element is temporary and will not be preserved when the markup is redrawn.

drawPolygons

Communicator.Markup.MarkupRenderer.drawPolygons(polygons)

Renders a collection of polygons sharing the same properties to the markup layer.

Arguments
  • polygons (Communicator.Markup.Shape.PolygonCollection()) – the collection of polygons to render.

Return type

[Element]

Returns

an array containing SVG elements for each polygon. These elements are temporary and will not be preserved when the markup is redrawn.

drawPolyline

Communicator.Markup.MarkupRenderer.drawPolyline(polyline)

Renders a polyline to the markup layer.

Arguments
  • polyline (Communicator.Markup.Shape.Polyline()) –

Return type

Element

Returns

SVG element for the line. This element is temporary and will not be preserved when the markup is redrawn.

drawPolylines

Communicator.Markup.MarkupRenderer.drawPolylines(polylines)

Renders a collection of polylines sharing the same properties to the markup layer.

Arguments
  • polylines (Communicator.Markup.Shape.PolylineCollection()) –

Return type

[Element]

Returns

an array containing SVG elements for each line. These elements are temporary and will not be preserved when the markup is redrawn.

drawRectangle

Communicator.Markup.MarkupRenderer.drawRectangle(rectangle)

Renders a rectangle to the markup layer.

Arguments
  • rectangle (Communicator.Markup.Shape.Rectangle()) – the rectangle to render.

Return type

Element

Returns

SVG element for the rectangle. This element is temporary and will not be preserved when the markup is redrawn.

drawRectangles

Communicator.Markup.MarkupRenderer.drawRectangles(rectangles)

Renders a collection of rectangles sharing the same properties to the markup layer.

Arguments
  • rectangles (Communicator.Markup.Shape.RectangleCollection()) – the collection of rectangles to render.

Return type

[Element]

Returns

an array containing SVG elements for each rectangle. These elements are temporary and will not be preserved when the markup is redrawn.

drawText

Communicator.Markup.MarkupRenderer.drawText(text)

Renders text to the markup layer.

Arguments
  • text (Communicator.Markup.Shape.Text()) – the text to render.

Return type

Element

Returns

SVG element for the text. This element is temporary and will not be preserved when the markup is redrawn.

drawTextBox

Communicator.Markup.MarkupRenderer.drawTextBox(textBox)

Renders a text box to the markup layer.

Arguments
  • textBox (Communicator.Markup.Shape.TextBox()) – the text box to render.

Return type

[Element]

Returns

SVG element pair for the text. The first item in this array corresponds to the rectangle. The second item corresponds to the text. These elements are temporary and will not be preserved when the markup is redrawn.

drawTextBoxes

Communicator.Markup.MarkupRenderer.drawTextBoxes(textBoxes)

Renders a collection of text boxes sharing the same properties to the markup layer.

Arguments
  • textBoxes (Communicator.Markup.Shape.TextBoxCollection()) – the collection of text boxes to render.

Return type

[[Element]]

Returns

an array containing SVG element pairs for each text box. These elements are temporary and will not be preserved when the markup is redrawn.

drawTexts

Communicator.Markup.MarkupRenderer.drawTexts(texts)

Renders a collection of text sharing the same properties to the markup layer.

Arguments
  • texts (Communicator.Markup.Shape.TextCollection()) – the collection of texts to render.

Return type

[Element]

Returns

an array containing SVG elements for each text. These elements are temporary and will not be preserved when the markup is redrawn.

measureText

Communicator.Markup.MarkupRenderer.measureText(str, markup)

Computes the width and height of a string using the given text attributes.

Arguments
  • str (string()) – the text string to measure.

  • markup (Communicator.Markup.Shape.TextMarkupBase()) –

Return type

Communicator.Point2

Returns

a point object containing the width and height in pixels of the string.

measureTextBox

Communicator.Markup.MarkupRenderer.measureTextBox(textBox)

Computes the width and height of a text box.

Arguments
  • textBox (Communicator.Markup.Shape.TextBox()) – the text box to measure.

Return type

Communicator.Point2

Returns

a point object containing the width and height in pixels of the text box.