Inline simple goog.isDef() checks

This commit is contained in:
Tim Schaub
2015-09-27 10:18:44 -06:00
parent cf5eadebaa
commit 7659e47e07
22 changed files with 59 additions and 59 deletions

View File

@@ -15,7 +15,7 @@ goog.require('goog.asserts');
ol.geom.flat.flip.flipXY = ol.geom.flat.flip.flipXY =
function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) { function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
var dest, destOffset; var dest, destOffset;
if (goog.isDef(opt_dest)) { if (opt_dest !== undefined) {
dest = opt_dest; dest = opt_dest;
destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0; destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0;
} else { } else {

View File

@@ -78,7 +78,7 @@ goog.inherits(ol.Image, ol.ImageBase);
* @api * @api
*/ */
ol.Image.prototype.getImage = function(opt_context) { ol.Image.prototype.getImage = function(opt_context) {
if (goog.isDef(opt_context)) { if (opt_context !== undefined) {
var image; var image;
var key = goog.getUid(opt_context); var key = goog.getUid(opt_context);
if (key in this.imageByContext_) { if (key in this.imageByContext_) {

View File

@@ -81,7 +81,7 @@ ol.ImageTile.prototype.disposeInternal = function() {
* @api * @api
*/ */
ol.ImageTile.prototype.getImage = function(opt_context) { ol.ImageTile.prototype.getImage = function(opt_context) {
if (goog.isDef(opt_context)) { if (opt_context !== undefined) {
var image; var image;
var key = goog.getUid(opt_context); var key = goog.getUid(opt_context);
if (key in this.imageByContext_) { if (key in this.imageByContext_) {

View File

@@ -116,7 +116,7 @@ ol.Object = function(opt_values) {
*/ */
this.values_ = {}; this.values_ = {};
if (goog.isDef(opt_values)) { if (opt_values !== undefined) {
this.setProperties(opt_values); this.setProperties(opt_values);
} }
}; };

View File

@@ -148,7 +148,7 @@ ol.proj.Projection = function(options) {
if (ol.ENABLE_PROJ4JS && typeof proj4 == 'function' && if (ol.ENABLE_PROJ4JS && typeof proj4 == 'function' &&
!goog.isDef(projections[code])) { !goog.isDef(projections[code])) {
var def = proj4.defs(code); var def = proj4.defs(code);
if (goog.isDef(def)) { if (def !== undefined) {
if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) { if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) {
this.axisOrientation_ = def.axis; this.axisOrientation_ = def.axis;
} }
@@ -165,7 +165,7 @@ ol.proj.Projection = function(options) {
var currentCode, currentDef, currentProj, proj4Transform; var currentCode, currentDef, currentProj, proj4Transform;
for (currentCode in projections) { for (currentCode in projections) {
currentDef = proj4.defs(currentCode); currentDef = proj4.defs(currentCode);
if (goog.isDef(currentDef)) { if (currentDef !== undefined) {
currentProj = ol.proj.get(currentCode); currentProj = ol.proj.get(currentCode);
if (currentDef === def) { if (currentDef === def) {
ol.proj.addEquivalentProjections([currentProj, this]); ol.proj.addEquivalentProjections([currentProj, this]);
@@ -361,7 +361,7 @@ ol.proj.Projection.prototype.getPointResolution_ = function(resolution, point) {
vertices.slice(4, 6), vertices.slice(6, 8)); vertices.slice(4, 6), vertices.slice(6, 8));
var pointResolution = (width + height) / 2; var pointResolution = (width + height) / 2;
var metersPerUnit = this.getMetersPerUnit(); var metersPerUnit = this.getMetersPerUnit();
if (goog.isDef(metersPerUnit)) { if (metersPerUnit !== undefined) {
pointResolution /= metersPerUnit; pointResolution /= metersPerUnit;
} }
return pointResolution; return pointResolution;
@@ -761,7 +761,7 @@ ol.proj.identityTransform = function(input, opt_output, opt_dimension) {
*/ */
ol.proj.cloneTransform = function(input, opt_output, opt_dimension) { ol.proj.cloneTransform = function(input, opt_output, opt_dimension) {
var output; var output;
if (goog.isDef(opt_output)) { if (opt_output !== undefined) {
for (var i = 0, ii = input.length; i < ii; ++i) { for (var i = 0, ii = input.length; i < ii; ++i) {
opt_output[i] = input[i]; opt_output[i] = input[i];
} }

View File

@@ -417,7 +417,7 @@ ol.render.canvas.Immediate.prototype.drawRings_ =
ol.render.canvas.Immediate.prototype.drawAsync = function(zIndex, callback) { ol.render.canvas.Immediate.prototype.drawAsync = function(zIndex, callback) {
var zIndexKey = zIndex.toString(); var zIndexKey = zIndex.toString();
var callbacks = this.callbacksByZIndex_[zIndexKey]; var callbacks = this.callbacksByZIndex_[zIndexKey];
if (goog.isDef(callbacks)) { if (callbacks !== undefined) {
callbacks.push(callback); callbacks.push(callback);
} else { } else {
this.callbacksByZIndex_[zIndexKey] = [callback]; this.callbacksByZIndex_[zIndexKey] = [callback];

View File

@@ -406,7 +406,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i; ++i;
break; break;
case ol.render.canvas.Instruction.END_GEOMETRY: case ol.render.canvas.Instruction.END_GEOMETRY:
if (goog.isDef(featureCallback)) { if (featureCallback !== undefined) {
feature = /** @type {ol.Feature} */ (instruction[1]); feature = /** @type {ol.Feature} */ (instruction[1]);
var result = featureCallback(feature); var result = featureCallback(feature);
if (result) { if (result) {
@@ -1220,7 +1220,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
return; return;
} }
if (goog.isDef(strokeStyle)) { if (strokeStyle !== undefined) {
goog.asserts.assert(goog.isDef(state.lineWidth), goog.asserts.assert(goog.isDef(state.lineWidth),
'state.lineWidth should be defined'); 'state.lineWidth should be defined');
} }
@@ -1273,7 +1273,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
return; return;
} }
if (goog.isDef(strokeStyle)) { if (strokeStyle !== undefined) {
goog.asserts.assert(goog.isDef(state.lineWidth), goog.asserts.assert(goog.isDef(state.lineWidth),
'state.lineWidth should be defined'); 'state.lineWidth should be defined');
} }
@@ -1309,7 +1309,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) { if (!goog.isDef(fillStyle) && !goog.isDef(strokeStyle)) {
return; return;
} }
if (goog.isDef(strokeStyle)) { if (strokeStyle !== undefined) {
goog.asserts.assert(goog.isDef(state.lineWidth), goog.asserts.assert(goog.isDef(state.lineWidth),
'state.lineWidth should be defined'); 'state.lineWidth should be defined');
} }
@@ -1446,7 +1446,7 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
[ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle]); [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle]);
state.currentFillStyle = state.fillStyle; state.currentFillStyle = state.fillStyle;
} }
if (goog.isDef(strokeStyle)) { if (strokeStyle !== undefined) {
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined'); goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null'); goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
goog.asserts.assert(goog.isDef(lineJoin), 'lineJoin should be defined'); goog.asserts.assert(goog.isDef(lineJoin), 'lineJoin should be defined');
@@ -1984,7 +1984,7 @@ ol.render.canvas.ReplayGroup.prototype.replay = function(
replays = this.replaysByZIndex_[zs[i].toString()]; replays = this.replaysByZIndex_[zs[i].toString()];
for (j = 0, jj = ol.render.REPLAY_ORDER.length; j < jj; ++j) { for (j = 0, jj = ol.render.REPLAY_ORDER.length; j < jj; ++j) {
replay = replays[ol.render.REPLAY_ORDER[j]]; replay = replays[ol.render.REPLAY_ORDER[j]];
if (goog.isDef(replay)) { if (replay !== undefined) {
replay.replay(context, pixelRatio, transform, viewRotation, replay.replay(context, pixelRatio, transform, viewRotation,
skippedFeaturesHash); skippedFeaturesHash);
} }
@@ -2020,7 +2020,7 @@ ol.render.canvas.ReplayGroup.prototype.replayHitDetection_ = function(
replays = this.replaysByZIndex_[zs[i].toString()]; replays = this.replaysByZIndex_[zs[i].toString()];
for (j = ol.render.REPLAY_ORDER.length - 1; j >= 0; --j) { for (j = ol.render.REPLAY_ORDER.length - 1; j >= 0; --j) {
replay = replays[ol.render.REPLAY_ORDER[j]]; replay = replays[ol.render.REPLAY_ORDER[j]];
if (goog.isDef(replay)) { if (replay !== undefined) {
result = replay.replayHitDetection(context, transform, viewRotation, result = replay.replayHitDetection(context, transform, viewRotation,
skippedFeaturesHash, featureCallback, opt_hitExtent); skippedFeaturesHash, featureCallback, opt_hitExtent);
if (result) { if (result) {

View File

@@ -103,7 +103,7 @@ ol.render.webgl.Immediate.prototype.flush = function() {
ol.render.webgl.Immediate.prototype.drawAsync = function(zIndex, callback) { ol.render.webgl.Immediate.prototype.drawAsync = function(zIndex, callback) {
var zIndexKey = zIndex.toString(); var zIndexKey = zIndex.toString();
var callbacks = this.callbacksByZIndex_[zIndexKey]; var callbacks = this.callbacksByZIndex_[zIndexKey];
if (goog.isDef(callbacks)) { if (callbacks !== undefined) {
callbacks.push(callback); callbacks.push(callback);
} else { } else {
this.callbacksByZIndex_[zIndexKey] = [callback]; this.callbacksByZIndex_[zIndexKey] = [callback];

View File

@@ -1078,7 +1078,7 @@ ol.render.webgl.ReplayGroup.prototype.replay = function(context,
var i, ii, replay, result; var i, ii, replay, result;
for (i = 0, ii = ol.render.REPLAY_ORDER.length; i < ii; ++i) { for (i = 0, ii = ol.render.REPLAY_ORDER.length; i < ii; ++i) {
replay = this.replays_[ol.render.REPLAY_ORDER[i]]; replay = this.replays_[ol.render.REPLAY_ORDER[i]];
if (goog.isDef(replay)) { if (replay !== undefined) {
replay.replay(context, replay.replay(context,
center, resolution, rotation, size, pixelRatio, center, resolution, rotation, size, pixelRatio,
opacity, brightness, contrast, hue, saturation, skippedFeaturesHash, opacity, brightness, contrast, hue, saturation, skippedFeaturesHash,
@@ -1117,7 +1117,7 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
var i, replay, result; var i, replay, result;
for (i = ol.render.REPLAY_ORDER.length - 1; i >= 0; --i) { for (i = ol.render.REPLAY_ORDER.length - 1; i >= 0; --i) {
replay = this.replays_[ol.render.REPLAY_ORDER[i]]; replay = this.replays_[ol.render.REPLAY_ORDER[i]];
if (goog.isDef(replay)) { if (replay !== undefined) {
result = replay.replay(context, result = replay.replay(context,
center, resolution, rotation, size, pixelRatio, center, resolution, rotation, size, pixelRatio,
opacity, brightness, contrast, hue, saturation, opacity, brightness, contrast, hue, saturation,

View File

@@ -221,7 +221,7 @@ ol.renderer.Layer.prototype.updateAttributions =
*/ */
ol.renderer.Layer.prototype.updateLogos = function(frameState, source) { ol.renderer.Layer.prototype.updateLogos = function(frameState, source) {
var logo = source.getLogo(); var logo = source.getLogo();
if (goog.isDef(logo)) { if (logo !== undefined) {
if (goog.isString(logo)) { if (goog.isString(logo)) {
frameState.logos[logo] = ''; frameState.logos[logo] = '';
} else if (goog.isObject(logo)) { } else if (goog.isObject(logo)) {
@@ -319,7 +319,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]); tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]);
} }
} }
if (goog.isDef(opt_tileCallback)) { if (opt_tileCallback !== undefined) {
opt_tileCallback.call(opt_this, tile); opt_tileCallback.call(opt_this, tile);
} }
} else { } else {

View File

@@ -25,7 +25,7 @@ ol.ResolutionConstraint.createSnapToResolutions =
* @return {number|undefined} Resolution. * @return {number|undefined} Resolution.
*/ */
function(resolution, delta, direction) { function(resolution, delta, direction) {
if (goog.isDef(resolution)) { if (resolution !== undefined) {
var z = var z =
ol.array.linearFindNearest(resolutions, resolution, direction); ol.array.linearFindNearest(resolutions, resolution, direction);
z = goog.math.clamp(z + delta, 0, resolutions.length - 1); z = goog.math.clamp(z + delta, 0, resolutions.length - 1);
@@ -53,7 +53,7 @@ ol.ResolutionConstraint.createSnapToPower =
* @return {number|undefined} Resolution. * @return {number|undefined} Resolution.
*/ */
function(resolution, delta, direction) { function(resolution, delta, direction) {
if (goog.isDef(resolution)) { if (resolution !== undefined) {
var offset; var offset;
if (direction > 0) { if (direction > 0) {
offset = 0; offset = 0;
@@ -65,7 +65,7 @@ ol.ResolutionConstraint.createSnapToPower =
var oldLevel = Math.floor( var oldLevel = Math.floor(
Math.log(maxResolution / resolution) / Math.log(power) + offset); Math.log(maxResolution / resolution) / Math.log(power) + offset);
var newLevel = Math.max(oldLevel + delta, 0); var newLevel = Math.max(oldLevel + delta, 0);
if (goog.isDef(opt_maxLevel)) { if (opt_maxLevel !== undefined) {
newLevel = Math.min(newLevel, opt_maxLevel); newLevel = Math.min(newLevel, opt_maxLevel);
} }
return maxResolution / Math.pow(power, newLevel); return maxResolution / Math.pow(power, newLevel);

View File

@@ -16,7 +16,7 @@ ol.RotationConstraintType;
* @return {number|undefined} Rotation. * @return {number|undefined} Rotation.
*/ */
ol.RotationConstraint.disable = function(rotation, delta) { ol.RotationConstraint.disable = function(rotation, delta) {
if (goog.isDef(rotation)) { if (rotation !== undefined) {
return 0; return 0;
} else { } else {
return undefined; return undefined;
@@ -30,7 +30,7 @@ ol.RotationConstraint.disable = function(rotation, delta) {
* @return {number|undefined} Rotation. * @return {number|undefined} Rotation.
*/ */
ol.RotationConstraint.none = function(rotation, delta) { ol.RotationConstraint.none = function(rotation, delta) {
if (goog.isDef(rotation)) { if (rotation !== undefined) {
return rotation + delta; return rotation + delta;
} else { } else {
return undefined; return undefined;
@@ -51,7 +51,7 @@ ol.RotationConstraint.createSnapToN = function(n) {
* @return {number|undefined} Rotation. * @return {number|undefined} Rotation.
*/ */
function(rotation, delta) { function(rotation, delta) {
if (goog.isDef(rotation)) { if (rotation !== undefined) {
rotation = Math.floor((rotation + delta) / theta + 0.5) * theta; rotation = Math.floor((rotation + delta) / theta + 0.5) * theta;
return rotation; return rotation;
} else { } else {
@@ -74,7 +74,7 @@ ol.RotationConstraint.createSnapToZero = function(opt_tolerance) {
* @return {number|undefined} Rotation. * @return {number|undefined} Rotation.
*/ */
function(rotation, delta) { function(rotation, delta) {
if (goog.isDef(rotation)) { if (rotation !== undefined) {
if (Math.abs(rotation + delta) <= tolerance) { if (Math.abs(rotation + delta) <= tolerance) {
return 0; return 0;
} else { } else {

View File

@@ -149,7 +149,7 @@ ol.source.ImageMapGuide.prototype.getImage =
var size = [width * pixelRatio, height * pixelRatio]; var size = [width * pixelRatio, height * pixelRatio];
var imageUrl = this.imageUrlFunction_(extent, size, projection); var imageUrl = this.imageUrlFunction_(extent, size, projection);
if (goog.isDef(imageUrl)) { if (imageUrl !== undefined) {
image = new ol.Image(extent, resolution, pixelRatio, image = new ol.Image(extent, resolution, pixelRatio,
this.getAttributions(), imageUrl, this.crossOrigin_, this.getAttributions(), imageUrl, this.crossOrigin_,
this.imageLoadFunction_); this.imageLoadFunction_);

View File

@@ -129,7 +129,7 @@ ol.source.TileVector.prototype.forEachFeatureAtCoordinateAndResolution =
var tileKey = this.getTileKeyZXY_(tileCoord[0], tileCoord[1], tileCoord[2]); var tileKey = this.getTileKeyZXY_(tileCoord[0], tileCoord[1], tileCoord[2]);
var features = tiles[tileKey]; var features = tiles[tileKey];
if (goog.isDef(features)) { if (features !== undefined) {
var i, ii; var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) { for (i = 0, ii = features.length; i < ii; ++i) {
var feature = features[i]; var feature = features[i];
@@ -168,7 +168,7 @@ ol.source.TileVector.prototype.forEachFeatureInExtentAtResolution =
for (y = tileRange.minY; y <= tileRange.maxY; ++y) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
var tileKey = this.getTileKeyZXY_(z, x, y); var tileKey = this.getTileKeyZXY_(z, x, y);
var features = tiles[tileKey]; var features = tiles[tileKey];
if (goog.isDef(features)) { if (features !== undefined) {
var i, ii; var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) { for (i = 0, ii = features.length; i < ii; ++i) {
var result = f.call(opt_this, features[i]); var result = f.call(opt_this, features[i]);
@@ -305,7 +305,7 @@ ol.source.TileVector.prototype.loadFeatures =
tileCoord, projection); tileCoord, projection);
var url = goog.isNull(urlTileCoord) ? undefined : var url = goog.isNull(urlTileCoord) ? undefined :
tileUrlFunction(urlTileCoord, 1, projection); tileUrlFunction(urlTileCoord, 1, projection);
if (goog.isDef(url)) { if (url !== undefined) {
tiles[tileKey] = []; tiles[tileKey] = [];
var tileSuccess = goog.partial(success, tileKey); var tileSuccess = goog.partial(success, tileKey);
if (!goog.isNull(this.tileLoadFunction_)) { if (!goog.isNull(this.tileLoadFunction_)) {

View File

@@ -164,10 +164,10 @@ ol.source.Vector = function(opt_options) {
if (!useSpatialIndex && !goog.isDef(collection)) { if (!useSpatialIndex && !goog.isDef(collection)) {
collection = new ol.Collection(features); collection = new ol.Collection(features);
} }
if (goog.isDef(features)) { if (features !== undefined) {
this.addFeaturesInternal(features); this.addFeaturesInternal(features);
} }
if (goog.isDef(collection)) { if (collection !== undefined) {
this.bindFeaturesCollection_(collection); this.bindFeaturesCollection_(collection);
} }
@@ -246,7 +246,7 @@ ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
ol.source.Vector.prototype.addToIndex_ = function(featureKey, feature) { ol.source.Vector.prototype.addToIndex_ = function(featureKey, feature) {
var valid = true; var valid = true;
var id = feature.getId(); var id = feature.getId();
if (goog.isDef(id)) { if (id !== undefined) {
if (!(id.toString() in this.idIndex_)) { if (!(id.toString() in this.idIndex_)) {
this.idIndex_[id.toString()] = feature; this.idIndex_[id.toString()] = feature;
} else { } else {
@@ -726,7 +726,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
} }
var id = feature.getId(); var id = feature.getId();
var removed; var removed;
if (goog.isDef(id)) { if (id !== undefined) {
var sid = id.toString(); var sid = id.toString();
if (featureKey in this.undefIdIndex_) { if (featureKey in this.undefIdIndex_) {
delete this.undefIdIndex_[featureKey]; delete this.undefIdIndex_[featureKey];
@@ -827,7 +827,7 @@ ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
goog.events.unlistenByKey); goog.events.unlistenByKey);
delete this.featureChangeKeys_[featureKey]; delete this.featureChangeKeys_[featureKey];
var id = feature.getId(); var id = feature.getId();
if (goog.isDef(id)) { if (id !== undefined) {
delete this.idIndex_[id.toString()]; delete this.idIndex_[id.toString()];
} else { } else {
delete this.undefIdIndex_[featureKey]; delete this.undefIdIndex_[featureKey];

View File

@@ -404,7 +404,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
goog.array.forEach(l['Dimension'], function(elt, index, array) { goog.array.forEach(l['Dimension'], function(elt, index, array) {
var key = elt['Identifier']; var key = elt['Identifier'];
var value = elt['default']; var value = elt['default'];
if (goog.isDef(value)) { if (value !== undefined) {
goog.asserts.assert(goog.array.contains(elt['values'], value), goog.asserts.assert(goog.array.contains(elt['values'], value),
'default value contained in values'); 'default value contained in values');
} else { } else {
@@ -432,7 +432,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var wgs84BoundingBox = l['WGS84BoundingBox']; var wgs84BoundingBox = l['WGS84BoundingBox'];
var extent, wrapX; var extent, wrapX;
if (goog.isDef(wgs84BoundingBox)) { if (wgs84BoundingBox !== undefined) {
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent(); var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] && wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]); wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);

View File

@@ -172,7 +172,7 @@ ol.style.Style.prototype.setGeometry = function(geometry) {
}; };
} else if (goog.isNull(geometry)) { } else if (goog.isNull(geometry)) {
this.geometryFunction_ = ol.style.defaultGeometryFunction; this.geometryFunction_ = ol.style.defaultGeometryFunction;
} else if (goog.isDef(geometry)) { } else if (geometry !== undefined) {
goog.asserts.assertInstanceof(geometry, ol.geom.Geometry, goog.asserts.assertInstanceof(geometry, ol.geom.Geometry,
'geometry must be an ol.geom.Geometry instance'); 'geometry must be an ol.geom.Geometry instance');
this.geometryFunction_ = function() { this.geometryFunction_ = function() {

View File

@@ -50,7 +50,7 @@ ol.tilecoord.createFromString = function(str) {
* @return {ol.TileCoord} Tile coordinate. * @return {ol.TileCoord} Tile coordinate.
*/ */
ol.tilecoord.createOrUpdate = function(z, x, y, opt_tileCoord) { ol.tilecoord.createOrUpdate = function(z, x, y, opt_tileCoord) {
if (goog.isDef(opt_tileCoord)) { if (opt_tileCoord !== undefined) {
opt_tileCoord[0] = z; opt_tileCoord[0] = z;
opt_tileCoord[1] = x; opt_tileCoord[1] = x;
opt_tileCoord[2] = y; opt_tileCoord[2] = y;

View File

@@ -79,7 +79,7 @@ ol.TileRange.boundingTileRange = function(var_args) {
* @return {ol.TileRange} Tile range. * @return {ol.TileRange} Tile range.
*/ */
ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) { ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
if (goog.isDef(tileRange)) { if (tileRange !== undefined) {
tileRange.minX = minX; tileRange.minX = minX;
tileRange.maxX = maxX; tileRange.maxX = maxX;
tileRange.minY = minY; tileRange.minY = minY;

View File

@@ -175,7 +175,7 @@ goog.inherits(ol.View, ol.Object);
ol.View.prototype.calculateCenterRotate = function(rotation, anchor) { ol.View.prototype.calculateCenterRotate = function(rotation, anchor) {
var center; var center;
var currentCenter = this.getCenter(); var currentCenter = this.getCenter();
if (goog.isDef(currentCenter)) { if (currentCenter !== undefined) {
center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]]; center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
ol.coordinate.rotate(center, rotation - this.getRotation()); ol.coordinate.rotate(center, rotation - this.getRotation());
ol.coordinate.add(center, anchor); ol.coordinate.add(center, anchor);
@@ -421,7 +421,7 @@ ol.View.prototype.getZoom = function() {
var offset; var offset;
var resolution = this.getResolution(); var resolution = this.getResolution();
if (goog.isDef(resolution)) { if (resolution !== undefined) {
var res, z = 0; var res, z = 0;
do { do {
res = this.constrainResolution(this.maxResolution_, z); res = this.constrainResolution(this.maxResolution_, z);
@@ -564,7 +564,7 @@ ol.View.prototype.isDef = function() {
* @api stable * @api stable
*/ */
ol.View.prototype.rotate = function(rotation, opt_anchor) { ol.View.prototype.rotate = function(rotation, opt_anchor) {
if (goog.isDef(opt_anchor)) { if (opt_anchor !== undefined) {
var center = this.calculateCenterRotate(rotation, opt_anchor); var center = this.calculateCenterRotate(rotation, opt_anchor);
this.setCenter(center); this.setCenter(center);
} }
@@ -695,7 +695,7 @@ ol.View.createResolutionConstraint_ = function(options) {
// user provided maxResolution takes precedence // user provided maxResolution takes precedence
maxResolution = options.maxResolution; maxResolution = options.maxResolution;
if (goog.isDef(maxResolution)) { if (maxResolution !== undefined) {
minZoom = 0; minZoom = 0;
} else { } else {
maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom); maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);

View File

@@ -367,11 +367,11 @@ ol.webgl.Context.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
if (goog.isDef(opt_wrapS)) { if (opt_wrapS !== undefined) {
gl.texParameteri( gl.texParameteri(
goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_S, opt_wrapS); goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_S, opt_wrapS);
} }
if (goog.isDef(opt_wrapT)) { if (opt_wrapT !== undefined) {
gl.texParameteri( gl.texParameteri(
goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_T, opt_wrapT); goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_WRAP_T, opt_wrapT);
} }

View File

@@ -132,7 +132,7 @@ ol.xml.getLocalName_ = function(node) {
*/ */
ol.xml.getLocalNameIE_ = function(node) { ol.xml.getLocalNameIE_ = function(node) {
var localName = node.localName; var localName = node.localName;
if (goog.isDef(localName)) { if (localName !== undefined) {
return localName; return localName;
} }
var baseName = node.baseName; var baseName = node.baseName;
@@ -227,7 +227,7 @@ ol.xml.getAttributeNS_ = function(node, namespaceURI, name) {
ol.xml.getAttributeNSActiveX_ = function(node, namespaceURI, name) { ol.xml.getAttributeNSActiveX_ = function(node, namespaceURI, name) {
var attributeValue = ''; var attributeValue = '';
var attributeNode = ol.xml.getAttributeNodeNS(node, namespaceURI, name); var attributeNode = ol.xml.getAttributeNodeNS(node, namespaceURI, name);
if (goog.isDef(attributeNode)) { if (attributeNode !== undefined) {
attributeValue = attributeNode.nodeValue; attributeValue = attributeNode.nodeValue;
} }
return attributeValue; return attributeValue;
@@ -363,7 +363,7 @@ ol.xml.makeArrayExtender = function(valueReader, opt_this) {
*/ */
function(node, objectStack) { function(node, objectStack) {
var value = valueReader.call(opt_this, node, objectStack); var value = valueReader.call(opt_this, node, objectStack);
if (goog.isDef(value)) { if (value !== undefined) {
goog.asserts.assert(goog.isArray(value), goog.asserts.assert(goog.isArray(value),
'valueReader function is expected to return an array of values'); 'valueReader function is expected to return an array of values');
var array = /** @type {Array.<*>} */ var array = /** @type {Array.<*>} */
@@ -393,7 +393,7 @@ ol.xml.makeArrayPusher = function(valueReader, opt_this) {
function(node, objectStack) { function(node, objectStack) {
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this, var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
node, objectStack); node, objectStack);
if (goog.isDef(value)) { if (value !== undefined) {
var array = objectStack[objectStack.length - 1]; var array = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isArray(array), goog.asserts.assert(goog.isArray(array),
'objectStack is supposed to be an array of arrays'); 'objectStack is supposed to be an array of arrays');
@@ -420,7 +420,7 @@ ol.xml.makeReplacer = function(valueReader, opt_this) {
function(node, objectStack) { function(node, objectStack) {
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this, var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
node, objectStack); node, objectStack);
if (goog.isDef(value)) { if (value !== undefined) {
objectStack[objectStack.length - 1] = value; objectStack[objectStack.length - 1] = value;
} }
}); });
@@ -448,7 +448,7 @@ ol.xml.makeObjectPropertyPusher =
function(node, objectStack) { function(node, objectStack) {
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this, var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
node, objectStack); node, objectStack);
if (goog.isDef(value)) { if (value !== undefined) {
var object = /** @type {Object} */ var object = /** @type {Object} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
var property = goog.isDef(opt_property) ? var property = goog.isDef(opt_property) ?
@@ -482,7 +482,7 @@ ol.xml.makeObjectPropertySetter =
function(node, objectStack) { function(node, objectStack) {
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this, var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
node, objectStack); node, objectStack);
if (goog.isDef(value)) { if (value !== undefined) {
var object = /** @type {Object} */ var object = /** @type {Object} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
var property = goog.isDef(opt_property) ? var property = goog.isDef(opt_property) ?
@@ -658,9 +658,9 @@ ol.xml.parseNode = function(parsersNS, node, objectStack, opt_this) {
var n; var n;
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
var parsers = parsersNS[n.namespaceURI]; var parsers = parsersNS[n.namespaceURI];
if (goog.isDef(parsers)) { if (parsers !== undefined) {
var parser = parsers[n.localName]; var parser = parsers[n.localName];
if (goog.isDef(parser)) { if (parser !== undefined) {
parser.call(opt_this, n, objectStack); parser.call(opt_this, n, objectStack);
} }
} }
@@ -715,10 +715,10 @@ ol.xml.serialize = function(
var value, node; var value, node;
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
value = values[i]; value = values[i];
if (goog.isDef(value)) { if (value !== undefined) {
node = nodeFactory.call(opt_this, value, objectStack, node = nodeFactory.call(opt_this, value, objectStack,
goog.isDef(opt_keys) ? opt_keys[i] : undefined); goog.isDef(opt_keys) ? opt_keys[i] : undefined);
if (goog.isDef(node)) { if (node !== undefined) {
serializersNS[node.namespaceURI][node.localName] serializersNS[node.namespaceURI][node.localName]
.call(opt_this, node, value, objectStack); .call(opt_this, node, value, objectStack);
} }