Merge pull request #4483 from fredj/rm_goog.object.containsKey
Remove use of goog.object.containsKey
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.geom.flat.geodesic');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.TransformFunction');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.proj');
|
||||
@@ -49,7 +48,7 @@ ol.geom.flat.geodesic.line_ =
|
||||
a = stack.pop();
|
||||
// Add the a coordinate if it has not been added yet
|
||||
key = fracA.toString();
|
||||
if (!goog.object.containsKey(fractions, key)) {
|
||||
if (!(key in fractions)) {
|
||||
flatCoordinates.push(a[0], a[1]);
|
||||
fractions[key] = true;
|
||||
}
|
||||
@@ -68,7 +67,7 @@ ol.geom.flat.geodesic.line_ =
|
||||
// segment.
|
||||
flatCoordinates.push(b[0], b[1]);
|
||||
key = fracB.toString();
|
||||
goog.asserts.assert(!goog.object.containsKey(fractions, key),
|
||||
goog.asserts.assert(!(key in fractions),
|
||||
'fractions object should contain key : ' + key);
|
||||
fractions[key] = true;
|
||||
} else {
|
||||
|
||||
@@ -126,8 +126,8 @@ ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) {
|
||||
*/
|
||||
ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) {
|
||||
var count = goog.object.getCount(this.pointerMap);
|
||||
if (count === 0 || (count === 1 && goog.object.containsKey(this.pointerMap,
|
||||
ol.pointer.MouseSource.POINTER_ID.toString()))) {
|
||||
if (count === 0 || (count === 1 &&
|
||||
ol.pointer.MouseSource.POINTER_ID.toString() in this.pointerMap)) {
|
||||
this.firstTouchId_ = inTouch.identifier;
|
||||
this.cancelResetClickCount_();
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ ol.proj.addTransform = function(source, destination, transformFn) {
|
||||
var sourceCode = source.getCode();
|
||||
var destinationCode = destination.getCode();
|
||||
var transforms = ol.proj.transforms_;
|
||||
if (!goog.object.containsKey(transforms, sourceCode)) {
|
||||
if (!(sourceCode in transforms)) {
|
||||
transforms[sourceCode] = {};
|
||||
}
|
||||
transforms[sourceCode][destinationCode] = transformFn;
|
||||
@@ -720,8 +720,7 @@ ol.proj.getTransformFromProjections =
|
||||
var sourceCode = sourceProjection.getCode();
|
||||
var destinationCode = destinationProjection.getCode();
|
||||
var transform;
|
||||
if (goog.object.containsKey(transforms, sourceCode) &&
|
||||
goog.object.containsKey(transforms[sourceCode], destinationCode)) {
|
||||
if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {
|
||||
transform = transforms[sourceCode][destinationCode];
|
||||
}
|
||||
if (transform === undefined) {
|
||||
|
||||
@@ -478,7 +478,7 @@ ol.render.webgl.ImageReplay.prototype.createTextures_ =
|
||||
image = images[i];
|
||||
|
||||
uid = goog.getUid(image).toString();
|
||||
if (goog.object.containsKey(texturePerImage, uid)) {
|
||||
if (uid in texturePerImage) {
|
||||
texture = texturePerImage[uid];
|
||||
} else {
|
||||
texture = ol.webgl.Context.createTexture(
|
||||
|
||||
@@ -118,7 +118,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
|
||||
|
||||
for (var i = 0, ii = features.length; i < ii; i++) {
|
||||
var feature = features[i];
|
||||
if (!goog.object.containsKey(clustered, goog.getUid(feature).toString())) {
|
||||
if (!(goog.getUid(feature).toString() in clustered)) {
|
||||
var geometry = feature.getGeometry();
|
||||
goog.asserts.assert(geometry instanceof ol.geom.Point,
|
||||
'feature geometry is a ol.geom.Point instance');
|
||||
@@ -130,7 +130,7 @@ ol.source.Cluster.prototype.cluster_ = function() {
|
||||
goog.asserts.assert(neighbors.length >= 1, 'at least one neighbor found');
|
||||
neighbors = neighbors.filter(function(neighbor) {
|
||||
var uid = goog.getUid(neighbor).toString();
|
||||
if (!goog.object.containsKey(clustered, uid)) {
|
||||
if (!(uid in clustered)) {
|
||||
clustered[uid] = true;
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -59,8 +59,7 @@ ol.structs.RBush.prototype.insert = function(extent, value) {
|
||||
];
|
||||
this.rbush_.insert(item);
|
||||
// remember the object that was added to the internal rbush
|
||||
goog.asserts.assert(
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)),
|
||||
goog.asserts.assert(!(goog.getUid(value) in this.items_),
|
||||
'uid (%s) of value (%s) already exists', goog.getUid(value), value);
|
||||
this.items_[goog.getUid(value)] = item;
|
||||
};
|
||||
@@ -92,8 +91,7 @@ ol.structs.RBush.prototype.load = function(extents, values) {
|
||||
value
|
||||
];
|
||||
items[i] = item;
|
||||
goog.asserts.assert(
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)),
|
||||
goog.asserts.assert(!(goog.getUid(value) in this.items_),
|
||||
'uid (%s) of value (%s) already exists', goog.getUid(value), value);
|
||||
this.items_[goog.getUid(value)] = item;
|
||||
}
|
||||
@@ -111,7 +109,7 @@ ol.structs.RBush.prototype.remove = function(value) {
|
||||
throw new Error('Can not remove value while reading');
|
||||
}
|
||||
var uid = goog.getUid(value);
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid),
|
||||
goog.asserts.assert(uid in this.items_,
|
||||
'uid (%s) of value (%s) does not exist', uid, value);
|
||||
|
||||
// get the object in which the value was wrapped when adding to the
|
||||
@@ -129,7 +127,7 @@ ol.structs.RBush.prototype.remove = function(value) {
|
||||
*/
|
||||
ol.structs.RBush.prototype.update = function(extent, value) {
|
||||
var uid = goog.getUid(value);
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid),
|
||||
goog.asserts.assert(uid in this.items_,
|
||||
'uid (%s) of value (%s) does not exist', uid, value);
|
||||
|
||||
var item = this.items_[uid];
|
||||
|
||||
Reference in New Issue
Block a user