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

  • render() [source]

  • Render the layer. Call checkResources

  • (abstract) checkResources() [source]

  • Check if has any external resources to load If yes, load the resources before calling draw method
    Returns:
    Array.<Array>: an array of resource arrays [ [url1, width, height], [url2, width, height], [url3, width, height] .. ]
  • (abstract) draw() [source]

  • a required abstract method to implement draw the layer when map is not interacting

  • (abstract) drawOnInteracting(eventParam) [source]

  • an optional abstract method to implement draw the layer when map is interacting (moving/zooming/dragrotating)
    Parameter Type Description
    eventParam Object event parameters

  • needToRedraw() [source]

  • Ask whether the layer renderer needs to redraw
    Returns:
    Boolean:
  • onSkipDrawOnInteracting() [source]

  • A callback for overriding when drawOnInteracting is skipped due to low fps

  • mustRenderOnInteracting() [source]

  • Whether must call render instead of drawOnInteracting when map is interacting

  • setToRedraw() [source]

  • Set to redraw, ask map to call draw/drawOnInteracting to redraw the layer

  • setCanvasUpdated() [source]

  • Mark layer's canvas updated

  • (protected) isCanvasUpdated() [source]

  • Only called by map's renderer to check whether the layer's canvas is updated
    Returns:
    Boolean:
  • 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:
  • clear() [source]

  • Clear canvas

  • isBlank() [source]

  • A method to help improve performance. If you are sure that layer's canvas is blank, returns true to save unnecessary layer works of maps.
    Returns:
    Boolean:
  • show() [source]

  • Show the layer

  • hide() [source]

  • Hide the layer

  • setZIndex() [source]

  • Set z-index of layer

  • hitDetect(point) [source]

  • Detect if there is anything painted on the given point
    Parameter Type Description
    point Point containerPoint
    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>:
  • 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.
  • getViewExtent() [source]

  • Get renderer's current view extent in 2d point
    Returns:
    Object: view.extent, view.maskExtent, view.zoom, view.middleWest
  • completeRender() [source]

  • call when rendering completes, this will fire necessary events and call setCanvasUpdated

  • getEvents() [source]

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

  • /** onZoomStart
    Parameter Type Description
    param Object event parameters

  • onZoomEnd(param) [source]

  • onZoomEnd
    Parameter Type Description
    param Object event parameters

  • onZooming(param) [source]

  • onZooming
    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

  • onDragRotateStart(param) [source]

  • onDragRotateStart
    Parameter Type Description
    param Object event parameters

  • onDragRotating(param) [source]

  • onDragRotating
    Parameter Type Description
    param Object event parameters

  • onDragRotateEnd(param) [source]

  • onDragRotateEnd
    Parameter Type Description
    param Object event parameters

  • onSpatialReferenceChange(param) [source]

  • onSpatialReferenceChange
    Parameter Type Description
    param Object event parameters

  • getDrawTime() [source]

  • Get ellapsed time of previous drawing
    Returns:
    Number:
  • (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
  • (inherited) onConfig() [source]

  • Default callback when config is called
    Inherited From: