ol.layer. ol.layer.Layer

new Layer

Parameters:
Name Type Description
options ol.layer.LayerOptions

Layer options.

Source:
  • layer.js, line 44

Extends

Methods

bindTo

Binds a View to a Model.

Parameters:
Name Type Argument Description
key string

Key.

target ol.Object

Target.

targetKey string <optional>
(Optional)

Target key.

noNotify boolean <optional>
(Optional)

No notify.

Inherited From:
Source:
  • object.js, line 147

get

Gets a value.

Parameters:
Name Type Description
key string

Key.

Inherited From:
Source:
  • object.js, line 170
Returns:

Value.

Type
*

getBrightness

Source:
  • layer.js, line 92
Returns:

Brightness.

Type
number

getContrast

Source:
  • layer.js, line 104
Returns:

Contrast.

Type
number

getHue

Source:
  • layer.js, line 116
Returns:

Hue.

Type
number

getOpacity

Source:
  • layer.js, line 151
Returns:

Opacity.

Type
number

getSaturation

Source:
  • layer.js, line 163
Returns:

Saturation.

Type
number

getSource

Source:
  • layer.js, line 175
Returns:

Source.

Type
ol.source.Source

getVisible

Source:
  • layer.js, line 183
Returns:

Visible.

Type
boolean

notify

Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.

Parameters:
Name Type Description
key string

Key.

Inherited From:
Source:
  • object.js, line 208

on

Listen for a certain type of event.

Parameters:
Name Type Argument Description
type string | Array.<string>

The event type or array of event types.

listener Function

The listener function.

scope Object <optional>
(Optional)

Object is whose scope to call the listener.

Inherited From:
Source:
  • object.js, line 240
Returns:

Unique key for the listener.

Type
goog.events.Key

once

Listen once for a certain type of event.

Parameters:
Name Type Argument Description
type string | Array.<string>

The event type or array of event types.

listener Function

The listener function.

scope Object <optional>
(Optional)

Object is whose scope to call the listener.

Inherited From:
Source:
  • object.js, line 253
Returns:

Unique key for the listener.

Type
goog.events.Key

set

Sets a value.

Parameters:
Name Type Description
key string

Key.

value *

Value.

Inherited From:
Source:
  • object.js, line 263

setBrightness

Adjust the layer brightness. A value of -1 will render the layer completely black. A value of 0 will leave the brightness unchanged. A value of 1 will render the layer completely white. Other values are linear multipliers on the effect (values are clamped between -1 and 1).

The filter effects draft [1] says the brightness function is supposed to render 0 black, 1 unchanged, and all other values as a linear multiplier.

The current WebKit implementation clamps values between -1 (black) and 1 (white) [2]. There is a bug open to change the filter effect spec [3].

TODO: revisit this if the spec is still unmodified before we release

[1] https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html [2] https://github.com/WebKit/webkit/commit/8f4765e569 [3] https://www.w3.org/Bugs/Public/show_bug.cgi?id=15647

Parameters:
Name Type Description
brightness number

Brightness.

Source:
  • layer.js, line 228

setContrast

Adjust the layer contrast. A value of 0 will render the layer completely grey. A value of 1 will leave the contrast unchanged. Other values are linear multipliers on the effect (and values over 1 are permitted).

Parameters:
Name Type Description
contrast number

Contrast.

Source:
  • layer.js, line 244

setHue

Apply a hue-rotation to the layer. A value of 0 will leave the hue unchanged. Other values are radians around the color circle.

Parameters:
Name Type Description
hue number

Hue.

Source:
  • layer.js, line 258

setOpacity

Parameters:
Name Type Description
opacity number

Opacity.

Source:
  • layer.js, line 270

setSaturation

Adjust layer saturation. A value of 0 will render the layer completely unsaturated. A value of 1 will leave the saturation unchanged. Other values are linear multipliers of the effect (and values over 1 are permitted).

Parameters:
Name Type Description
saturation number

Saturation.

Source:
  • layer.js, line 287

setValues

Sets a collection of key-value pairs.

Parameters:
Name Type Description
values Object.<string, *>

Values.

Inherited From:
Source:
  • object.js, line 286

setVisible

Parameters:
Name Type Description
visible boolean

Visible.

Source:
  • layer.js, line 299

un

Unlisten for a certain type of event.

Parameters:
Name Type Argument Description
type string | Array.<string>

The event type or array of event types.

listener Function

The listener function.

scope Object <optional>
(Optional)

Object is whose scope to call the listener.

Inherited From:
Source:
  • object.js, line 326

unbind

Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.

Parameters:
Name Type Description
key string

Key.

Inherited From:
Source:
  • object.js, line 305

unbindAll

Removes all bindings.

Inherited From:
Source:
  • object.js, line 344

unByKey

Removes an event listener which was added with listen() by the key returned by on().

Parameters:
Name Type Argument Description
key number <nullable>

Key.

Inherited From:
Source:
  • object.js, line 336