Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CustomLayer

The CustomLayer can be used to integrate custom renderers to the map display.

Hierarchy

Index

Constructors

constructor

  • new CustomLayer(options?: CustomLayerOptions): CustomLayer

Properties

Readonly id

id: string

The identifier of the Layer.

max

max: number

maximum zoom level at which data from the Layer will be displayed.

min

min: number

minimum zoom level at which data from the Layer is displayed.

name

name: string = ""

The name of the Layer

renderOptions

renderOptions: { mode?: "2d" | "3d" | string; zIndex?: number; zLayer?: number }

Options to configure the renderer.

Type declaration

  • Optional mode?: "2d" | "3d" | string

    The used rendering mode. Use '2d' for traditional flat map layers that are located on the ground-plane, otherwise '3d'.

    defaultvalue:

    '2d'

  • Optional zIndex?: number

    Indicates the drawing order within the layer. Styles with larger zIndex value are rendered above those with smaller values. The zIndex is defined relative to the "zLayer" property. If "zLayer" is defined all zIndex values are relative to the "zLayer" value.

  • Optional zLayer?: number

    Indicates drawing order across multiple layers. Styles using zLayer with a high value are rendered on top of zLayers with a low value. If no zLayer is defined the zLayer depends on the display layer order. The first (lowest) layer has a zLayer value of 1.

    example

    {...zLayer: 2, zIndex: 5} will be rendered on top of {...zLayer: 1, zIndex: 10}

Methods

isVisible

  • isVisible(): boolean
  • Checks whether the xyz-maps tile layer is currently visible.

    example
    if (layer.isVisible()) {
      console.log("Layer is visible");
    } else {
      console.log("Layer is not visible");
    }
    

    Returns boolean

    • Returns true if the layer is visible, otherwise false.

onLayerAdd

  • onLayerAdd(ev: CustomEvent): void
  • Event Listener that will be called when the layer is added to the display.

    Parameters

    • ev: CustomEvent

      Event of type "layerAdd"

    Returns void

onLayerRemove

  • onLayerRemove(ev: CustomEvent): void
  • Event Listener that will be called when the layer is removed from the display.

    Parameters

    • ev: CustomEvent

      Event of type "layerRemove"

    Returns void

render

  • render(context: WebGLRenderingContext | CanvasRenderingContext2D, matrix: Float64Array): void
  • The render function will be called each frame. It enables seamless drawing into the rendering context of the map. The context states are correctly set already to allow "simple" drawing at the respective zIndex/zLayer. The camera matrix projects from the world coordinate system (WebMercator projected, topLeft [0,0] -> bottomRight [1,1]) to the clipspace.

    Parameters

    • context: WebGLRenderingContext | CanvasRenderingContext2D

      the rendering context of the map.

    • matrix: Float64Array

      the camera matrix of the map.

    Returns void

setVisible

  • setVisible(isVisible?: boolean): void
  • Sets the visibility of the Layer.

    This function controls whether the tile layer is currently displayed or hidden.

    example
    // Create a new tile layer
    let tileLayer = new XYZMapsTileLayer();
    
    // Hide the tile layer
    tileLayer.visible(false);
    
    // Show the tile layer
    tileLayer.visible(true);
    

    Parameters

    • Optional isVisible: boolean

    Returns void

    • The current visibility state of the tile layer.

Generated using TypeDoc