靜態unGet the feature's default geometry. A feature may have any number of named geometries. The "default" geometry (the one that is rendered by default) is set when calling ol.Feature#setGeometry.
The default geometry for the feature.
Get the feature identifier. This is a stable identifier for the feature and is either set when reading data from a remote source or set explicitly by calling ol.Feature#setId.
Id.
Get the feature's style. This return for this method depends on what was provided to the ol.Feature#setStyle method.
The feature style.
Get the feature's style function.
Return a function representing the current style of this feature.
Set the default geometry for the feature. This will update the property with the name returned by ol.Feature#getGeometryName.
Set the style for the feature. This can be a single style object, an array
of styles, or a function that takes a resolution and returns an array of
styles. If it is null the feature has no style (a null style).
Style for this feature.
Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
The feature id.
Set the property name to be used when getting the feature's default geometry. When calling ol.Feature#getGeometry, the value of the property with this name will be returned.
The property name of the default geometry.
Listen for a certain type of event.
The event type or array of event types.
The listener function.
可選opt_this: ObjectThe object to use as this in listener.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
Listen once for a certain type of event.
The event type or array of event types.
The listener function.
可選opt_this: ObjectThe object to use as this in listener.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
函數Removes an event listener using the key returned by on() or once().
Note that using the ol.Observable.unByKey static function is to
be preferred.
A vector object for geographic features with a geometry and other attribute properties, similar to the features in vector file formats like GeoJSON.
Features can be styled individually with setStyle; otherwise they use the
style of their vector layer.
Note that attribute properties are set as ol.Object properties on the feature object, so they are observable, and have get/set accessors.
Typically, a feature has a single geometry property. You can set the
geometry using the setGeometry method and get it with getGeometry.
It is possible to store more than one geometry on a feature using attribute
properties. By default, the geometry used for rendering is identified by
the property name geometry. If you want to use another geometry property
for rendering, use the setGeometryName method to change the attribute
property associated with the geometry for the feature. For example:
var feature = new ol.Feature({
geometry: new ol.geom.Polygon(polyCoords),
labelPoint: new ol.geom.Point(labelCoords),
name: 'My Polygon'
});
// get the polygon geometry
var poly = feature.getGeometry();
// Render the feature as a point using the coordinates from labelPoint
feature.setGeometryName('labelPoint');
// get the point geometry
var point = feature.getGeometry();
Classdesc
A vector object for geographic features with a geometry and other attribute properties, similar to the features in vector file formats like GeoJSON.
Features can be styled individually with
setStyle; otherwise they use the style of their vector layer.Note that attribute properties are set as ol.Object properties on the feature object, so they are observable, and have get/set accessors.
Typically, a feature has a single geometry property. You can set the geometry using the
setGeometrymethod and get it withgetGeometry. It is possible to store more than one geometry on a feature using attribute properties. By default, the geometry used for rendering is identified by the property namegeometry. If you want to use another geometry property for rendering, use thesetGeometryNamemethod to change the attribute property associated with the geometry for the feature. For example:參數: opt_geometryOrProperties
You may pass a Geometry object directly, or an object literal containing properties. If you pass an object literal, you may include a Geometry associated with a
geometrykey.Api
stable