Class: CanvasRenderer

renderer.CanvasRenderer

Base Class to render layer on HTMLCanvasElement

(abstract, protected) new renderer.CanvasRenderer(layer) [source]

Parameter Type Description
layer Layer the layer to render
Extends:

Methods

  • isCanvasRender() [source]

  • Whether it's a renderer based on Canvas
    Returns:
    Boolean:
  • render(isCheckRes) [source]

  • Render the layer
    Parameter Type Description
    isCheckRes Boolean whether to check and load external resources in the layer

  • remove() [source]

  • Remove the renderer, will be called when layer is removed

  • getMap() [source]

  • Get map
    Returns:
    Map:
  • getCanvasImage() [source]

  • Get renderer's Canvas image object
    Returns:
    HTMLCanvasElement:
  • isLoaded() [source]

  • Check if the renderer is loaded
    Returns:
    Boolean:
  • show() [source]

  • Show the layer

  • hide() [source]

  • Hide the layer

  • hitDetect(point) [source]

  • Detect if there is anything painted on the given point
    Parameter Type Description
    point Point a 2d point on current zoom
    Returns:
    Boolean:
  • loadResources(resourceUrls, onComplete, context) [source]

  • loadResource from resourceUrls
    Parameter Type Description
    resourceUrls Array.<String> Array of urls to load
    onComplete function callback after loading complete
    context Object callback's context
    Returns:
    Array.<Promise>:
  • prepareRender() [source]

  • Prepare rendering,

  • createCanvas() [source]

  • Create renderer's Canvas

  • resizeCanvas(canvasSize) [source]

  • Resize the canvas
    Parameter Type Description
    canvasSize Size the size resizing to

  • clearCanvas() [source]

  • Clear the canvas to blank

  • prepareCanvas() [source]

  • Prepare the canvas for rendering.
    1. Clear the canvas to blank.
    2. Clip the canvas by mask if there is any and return the mask's extent
    Returns:
    PointExtent: mask's extent of current zoom's 2d point.
  • get2DExtent() [source]

  • Get renderer's extent of 2d points in current zoom
    Returns:
    PointExtent: 2d extent
  • requestMapToRender() [source]

  • Request map to render, to redraw all layer's canvas on map's canvas.
    This should be called once any canvas layer is updated

  • fireLoadedEvent() [source]

  • Ask the layer to fire the layerload event

  • completeRender() [source]

  • requestMapToRender and fireLoadedEvent

  • getPaintContext() [source]

  • Get painter context for painters
    Returns:
    Array.<Object>: the Canvas2dContext and the resources
  • getEvents() [source]

  • Get renderer's events registered on the map
    Returns:
    Object: events
  • isUpdateWhenZooming() [source]

  • Should update the layer when zooming?
    If enabled, renderer's drawOnZooming will be called when map is zooming.
    Can be disabled to improve performance if not necessary.
    Returns:
    Boolean:
  • onZooming(param) [source]

  • onZooming
    Parameter Type Description
    param Object event parameters

  • onZoomStart(param) [source]

  • onZoomStart
    Parameter Type Description
    param Object event parameters

  • onZoomEnd(param) [source]

  • onZoomEnd
    Parameter Type Description
    param Object event parameters

  • onMoveStart(param) [source]

  • onMoveStart
    Parameter Type Description
    param Object event parameters

  • onMoving(param) [source]

  • onMoving
    Parameter Type Description
    param Object event parameters

  • onMoveEnd(param) [source]

  • onMoveEnd
    Parameter Type Description
    param Object event parameters

  • onResize(param) [source]

  • onResize
    Parameter Type Description
    param Object event parameters

  • (inherited) callInitHooks() [source]

  • Visit and call all the init hooks defined on Class and its parents.
    Inherited From:
    Returns:
    Class: this
  • (inherited) setOptions(options) [source]

  • Merges options with the default options of the object.
    Parameter Type Description
    options Object options to set
    Inherited From:
    Returns:
    Class: this
  • (inherited) config(conf) [source]

  • 1. Return object's options if no parameter is provided.
    2. update an option and enable/disable the handler if a handler with the same name existed.
    // Get marker's options;
    var options = marker.config();
    // Set map's option "draggable" to false and disable map's draggable handler.
    map.config('draggable', false);
    // You can update more than one options like this:
    map.config({
        'scrollWheelZoom' : false,
        'doubleClickZoom' : false
    });
    Parameter Type Description
    conf Object config to update
    Inherited From:
    Returns:
    Class: this