Inline simple !goog.isDef() calls

This commit is contained in:
Tim Schaub
2015-09-27 10:31:16 -06:00
parent 3a0683f373
commit a86c270f6a
11 changed files with 17 additions and 17 deletions

View File

@@ -19,7 +19,7 @@ ol.geom.flat.flip.flipXY =
dest = opt_dest; dest = opt_dest;
destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0; destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0;
} else { } else {
goog.asserts.assert(!goog.isDef(opt_destOffset), goog.asserts.assert(opt_destOffset === undefined,
'opt_destOffSet should be defined'); 'opt_destOffSet should be defined');
dest = []; dest = [];
destOffset = 0; destOffset = 0;

View File

@@ -366,7 +366,7 @@ ol.Overlay.prototype.panIntoView_ = function() {
goog.asserts.assert(this.autoPan, 'this.autoPan should be true'); goog.asserts.assert(this.autoPan, 'this.autoPan should be true');
var map = this.getMap(); var map = this.getMap();
if (!goog.isDef(map) || goog.isNull(map.getTargetElement())) { if (map === undefined || goog.isNull(map.getTargetElement())) {
return; return;
} }
@@ -474,7 +474,7 @@ ol.Overlay.prototype.setVisible = function(visible) {
ol.Overlay.prototype.updatePixelPosition = function() { ol.Overlay.prototype.updatePixelPosition = function() {
var map = this.getMap(); var map = this.getMap();
var position = this.getPosition(); var position = this.getPosition();
if (!goog.isDef(map) || !map.isRendered() || !goog.isDef(position)) { if (map === undefined || !map.isRendered() || position === undefined) {
this.setVisible(false); this.setVisible(false);
return; return;
} }

View File

@@ -652,7 +652,7 @@ ol.proj.get = function(projectionLike) {
} else if (goog.isString(projectionLike)) { } else if (goog.isString(projectionLike)) {
var code = projectionLike; var code = projectionLike;
projection = ol.proj.projections_[code]; projection = ol.proj.projections_[code];
if (ol.ENABLE_PROJ4JS && !goog.isDef(projection) && if (ol.ENABLE_PROJ4JS && projection === undefined &&
typeof proj4 == 'function' && goog.isDef(proj4.defs(code))) { typeof proj4 == 'function' && goog.isDef(proj4.defs(code))) {
projection = new ol.proj.Projection({code: code}); projection = new ol.proj.Projection({code: code});
ol.proj.addProjection(projection); ol.proj.addProjection(projection);

View File

@@ -1007,7 +1007,7 @@ ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
goog.asserts.assert(!goog.isNull(state), 'state should not be null'); goog.asserts.assert(!goog.isNull(state), 'state should not be null');
var strokeStyle = state.strokeStyle; var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth; var lineWidth = state.lineWidth;
if (!goog.isDef(strokeStyle) || !goog.isDef(lineWidth)) { if (strokeStyle === undefined || lineWidth === undefined) {
return; return;
} }
this.setStrokeStyle_(); this.setStrokeStyle_();
@@ -1035,7 +1035,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
goog.asserts.assert(!goog.isNull(state), 'state should not be null'); goog.asserts.assert(!goog.isNull(state), 'state should not be null');
var strokeStyle = state.strokeStyle; var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth; var lineWidth = state.lineWidth;
if (!goog.isDef(strokeStyle) || !goog.isDef(lineWidth)) { if (strokeStyle === undefined || lineWidth === undefined) {
return; return;
} }
this.setStrokeStyle_(); this.setStrokeStyle_();
@@ -1217,7 +1217,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
goog.asserts.assert(!goog.isNull(state), 'state should not be null'); goog.asserts.assert(!goog.isNull(state), 'state should not be null');
var fillStyle = state.fillStyle; var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle; var strokeStyle = state.strokeStyle;
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
if (strokeStyle !== undefined) { if (strokeStyle !== undefined) {
@@ -1270,7 +1270,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
goog.asserts.assert(!goog.isNull(state), 'state should not be null'); goog.asserts.assert(!goog.isNull(state), 'state should not be null');
var fillStyle = state.fillStyle; var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle; var strokeStyle = state.strokeStyle;
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
if (strokeStyle !== undefined) { if (strokeStyle !== undefined) {
@@ -1306,7 +1306,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
goog.asserts.assert(!goog.isNull(state), 'state should not be null'); goog.asserts.assert(!goog.isNull(state), 'state should not be null');
var fillStyle = state.fillStyle; var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle; var strokeStyle = state.strokeStyle;
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
if (strokeStyle !== undefined) { if (strokeStyle !== undefined) {

View File

@@ -866,7 +866,7 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne_ =
if (!goog.isDef(skippedFeaturesHash[featureUid]) && if (!goog.isDef(skippedFeaturesHash[featureUid]) &&
goog.isDefAndNotNull(feature.getGeometry()) && goog.isDefAndNotNull(feature.getGeometry()) &&
(!goog.isDef(opt_hitExtent) || ol.extent.intersects( (opt_hitExtent === undefined || ol.extent.intersects(
opt_hitExtent, feature.getGeometry().getExtent()))) { opt_hitExtent, feature.getGeometry().getExtent()))) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
this.drawElements_(gl, start, end, elementType, elementSize); this.drawElements_(gl, start, end, elementType, elementSize);

View File

@@ -48,7 +48,7 @@ ol.source.TileArcGISRest = function(opt_options) {
}); });
var urls = options.urls; var urls = options.urls;
if (!goog.isDef(urls) && goog.isDef(options.url)) { if (urls === undefined && goog.isDef(options.url)) {
urls = ol.TileUrlFunction.expandUrl(options.url); urls = ol.TileUrlFunction.expandUrl(options.url);
} }

View File

@@ -52,7 +52,7 @@ ol.source.TileWMS = function(opt_options) {
}); });
var urls = options.urls; var urls = options.urls;
if (!goog.isDef(urls) && goog.isDef(options.url)) { if (urls === undefined && goog.isDef(options.url)) {
urls = ol.TileUrlFunction.expandUrl(options.url); urls = ol.TileUrlFunction.expandUrl(options.url);
} }

View File

@@ -161,7 +161,7 @@ ol.source.Vector = function(opt_options) {
} else if (goog.isArray(options.features)) { } else if (goog.isArray(options.features)) {
features = options.features; features = options.features;
} }
if (!useSpatialIndex && !goog.isDef(collection)) { if (!useSpatialIndex && collection === undefined) {
collection = new ol.Collection(features); collection = new ol.Collection(features);
} }
if (features !== undefined) { if (features !== undefined) {

View File

@@ -83,7 +83,7 @@ ol.source.WMTS = function(options) {
this.style_ = options.style; this.style_ = options.style;
var urls = options.urls; var urls = options.urls;
if (!goog.isDef(urls) && goog.isDef(options.url)) { if (urls === undefined && goog.isDef(options.url)) {
urls = ol.TileUrlFunction.expandUrl(options.url); urls = ol.TileUrlFunction.expandUrl(options.url);
} }

View File

@@ -108,13 +108,13 @@ ol.style.Icon = function(opt_options) {
goog.asserts.assert(!(goog.isDef(src) && !goog.isNull(image)), goog.asserts.assert(!(goog.isDef(src) && !goog.isNull(image)),
'image and src can not provided at the same time'); 'image and src can not provided at the same time');
goog.asserts.assert( goog.asserts.assert(
!goog.isDef(src) || (goog.isDef(src) && goog.isNull(imgSize)), src === undefined || (goog.isDef(src) && goog.isNull(imgSize)),
'imgSize should not be set when src is provided'); 'imgSize should not be set when src is provided');
goog.asserts.assert( goog.asserts.assert(
goog.isNull(image) || (!goog.isNull(image) && !goog.isNull(imgSize)), goog.isNull(image) || (!goog.isNull(image) && !goog.isNull(imgSize)),
'imgSize must be set when image is provided'); 'imgSize must be set when image is provided');
if ((!goog.isDef(src) || src.length === 0) && !goog.isNull(image)) { if ((src === undefined || src.length === 0) && !goog.isNull(image)) {
src = image.src; src = image.src;
} }
goog.asserts.assert(goog.isDef(src) && src.length > 0, goog.asserts.assert(goog.isDef(src) && src.length > 0,

View File

@@ -738,7 +738,7 @@ ol.View.createRotationConstraint_ = function(options) {
options.enableRotation : true; options.enableRotation : true;
if (enableRotation) { if (enableRotation) {
var constrainRotation = options.constrainRotation; var constrainRotation = options.constrainRotation;
if (!goog.isDef(constrainRotation) || constrainRotation === true) { if (constrainRotation === undefined || constrainRotation === true) {
return ol.RotationConstraint.createSnapToZero(); return ol.RotationConstraint.createSnapToZero();
} else if (constrainRotation === false) { } else if (constrainRotation === false) {
return ol.RotationConstraint.none; return ol.RotationConstraint.none;