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

LayerBaseVector

Extends:

LayerBase → LayerBaseVector

The Vector layer base

Constructor Summary

Public Constructor
public

constructor(url: string, options: object)

The base vector layer

Member Summary

Public Members
public get

get if the layer is autoloaded

public get

features: Array<ol.Feature>

array of ol features

public get

mapCrs: string | *

get the map CRS if it is defined by the map move object

public get

get the map move object

public get

map move params

public get

olLayer: ol.layer | Vector | ol.layer.Base | undefined: *

public get

get on demand delay in miliseconds

public get

source: ol.source.Vector

get the layer vector source

public set

style(style: ol.Style | styleFunc): *

set the style

public get

style: ol.Style | styleFunc

get the style definition

public get

Get the layer visibility

public set

Set the layer visibility

Method Summary

Public Methods
public

addFeatures(featureCollection: object)

dummy to be overridden

public

clear()

clear features in the layer

public

mapMoveBefore(zoom: number, evtType: string): boolean

Before call to map move callback, can prevent call by returning false

public

callback function on map move

public

mapMoveMakeGetParams(extent: object, zoomLevel: number)

callback to generate the parameters passed in the get request

Inherited Summary

From class LayerBase
public get

get the legend content

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 get

Get the layer name

public set

name(newName: string): *

set 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 get

Get the layer visibility

public set

visible(visibility: boolean): *

Set the layer visibility

public get

get the z index

public set

zIndex(newZ: number): *

set the z index

protected set

legendContent(newVal: string): *

set the legend content directly

protected set

params(newParams: object): *

set the map get params

public
public

id: *

public
protected
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

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

Public Constructors

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

The base vector layer

Override:

LayerBase#constructor

Params:

NameTypeAttributeDescription
url string

pass an empty string to prevent default load and add from a json source

options object

config

options.id string
  • optional

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

additional content to add to the legend

options.autoLoad boolean
  • optional
  • default: false

if the layer should auto load if not visible

options.style object
  • optional
  • default: undefined

the layer style, use openlayers default style if not defined

options.onDemand boolean
  • optional
  • default: false

if the layer should be loaded by extent on map move

options.onDemandDelay number
  • optional
  • default: 300

delay before the map move callback should be called

options.mapMoveMakeGetParams mapMoveMakeGetParams
  • optional
  • default: function(lyr,

extent, zoomLevel){}] function to create additional map move params

options.mapMoveObj MapMoveCls
  • optional
  • default: mapMove

alternate map move object for use with multi map pages

Public Members

public get autoLoad: boolean source

get if the layer is autoloaded

public get features: Array<ol.Feature> source

array of ol features

public get mapCrs: string | * source

get the map CRS if it is defined by the map move object

public get mapMove: MapMoveCls | * source

get the map move object

public get mapMoveParams: object source

map move params

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

Override:

LayerBase#olLayer

Return:

ol.layer | Vector | ol.layer.Base | undefined

the ol layer

public get onDemandDelay: number | * source

get on demand delay in miliseconds

public get source: ol.source.Vector source

get the layer vector source

Override:

LayerBase#source

public set style(style: ol.Style | styleFunc): * source

set the style

public get style: ol.Style | styleFunc source

get the style definition

public get visible: boolean source

Get the layer visibility

Override:

LayerBase#visible

public set visible: boolean source

Set the layer visibility

Override:

LayerBase#visible

Public Methods

public addFeatures(featureCollection: object) source

dummy to be overridden

Params:

NameTypeAttributeDescription
featureCollection object

geojson or esrijson object

public clear() source

clear features in the layer

public mapMoveBefore(zoom: number, evtType: string): boolean source

Before call to map move callback, can prevent call by returning false

Params:

NameTypeAttributeDescription
zoom number

zoom level

evtType string
  • optional
  • default: undefined

undefined for initial load, otherwise one of 'change:center', 'change:resolution'

Return:

boolean

if the call should proceed

public mapMoveCallback(d: object) source

callback function on map move

Params:

NameTypeAttributeDescription
d object

the json response

public mapMoveMakeGetParams(extent: object, zoomLevel: number) source

callback to generate the parameters passed in the get request

Params:

NameTypeAttributeDescription
extent object

extent object

extent.minX number

minX

extent.minY number

minY

extent.maxX number

maxX

extent.maxY number

maxY

zoomLevel number

zoom level