new Feature
Create a new feature. A feature is the base entity for vectors and has attributes, including normally a geometry attribute.
Example:
var feature = new ol.Feature({'foo': 'bar'});
feature.setGeometry(new ol.geom.Point([100, 500]));
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
values |
Object.<string, *>= |
<optional> |
(Optional) Attributes. |
- Source:
- feature.js, line 21
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
- *
-
getAttributes
-
Gets a copy of the attributes of this feature.
- Source:
- feature.js, line 51
Returns:
Attributes object.
- Type
- Object.<string, *>
-
getFeatureId
-
Returns the feature's commonly used identifier. This identifier is usually the unique id in the source store.
- Source:
- feature.js, line 70
Returns:
The feature's identifier.
- Type
- string | undefined
-
getGeometry
-
Get the geometry associated with this feature.
- Source:
- feature.js, line 79
Returns:
The geometry (or null if none).
- Type
- ol.geom.Geometry
-
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
-
setFeatureId
-
Set the feature's commonly used identifier. This identifier is usually the unique id in the source store.
Parameters:
Name Type Description featureId
string The feature's identifier.
- Source:
- feature.js, line 121
-
setGeometry
-
Set the geometry to be associated with this feature after its creation.
Parameters:
Name Type Description geometry
ol.geom.Geometry The geometry.
- Source:
- feature.js, line 130
-
setSymbolizers
-
Set the symbolizers to be used for this feature.
Parameters:
Name Type Description symbolizers
Array.<ol.style.Symbolizer> Symbolizers for this feature. If set, these take precedence over layer style.
- Source:
- feature.js, line 143
-
setValues
-
Sets a collection of key-value pairs.
Parameters:
Name Type Description values
Object.<string, *> Values.
- Inherited From:
- Source:
- object.js, line 286
-
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