Interface GeoContext

A minimal rendering context for a GeoPath generator. The minimum implemented methods are a subset of the CanvasRenderingContext2D API.

For reference to the CanvasRenderingContext2D see https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D

interface GeoContext {
    arc(x, y, radius, startAngle, endAngle, anticlockwise?): void;
    beginPath(): void;
    closePath(): void;
    lineTo(x, y): void;
    moveTo(x, y): void;
}

Methods

  • Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. The arc is drawn in clockwise direction by default.

    Parameters

    • x: number

      x-coordinate of arc center point.

    • y: number

      y-coordinate of arc center point.

    • radius: number

      Radius of arc.

    • startAngle: number

      The starting angle of the arc, measured clockwise from the positive x axis and expressed in radians.

    • endAngle: number

      The end angle of the arc, measured clockwise from the positive x axis and expressed in radians.

    • Optional anticlockwise: boolean

      Optional boolean flag, if true the arc is drawn counter-clockwise between the two angles.

    Returns void

  • Start a new path by emptying the list of sub-paths.

    Returns void

  • Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.

    Returns void

  • Connects the last point in the sub-path to the x, y coordinates with a straight line (but does not actually draw it).

    Parameters

    • x: number

      The x-coordinate for the end of the line.

    • y: number

      The y-coordinate for the end of the line.

    Returns void

  • Move the starting point of a new sub-path to the (x, y) coordinates.

    Parameters

    • x: number

      The x-coordinate for the new starting point.

    • y: number

      The y-coordinate for the new starting point.

    Returns void