Add getId() method for ol.render.Feature

This commit is contained in:
Andreas Hocevar
2017-05-11 15:54:20 +02:00
parent 1d7144564c
commit df72d7b20f
5 changed files with 38 additions and 7 deletions
+18 -1
View File
@@ -16,14 +16,21 @@ goog.require('ol.geom.GeometryType');
* to be right-handed for polygons.
* @param {Array.<number>|Array.<Array.<number>>} ends Ends or Endss.
* @param {Object.<string, *>} properties Properties.
* @param {number|string|undefined} id Feature id.
*/
ol.render.Feature = function(type, flatCoordinates, ends, properties) {
ol.render.Feature = function(type, flatCoordinates, ends, properties, id) {
/**
* @private
* @type {ol.Extent|undefined}
*/
this.extent_;
/**
* @private
* @type {number|string|undefined}
*/
this.id_ = id;
/**
* @private
* @type {ol.geom.GeometryType}
@@ -85,6 +92,16 @@ ol.render.Feature.prototype.getExtent = function() {
return this.extent_;
};
/**
* Get the feature identifier. This is a stable identifier for the feature and
* is set when reading data from a remote source.
* @return {number|string|undefined} Id.
* @api
*/
ol.render.Feature.prototype.getId = function() {
return this.id_;
};
/**
* @return {Array.<number>} Flat coordinates.