Class renderer

A tile renderer handles converting JSON vector content loaded from the MapDotNet REST feature service into a canvas rendering on a tile.

class

renderer

Index

Constructor methods

Methods

Constructor methods

constructor(options?: { renderPoint?: (pt: 'mapsjs'.point, context: CanvasRenderingContext2D) => void; renderGeometry?: (shape: 'mapsjs'.geometry, context: CanvasRenderingContext2D) => void; renderBitmap?: (img: HTMLElement, context: CanvasRenderingContext2D, contextSize: number, bleed: number) => void; }): renderer

Parameters

  • options?: { renderPoint?: (pt: 'mapsjs'.point, context: CanvasRenderingContext2D) => void; renderGeometry?: (shape: 'mapsjs'.geometry, context: CanvasRenderingContext2D) => void; renderBitmap?: (img: HTMLElement, context: CanvasRenderingContext2D, contextSize: number, bleed: number) => void; } optional

Returns

renderer

Methods

public setRenderBitmap(func: (img: HTMLElement, context: CanvasRenderingContext2D, contextSize: number, bleed: number) => void)

Sets the render bitmap function which takes a bitmap image and a canvas context and renders the image to the canvas context.

Parameters

  • func: (img: HTMLElement, context: CanvasRenderingContext2D, contextSize: number, bleed: number) => void

    Function with the signature func(img, context, contextSize, bleed) where img is the bitmap image to render, context is the canvas context on which to render the image, contextSize is the size of the canvas context in pixels and bleed is the margin around each tile to bleed.

public setRenderGeometry(func: (shape: 'mapsjs'.geometry, context: CanvasRenderingContext2D) => void)

Sets render geometry function which takes a geometry and canvas context and renders the geometry to the canvas context. The geometries passed in are transformed to pixel units and offset to the context origin.

Parameters

  • func: (shape: 'mapsjs'.geometry, context: CanvasRenderingContext2D) => void

    Function with signature func(shape, context) where shape is the geometry to render and context is the canvas context on which to render.

public setRenderPoint(func: (pt: 'mapsjs'.point, context: CanvasRenderingContext2D) => void)

Sets the render point function which takes a point and canvas context and renders the point to the canvas. The points passed in are transformed to pixel units and offset to context origin.

Parameters

  • func: (pt: 'mapsjs'.point, context: CanvasRenderingContext2D) => void

    Function of the form func(shape, context) where shape is the point object to be rendered and context is the canvas context on which to render.