diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js index c6d35470d8..c6d14c2a51 100644 --- a/src/ol/geolocation.js +++ b/src/ol/geolocation.js @@ -97,7 +97,7 @@ ol.Geolocation = function(opt_options) { this.setTrackingOptions(options.trackingOptions); } - this.setTracking(goog.isDef(options.tracking) ? options.tracking : false); + this.setTracking(options.tracking !== undefined ? options.tracking : false); }; goog.inherits(ol.Geolocation, ol.Object); @@ -139,7 +139,7 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() { goog.bind(this.positionChange_, this), goog.bind(this.positionError_, this), this.getTrackingOptions()); - } else if (!tracking && goog.isDef(this.watchId_)) { + } else if (!tracking && this.watchId_ !== undefined) { goog.global.navigator.geolocation.clearWatch(this.watchId_); this.watchId_ = undefined; } diff --git a/src/ol/graticule.js b/src/ol/graticule.js index 3a3ca588b7..4d5b012042 100644 --- a/src/ol/graticule.js +++ b/src/ol/graticule.js @@ -86,14 +86,14 @@ ol.Graticule = function(opt_options) { * @type {number} * @private */ - this.targetSize_ = goog.isDef(options.targetSize) ? + this.targetSize_ = options.targetSize !== undefined ? options.targetSize : 100; /** * @type {number} * @private */ - this.maxLines_ = goog.isDef(options.maxLines) ? options.maxLines : 100; + this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100; goog.asserts.assert(this.maxLines_ > 0, 'this.maxLines_ should be more than 0'); @@ -113,7 +113,7 @@ ol.Graticule = function(opt_options) { * @type {ol.style.Stroke} * @private */ - this.strokeStyle_ = goog.isDef(options.strokeStyle) ? + this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_; /** @@ -134,7 +134,7 @@ ol.Graticule = function(opt_options) { */ this.projectionCenterLonLat_ = null; - this.setMap(goog.isDef(options.map) ? options.map : null); + this.setMap(options.map !== undefined ? options.map : null); }; diff --git a/src/ol/imagebase.js b/src/ol/imagebase.js index 5e0a464fbb..e188221977 100644 --- a/src/ol/imagebase.js +++ b/src/ol/imagebase.js @@ -110,7 +110,7 @@ ol.ImageBase.prototype.getPixelRatio = function() { * @return {number} Resolution. */ ol.ImageBase.prototype.getResolution = function() { - goog.asserts.assert(goog.isDef(this.resolution), 'resolution not yet set'); + goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set'); return this.resolution; }; diff --git a/src/ol/interaction/translateinteraction.js b/src/ol/interaction/translateinteraction.js index 09fbe8c349..1f2ec0bd1e 100644 --- a/src/ol/interaction/translateinteraction.js +++ b/src/ol/interaction/translateinteraction.js @@ -42,7 +42,7 @@ ol.interaction.Translate = function(options) { * @type {ol.Collection.} * @private */ - this.features_ = goog.isDef(options.features) ? options.features : null; + this.features_ = options.features !== undefined ? options.features : null; /** * @type {ol.Feature} @@ -147,7 +147,7 @@ ol.interaction.Translate.handleMoveEvent_ = function(event) 'grabbing' : (isSelected ? 'grab' : 'pointer'); } else { - elem.style.cursor = goog.isDef(this.previousCursor_) ? + elem.style.cursor = this.previousCursor_ !== undefined ? this.previousCursor_ : ''; this.previousCursor_ = undefined; } diff --git a/src/ol/map.js b/src/ol/map.js index cf7e509e68..dfb9618635 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -181,22 +181,23 @@ ol.Map = function(options) { * @type {boolean} * @private */ - this.loadTilesWhileAnimating_ = goog.isDef(options.loadTilesWhileAnimating) ? - options.loadTilesWhileAnimating : false; + this.loadTilesWhileAnimating_ = + options.loadTilesWhileAnimating !== undefined ? + options.loadTilesWhileAnimating : false; /** * @type {boolean} * @private */ this.loadTilesWhileInteracting_ = - goog.isDef(options.loadTilesWhileInteracting) ? + options.loadTilesWhileInteracting !== undefined ? options.loadTilesWhileInteracting : false; /** * @private * @type {number} */ - this.pixelRatio_ = goog.isDef(options.pixelRatio) ? + this.pixelRatio_ = options.pixelRatio !== undefined ? options.pixelRatio : ol.has.DEVICE_PIXEL_RATIO; /** @@ -1486,7 +1487,7 @@ ol.Map.createOptionsInternal = function(options) { values[ol.MapProperty.TARGET] = options.target; - values[ol.MapProperty.VIEW] = goog.isDef(options.view) ? + values[ol.MapProperty.VIEW] = options.view !== undefined ? options.view : new ol.View(); /** diff --git a/src/ol/overlay.js b/src/ol/overlay.js index 97950b21c3..33c12c7cf9 100644 --- a/src/ol/overlay.js +++ b/src/ol/overlay.js @@ -78,14 +78,14 @@ ol.Overlay = function(options) { * @private * @type {boolean} */ - this.insertFirst_ = goog.isDef(options.insertFirst) ? + this.insertFirst_ = options.insertFirst !== undefined ? options.insertFirst : true; /** * @private * @type {boolean} */ - this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : true; + this.stopEvent_ = options.stopEvent !== undefined ? options.stopEvent : true; /** * @private @@ -100,20 +100,20 @@ ol.Overlay = function(options) { * @protected * @type {boolean} */ - this.autoPan = goog.isDef(options.autoPan) ? options.autoPan : false; + this.autoPan = options.autoPan !== undefined ? options.autoPan : false; /** * @private * @type {olx.animation.PanOptions} */ - this.autoPanAnimation_ = goog.isDef(options.autoPanAnimation) ? + this.autoPanAnimation_ = options.autoPanAnimation !== undefined ? options.autoPanAnimation : /** @type {olx.animation.PanOptions} */ ({}); /** * @private * @type {number} */ - this.autoPanMargin_ = goog.isDef(options.autoPanMargin) ? + this.autoPanMargin_ = options.autoPanMargin !== undefined ? options.autoPanMargin : 20; /** @@ -162,9 +162,9 @@ ol.Overlay = function(options) { this.setElement(options.element); } - this.setOffset(goog.isDef(options.offset) ? options.offset : [0, 0]); + this.setOffset(options.offset !== undefined ? options.offset : [0, 0]); - this.setPositioning(goog.isDef(options.positioning) ? + this.setPositioning(options.positioning !== undefined ? /** @type {ol.OverlayPositioning} */ (options.positioning) : ol.OverlayPositioning.TOP_LEFT); diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index dd14c7fded..47b209dff2 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -99,27 +99,27 @@ ol.proj.Projection = function(options) { * @private * @type {ol.Extent} */ - this.extent_ = goog.isDef(options.extent) ? options.extent : null; + this.extent_ = options.extent !== undefined ? options.extent : null; /** * @private * @type {ol.Extent} */ - this.worldExtent_ = goog.isDef(options.worldExtent) ? + this.worldExtent_ = options.worldExtent !== undefined ? options.worldExtent : null; /** * @private * @type {string} */ - this.axisOrientation_ = goog.isDef(options.axisOrientation) ? + this.axisOrientation_ = options.axisOrientation !== undefined ? options.axisOrientation : 'enu'; /** * @private * @type {boolean} */ - this.global_ = goog.isDef(options.global) ? options.global : false; + this.global_ = options.global !== undefined ? options.global : false; /** @@ -132,7 +132,7 @@ ol.proj.Projection = function(options) { * @private * @type {function(number, ol.Coordinate):number} */ - this.getPointResolutionFunc_ = goog.isDef(options.getPointResolution) ? + this.getPointResolutionFunc_ = options.getPointResolution !== undefined ? options.getPointResolution : this.getPointResolution_; /** @@ -149,7 +149,7 @@ ol.proj.Projection = function(options) { !goog.isDef(projections[code])) { var def = proj4.defs(code); if (def !== undefined) { - if (goog.isDef(def.axis) && options.axisOrientation === undefined) { + if (def.axis !== undefined && options.axisOrientation === undefined) { this.axisOrientation_ = def.axis; } if (options.units === undefined) { diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 8e33020d22..a3a44356d3 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -716,25 +716,25 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry = if (goog.isNull(this.image_)) { return; } - goog.asserts.assert(goog.isDef(this.anchorX_), + goog.asserts.assert(this.anchorX_ !== undefined, 'this.anchorX_ should be defined'); - goog.asserts.assert(goog.isDef(this.anchorY_), + goog.asserts.assert(this.anchorY_ !== undefined, 'this.anchorY_ should be defined'); - goog.asserts.assert(goog.isDef(this.height_), + goog.asserts.assert(this.height_ !== undefined, 'this.height_ should be defined'); - goog.asserts.assert(goog.isDef(this.opacity_), + goog.asserts.assert(this.opacity_ !== undefined, 'this.opacity_ should be defined'); - goog.asserts.assert(goog.isDef(this.originX_), + goog.asserts.assert(this.originX_ !== undefined, 'this.originX_ should be defined'); - goog.asserts.assert(goog.isDef(this.originY_), + goog.asserts.assert(this.originY_ !== undefined, 'this.originY_ should be defined'); - goog.asserts.assert(goog.isDef(this.rotateWithView_), + goog.asserts.assert(this.rotateWithView_ !== undefined, 'this.rotateWithView_ should be defined'); - goog.asserts.assert(goog.isDef(this.rotation_), + goog.asserts.assert(this.rotation_ !== undefined, 'this.rotation_ should be defined'); - goog.asserts.assert(goog.isDef(this.scale_), + goog.asserts.assert(this.scale_ !== undefined, 'this.scale_ should be defined'); - goog.asserts.assert(goog.isDef(this.width_), + goog.asserts.assert(this.width_ !== undefined, 'this.width_ should be defined'); this.beginGeometry(pointGeometry, feature); var flatCoordinates = pointGeometry.getFlatCoordinates(); @@ -769,25 +769,25 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry = if (goog.isNull(this.image_)) { return; } - goog.asserts.assert(goog.isDef(this.anchorX_), + goog.asserts.assert(this.anchorX_ !== undefined, 'this.anchorX_ should be defined'); - goog.asserts.assert(goog.isDef(this.anchorY_), + goog.asserts.assert(this.anchorY_ !== undefined, 'this.anchorY_ should be defined'); - goog.asserts.assert(goog.isDef(this.height_), + goog.asserts.assert(this.height_ !== undefined, 'this.height_ should be defined'); - goog.asserts.assert(goog.isDef(this.opacity_), + goog.asserts.assert(this.opacity_ !== undefined, 'this.opacity_ should be defined'); - goog.asserts.assert(goog.isDef(this.originX_), + goog.asserts.assert(this.originX_ !== undefined, 'this.originX_ should be defined'); - goog.asserts.assert(goog.isDef(this.originY_), + goog.asserts.assert(this.originY_ !== undefined, 'this.originY_ should be defined'); - goog.asserts.assert(goog.isDef(this.rotateWithView_), + goog.asserts.assert(this.rotateWithView_ !== undefined, 'this.rotateWithView_ should be defined'); - goog.asserts.assert(goog.isDef(this.rotation_), + goog.asserts.assert(this.rotation_ !== undefined, 'this.rotation_ should be defined'); - goog.asserts.assert(goog.isDef(this.scale_), + goog.asserts.assert(this.scale_ !== undefined, 'this.scale_ should be defined'); - goog.asserts.assert(goog.isDef(this.width_), + goog.asserts.assert(this.width_ !== undefined, 'this.width_ should be defined'); this.beginGeometry(multiPointGeometry, feature); var flatCoordinates = multiPointGeometry.getFlatCoordinates(); @@ -1198,7 +1198,7 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = this.instructions.push(fillInstruction); } if (state.strokeStyle !== undefined) { - goog.asserts.assert(goog.isDef(state.lineWidth), + goog.asserts.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; this.instructions.push(strokeInstruction); @@ -1221,7 +1221,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry = return; } if (strokeStyle !== undefined) { - goog.asserts.assert(goog.isDef(state.lineWidth), + goog.asserts.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); @@ -1251,7 +1251,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry = this.instructions.push(fillInstruction); } if (state.strokeStyle !== undefined) { - goog.asserts.assert(goog.isDef(state.lineWidth), + goog.asserts.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); var strokeInstruction = [ol.render.canvas.Instruction.STROKE]; this.instructions.push(strokeInstruction); @@ -1274,7 +1274,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry = return; } if (strokeStyle !== undefined) { - goog.asserts.assert(goog.isDef(state.lineWidth), + goog.asserts.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); @@ -1310,7 +1310,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry = return; } if (strokeStyle !== undefined) { - goog.asserts.assert(goog.isDef(state.lineWidth), + goog.asserts.assert(state.lineWidth !== undefined, 'state.lineWidth should be defined'); } this.setFillStrokeStyles_(); diff --git a/src/ol/render/webgl/webglreplay.js b/src/ol/render/webgl/webglreplay.js index bb9e91f52b..b450e650db 100644 --- a/src/ol/render/webgl/webglreplay.js +++ b/src/ol/render/webgl/webglreplay.js @@ -280,19 +280,20 @@ ol.render.webgl.ImageReplay.prototype.drawAsync = goog.abstractMethod; */ ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) { - goog.asserts.assert(goog.isDef(this.anchorX_), 'anchorX is defined'); - goog.asserts.assert(goog.isDef(this.anchorY_), 'anchorY is defined'); - goog.asserts.assert(goog.isDef(this.height_), 'height is defined'); - goog.asserts.assert(goog.isDef(this.imageHeight_), 'imageHeight is defined'); - goog.asserts.assert(goog.isDef(this.imageWidth_), 'imageWidth is defined'); - goog.asserts.assert(goog.isDef(this.opacity_), 'opacity is defined'); - goog.asserts.assert(goog.isDef(this.originX_), 'originX is defined'); - goog.asserts.assert(goog.isDef(this.originY_), 'originY is defined'); - goog.asserts.assert(goog.isDef(this.rotateWithView_), + goog.asserts.assert(this.anchorX_ !== undefined, 'anchorX is defined'); + goog.asserts.assert(this.anchorY_ !== undefined, 'anchorY is defined'); + goog.asserts.assert(this.height_ !== undefined, 'height is defined'); + goog.asserts.assert(this.imageHeight_ !== undefined, + 'imageHeight is defined'); + goog.asserts.assert(this.imageWidth_ !== undefined, 'imageWidth is defined'); + goog.asserts.assert(this.opacity_ !== undefined, 'opacity is defined'); + goog.asserts.assert(this.originX_ !== undefined, 'originX is defined'); + goog.asserts.assert(this.originY_ !== undefined, 'originY is defined'); + goog.asserts.assert(this.rotateWithView_ !== undefined, 'rotateWithView is defined'); - goog.asserts.assert(goog.isDef(this.rotation_), 'rotation is defined'); - goog.asserts.assert(goog.isDef(this.scale_), 'scale is defined'); - goog.asserts.assert(goog.isDef(this.width_), 'width is defined'); + goog.asserts.assert(this.rotation_ !== undefined, 'rotation is defined'); + goog.asserts.assert(this.scale_ !== undefined, 'scale is defined'); + goog.asserts.assert(this.width_ !== undefined, 'width is defined'); var anchorX = this.anchorX_; var anchorY = this.anchorY_; var height = this.height_; diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index 4e2da51682..490bd7e2a2 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -32,20 +32,20 @@ ol.source.BingMaps = function(options) { projection: ol.proj.get('EPSG:3857'), state: ol.source.State.LOADING, tileLoadFunction: options.tileLoadFunction, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); /** * @private * @type {string} */ - this.culture_ = goog.isDef(options.culture) ? options.culture : 'en-us'; + this.culture_ = options.culture !== undefined ? options.culture : 'en-us'; /** * @private * @type {number} */ - this.maxZoom_ = goog.isDef(options.maxZoom) ? options.maxZoom : -1; + this.maxZoom_ = options.maxZoom !== undefined ? options.maxZoom : -1; var uri = new goog.Uri( 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/' + diff --git a/src/ol/source/clustersource.js b/src/ol/source/clustersource.js index d1e15c01c3..c2ba38a1d0 100644 --- a/src/ol/source/clustersource.js +++ b/src/ol/source/clustersource.js @@ -42,7 +42,7 @@ ol.source.Cluster = function(options) { * @type {number} * @private */ - this.distance_ = goog.isDef(options.distance) ? options.distance : 20; + this.distance_ = options.distance !== undefined ? options.distance : 20; /** * @type {Array.} diff --git a/src/ol/source/imagecanvassource.js b/src/ol/source/imagecanvassource.js index 16e390ea17..ba8e8a15f4 100644 --- a/src/ol/source/imagecanvassource.js +++ b/src/ol/source/imagecanvassource.js @@ -23,7 +23,7 @@ ol.source.ImageCanvas = function(options) { logo: options.logo, projection: options.projection, resolutions: options.resolutions, - state: goog.isDef(options.state) ? + state: options.state !== undefined ? /** @type {ol.source.State} */ (options.state) : undefined }); @@ -49,7 +49,7 @@ ol.source.ImageCanvas = function(options) { * @private * @type {number} */ - this.ratio_ = goog.isDef(options.ratio) ? + this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5; }; diff --git a/src/ol/source/imagemapguidesource.js b/src/ol/source/imagemapguidesource.js index e3bad37c7e..899d8663d0 100644 --- a/src/ol/source/imagemapguidesource.js +++ b/src/ol/source/imagemapguidesource.js @@ -34,20 +34,20 @@ ol.source.ImageMapGuide = function(options) { * @type {?string} */ this.crossOrigin_ = - goog.isDef(options.crossOrigin) ? options.crossOrigin : null; + options.crossOrigin !== undefined ? options.crossOrigin : null; /** * @private * @type {number} */ - this.displayDpi_ = goog.isDef(options.displayDpi) ? + this.displayDpi_ = options.displayDpi !== undefined ? options.displayDpi : 96; /** * @private * @type {Object} */ - this.params_ = goog.isDef(options.params) ? options.params : {}; + this.params_ = options.params !== undefined ? options.params : {}; var imageUrlFunction; if (options.url !== undefined) { @@ -67,33 +67,33 @@ ol.source.ImageMapGuide = function(options) { * @private * @type {ol.ImageLoadFunctionType} */ - this.imageLoadFunction_ = goog.isDef(options.imageLoadFunction) ? + this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; /** * @private * @type {boolean} */ - this.hidpi_ = goog.isDef(options.hidpi) ? options.hidpi : true; + this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; /** * @private * @type {number} */ - this.metersPerUnit_ = goog.isDef(options.metersPerUnit) ? + this.metersPerUnit_ = options.metersPerUnit !== undefined ? options.metersPerUnit : 1; /** * @private * @type {number} */ - this.ratio_ = goog.isDef(options.ratio) ? options.ratio : 1; + this.ratio_ = options.ratio !== undefined ? options.ratio : 1; /** * @private * @type {boolean} */ - this.useOverlay_ = goog.isDef(options.useOverlay) ? + this.useOverlay_ = options.useOverlay !== undefined ? options.useOverlay : false; /** diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js index 38f726b0eb..2865fb6511 100644 --- a/src/ol/source/imagesource.js +++ b/src/ol/source/imagesource.js @@ -48,7 +48,7 @@ ol.source.Image = function(options) { * @private * @type {Array.} */ - this.resolutions_ = goog.isDef(options.resolutions) ? + this.resolutions_ = options.resolutions !== undefined ? options.resolutions : null; goog.asserts.assert(goog.isNull(this.resolutions_) || goog.array.isSorted(this.resolutions_, diff --git a/src/ol/source/imagestaticsource.js b/src/ol/source/imagestaticsource.js index fe7529c477..8bffee68fe 100644 --- a/src/ol/source/imagestaticsource.js +++ b/src/ol/source/imagestaticsource.js @@ -21,7 +21,7 @@ goog.require('ol.source.Image'); */ ol.source.ImageStatic = function(options) { - var attributions = goog.isDef(options.attributions) ? + var attributions = options.attributions !== undefined ? options.attributions : null; var imageExtent = options.imageExtent; @@ -32,11 +32,11 @@ ol.source.ImageStatic = function(options) { resolutions = [resolution]; } - var crossOrigin = goog.isDef(options.crossOrigin) ? + var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : null; var /** @type {ol.ImageLoadFunctionType} */ imageLoadFunction = - goog.isDef(options.imageLoadFunction) ? + options.imageLoadFunction !== undefined ? options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; goog.base(this, { diff --git a/src/ol/source/imagewmssource.js b/src/ol/source/imagewmssource.js index 4f99ac2a82..9b1b51df26 100644 --- a/src/ol/source/imagewmssource.js +++ b/src/ol/source/imagewmssource.js @@ -45,7 +45,7 @@ ol.source.ImageWMS = function(opt_options) { * @type {?string} */ this.crossOrigin_ = - goog.isDef(options.crossOrigin) ? options.crossOrigin : null; + options.crossOrigin !== undefined ? options.crossOrigin : null; /** * @private @@ -57,7 +57,7 @@ ol.source.ImageWMS = function(opt_options) { * @private * @type {ol.ImageLoadFunctionType} */ - this.imageLoadFunction_ = goog.isDef(options.imageLoadFunction) ? + this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; /** @@ -84,7 +84,7 @@ ol.source.ImageWMS = function(opt_options) { * @private * @type {boolean} */ - this.hidpi_ = goog.isDef(options.hidpi) ? options.hidpi : true; + this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; /** * @private @@ -108,7 +108,7 @@ ol.source.ImageWMS = function(opt_options) { * @private * @type {number} */ - this.ratio_ = goog.isDef(options.ratio) ? options.ratio : 1.5; + this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5; }; goog.inherits(ol.source.ImageWMS, ol.source.Image); @@ -281,7 +281,7 @@ ol.source.ImageWMS.prototype.getImageLoadFunction = function() { ol.source.ImageWMS.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { - goog.asserts.assert(goog.isDef(this.url_), 'url is defined'); + goog.asserts.assert(this.url_ !== undefined, 'url is defined'); params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode(); diff --git a/src/ol/source/mapquestsource.js b/src/ol/source/mapquestsource.js index f073c13f00..69ecc336b7 100644 --- a/src/ol/source/mapquestsource.js +++ b/src/ol/source/mapquestsource.js @@ -31,7 +31,7 @@ ol.source.MapQuest = function(opt_options) { */ this.layer_ = options.layer; - var url = goog.isDef(options.url) ? options.url : + var url = options.url !== undefined ? options.url : 'https://otile{1-4}-s.mqcdn.com/tiles/1.0.0/' + this.layer_ + '/{z}/{x}/{y}.jpg'; diff --git a/src/ol/source/osmsource.js b/src/ol/source/osmsource.js index 9a2c77222c..af17595c5e 100644 --- a/src/ol/source/osmsource.js +++ b/src/ol/source/osmsource.js @@ -25,17 +25,17 @@ ol.source.OSM = function(opt_options) { attributions = [ol.source.OSM.ATTRIBUTION]; } - var crossOrigin = goog.isDef(options.crossOrigin) ? + var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous'; - var url = goog.isDef(options.url) ? + var url = options.url !== undefined ? options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'; goog.base(this, { attributions: attributions, crossOrigin: crossOrigin, opaque: true, - maxZoom: goog.isDef(options.maxZoom) ? options.maxZoom : 19, + maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19, tileLoadFunction: options.tileLoadFunction, url: url, wrapX: options.wrapX diff --git a/src/ol/source/rastersource.js b/src/ol/source/rastersource.js index aaa809da4d..70083ab502 100644 --- a/src/ol/source/rastersource.js +++ b/src/ol/source/rastersource.js @@ -48,14 +48,14 @@ ol.source.Raster = function(options) { * @private * @type {ol.raster.OperationType} */ - this.operationType_ = goog.isDef(options.operationType) ? + this.operationType_ = options.operationType !== undefined ? options.operationType : ol.raster.OperationType.PIXEL; /** * @private * @type {number} */ - this.threads_ = goog.isDef(options.threads) ? options.threads : 1; + this.threads_ = options.threads !== undefined ? options.threads : 1; /** * @private diff --git a/src/ol/source/source.js b/src/ol/source/source.js index fe83c31468..98dc3124ec 100644 --- a/src/ol/source/source.js +++ b/src/ol/source/source.js @@ -57,7 +57,7 @@ ol.source.Source = function(options) { * @private * @type {Array.} */ - this.attributions_ = goog.isDef(options.attributions) ? + this.attributions_ = options.attributions !== undefined ? options.attributions : null; /** @@ -70,14 +70,14 @@ ol.source.Source = function(options) { * @private * @type {ol.source.State} */ - this.state_ = goog.isDef(options.state) ? + this.state_ = options.state !== undefined ? options.state : ol.source.State.READY; /** * @private * @type {boolean} */ - this.wrapX_ = goog.isDef(options.wrapX) ? options.wrapX : false; + this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false; }; goog.inherits(ol.source.Source, ol.Object); diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index ed34cb7988..f49f2d8b98 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -98,7 +98,7 @@ ol.source.Stamen = function(options) { 'known layer configured'); var layerConfig = ol.source.StamenLayerConfig[options.layer]; - var url = goog.isDef(options.url) ? options.url : + var url = options.url !== undefined ? options.url : 'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer + '/{z}/{x}/{y}.' + layerConfig.extension; diff --git a/src/ol/source/tilearcgisrestsource.js b/src/ol/source/tilearcgisrestsource.js index 29c7e19d22..663574695c 100644 --- a/src/ol/source/tilearcgisrestsource.js +++ b/src/ol/source/tilearcgisrestsource.js @@ -34,7 +34,7 @@ ol.source.TileArcGISRest = function(opt_options) { var options = opt_options || {}; - var params = goog.isDef(options.params) ? options.params : {}; + var params = options.params !== undefined ? options.params : {}; goog.base(this, { attributions: options.attributions, @@ -44,11 +44,11 @@ ol.source.TileArcGISRest = function(opt_options) { tileGrid: options.tileGrid, tileLoadFunction: options.tileLoadFunction, tileUrlFunction: goog.bind(this.tileUrlFunction_, this), - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); var urls = options.urls; - if (urls === undefined && goog.isDef(options.url)) { + if (urls === undefined && options.url !== undefined) { urls = ol.TileUrlFunction.expandUrl(options.url); } diff --git a/src/ol/source/tiledebugsource.js b/src/ol/source/tiledebugsource.js index 66b7409fbd..41aed6df4a 100644 --- a/src/ol/source/tiledebugsource.js +++ b/src/ol/source/tiledebugsource.js @@ -92,7 +92,7 @@ ol.source.TileDebug = function(options) { opaque: false, projection: options.projection, tileGrid: options.tileGrid, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); }; diff --git a/src/ol/source/tileimagesource.js b/src/ol/source/tileimagesource.js index 457143f702..1fddb16652 100644 --- a/src/ol/source/tileimagesource.js +++ b/src/ol/source/tileimagesource.js @@ -32,7 +32,7 @@ ol.source.TileImage = function(options) { logo: options.logo, opaque: options.opaque, projection: options.projection, - state: goog.isDef(options.state) ? + state: options.state !== undefined ? /** @type {ol.source.State} */ (options.state) : undefined, tileGrid: options.tileGrid, tilePixelRatio: options.tilePixelRatio, @@ -43,7 +43,7 @@ ol.source.TileImage = function(options) { * @protected * @type {ol.TileUrlFunctionType} */ - this.tileUrlFunction = goog.isDef(options.tileUrlFunction) ? + this.tileUrlFunction = options.tileUrlFunction !== undefined ? options.tileUrlFunction : ol.TileUrlFunction.nullTileUrlFunction; @@ -52,13 +52,13 @@ ol.source.TileImage = function(options) { * @type {?string} */ this.crossOrigin = - goog.isDef(options.crossOrigin) ? options.crossOrigin : null; + options.crossOrigin !== undefined ? options.crossOrigin : null; /** * @protected * @type {ol.TileLoadFunctionType} */ - this.tileLoadFunction = goog.isDef(options.tileLoadFunction) ? + this.tileLoadFunction = options.tileLoadFunction !== undefined ? options.tileLoadFunction : ol.source.TileImage.defaultTileLoadFunction; /** @@ -66,7 +66,7 @@ ol.source.TileImage = function(options) { * @type {function(new: ol.ImageTile, ol.TileCoord, ol.TileState, string, * ?string, ol.TileLoadFunctionType)} */ - this.tileClass = goog.isDef(options.tileClass) ? + this.tileClass = options.tileClass !== undefined ? options.tileClass : ol.ImageTile; }; diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js index 472cfbd181..01982fd896 100644 --- a/src/ol/source/tilejsonsource.js +++ b/src/ol/source/tilejsonsource.js @@ -36,7 +36,7 @@ ol.source.TileJSON = function(options) { projection: ol.proj.get('EPSG:3857'), state: ol.source.State.LOADING, tileLoadFunction: options.tileLoadFunction, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); var request = new goog.net.Jsonp(options.url); @@ -77,7 +77,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) { this.tileUrlFunction = ol.TileUrlFunction.createFromTemplates(tileJSON.tiles); - if (goog.isDef(tileJSON.attribution) && + if (tileJSON.attribution !== undefined && goog.isNull(this.getAttributions())) { var attributionExtent = extent !== undefined ? extent : epsg4326Projection.getExtent(); diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index b0546ecaaa..ad707f5042 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -56,20 +56,20 @@ ol.source.Tile = function(options) { * @private * @type {boolean} */ - this.opaque_ = goog.isDef(options.opaque) ? options.opaque : false; + this.opaque_ = options.opaque !== undefined ? options.opaque : false; /** * @private * @type {number} */ - this.tilePixelRatio_ = goog.isDef(options.tilePixelRatio) ? + this.tilePixelRatio_ = options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1; /** * @protected * @type {ol.tilegrid.TileGrid} */ - this.tileGrid = goog.isDef(options.tileGrid) ? options.tileGrid : null; + this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null; /** * @protected diff --git a/src/ol/source/tileutfgridsource.js b/src/ol/source/tileutfgridsource.js index 4786fd8d70..28e96efabb 100644 --- a/src/ol/source/tileutfgridsource.js +++ b/src/ol/source/tileutfgridsource.js @@ -35,7 +35,7 @@ ol.source.TileUTFGrid = function(options) { * @private * @type {boolean} */ - this.preemptive_ = goog.isDef(options.preemptive) ? + this.preemptive_ = options.preemptive !== undefined ? options.preemptive : true; /** diff --git a/src/ol/source/tilevectorsource.js b/src/ol/source/tilevectorsource.js index 310431a545..af66f75ed9 100644 --- a/src/ol/source/tilevectorsource.js +++ b/src/ol/source/tilevectorsource.js @@ -36,7 +36,7 @@ ol.source.TileVector = function(options) { * @private * @type {ol.format.Feature|undefined} */ - this.format_ = goog.isDef(options.format) ? options.format : null; + this.format_ = options.format !== undefined ? options.format : null; /** * @private @@ -54,7 +54,7 @@ ol.source.TileVector = function(options) { * @private * @type {?ol.TileVectorLoadFunctionType} */ - this.tileLoadFunction_ = goog.isDef(options.tileLoadFunction) ? + this.tileLoadFunction_ = options.tileLoadFunction !== undefined ? options.tileLoadFunction : null; goog.asserts.assert(!goog.isNull(this.format_) || diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index 09c7f6e504..a76089d048 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -35,7 +35,7 @@ ol.source.TileWMS = function(opt_options) { var options = opt_options || {}; - var params = goog.isDef(options.params) ? options.params : {}; + var params = options.params !== undefined ? options.params : {}; var transparent = goog.object.get(params, 'TRANSPARENT', true); @@ -48,11 +48,11 @@ ol.source.TileWMS = function(opt_options) { tileGrid: options.tileGrid, tileLoadFunction: options.tileLoadFunction, tileUrlFunction: goog.bind(this.tileUrlFunction_, this), - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); var urls = options.urls; - if (urls === undefined && goog.isDef(options.url)) { + if (urls === undefined && options.url !== undefined) { urls = ol.TileUrlFunction.expandUrl(options.url); } @@ -66,7 +66,7 @@ ol.source.TileWMS = function(opt_options) { * @private * @type {number} */ - this.gutter_ = goog.isDef(options.gutter) ? options.gutter : 0; + this.gutter_ = options.gutter !== undefined ? options.gutter : 0; /** * @private @@ -91,7 +91,7 @@ ol.source.TileWMS = function(opt_options) { * @private * @type {boolean} */ - this.hidpi_ = goog.isDef(options.hidpi) ? options.hidpi : true; + this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true; /** * @private diff --git a/src/ol/source/vectorsource.js b/src/ol/source/vectorsource.js index 48cd84f0e5..fee984991c 100644 --- a/src/ol/source/vectorsource.js +++ b/src/ol/source/vectorsource.js @@ -82,7 +82,7 @@ ol.source.Vector = function(opt_options) { logo: options.logo, projection: undefined, state: ol.source.State.READY, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); /** @@ -94,7 +94,7 @@ ol.source.Vector = function(opt_options) { if (options.loader !== undefined) { this.loader_ = options.loader; } else if (options.url !== undefined) { - goog.asserts.assert(goog.isDef(options.format), + goog.asserts.assert(options.format !== undefined, 'format must be set when url is set'); // create a XHR feature loader for "url" and "format" this.loader_ = ol.featureloader.xhr(options.url, options.format); @@ -104,11 +104,11 @@ ol.source.Vector = function(opt_options) { * @private * @type {ol.LoadingStrategy} */ - this.strategy_ = goog.isDef(options.strategy) ? options.strategy : + this.strategy_ = options.strategy !== undefined ? options.strategy : ol.loadingstrategy.all; var useSpatialIndex = - goog.isDef(options.useSpatialIndex) ? options.useSpatialIndex : true; + options.useSpatialIndex !== undefined ? options.useSpatialIndex : true; /** * @private diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index 05d646d527..17e24ef6c1 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -43,19 +43,19 @@ ol.source.WMTS = function(options) { * @private * @type {string} */ - this.version_ = goog.isDef(options.version) ? options.version : '1.0.0'; + this.version_ = options.version !== undefined ? options.version : '1.0.0'; /** * @private * @type {string} */ - this.format_ = goog.isDef(options.format) ? options.format : 'image/jpeg'; + this.format_ = options.format !== undefined ? options.format : 'image/jpeg'; /** * @private * @type {Object} */ - this.dimensions_ = goog.isDef(options.dimensions) ? options.dimensions : {}; + this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {}; /** * @private @@ -83,7 +83,7 @@ ol.source.WMTS = function(options) { this.style_ = options.style; var urls = options.urls; - if (urls === undefined && goog.isDef(options.url)) { + if (urls === undefined && options.url !== undefined) { urls = ol.TileUrlFunction.expandUrl(options.url); } @@ -100,7 +100,7 @@ ol.source.WMTS = function(options) { * @private * @type {ol.source.WMTSRequestEncoding} */ - this.requestEncoding_ = goog.isDef(options.requestEncoding) ? + this.requestEncoding_ = options.requestEncoding !== undefined ? /** @type {ol.source.WMTSRequestEncoding} */ (options.requestEncoding) : ol.source.WMTSRequestEncoding.KVP; @@ -190,7 +190,7 @@ ol.source.WMTS = function(options) { tileLoadFunction: options.tileLoadFunction, tilePixelRatio: options.tilePixelRatio, tileUrlFunction: tileUrlFunction, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : false + wrapX: options.wrapX !== undefined ? options.wrapX : false }); }; diff --git a/src/ol/source/xyzsource.js b/src/ol/source/xyzsource.js index 7294c312b2..7b8bdbb0c6 100644 --- a/src/ol/source/xyzsource.js +++ b/src/ol/source/xyzsource.js @@ -28,10 +28,10 @@ goog.require('ol.source.TileImage'); * @api stable */ ol.source.XYZ = function(options) { - var projection = goog.isDef(options.projection) ? + var projection = options.projection !== undefined ? options.projection : 'EPSG:3857'; - var tileGrid = goog.isDef(options.tileGrid) ? options.tileGrid : + var tileGrid = options.tileGrid !== undefined ? options.tileGrid : ol.tilegrid.createXYZ({ extent: ol.tilegrid.extentFromProjection(projection), maxZoom: options.maxZoom, @@ -53,7 +53,7 @@ ol.source.XYZ = function(options) { tileLoadFunction: options.tileLoadFunction, tilePixelRatio: options.tilePixelRatio, tileUrlFunction: ol.TileUrlFunction.nullTileUrlFunction, - wrapX: goog.isDef(options.wrapX) ? options.wrapX : true + wrapX: options.wrapX !== undefined ? options.wrapX : true }); if (options.tileUrlFunction !== undefined) { diff --git a/src/ol/source/zoomifysource.js b/src/ol/source/zoomifysource.js index 235b69fccb..ca2166d101 100644 --- a/src/ol/source/zoomifysource.js +++ b/src/ol/source/zoomifysource.js @@ -36,7 +36,7 @@ ol.source.Zoomify = function(opt_options) { var options = opt_options || {}; var size = options.size; - var tierSizeCalculation = goog.isDef(options.tierSizeCalculation) ? + var tierSizeCalculation = options.tierSizeCalculation !== undefined ? options.tierSizeCalculation : ol.source.ZoomifyTierSizeCalculation.DEFAULT; diff --git a/src/ol/style/atlasmanager.js b/src/ol/style/atlasmanager.js index 33cc672112..01967f8bcd 100644 --- a/src/ol/style/atlasmanager.js +++ b/src/ol/style/atlasmanager.js @@ -47,7 +47,7 @@ ol.style.AtlasManager = function(opt_options) { * @private * @type {number} */ - this.currentSize_ = goog.isDef(options.initialSize) ? + this.currentSize_ = options.initialSize !== undefined ? options.initialSize : ol.INITIAL_ATLAS_SIZE; /** @@ -55,9 +55,9 @@ ol.style.AtlasManager = function(opt_options) { * @private * @type {number} */ - this.maxSize_ = goog.isDef(options.maxSize) ? + this.maxSize_ = options.maxSize !== undefined ? options.maxSize : ol.MAX_ATLAS_SIZE != -1 ? - ol.MAX_ATLAS_SIZE : goog.isDef(ol.WEBGL_MAX_TEXTURE_SIZE) ? + ol.MAX_ATLAS_SIZE : ol.WEBGL_MAX_TEXTURE_SIZE !== undefined ? ol.WEBGL_MAX_TEXTURE_SIZE : 2048; /** @@ -65,7 +65,7 @@ ol.style.AtlasManager = function(opt_options) { * @private * @type {number} */ - this.space_ = goog.isDef(options.space) ? options.space : 1; + this.space_ = options.space !== undefined ? options.space : 1; /** * @private diff --git a/src/ol/style/circlestyle.js b/src/ol/style/circlestyle.js index 9de1b18d4e..34eb334b87 100644 --- a/src/ol/style/circlestyle.js +++ b/src/ol/style/circlestyle.js @@ -50,13 +50,13 @@ ol.style.Circle = function(opt_options) { * @private * @type {ol.style.Fill} */ - this.fill_ = goog.isDef(options.fill) ? options.fill : null; + this.fill_ = options.fill !== undefined ? options.fill : null; /** * @private * @type {ol.style.Stroke} */ - this.stroke_ = goog.isDef(options.stroke) ? options.stroke : null; + this.stroke_ = options.stroke !== undefined ? options.stroke : null; /** * @private @@ -99,7 +99,7 @@ ol.style.Circle = function(opt_options) { /** * @type {boolean} */ - var snapToPixel = goog.isDef(options.snapToPixel) ? + var snapToPixel = options.snapToPixel !== undefined ? options.snapToPixel : true; goog.base(this, { @@ -435,7 +435,7 @@ ol.style.Circle.prototype.getChecksum = function() { if (recalculate) { var checksum = 'c' + strokeChecksum + fillChecksum + - (goog.isDef(this.radius_) ? this.radius_.toString() : '-'); + (this.radius_ !== undefined ? this.radius_.toString() : '-'); this.checksums_ = [checksum, strokeChecksum, fillChecksum, this.radius_]; } diff --git a/src/ol/style/fillstyle.js b/src/ol/style/fillstyle.js index 19895f0c86..5b9d320bc7 100644 --- a/src/ol/style/fillstyle.js +++ b/src/ol/style/fillstyle.js @@ -22,7 +22,7 @@ ol.style.Fill = function(opt_options) { * @private * @type {ol.Color|string} */ - this.color_ = goog.isDef(options.color) ? options.color : null; + this.color_ = options.color !== undefined ? options.color : null; /** * @private diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index df3d85452b..e65dc9b4b0 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -55,7 +55,7 @@ ol.style.Icon = function(opt_options) { * @private * @type {Array.} */ - this.anchor_ = goog.isDef(options.anchor) ? options.anchor : [0.5, 0.5]; + this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5]; /** * @private @@ -67,38 +67,38 @@ ol.style.Icon = function(opt_options) { * @private * @type {ol.style.IconOrigin} */ - this.anchorOrigin_ = goog.isDef(options.anchorOrigin) ? + this.anchorOrigin_ = options.anchorOrigin !== undefined ? options.anchorOrigin : ol.style.IconOrigin.TOP_LEFT; /** * @private * @type {ol.style.IconAnchorUnits} */ - this.anchorXUnits_ = goog.isDef(options.anchorXUnits) ? + this.anchorXUnits_ = options.anchorXUnits !== undefined ? options.anchorXUnits : ol.style.IconAnchorUnits.FRACTION; /** * @private * @type {ol.style.IconAnchorUnits} */ - this.anchorYUnits_ = goog.isDef(options.anchorYUnits) ? + this.anchorYUnits_ = options.anchorYUnits !== undefined ? options.anchorYUnits : ol.style.IconAnchorUnits.FRACTION; /** * @type {?string} */ var crossOrigin = - goog.isDef(options.crossOrigin) ? options.crossOrigin : null; + options.crossOrigin !== undefined ? options.crossOrigin : null; /** * @type {Image} */ - var image = goog.isDef(options.img) ? options.img : null; + var image = options.img !== undefined ? options.img : null; /** * @type {ol.Size} */ - var imgSize = goog.isDef(options.imgSize) ? options.imgSize : null; + var imgSize = options.imgSize !== undefined ? options.imgSize : null; /** * @type {string|undefined} @@ -123,7 +123,7 @@ ol.style.Icon = function(opt_options) { /** * @type {ol.style.ImageState} */ - var imageState = goog.isDef(options.src) ? + var imageState = options.src !== undefined ? ol.style.ImageState.IDLE : ol.style.ImageState.LOADED; /** @@ -137,13 +137,13 @@ ol.style.Icon = function(opt_options) { * @private * @type {Array.} */ - this.offset_ = goog.isDef(options.offset) ? options.offset : [0, 0]; + this.offset_ = options.offset !== undefined ? options.offset : [0, 0]; /** * @private * @type {ol.style.IconOrigin} */ - this.offsetOrigin_ = goog.isDef(options.offsetOrigin) ? + this.offsetOrigin_ = options.offsetOrigin !== undefined ? options.offsetOrigin : ol.style.IconOrigin.TOP_LEFT; /** @@ -156,33 +156,33 @@ ol.style.Icon = function(opt_options) { * @private * @type {ol.Size} */ - this.size_ = goog.isDef(options.size) ? options.size : null; + this.size_ = options.size !== undefined ? options.size : null; /** * @type {number} */ - var opacity = goog.isDef(options.opacity) ? options.opacity : 1; + var opacity = options.opacity !== undefined ? options.opacity : 1; /** * @type {boolean} */ - var rotateWithView = goog.isDef(options.rotateWithView) ? + var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false; /** * @type {number} */ - var rotation = goog.isDef(options.rotation) ? options.rotation : 0; + var rotation = options.rotation !== undefined ? options.rotation : 0; /** * @type {number} */ - var scale = goog.isDef(options.scale) ? options.scale : 1; + var scale = options.scale !== undefined ? options.scale : 1; /** * @type {boolean} */ - var snapToPixel = goog.isDef(options.snapToPixel) ? + var snapToPixel = options.snapToPixel !== undefined ? options.snapToPixel : true; goog.base(this, { @@ -553,7 +553,7 @@ ol.style.IconImage_.prototype.getSrc = function() { */ ol.style.IconImage_.prototype.load = function() { if (this.imageState_ == ol.style.ImageState.IDLE) { - goog.asserts.assert(goog.isDef(this.src_), + goog.asserts.assert(this.src_ !== undefined, 'this.src_ must not be undefined'); goog.asserts.assert(goog.isNull(this.imageListenerKeys_), 'no listener keys existing'); diff --git a/src/ol/style/regularshapestyle.js b/src/ol/style/regularshapestyle.js index 315f8f49cc..2994738547 100644 --- a/src/ol/style/regularshapestyle.js +++ b/src/ol/style/regularshapestyle.js @@ -30,7 +30,7 @@ goog.require('ol.style.Stroke'); ol.style.RegularShape = function(options) { goog.asserts.assert( - goog.isDef(options.radius) || goog.isDef(options.radius1), + options.radius !== undefined || options.radius1 !== undefined, 'must provide either "radius" or "radius1"'); /** @@ -55,7 +55,7 @@ ol.style.RegularShape = function(options) { * @private * @type {ol.style.Fill} */ - this.fill_ = goog.isDef(options.fill) ? options.fill : null; + this.fill_ = options.fill !== undefined ? options.fill : null; /** * @private @@ -73,7 +73,7 @@ ol.style.RegularShape = function(options) { * @private * @type {number} */ - this.radius_ = /** @type {number} */ (goog.isDef(options.radius) ? + this.radius_ = /** @type {number} */ (options.radius !== undefined ? options.radius : options.radius1); /** @@ -81,19 +81,19 @@ ol.style.RegularShape = function(options) { * @type {number} */ this.radius2_ = - goog.isDef(options.radius2) ? options.radius2 : this.radius_; + options.radius2 !== undefined ? options.radius2 : this.radius_; /** * @private * @type {number} */ - this.angle_ = goog.isDef(options.angle) ? options.angle : 0; + this.angle_ = options.angle !== undefined ? options.angle : 0; /** * @private * @type {ol.style.Stroke} */ - this.stroke_ = goog.isDef(options.stroke) ? options.stroke : null; + this.stroke_ = options.stroke !== undefined ? options.stroke : null; /** * @private @@ -124,13 +124,13 @@ ol.style.RegularShape = function(options) { /** * @type {boolean} */ - var snapToPixel = goog.isDef(options.snapToPixel) ? + var snapToPixel = options.snapToPixel !== undefined ? options.snapToPixel : true; goog.base(this, { opacity: 1, rotateWithView: false, - rotation: goog.isDef(options.rotation) ? options.rotation : 0, + rotation: options.rotation !== undefined ? options.rotation : 0, scale: 1, snapToPixel: snapToPixel }); @@ -536,10 +536,10 @@ ol.style.RegularShape.prototype.getChecksum = function() { if (recalculate) { var checksum = 'r' + strokeChecksum + fillChecksum + - (goog.isDef(this.radius_) ? this.radius_.toString() : '-') + - (goog.isDef(this.radius2_) ? this.radius2_.toString() : '-') + - (goog.isDef(this.angle_) ? this.angle_.toString() : '-') + - (goog.isDef(this.points_) ? this.points_.toString() : '-'); + (this.radius_ !== undefined ? this.radius_.toString() : '-') + + (this.radius2_ !== undefined ? this.radius2_.toString() : '-') + + (this.angle_ !== undefined ? this.angle_.toString() : '-') + + (this.points_ !== undefined ? this.points_.toString() : '-'); this.checksums_ = [checksum, strokeChecksum, fillChecksum, this.radius_, this.radius2_, this.angle_, this.points_]; } diff --git a/src/ol/style/strokestyle.js b/src/ol/style/strokestyle.js index 1fbd7a9a02..230f32e1fc 100644 --- a/src/ol/style/strokestyle.js +++ b/src/ol/style/strokestyle.js @@ -27,7 +27,7 @@ ol.style.Stroke = function(opt_options) { * @private * @type {ol.Color|string} */ - this.color_ = goog.isDef(options.color) ? options.color : null; + this.color_ = options.color !== undefined ? options.color : null; /** * @private @@ -39,7 +39,7 @@ ol.style.Stroke = function(opt_options) { * @private * @type {Array.} */ - this.lineDash_ = goog.isDef(options.lineDash) ? options.lineDash : null; + this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null; /** * @private @@ -207,15 +207,15 @@ ol.style.Stroke.prototype.getChecksum = function() { var raw = 's' + (!goog.isNull(this.color_) ? ol.color.asString(this.color_) : '-') + ',' + - (goog.isDef(this.lineCap_) ? + (this.lineCap_ !== undefined ? this.lineCap_.toString() : '-') + ',' + (!goog.isNull(this.lineDash_) ? this.lineDash_.toString() : '-') + ',' + - (goog.isDef(this.lineJoin_) ? + (this.lineJoin_ !== undefined ? this.lineJoin_ : '-') + ',' + - (goog.isDef(this.miterLimit_) ? + (this.miterLimit_ !== undefined ? this.miterLimit_.toString() : '-') + ',' + - (goog.isDef(this.width_) ? + (this.width_ !== undefined ? this.width_.toString() : '-'); var md5 = new goog.crypt.Md5(); diff --git a/src/ol/style/style.js b/src/ol/style/style.js index 9b43147456..8cb9910baa 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -48,25 +48,25 @@ ol.style.Style = function(opt_options) { * @private * @type {ol.style.Fill} */ - this.fill_ = goog.isDef(options.fill) ? options.fill : null; + this.fill_ = options.fill !== undefined ? options.fill : null; /** * @private * @type {ol.style.Image} */ - this.image_ = goog.isDef(options.image) ? options.image : null; + this.image_ = options.image !== undefined ? options.image : null; /** * @private * @type {ol.style.Stroke} */ - this.stroke_ = goog.isDef(options.stroke) ? options.stroke : null; + this.stroke_ = options.stroke !== undefined ? options.stroke : null; /** * @private * @type {ol.style.Text} */ - this.text_ = goog.isDef(options.text) ? options.text : null; + this.text_ = options.text !== undefined ? options.text : null; /** * @private diff --git a/src/ol/style/textstyle.js b/src/ol/style/textstyle.js index a8e127047b..f2ff125499 100644 --- a/src/ol/style/textstyle.js +++ b/src/ol/style/textstyle.js @@ -57,26 +57,26 @@ ol.style.Text = function(opt_options) { * @private * @type {ol.style.Fill} */ - this.fill_ = goog.isDef(options.fill) ? options.fill : + this.fill_ = options.fill !== undefined ? options.fill : new ol.style.Fill({color: ol.style.Text.DEFAULT_FILL_COLOR_}); /** * @private * @type {ol.style.Stroke} */ - this.stroke_ = goog.isDef(options.stroke) ? options.stroke : null; + this.stroke_ = options.stroke !== undefined ? options.stroke : null; /** * @private * @type {number} */ - this.offsetX_ = goog.isDef(options.offsetX) ? options.offsetX : 0; + this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0; /** * @private * @type {number} */ - this.offsetY_ = goog.isDef(options.offsetY) ? options.offsetY : 0; + this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0; }; diff --git a/src/ol/tilegrid/tilegrid.js b/src/ol/tilegrid/tilegrid.js index 8eb794267b..8d6073eb2a 100644 --- a/src/ol/tilegrid/tilegrid.js +++ b/src/ol/tilegrid/tilegrid.js @@ -36,7 +36,7 @@ ol.tilegrid.TileGrid = function(options) { * @protected * @type {number} */ - this.minZoom = goog.isDef(options.minZoom) ? options.minZoom : 0; + this.minZoom = options.minZoom !== undefined ? options.minZoom : 0; /** * @private @@ -57,7 +57,7 @@ ol.tilegrid.TileGrid = function(options) { * @private * @type {ol.Coordinate} */ - this.origin_ = goog.isDef(options.origin) ? options.origin : null; + this.origin_ = options.origin !== undefined ? options.origin : null; /** * @private @@ -97,7 +97,7 @@ ol.tilegrid.TileGrid = function(options) { * @private * @type {number|ol.Size} */ - this.tileSize_ = goog.isDef(options.tileSize) ? + this.tileSize_ = options.tileSize !== undefined ? options.tileSize : goog.isNull(this.tileSizes_) ? ol.DEFAULT_TILE_SIZE : null; goog.asserts.assert( diff --git a/src/ol/view.js b/src/ol/view.js index b787868f9e..137fa94dd0 100644 --- a/src/ol/view.js +++ b/src/ol/view.js @@ -112,7 +112,7 @@ ol.View = function(opt_options) { * @type {Object.} */ var properties = {}; - properties[ol.ViewProperty.CENTER] = goog.isDef(options.center) ? + properties[ol.ViewProperty.CENTER] = options.center !== undefined ? options.center : null; /** @@ -161,7 +161,7 @@ ol.View = function(opt_options) { this.maxResolution_, options.zoom - this.minZoom_); } properties[ol.ViewProperty.ROTATION] = - goog.isDef(options.rotation) ? options.rotation : 0; + options.rotation !== undefined ? options.rotation : 0; this.setProperties(properties); }; goog.inherits(ol.View, ol.Object); @@ -458,10 +458,10 @@ ol.View.prototype.fit = function(geometry, size, opt_options) { var options = opt_options || {}; - var padding = goog.isDef(options.padding) ? options.padding : [0, 0, 0, 0]; - var constrainResolution = goog.isDef(options.constrainResolution) ? + var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0]; + var constrainResolution = options.constrainResolution !== undefined ? options.constrainResolution : true; - var nearest = goog.isDef(options.nearest) ? options.nearest : false; + var nearest = options.nearest !== undefined ? options.nearest : false; var minResolution; if (options.minResolution !== undefined) { minResolution = options.minResolution; @@ -662,13 +662,13 @@ ol.View.createResolutionConstraint_ = function(options) { var defaultMaxZoom = 28; var defaultZoomFactor = 2; - var minZoom = goog.isDef(options.minZoom) ? + var minZoom = options.minZoom !== undefined ? options.minZoom : ol.DEFAULT_MIN_ZOOM; - var maxZoom = goog.isDef(options.maxZoom) ? + var maxZoom = options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom; - var zoomFactor = goog.isDef(options.zoomFactor) ? + var zoomFactor = options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor; if (options.resolutions !== undefined) { @@ -734,7 +734,7 @@ ol.View.createResolutionConstraint_ = function(options) { * @return {ol.RotationConstraintType} Rotation constraint. */ ol.View.createRotationConstraint_ = function(options) { - var enableRotation = goog.isDef(options.enableRotation) ? + var enableRotation = options.enableRotation !== undefined ? options.enableRotation : true; if (enableRotation) { var constrainRotation = options.constrainRotation; diff --git a/src/ol/xml.js b/src/ol/xml.js index 622b18569e..b45fdbe183 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -194,7 +194,7 @@ ol.xml.isNode_ = function(value) { * @return {boolean} Is node. */ ol.xml.isNodeIE_ = function(value) { - return goog.isObject(value) && goog.isDef(value.nodeType); + return goog.isObject(value) && value.nodeType !== undefined; };