Store the feature's commonly used id
To not clobber the feature's attributes, this is a separate member property.
This commit is contained in:
@@ -14,6 +14,12 @@ ol.Feature = function(opt_values) {
|
||||
|
||||
goog.base(this, opt_values);
|
||||
|
||||
/**
|
||||
* @type {string|undefined}
|
||||
* @private
|
||||
*/
|
||||
this.featureId_;
|
||||
|
||||
/**
|
||||
* @type {string|undefined}
|
||||
* @private
|
||||
@@ -46,6 +52,17 @@ ol.Feature.prototype.getAttributes = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the feature's commonly used identifier. This identifier is usually
|
||||
* the unique id in the source store.
|
||||
*
|
||||
* @return {string|undefined} The feature's identifier.
|
||||
*/
|
||||
ol.Feature.prototype.getFeatureId = function() {
|
||||
return this.featureId_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.geom.Geometry} The geometry (or null if none).
|
||||
*/
|
||||
@@ -85,6 +102,17 @@ ol.Feature.prototype.set = function(key, value) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the feature's commonly used identifier. This identifier is usually the
|
||||
* unique id in the source store.
|
||||
*
|
||||
* @param {string} featureId The feature's identifier.
|
||||
*/
|
||||
ol.Feature.prototype.setFeatureId = function(featureId) {
|
||||
this.featureId_ = featureId;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.geom.Geometry} geometry The geometry.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user