Replace goog.object.isEmpty() with ol.object.isEmpty()
This commit is contained in:
@@ -5,14 +5,13 @@ goog.provide('ol.control.Attribution');
|
|||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.dom.classlist');
|
goog.require('goog.dom.classlist');
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('ol.events.EventType');
|
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
|
goog.require('ol.events');
|
||||||
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.object');
|
goog.require('ol.object');
|
||||||
goog.require('ol.source.Tile');
|
goog.require('ol.source.Tile');
|
||||||
|
|
||||||
@@ -268,14 +267,14 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var renderVisible =
|
var renderVisible =
|
||||||
!goog.object.isEmpty(this.attributionElementRenderedVisible_) ||
|
!ol.object.isEmpty(this.attributionElementRenderedVisible_) ||
|
||||||
!goog.object.isEmpty(frameState.logos);
|
!ol.object.isEmpty(frameState.logos);
|
||||||
if (this.renderedVisible_ != renderVisible) {
|
if (this.renderedVisible_ != renderVisible) {
|
||||||
goog.style.setElementShown(this.element, renderVisible);
|
goog.style.setElementShown(this.element, renderVisible);
|
||||||
this.renderedVisible_ = renderVisible;
|
this.renderedVisible_ = renderVisible;
|
||||||
}
|
}
|
||||||
if (renderVisible &&
|
if (renderVisible &&
|
||||||
goog.object.isEmpty(this.attributionElementRenderedVisible_)) {
|
ol.object.isEmpty(this.attributionElementRenderedVisible_)) {
|
||||||
goog.dom.classlist.add(this.element, 'ol-logo-only');
|
goog.dom.classlist.add(this.element, 'ol-logo-only');
|
||||||
} else {
|
} else {
|
||||||
goog.dom.classlist.remove(this.element, 'ol-logo-only');
|
goog.dom.classlist.remove(this.element, 'ol-logo-only');
|
||||||
@@ -322,7 +321,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goog.style.setElementShown(this.logoLi_, !goog.object.isEmpty(logos));
|
goog.style.setElementShown(this.logoLi_, !ol.object.isEmpty(logos));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
goog.provide('ol.format.EsriJSON');
|
goog.provide('ol.format.EsriJSON');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.array');
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
|
goog.require('ol.array');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.format.Feature');
|
goog.require('ol.format.Feature');
|
||||||
goog.require('ol.format.JSONFeature');
|
goog.require('ol.format.JSONFeature');
|
||||||
@@ -652,7 +651,7 @@ ol.format.EsriJSON.prototype.writeFeatureObject = function(
|
|||||||
}
|
}
|
||||||
var properties = feature.getProperties();
|
var properties = feature.getProperties();
|
||||||
delete properties[feature.getGeometryName()];
|
delete properties[feature.getGeometryName()];
|
||||||
if (!goog.object.isEmpty(properties)) {
|
if (!ol.object.isEmpty(properties)) {
|
||||||
object['attributes'] = properties;
|
object['attributes'] = properties;
|
||||||
} else {
|
} else {
|
||||||
object['attributes'] = {};
|
object['attributes'] = {};
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
goog.provide('ol.format.GeoJSON');
|
goog.provide('ol.format.GeoJSON');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.format.Feature');
|
goog.require('ol.format.Feature');
|
||||||
goog.require('ol.format.JSONFeature');
|
goog.require('ol.format.JSONFeature');
|
||||||
@@ -15,6 +14,7 @@ goog.require('ol.geom.MultiPoint');
|
|||||||
goog.require('ol.geom.MultiPolygon');
|
goog.require('ol.geom.MultiPolygon');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
|
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
|
|||||||
}
|
}
|
||||||
var properties = feature.getProperties();
|
var properties = feature.getProperties();
|
||||||
delete properties[feature.getGeometryName()];
|
delete properties[feature.getGeometryName()];
|
||||||
if (!goog.object.isEmpty(properties)) {
|
if (!ol.object.isEmpty(properties)) {
|
||||||
object.properties = properties;
|
object.properties = properties;
|
||||||
} else {
|
} else {
|
||||||
object.properties = null;
|
object.properties = null;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ goog.require('ol.geom.MultiPolygon');
|
|||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.style.Fill');
|
goog.require('ol.style.Fill');
|
||||||
goog.require('ol.style.Icon');
|
goog.require('ol.style.Icon');
|
||||||
@@ -331,7 +332,7 @@ ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
|
|||||||
textAlign = 'left';
|
textAlign = 'left';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!goog.object.isEmpty(foundStyle.getText())) {
|
if (!ol.object.isEmpty(foundStyle.getText())) {
|
||||||
textStyle = /** @type {ol.style.Text} */
|
textStyle = /** @type {ol.style.Text} */
|
||||||
(goog.object.clone(foundStyle.getText()));
|
(goog.object.clone(foundStyle.getText()));
|
||||||
textStyle.setText(name);
|
textStyle.setText(name);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ goog.provide('ol.format.OSMXML');
|
|||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.dom.NodeType');
|
goog.require('goog.dom.NodeType');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.format.Feature');
|
goog.require('ol.format.Feature');
|
||||||
@@ -12,6 +11,7 @@ goog.require('ol.geom.GeometryLayout');
|
|||||||
goog.require('ol.geom.LineString');
|
goog.require('ol.geom.LineString');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.xml');
|
goog.require('ol.xml');
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
|
|||||||
var values = ol.xml.pushParseAndPop({
|
var values = ol.xml.pushParseAndPop({
|
||||||
tags: {}
|
tags: {}
|
||||||
}, ol.format.OSMXML.NODE_PARSERS_, node, objectStack);
|
}, ol.format.OSMXML.NODE_PARSERS_, node, objectStack);
|
||||||
if (!goog.object.isEmpty(values.tags)) {
|
if (!ol.object.isEmpty(values.tags)) {
|
||||||
var geometry = new ol.geom.Point(coordinates);
|
var geometry = new ol.geom.Point(coordinates);
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, options);
|
ol.format.Feature.transformWithOptions(geometry, false, options);
|
||||||
var feature = new ol.Feature(geometry);
|
var feature = new ol.Feature(geometry);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
goog.provide('ol.Image');
|
goog.provide('ol.Image');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('ol.events.EventType');
|
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.ImageBase');
|
goog.require('ol.ImageBase');
|
||||||
goog.require('ol.ImageState');
|
goog.require('ol.ImageState');
|
||||||
|
goog.require('ol.events');
|
||||||
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.object');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@ ol.Image.prototype.getImage = function(opt_context) {
|
|||||||
var key = goog.getUid(opt_context);
|
var key = goog.getUid(opt_context);
|
||||||
if (key in this.imageByContext_) {
|
if (key in this.imageByContext_) {
|
||||||
return this.imageByContext_[key];
|
return this.imageByContext_[key];
|
||||||
} else if (goog.object.isEmpty(this.imageByContext_)) {
|
} else if (ol.object.isEmpty(this.imageByContext_)) {
|
||||||
image = this.image_;
|
image = this.image_;
|
||||||
} else {
|
} else {
|
||||||
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
goog.provide('ol.ImageTile');
|
goog.provide('ol.ImageTile');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('ol.events.EventType');
|
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
goog.require('ol.TileLoadFunctionType');
|
goog.require('ol.TileLoadFunctionType');
|
||||||
goog.require('ol.TileState');
|
goog.require('ol.TileState');
|
||||||
|
goog.require('ol.events');
|
||||||
|
goog.require('ol.events.EventType');
|
||||||
|
goog.require('ol.object');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +87,7 @@ ol.ImageTile.prototype.getImage = function(opt_context) {
|
|||||||
var key = goog.getUid(opt_context);
|
var key = goog.getUid(opt_context);
|
||||||
if (key in this.imageByContext_) {
|
if (key in this.imageByContext_) {
|
||||||
return this.imageByContext_[key];
|
return this.imageByContext_[key];
|
||||||
} else if (goog.object.isEmpty(this.imageByContext_)) {
|
} else if (ol.object.isEmpty(this.imageByContext_)) {
|
||||||
image = this.image_;
|
image = this.image_;
|
||||||
} else {
|
} else {
|
||||||
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
||||||
|
|||||||
@@ -37,6 +37,20 @@ ol.object.assign = (typeof Object.assign === 'function') ? Object.assign : funct
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if an object has any properties.
|
||||||
|
* @param {Object} object The object to check.
|
||||||
|
* @return {boolean} The object is empty.
|
||||||
|
*/
|
||||||
|
ol.object.isEmpty = function(object) {
|
||||||
|
var property;
|
||||||
|
for (property in object) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !property;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ goog.provide('ol.proj.ProjectionLike');
|
|||||||
goog.provide('ol.proj.Units');
|
goog.provide('ol.proj.Units');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.TransformFunction');
|
goog.require('ol.TransformFunction');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.sphere.NORMAL');
|
goog.require('ol.sphere.NORMAL');
|
||||||
|
|
||||||
|
|
||||||
@@ -630,7 +630,7 @@ ol.proj.removeTransform = function(source, destination) {
|
|||||||
'destinationCode should be in transforms of sourceCode');
|
'destinationCode should be in transforms of sourceCode');
|
||||||
var transform = transforms[sourceCode][destinationCode];
|
var transform = transforms[sourceCode][destinationCode];
|
||||||
delete transforms[sourceCode][destinationCode];
|
delete transforms[sourceCode][destinationCode];
|
||||||
if (goog.object.isEmpty(transforms[sourceCode])) {
|
if (ol.object.isEmpty(transforms[sourceCode])) {
|
||||||
delete transforms[sourceCode];
|
delete transforms[sourceCode];
|
||||||
}
|
}
|
||||||
return transform;
|
return transform;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ goog.provide('ol.render.canvas.ReplayGroup');
|
|||||||
goog.provide('ol.render.canvas.TextReplay');
|
goog.provide('ol.render.canvas.TextReplay');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('goog.vec.Mat4');
|
goog.require('goog.vec.Mat4');
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
@@ -20,6 +19,7 @@ goog.require('ol.extent.Relationship');
|
|||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
goog.require('ol.geom.flat.transform');
|
goog.require('ol.geom.flat.transform');
|
||||||
goog.require('ol.has');
|
goog.require('ol.has');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.render.IReplayGroup');
|
goog.require('ol.render.IReplayGroup');
|
||||||
goog.require('ol.render.VectorContext');
|
goog.require('ol.render.VectorContext');
|
||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
@@ -249,7 +249,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
goog.asserts.assert(pixelCoordinates === this.pixelCoordinates_,
|
||||||
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
'pixelCoordinates should be the same as this.pixelCoordinates_');
|
||||||
}
|
}
|
||||||
var skipFeatures = !goog.object.isEmpty(skippedFeaturesHash);
|
var skipFeatures = !ol.object.isEmpty(skippedFeaturesHash);
|
||||||
var i = 0; // instruction index
|
var i = 0; // instruction index
|
||||||
var ii = instructions.length; // end of instructions
|
var ii = instructions.length; // end of instructions
|
||||||
var d = 0; // data index
|
var d = 0; // data index
|
||||||
@@ -1981,7 +1981,7 @@ ol.render.canvas.ReplayGroup.prototype.getReplay = function(zIndex, replayType)
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.ReplayGroup.prototype.isEmpty = function() {
|
ol.render.canvas.ReplayGroup.prototype.isEmpty = function() {
|
||||||
return goog.object.isEmpty(this.replaysByZIndex_);
|
return ol.object.isEmpty(this.replaysByZIndex_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ goog.provide('ol.render.webgl.ReplayGroup');
|
|||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('goog.vec.Mat4');
|
goog.require('goog.vec.Mat4');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.render.IReplayGroup');
|
goog.require('ol.render.IReplayGroup');
|
||||||
goog.require('ol.render.VectorContext');
|
goog.require('ol.render.VectorContext');
|
||||||
goog.require('ol.render.webgl.imagereplay.shader.Default');
|
goog.require('ol.render.webgl.imagereplay.shader.Default');
|
||||||
@@ -620,7 +620,7 @@ ol.render.webgl.ImageReplay.prototype.drawReplay_ = function(gl, context, skippe
|
|||||||
goog.webgl.UNSIGNED_INT : goog.webgl.UNSIGNED_SHORT;
|
goog.webgl.UNSIGNED_INT : goog.webgl.UNSIGNED_SHORT;
|
||||||
var elementSize = context.hasOESElementIndexUint ? 4 : 2;
|
var elementSize = context.hasOESElementIndexUint ? 4 : 2;
|
||||||
|
|
||||||
if (!goog.object.isEmpty(skippedFeaturesHash)) {
|
if (!ol.object.isEmpty(skippedFeaturesHash)) {
|
||||||
this.drawReplaySkipping_(
|
this.drawReplaySkipping_(
|
||||||
gl, skippedFeaturesHash, textures, groupIndices,
|
gl, skippedFeaturesHash, textures, groupIndices,
|
||||||
elementType, elementSize);
|
elementType, elementSize);
|
||||||
@@ -996,7 +996,7 @@ ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.render.webgl.ReplayGroup.prototype.isEmpty = function() {
|
ol.render.webgl.ReplayGroup.prototype.isEmpty = function() {
|
||||||
return goog.object.isEmpty(this.replays_);
|
return ol.object.isEmpty(this.replays_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ goog.provide('ol.reproj.Tile');
|
|||||||
goog.provide('ol.reproj.TileFunctionType');
|
goog.provide('ol.reproj.TileFunctionType');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('ol.events.EventType');
|
|
||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileState');
|
goog.require('ol.TileState');
|
||||||
|
goog.require('ol.events');
|
||||||
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.reproj');
|
goog.require('ol.reproj');
|
||||||
goog.require('ol.reproj.Triangulation');
|
goog.require('ol.reproj.Triangulation');
|
||||||
@@ -226,7 +226,7 @@ ol.reproj.Tile.prototype.getImage = function(opt_context) {
|
|||||||
var key = goog.getUid(opt_context);
|
var key = goog.getUid(opt_context);
|
||||||
if (key in this.canvasByContext_) {
|
if (key in this.canvasByContext_) {
|
||||||
return this.canvasByContext_[key];
|
return this.canvasByContext_[key];
|
||||||
} else if (goog.object.isEmpty(this.canvasByContext_)) {
|
} else if (ol.object.isEmpty(this.canvasByContext_)) {
|
||||||
image = this.canvas_;
|
image = this.canvas_;
|
||||||
} else {
|
} else {
|
||||||
image = /** @type {HTMLCanvasElement} */ (this.canvas_.cloneNode(false));
|
image = /** @type {HTMLCanvasElement} */ (this.canvas_.cloneNode(false));
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ goog.require('ol.events.EventType');
|
|||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.featureloader');
|
goog.require('ol.featureloader');
|
||||||
goog.require('ol.loadingstrategy');
|
goog.require('ol.loadingstrategy');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.Source');
|
goog.require('ol.source.Source');
|
||||||
goog.require('ol.source.State');
|
goog.require('ol.source.State');
|
||||||
@@ -392,11 +393,11 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
|
|||||||
if (this.featuresCollection_) {
|
if (this.featuresCollection_) {
|
||||||
this.featuresCollection_.clear();
|
this.featuresCollection_.clear();
|
||||||
}
|
}
|
||||||
goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_),
|
goog.asserts.assert(ol.object.isEmpty(this.featureChangeKeys_),
|
||||||
'featureChangeKeys is an empty object now');
|
'featureChangeKeys is an empty object now');
|
||||||
goog.asserts.assert(goog.object.isEmpty(this.idIndex_),
|
goog.asserts.assert(ol.object.isEmpty(this.idIndex_),
|
||||||
'idIndex is an empty object now');
|
'idIndex is an empty object now');
|
||||||
goog.asserts.assert(goog.object.isEmpty(this.undefIdIndex_),
|
goog.asserts.assert(ol.object.isEmpty(this.undefIdIndex_),
|
||||||
'undefIdIndex is an empty object now');
|
'undefIdIndex is an empty object now');
|
||||||
|
|
||||||
if (this.featuresRtree_) {
|
if (this.featuresRtree_) {
|
||||||
@@ -550,7 +551,7 @@ ol.source.Vector.prototype.getFeatures = function() {
|
|||||||
features = this.featuresCollection_.getArray();
|
features = this.featuresCollection_.getArray();
|
||||||
} else if (this.featuresRtree_) {
|
} else if (this.featuresRtree_) {
|
||||||
features = this.featuresRtree_.getAll();
|
features = this.featuresRtree_.getAll();
|
||||||
if (!goog.object.isEmpty(this.nullGeometryFeatures_)) {
|
if (!ol.object.isEmpty(this.nullGeometryFeatures_)) {
|
||||||
ol.array.extend(
|
ol.array.extend(
|
||||||
features, goog.object.getValues(this.nullGeometryFeatures_));
|
features, goog.object.getValues(this.nullGeometryFeatures_));
|
||||||
}
|
}
|
||||||
@@ -753,7 +754,7 @@ ol.source.Vector.prototype.hasFeature = function(feature) {
|
|||||||
*/
|
*/
|
||||||
ol.source.Vector.prototype.isEmpty = function() {
|
ol.source.Vector.prototype.isEmpty = function() {
|
||||||
return this.featuresRtree_.isEmpty() &&
|
return this.featuresRtree_.isEmpty() &&
|
||||||
goog.object.isEmpty(this.nullGeometryFeatures_);
|
ol.object.isEmpty(this.nullGeometryFeatures_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.structs.LRUCache');
|
goog.provide('ol.structs.LRUCache');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('ol.object');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ ol.structs.LRUCache = function() {
|
|||||||
*/
|
*/
|
||||||
ol.structs.LRUCache.prototype.assertValid = function() {
|
ol.structs.LRUCache.prototype.assertValid = function() {
|
||||||
if (this.count_ === 0) {
|
if (this.count_ === 0) {
|
||||||
goog.asserts.assert(goog.object.isEmpty(this.entries_),
|
goog.asserts.assert(ol.object.isEmpty(this.entries_),
|
||||||
'entries must be an empty object (count = 0)');
|
'entries must be an empty object (count = 0)');
|
||||||
goog.asserts.assert(!this.oldest_,
|
goog.asserts.assert(!this.oldest_,
|
||||||
'oldest must be null (count = 0)');
|
'oldest must be null (count = 0)');
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
goog.provide('ol.structs.RBush');
|
goog.provide('ol.structs.RBush');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.ext.rbush');
|
goog.require('ol.ext.rbush');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.object');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +234,7 @@ ol.structs.RBush.prototype.forEach_ = function(values, callback, opt_this) {
|
|||||||
* @return {boolean} Is empty.
|
* @return {boolean} Is empty.
|
||||||
*/
|
*/
|
||||||
ol.structs.RBush.prototype.isEmpty = function() {
|
ol.structs.RBush.prototype.isEmpty = function() {
|
||||||
return goog.object.isEmpty(this.items_);
|
return ol.object.isEmpty(this.items_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ describe('ol.Feature', function() {
|
|||||||
it('is empty by default', function() {
|
it('is empty by default', function() {
|
||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
var properties = feature.getProperties();
|
var properties = feature.getProperties();
|
||||||
expect(goog.object.isEmpty(properties)).to.be(true);
|
expect(ol.object.isEmpty(properties)).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -462,8 +462,7 @@ describe('ol.Feature.createStyleFunction()', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('goog.object');
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|||||||
@@ -268,6 +268,17 @@ describe('ol.object.assign()', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ol.object.isEmpty()', function() {
|
||||||
|
|
||||||
|
it('checks if an object has any properties', function() {
|
||||||
|
expect(ol.object.isEmpty({})).to.be(true);
|
||||||
|
expect(ol.object.isEmpty(null)).to.be(true);
|
||||||
|
expect(ol.object.isEmpty({foo: 'bar'})).to.be(false);
|
||||||
|
expect(ol.object.isEmpty({foo: false})).to.be(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.ObjectEventType');
|
goog.require('ol.ObjectEventType');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
|
|||||||
Reference in New Issue
Block a user