Class: Permalink

ol.control. Permalink


Set an hyperlink that will return the user to the current map view. Just add a permalinkproperty to layers to be handled by the control (and added in the url). The layer's permalink property is used to name the layer in the url. The control must be added after all layer are inserted in the map to take them into acount.

Parameters:
Name Type Argument Description
options Object <optional>
Properties
Name Type Description
urlReplace bool

replace url or not, default true

fixed integer

number of digit in coords, default 6

anchor bool

use "#" instead of "?" in href

hidden bool

hide the button on the map, default false

onclick function

a function called when control is clicked

Extends

Methods


Get layer given a permalink name (permalink propertie in the layer)

Parameters:
Name Type Description
the string

permalink to search for

an Array.<ol.layer> | undefined

array of layer to search in

Returns:
Type
ol.layer | false

Get the permalink

Returns:
Type
permalink

getUrlParam(key)

Get a parameter url.

Parameters:
Name Type Description
key string

the key parameter

Returns:

the parameter's value or empty string if not set

Type
string

getUrlParams()

Get the parameters added to the url. The object can be changed to add new values.

Returns:

a key value object added to the url as &key=value

Type
Object

hasUrlParam(key)

Has a parameter url.

Parameters:
Name Type Description
key string

the key parameter

Returns:
Type
boolean

setMap(map)

Set the map instance the control associated with.

Parameters:
Name Type Description
map ol.Map

The map instance.


setPosition()

Set map position according to the current link


setUrlParam(key, value)

Set a parameter to the url.

Parameters:
Name Type Description
key string

the key parameter

value string | undefined

the parameter's value, if undefined or empty string remove the parameter


setUrlReplace(replace)

Enable / disable url replacement (replaceSate)

Parameters:
Name Type Description
replace bool