Home Reference Source Repository
import LayerBase from 'webmapsjs/src/layers/LayerBase.js'
public class | source

LayerBase

The base layer class

Constructor Summary

Public Constructor
public

constructor(url: string, options: object)

The base layer for all others

Member Summary

Public Members
public
public

id: *

public get

get the legend content

public
public get

Check if the layer is loaded

public get

get the maximum resolution

public get

get max zoom

public get

get the minimum resolution

public get

get min zoom

public set

name(newName: string): *

set the layer name

public get

Get the layer name

public get

olLayer: ol.layer.Base | undefined: *

public get

Get the layer opacity

public set

opacity(opacity: number): *

Set the layer opacity

public get

get the map get params

public get

source: *

get the layer source

public get

get the url

public set

visible(visibility: boolean): *

Set the layer visibility

public get

Get the layer visibility

public get

get the z index

public set

zIndex(newZ: number): *

set the z index

Protected Members
protected
protected set

legendContent(newVal: string): *

set the legend content directly

protected set

params(newParams: object): *

set the map get params

Method Summary

Public Methods
public

addLegendContent(additionalContent: string)

add additional content to the legend

public
public

Get the legend html, be sure to only add to the DOM once

public

trick to refresh the layer

Protected Methods
protected

base load function, sets _loaded = true if it is not already

Public Constructors

public constructor(url: string, options: object) source

The base layer for all others

Params:

NameTypeAttributeDescription
url string

url for source

options object

config

options.id string
  • optional
  • default: makeGuid()

layer id

options.name string
  • optional
  • default: Unnamed

Layer] - layer name

options.opacity number
  • optional
  • default: 1

opacity

options.visible boolean
  • optional
  • default: true

default visible

options.minZoom number
  • optional
  • default: undefined

min zoom level, 0 - 28

options.maxZoom number
  • optional
  • default: undefined

max zoom level, 0 - 28

options.params object
  • optional
  • default: {}

the get parameters to include to retrieve the layer

options.zIndex number
  • optional
  • default: 0

the z index for the layer

options.loadCallback function
  • optional

function to call on load, context this is the layer object

options.legendCollapse boolean
  • optional
  • default: false

if the legend item should be initially collapsed

options.legendCheckbox boolean
  • optional
  • default: true

if the legend item should have a checkbox for visibility

options.legendContent boolean
  • optional
  • default: undefined

additional content to add to the legend

Public Members

public animate: boolean source

public id: * source

public get legendContent: string source

get the legend content

public loadCallback: * source

public get loaded: boolean source

Check if the layer is loaded

public get maxResolution: number | * source

get the maximum resolution

public get maxZoom: number | * source

get max zoom

public get minResolution: number | * source

get the minimum resolution

public get minZoom: number | * source

get min zoom

public set name(newName: string): * source

set the layer name

public get name: string source

Get the layer name

public get olLayer: ol.layer.Base | undefined: * source

Return:

ol.layer.Base | undefined

the ol layer

public get opacity: number source

Get the layer opacity

public set opacity(opacity: number): * source

Set the layer opacity

public get params: object source

get the map get params

public get source: * source

get the layer source

public get url: string source

get the url

public set visible(visibility: boolean): * source

Set the layer visibility

public get visible: boolean source

Get the layer visibility

public get zIndex: number source

get the z index

public set zIndex(newZ: number): * source

set the z index

Protected Members

protected _olLayer: * source

protected set legendContent(newVal: string): * source

set the legend content directly

protected set params(newParams: object): * source

set the map get params

Public Methods

public addLegendContent(additionalContent: string) source

add additional content to the legend

Params:

NameTypeAttributeDescription
additionalContent string
  • optional
  • default:

additonal content to add

public applyCollapse(): * source

Return:

*

public getLegendDiv(): string source

Get the legend html, be sure to only add to the DOM once

Return:

string

html for layer wrapped in a div

public refresh() source

trick to refresh the layer

Protected Methods

protected _load(): boolean source

base load function, sets _loaded = true if it is not already

Return:

boolean

if already loaded