Add method for retrieving ol.Overlay by id
This commit is contained in:
+2
-29
@@ -19,7 +19,6 @@ goog.require('ol.extent');
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.OverlayProperty = {
|
||||
ID: 'id',
|
||||
ELEMENT: 'element',
|
||||
MAP: 'map',
|
||||
OFFSET: 'offset',
|
||||
@@ -78,7 +77,7 @@ ol.Overlay = function(options) {
|
||||
* @private
|
||||
* @type {number|string|undefined}
|
||||
*/
|
||||
this.id_ = undefined;
|
||||
this.id_ = options.id;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -195,8 +194,7 @@ ol.Overlay.prototype.getElement = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Get the feature identifier. This is an identifier for the overlay and
|
||||
* is set explicitly by calling {@link ol.Overlay#setId}.
|
||||
* Get the feature identifier which is set on constructor.
|
||||
* @return {number|string|undefined} Id.
|
||||
* @api
|
||||
*/
|
||||
@@ -229,15 +227,6 @@ ol.Overlay.prototype.getOffset = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Workaround to overcome circular dependency.
|
||||
* @return {ol.OverlayProperty}
|
||||
*/
|
||||
ol.Overlay.prototype.getOverlayIdProperty = function() {
|
||||
return ol.OverlayProperty.ID;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the current position of this overlay.
|
||||
* @return {ol.Coordinate|undefined} The spatial point that the overlay is
|
||||
@@ -348,22 +337,6 @@ ol.Overlay.prototype.setElement = function(element) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the feature id. The feature id can be used with the
|
||||
* {@link ol.Map#getOverlayById} method.
|
||||
* @param {number|string} id The feature id.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.Overlay.prototype.setId = function(id) {
|
||||
goog.asserts.assert(id !== undefined, 'overlay id should be defined');
|
||||
if (id != this.id_) {
|
||||
this.id_ = id;
|
||||
this.set(ol.OverlayProperty.ID, id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the map to be associated with this overlay.
|
||||
* @param {ol.Map|undefined} map The map that the overlay is part of.
|
||||
|
||||
Reference in New Issue
Block a user