Merge pull request #4176 from tschaub/remove-isdefandnotnull
Remove use of goog.isDefAndNotNull().
This commit is contained in:
@@ -265,7 +265,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
|
||||
} else if (this.styleFunction_) {
|
||||
styles = this.styleFunction_(feature, resolution);
|
||||
}
|
||||
if (!goog.isDefAndNotNull(styles)) {
|
||||
if (!styles) {
|
||||
return false;
|
||||
}
|
||||
var i, ii, loading = false;
|
||||
|
||||
@@ -56,7 +56,7 @@ ol.source.TileArcGISRest = function(opt_options) {
|
||||
* @private
|
||||
* @type {!Array.<string>}
|
||||
*/
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
this.urls_ = urls || [];
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -184,7 +184,7 @@ ol.source.TileArcGISRest.prototype.setUrl = function(url) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.TileArcGISRest.prototype.setUrls = function(urls) {
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
this.urls_ = urls || [];
|
||||
this.changed();
|
||||
};
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
this.template_ = tileJSON.template;
|
||||
|
||||
var grids = tileJSON.grids;
|
||||
if (!goog.isDefAndNotNull(grids)) {
|
||||
if (!grids) {
|
||||
this.setState(ol.source.State.ERROR);
|
||||
return;
|
||||
}
|
||||
@@ -268,8 +268,7 @@ ol.source.TileUTFGridTile_.prototype.getImage = function(opt_context) {
|
||||
* @return {Object}
|
||||
*/
|
||||
ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) {
|
||||
if (goog.isNull(this.grid_) || goog.isNull(this.keys_) ||
|
||||
!goog.isDefAndNotNull(this.data_)) {
|
||||
if (goog.isNull(this.grid_) || goog.isNull(this.keys_) || !this.data_) {
|
||||
return null;
|
||||
}
|
||||
var xRelative = (coordinate[0] - this.extent_[0]) /
|
||||
@@ -292,9 +291,7 @@ ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) {
|
||||
}
|
||||
code -= 32;
|
||||
|
||||
var key = this.keys_[code];
|
||||
|
||||
return goog.isDefAndNotNull(key) ? this.data_[key] : null;
|
||||
return (code in this.keys_) ? this.data_[this.keys_[code]] : null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -134,8 +134,7 @@ ol.source.TileVector.prototype.forEachFeatureAtCoordinateAndResolution =
|
||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
||||
var feature = features[i];
|
||||
var geometry = feature.getGeometry();
|
||||
goog.asserts.assert(goog.isDefAndNotNull(geometry),
|
||||
'feature geometry is defined and not null');
|
||||
goog.asserts.assert(geometry, 'feature geometry is defined and not null');
|
||||
if (geometry.containsCoordinate(coordinate)) {
|
||||
var result = callback.call(opt_this, feature);
|
||||
if (result) {
|
||||
|
||||
@@ -60,7 +60,7 @@ ol.source.TileWMS = function(opt_options) {
|
||||
* @private
|
||||
* @type {!Array.<string>}
|
||||
*/
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
this.urls_ = urls || [];
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -348,7 +348,7 @@ ol.source.TileWMS.prototype.setUrl = function(url) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.TileWMS.prototype.setUrls = function(urls) {
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
this.urls_ = urls || [];
|
||||
this.resetCoordKeyPrefix_();
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -204,7 +204,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
|
||||
this.setupChangeEvents_(featureKey, feature);
|
||||
|
||||
var geometry = feature.getGeometry();
|
||||
if (goog.isDefAndNotNull(geometry)) {
|
||||
if (geometry) {
|
||||
var extent = geometry.getExtent();
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
this.featuresRtree_.insert(extent, feature);
|
||||
@@ -299,7 +299,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
|
||||
this.setupChangeEvents_(featureKey, feature);
|
||||
|
||||
var geometry = feature.getGeometry();
|
||||
if (goog.isDefAndNotNull(geometry)) {
|
||||
if (geometry) {
|
||||
var extent = geometry.getExtent();
|
||||
extents.push(extent);
|
||||
geometryFeatures.push(feature);
|
||||
@@ -450,8 +450,7 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect =
|
||||
var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
|
||||
return this.forEachFeatureInExtent(extent, function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
goog.asserts.assert(goog.isDefAndNotNull(geometry),
|
||||
'feature geometry is defined and not null');
|
||||
goog.asserts.assert(geometry, 'feature geometry is defined and not null');
|
||||
if (geometry.containsCoordinate(coordinate)) {
|
||||
return callback.call(opt_this, feature);
|
||||
} else {
|
||||
@@ -533,7 +532,7 @@ ol.source.Vector.prototype.forEachFeatureIntersectingExtent =
|
||||
*/
|
||||
function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
goog.asserts.assert(goog.isDefAndNotNull(geometry),
|
||||
goog.asserts.assert(geometry,
|
||||
'feature geometry is defined and not null');
|
||||
if (geometry.intersectsExtent(extent)) {
|
||||
var result = callback.call(opt_this, feature);
|
||||
@@ -645,7 +644,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
|
||||
*/
|
||||
function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
goog.asserts.assert(goog.isDefAndNotNull(geometry),
|
||||
goog.asserts.assert(geometry,
|
||||
'feature geometry is defined and not null');
|
||||
var previousMinSquaredDistance = minSquaredDistance;
|
||||
minSquaredDistance = geometry.closestPointXY(
|
||||
@@ -705,7 +704,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
var feature = /** @type {ol.Feature} */ (event.target);
|
||||
var featureKey = goog.getUid(feature).toString();
|
||||
var geometry = feature.getGeometry();
|
||||
if (!goog.isDefAndNotNull(geometry)) {
|
||||
if (!geometry) {
|
||||
if (!(featureKey in this.nullGeometryFeatures_)) {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
this.featuresRtree_.remove(feature);
|
||||
|
||||
@@ -92,7 +92,7 @@ ol.source.WMTS = function(options) {
|
||||
* @private
|
||||
* @type {!Array.<string>}
|
||||
*/
|
||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||
this.urls_ = urls || [];
|
||||
|
||||
// FIXME: should we guess this requestEncoding from options.url(s)
|
||||
// structure? that would mean KVP only if a template is not provided.
|
||||
|
||||
Reference in New Issue
Block a user