Change getUid return type from number to string

This commit is contained in:
Frederic Junod
2018-10-17 08:58:50 +02:00
parent a85099a36b
commit 041836c645
33 changed files with 78 additions and 92 deletions

View File

@@ -297,7 +297,7 @@ class VectorSource extends Source {
* @protected
*/
addFeatureInternal(feature) {
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
if (!this.addToIndex_(featureKey, feature)) {
return;
@@ -383,7 +383,7 @@ class VectorSource extends Source {
for (let i = 0, length = features.length; i < length; i++) {
const feature = features[i];
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
if (this.addToIndex_(featureKey, feature)) {
newFeatures.push(feature);
}
@@ -391,7 +391,7 @@ class VectorSource extends Source {
for (let i = 0, length = newFeatures.length; i < length; i++) {
const feature = newFeatures[i];
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
this.setupChangeEvents_(featureKey, feature);
const geometry = feature.getGeometry();
@@ -799,7 +799,7 @@ class VectorSource extends Source {
*/
handleFeatureChange_(event) {
const feature = /** @type {import("../Feature.js").default} */ (event.target);
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
const geometry = feature.getGeometry();
if (!geometry) {
if (!(featureKey in this.nullGeometryFeatures_)) {
@@ -855,8 +855,7 @@ class VectorSource extends Source {
if (id !== undefined) {
return id in this.idIndex_;
} else {
const featureKey = getUid(feature).toString();
return featureKey in this.undefIdIndex_;
return getUid(feature) in this.undefIdIndex_;
}
}
@@ -924,7 +923,7 @@ class VectorSource extends Source {
* @api
*/
removeFeature(feature) {
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
if (featureKey in this.nullGeometryFeatures_) {
delete this.nullGeometryFeatures_[featureKey];
} else {
@@ -943,7 +942,7 @@ class VectorSource extends Source {
* @protected
*/
removeFeatureInternal(feature) {
const featureKey = getUid(feature).toString();
const featureKey = getUid(feature);
this.featureChangeKeys_[featureKey].forEach(unlistenByKey);
delete this.featureChangeKeys_[featureKey];
const id = feature.getId();