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