Inline simple goog.isDef() calls
This commit is contained in:
@@ -17,7 +17,7 @@ ol.geom.flat.flip.flipXY =
|
||||
var dest, destOffset;
|
||||
if (opt_dest !== undefined) {
|
||||
dest = opt_dest;
|
||||
destOffset = goog.isDef(opt_destOffset) ? opt_destOffset : 0;
|
||||
destOffset = opt_destOffset !== undefined ? opt_destOffset : 0;
|
||||
} else {
|
||||
goog.asserts.assert(opt_destOffset === undefined,
|
||||
'opt_destOffSet should be defined');
|
||||
|
||||
@@ -11,7 +11,7 @@ goog.provide('ol.geom.flat.inflate');
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinates =
|
||||
function(flatCoordinates, offset, end, stride, opt_coordinates) {
|
||||
var coordinates = goog.isDef(opt_coordinates) ? opt_coordinates : [];
|
||||
var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];
|
||||
var i = 0;
|
||||
var j;
|
||||
for (j = offset; j < end; j += stride) {
|
||||
@@ -32,7 +32,7 @@ ol.geom.flat.inflate.coordinates =
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatess =
|
||||
function(flatCoordinates, offset, ends, stride, opt_coordinatess) {
|
||||
var coordinatess = goog.isDef(opt_coordinatess) ? opt_coordinatess : [];
|
||||
var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = ends.length; j < jj; ++j) {
|
||||
@@ -57,7 +57,7 @@ ol.geom.flat.inflate.coordinatess =
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatesss =
|
||||
function(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
|
||||
var coordinatesss = goog.isDef(opt_coordinatesss) ? opt_coordinatesss : [];
|
||||
var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = endss.length; j < jj; ++j) {
|
||||
|
||||
@@ -42,7 +42,7 @@ goog.require('ol.math');
|
||||
*/
|
||||
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
|
||||
var simplifiedFlatCoordinates = goog.isDef(opt_simplifiedFlatCoordinates) ?
|
||||
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
|
||||
opt_simplifiedFlatCoordinates : [];
|
||||
if (!highQuality) {
|
||||
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
|
||||
|
||||
@@ -463,18 +463,18 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
||||
var minLonP = worldExtentP[0];
|
||||
|
||||
goog.asserts.assert(!goog.isNull(extent), 'extent cannot be null');
|
||||
goog.asserts.assert(goog.isDef(maxLat), 'maxLat should be defined');
|
||||
goog.asserts.assert(goog.isDef(maxLon), 'maxLon should be defined');
|
||||
goog.asserts.assert(goog.isDef(minLat), 'minLat should be defined');
|
||||
goog.asserts.assert(goog.isDef(minLon), 'minLon should be defined');
|
||||
goog.asserts.assert(maxLat !== undefined, 'maxLat should be defined');
|
||||
goog.asserts.assert(maxLon !== undefined, 'maxLon should be defined');
|
||||
goog.asserts.assert(minLat !== undefined, 'minLat should be defined');
|
||||
goog.asserts.assert(minLon !== undefined, 'minLon should be defined');
|
||||
|
||||
goog.asserts.assert(goog.isDef(maxLatP),
|
||||
goog.asserts.assert(maxLatP !== undefined,
|
||||
'projected maxLat should be defined');
|
||||
goog.asserts.assert(goog.isDef(maxLonP),
|
||||
goog.asserts.assert(maxLonP !== undefined,
|
||||
'projected maxLon should be defined');
|
||||
goog.asserts.assert(goog.isDef(minLatP),
|
||||
goog.asserts.assert(minLatP !== undefined,
|
||||
'projected minLat should be defined');
|
||||
goog.asserts.assert(goog.isDef(minLonP),
|
||||
goog.asserts.assert(minLonP !== undefined,
|
||||
'projected minLon should be defined');
|
||||
|
||||
this.maxLat_ = maxLat;
|
||||
|
||||
@@ -25,9 +25,9 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
||||
* @type {?ol.ImageCanvasLoader}
|
||||
* @private
|
||||
*/
|
||||
this.loader_ = goog.isDef(opt_loader) ? opt_loader : null;
|
||||
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
||||
|
||||
var state = goog.isDef(opt_loader) ?
|
||||
var state = opt_loader !== undefined ?
|
||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||
|
||||
goog.base(this, extent, resolution, pixelRatio, state, attributions);
|
||||
|
||||
@@ -191,7 +191,7 @@ ol.layer.Group.prototype.setLayers = function(layers) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.layer.Group.prototype.getLayersArray = function(opt_array) {
|
||||
var array = goog.isDef(opt_array) ? opt_array : [];
|
||||
var array = opt_array !== undefined ? opt_array : [];
|
||||
this.getLayers().forEach(function(layer) {
|
||||
layer.getLayersArray(array);
|
||||
});
|
||||
@@ -203,7 +203,7 @@ ol.layer.Group.prototype.getLayersArray = function(opt_array) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.layer.Group.prototype.getLayerStatesArray = function(opt_states) {
|
||||
var states = goog.isDef(opt_states) ? opt_states : [];
|
||||
var states = opt_states !== undefined ? opt_states : [];
|
||||
|
||||
var pos = states.length;
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ goog.inherits(ol.Map, ol.Object);
|
||||
*/
|
||||
ol.Map.prototype.addControl = function(control) {
|
||||
var controls = this.getControls();
|
||||
goog.asserts.assert(goog.isDef(controls), 'controls should be defined');
|
||||
goog.asserts.assert(controls !== undefined, 'controls should be defined');
|
||||
controls.push(control);
|
||||
};
|
||||
|
||||
@@ -508,7 +508,7 @@ ol.Map.prototype.addControl = function(control) {
|
||||
*/
|
||||
ol.Map.prototype.addInteraction = function(interaction) {
|
||||
var interactions = this.getInteractions();
|
||||
goog.asserts.assert(goog.isDef(interactions),
|
||||
goog.asserts.assert(interactions !== undefined,
|
||||
'interactions should be defined');
|
||||
interactions.push(interaction);
|
||||
};
|
||||
@@ -534,7 +534,7 @@ ol.Map.prototype.addLayer = function(layer) {
|
||||
*/
|
||||
ol.Map.prototype.addOverlay = function(overlay) {
|
||||
var overlays = this.getOverlays();
|
||||
goog.asserts.assert(goog.isDef(overlays), 'overlays should be defined');
|
||||
goog.asserts.assert(overlays !== undefined, 'overlays should be defined');
|
||||
overlays.push(overlay);
|
||||
};
|
||||
|
||||
@@ -600,10 +600,10 @@ ol.Map.prototype.forEachFeatureAtPixel =
|
||||
return;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
var thisArg = goog.isDef(opt_this) ? opt_this : null;
|
||||
var layerFilter = goog.isDef(opt_layerFilter) ?
|
||||
var thisArg = opt_this !== undefined ? opt_this : null;
|
||||
var layerFilter = opt_layerFilter !== undefined ?
|
||||
opt_layerFilter : goog.functions.TRUE;
|
||||
var thisArg2 = goog.isDef(opt_this2) ? opt_this2 : null;
|
||||
var thisArg2 = opt_this2 !== undefined ? opt_this2 : null;
|
||||
return this.renderer_.forEachFeatureAtCoordinate(
|
||||
coordinate, this.frameState_, callback, thisArg,
|
||||
layerFilter, thisArg2);
|
||||
@@ -637,10 +637,10 @@ ol.Map.prototype.forEachLayerAtPixel =
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
return;
|
||||
}
|
||||
var thisArg = goog.isDef(opt_this) ? opt_this : null;
|
||||
var layerFilter = goog.isDef(opt_layerFilter) ?
|
||||
var thisArg = opt_this !== undefined ? opt_this : null;
|
||||
var layerFilter = opt_layerFilter !== undefined ?
|
||||
opt_layerFilter : goog.functions.TRUE;
|
||||
var thisArg2 = goog.isDef(opt_this2) ? opt_this2 : null;
|
||||
var thisArg2 = opt_this2 !== undefined ? opt_this2 : null;
|
||||
return this.renderer_.forEachLayerAtPixel(
|
||||
pixel, this.frameState_, callback, thisArg,
|
||||
layerFilter, thisArg2);
|
||||
@@ -668,9 +668,9 @@ ol.Map.prototype.hasFeatureAtPixel =
|
||||
return false;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
var layerFilter = goog.isDef(opt_layerFilter) ?
|
||||
var layerFilter = opt_layerFilter !== undefined ?
|
||||
opt_layerFilter : goog.functions.TRUE;
|
||||
var thisArg = goog.isDef(opt_this) ? opt_this : null;
|
||||
var thisArg = opt_this !== undefined ? opt_this : null;
|
||||
return this.renderer_.hasFeatureAtCoordinate(
|
||||
coordinate, this.frameState_, layerFilter, thisArg);
|
||||
};
|
||||
@@ -723,7 +723,7 @@ ol.Map.prototype.getTarget = function() {
|
||||
*/
|
||||
ol.Map.prototype.getTargetElement = function() {
|
||||
var target = this.getTarget();
|
||||
return goog.isDef(target) ? goog.dom.getElement(target) : null;
|
||||
return target !== undefined ? goog.dom.getElement(target) : null;
|
||||
};
|
||||
|
||||
|
||||
@@ -941,7 +941,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
this.focus_ = mapBrowserEvent.coordinate;
|
||||
mapBrowserEvent.frameState = this.frameState_;
|
||||
var interactions = this.getInteractions();
|
||||
goog.asserts.assert(goog.isDef(interactions),
|
||||
goog.asserts.assert(interactions !== undefined,
|
||||
'interactions should be defined');
|
||||
var interactionsArray = interactions.getArray();
|
||||
var i;
|
||||
@@ -1199,7 +1199,7 @@ ol.Map.prototype.render = function() {
|
||||
*/
|
||||
ol.Map.prototype.removeControl = function(control) {
|
||||
var controls = this.getControls();
|
||||
goog.asserts.assert(goog.isDef(controls), 'controls should be defined');
|
||||
goog.asserts.assert(controls !== undefined, 'controls should be defined');
|
||||
if (goog.isDef(controls.remove(control))) {
|
||||
return control;
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ ol.Map.prototype.removeControl = function(control) {
|
||||
ol.Map.prototype.removeInteraction = function(interaction) {
|
||||
var removed;
|
||||
var interactions = this.getInteractions();
|
||||
goog.asserts.assert(goog.isDef(interactions),
|
||||
goog.asserts.assert(interactions !== undefined,
|
||||
'interactions should be defined');
|
||||
if (goog.isDef(interactions.remove(interaction))) {
|
||||
removed = interaction;
|
||||
@@ -1248,7 +1248,7 @@ ol.Map.prototype.removeLayer = function(layer) {
|
||||
*/
|
||||
ol.Map.prototype.removeOverlay = function(overlay) {
|
||||
var overlays = this.getOverlays();
|
||||
goog.asserts.assert(goog.isDef(overlays), 'overlays should be defined');
|
||||
goog.asserts.assert(overlays !== undefined, 'overlays should be defined');
|
||||
if (goog.isDef(overlays.remove(overlay))) {
|
||||
return overlay;
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
var view = this.getView();
|
||||
/** @type {?olx.FrameState} */
|
||||
var frameState = null;
|
||||
if (goog.isDef(size) && ol.size.hasArea(size) &&
|
||||
if (size !== undefined && ol.size.hasArea(size) &&
|
||||
!goog.isNull(view) && view.isDef()) {
|
||||
var viewHints = view.getHints();
|
||||
var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
|
||||
|
||||
@@ -73,7 +73,7 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_dragging,
|
||||
* @type {boolean}
|
||||
* @api stable
|
||||
*/
|
||||
this.dragging = goog.isDef(opt_dragging) ? opt_dragging : false;
|
||||
this.dragging = opt_dragging !== undefined ? opt_dragging : false;
|
||||
|
||||
};
|
||||
goog.inherits(ol.MapBrowserEvent, ol.MapEvent);
|
||||
|
||||
@@ -55,7 +55,7 @@ ol.MapEvent = function(type, map, opt_frameState) {
|
||||
* @type {?olx.FrameState}
|
||||
* @api
|
||||
*/
|
||||
this.frameState = goog.isDef(opt_frameState) ? opt_frameState : null;
|
||||
this.frameState = opt_frameState !== undefined ? opt_frameState : null;
|
||||
|
||||
};
|
||||
goog.inherits(ol.MapEvent, goog.events.Event);
|
||||
|
||||
@@ -403,7 +403,7 @@ ol.Overlay.prototype.panIntoView_ = function() {
|
||||
|
||||
if (delta[0] !== 0 || delta[1] !== 0) {
|
||||
var center = map.getView().getCenter();
|
||||
goog.asserts.assert(goog.isDef(center), 'center should be defined');
|
||||
goog.asserts.assert(center !== undefined, 'center should be defined');
|
||||
var centerPx = map.getPixelFromCoordinate(center);
|
||||
var newCenterPx = [
|
||||
centerPx[0] + delta[0],
|
||||
@@ -430,7 +430,7 @@ ol.Overlay.prototype.panIntoView_ = function() {
|
||||
ol.Overlay.prototype.getRect_ = function(element, size) {
|
||||
goog.asserts.assert(goog.isDefAndNotNull(element),
|
||||
'element should be defined');
|
||||
goog.asserts.assert(goog.isDef(size), 'size should be defined');
|
||||
goog.asserts.assert(size !== undefined, 'size should be defined');
|
||||
|
||||
var offset = goog.style.getPageOffset(element);
|
||||
return [
|
||||
@@ -492,13 +492,13 @@ ol.Overlay.prototype.updatePixelPosition = function() {
|
||||
*/
|
||||
ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
||||
goog.asserts.assert(!goog.isNull(pixel), 'pixel should not be null');
|
||||
goog.asserts.assert(goog.isDef(mapSize), 'mapSize should be defined');
|
||||
goog.asserts.assert(mapSize !== undefined, 'mapSize should be defined');
|
||||
var style = this.element_.style;
|
||||
var offset = this.getOffset();
|
||||
goog.asserts.assert(goog.isArray(offset), 'offset should be an array');
|
||||
|
||||
var positioning = this.getPositioning();
|
||||
goog.asserts.assert(goog.isDef(positioning),
|
||||
goog.asserts.assert(positioning !== undefined,
|
||||
'positioning should be defined');
|
||||
|
||||
var offsetX = offset[0];
|
||||
|
||||
@@ -143,7 +143,7 @@ ol.proj.Projection = function(options) {
|
||||
|
||||
var projections = ol.proj.projections_;
|
||||
var code = options.code;
|
||||
goog.asserts.assert(goog.isDef(code),
|
||||
goog.asserts.assert(code !== undefined,
|
||||
'Option "code" is required for constructing instance');
|
||||
if (ol.ENABLE_PROJ4JS && typeof proj4 == 'function' &&
|
||||
!goog.isDef(projections[code])) {
|
||||
@@ -563,8 +563,8 @@ ol.proj.createTransformFromCoordinateTransform = function(transform) {
|
||||
*/
|
||||
function(input, opt_output, opt_dimension) {
|
||||
var length = input.length;
|
||||
var dimension = goog.isDef(opt_dimension) ? opt_dimension : 2;
|
||||
var output = goog.isDef(opt_output) ? opt_output : new Array(length);
|
||||
var dimension = opt_dimension !== undefined ? opt_dimension : 2;
|
||||
var output = opt_output !== undefined ? opt_output : new Array(length);
|
||||
var point, i, j;
|
||||
for (i = 0; i < length; i += dimension) {
|
||||
point = transform([input[i], input[i + 1]]);
|
||||
@@ -617,7 +617,7 @@ ol.proj.removeTransform = function(source, destination) {
|
||||
*/
|
||||
ol.proj.fromLonLat = function(coordinate, opt_projection) {
|
||||
return ol.proj.transform(coordinate, 'EPSG:4326',
|
||||
goog.isDef(opt_projection) ? opt_projection : 'EPSG:3857');
|
||||
opt_projection !== undefined ? opt_projection : 'EPSG:3857');
|
||||
};
|
||||
|
||||
|
||||
@@ -632,7 +632,7 @@ ol.proj.fromLonLat = function(coordinate, opt_projection) {
|
||||
*/
|
||||
ol.proj.toLonLat = function(coordinate, opt_projection) {
|
||||
return ol.proj.transform(coordinate,
|
||||
goog.isDef(opt_projection) ? opt_projection : 'EPSG:3857', 'EPSG:4326');
|
||||
opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326');
|
||||
};
|
||||
|
||||
|
||||
@@ -726,7 +726,7 @@ ol.proj.getTransformFromProjections =
|
||||
transform = transforms[sourceCode][destinationCode];
|
||||
}
|
||||
if (transform === undefined) {
|
||||
goog.asserts.assert(goog.isDef(transform), 'transform should be defined');
|
||||
goog.asserts.assert(transform !== undefined, 'transform should be defined');
|
||||
transform = ol.proj.identityTransform;
|
||||
}
|
||||
return transform;
|
||||
@@ -740,7 +740,7 @@ ol.proj.getTransformFromProjections =
|
||||
* @return {Array.<number>} Input coordinate array (same array as input).
|
||||
*/
|
||||
ol.proj.identityTransform = function(input, opt_output, opt_dimension) {
|
||||
if (goog.isDef(opt_output) && input !== opt_output) {
|
||||
if (opt_output !== undefined && input !== opt_output) {
|
||||
// TODO: consider making this a warning instead
|
||||
goog.asserts.fail('This should not be used internally.');
|
||||
for (var i = 0, ii = input.length; i < ii; ++i) {
|
||||
|
||||
@@ -494,7 +494,7 @@ ol.render.canvas.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
render.setTextStyle(style.getText());
|
||||
var renderGeometry =
|
||||
ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()];
|
||||
goog.asserts.assert(goog.isDef(renderGeometry),
|
||||
goog.asserts.assert(renderGeometry !== undefined,
|
||||
'renderGeometry should be defined');
|
||||
renderGeometry.call(render, geometry, null);
|
||||
});
|
||||
@@ -517,7 +517,7 @@ ol.render.canvas.Immediate.prototype.drawGeometryCollectionGeometry =
|
||||
var geometry = geometries[i];
|
||||
var geometryRenderer =
|
||||
ol.render.canvas.Immediate.GEOMETRY_RENDERERS_[geometry.getType()];
|
||||
goog.asserts.assert(goog.isDef(geometryRenderer),
|
||||
goog.asserts.assert(geometryRenderer !== undefined,
|
||||
'geometryRenderer should be defined');
|
||||
geometryRenderer.call(this, geometry, feature);
|
||||
}
|
||||
@@ -872,15 +872,15 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
|
||||
var strokeStyleWidth = strokeStyle.getWidth();
|
||||
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
|
||||
this.strokeState_ = {
|
||||
lineCap: goog.isDef(strokeStyleLineCap) ?
|
||||
lineCap: strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.canvas.defaultLineCap,
|
||||
lineDash: goog.isDefAndNotNull(strokeStyleLineDash) ?
|
||||
strokeStyleLineDash : ol.render.canvas.defaultLineDash,
|
||||
lineJoin: goog.isDef(strokeStyleLineJoin) ?
|
||||
lineJoin: strokeStyleLineJoin !== undefined ?
|
||||
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin,
|
||||
lineWidth: this.pixelRatio_ * (goog.isDef(strokeStyleWidth) ?
|
||||
lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ?
|
||||
strokeStyleWidth : ol.render.canvas.defaultLineWidth),
|
||||
miterLimit: goog.isDef(strokeStyleMiterLimit) ?
|
||||
miterLimit: strokeStyleMiterLimit !== undefined ?
|
||||
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
|
||||
strokeStyle: ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle)
|
||||
@@ -961,15 +961,15 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
||||
var textStrokeStyleWidth = textStrokeStyle.getWidth();
|
||||
var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
|
||||
this.textStrokeState_ = {
|
||||
lineCap: goog.isDef(textStrokeStyleLineCap) ?
|
||||
lineCap: textStrokeStyleLineCap !== undefined ?
|
||||
textStrokeStyleLineCap : ol.render.canvas.defaultLineCap,
|
||||
lineDash: goog.isDefAndNotNull(textStrokeStyleLineDash) ?
|
||||
textStrokeStyleLineDash : ol.render.canvas.defaultLineDash,
|
||||
lineJoin: goog.isDef(textStrokeStyleLineJoin) ?
|
||||
lineJoin: textStrokeStyleLineJoin !== undefined ?
|
||||
textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin,
|
||||
lineWidth: goog.isDef(textStrokeStyleWidth) ?
|
||||
lineWidth: textStrokeStyleWidth !== undefined ?
|
||||
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth,
|
||||
miterLimit: goog.isDef(textStrokeStyleMiterLimit) ?
|
||||
miterLimit: textStrokeStyleMiterLimit !== undefined ?
|
||||
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
|
||||
strokeStyle: ol.color.asString(!goog.isNull(textStrokeStyleColor) ?
|
||||
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle)
|
||||
@@ -984,20 +984,20 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
||||
var textTextAlign = textStyle.getTextAlign();
|
||||
var textTextBaseline = textStyle.getTextBaseline();
|
||||
this.textState_ = {
|
||||
font: goog.isDef(textFont) ?
|
||||
font: textFont !== undefined ?
|
||||
textFont : ol.render.canvas.defaultFont,
|
||||
textAlign: goog.isDef(textTextAlign) ?
|
||||
textAlign: textTextAlign !== undefined ?
|
||||
textTextAlign : ol.render.canvas.defaultTextAlign,
|
||||
textBaseline: goog.isDef(textTextBaseline) ?
|
||||
textBaseline: textTextBaseline !== undefined ?
|
||||
textTextBaseline : ol.render.canvas.defaultTextBaseline
|
||||
};
|
||||
this.text_ = goog.isDef(textText) ? textText : '';
|
||||
this.text_ = textText !== undefined ? textText : '';
|
||||
this.textOffsetX_ =
|
||||
goog.isDef(textOffsetX) ? (this.pixelRatio_ * textOffsetX) : 0;
|
||||
textOffsetX !== undefined ? (this.pixelRatio_ * textOffsetX) : 0;
|
||||
this.textOffsetY_ =
|
||||
goog.isDef(textOffsetY) ? (this.pixelRatio_ * textOffsetY) : 0;
|
||||
this.textRotation_ = goog.isDef(textRotation) ? textRotation : 0;
|
||||
this.textScale_ = this.pixelRatio_ * (goog.isDef(textScale) ?
|
||||
textOffsetY !== undefined ? (this.pixelRatio_ * textOffsetY) : 0;
|
||||
this.textRotation_ = textRotation !== undefined ? textRotation : 0;
|
||||
this.textScale_ = this.pixelRatio_ * (textScale !== undefined ?
|
||||
textScale : 1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -260,7 +260,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
if (goog.isDef(skippedFeaturesHash[featureUid]) ||
|
||||
!goog.isDefAndNotNull(feature.getGeometry())) {
|
||||
i = /** @type {number} */ (instruction[2]);
|
||||
} else if (goog.isDef(opt_hitExtent) && !ol.extent.intersects(
|
||||
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
||||
opt_hitExtent, feature.getGeometry().getExtent())) {
|
||||
i = /** @type {number} */ (instruction[2]);
|
||||
} else {
|
||||
@@ -966,13 +966,13 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
var lineJoin = state.lineJoin;
|
||||
var lineWidth = state.lineWidth;
|
||||
var miterLimit = state.miterLimit;
|
||||
goog.asserts.assert(goog.isDef(strokeStyle),
|
||||
goog.asserts.assert(strokeStyle !== undefined,
|
||||
'strokeStyle should be defined');
|
||||
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
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(lineWidth), 'lineWidth should be defined');
|
||||
goog.asserts.assert(goog.isDef(miterLimit), 'miterLimit should be defined');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== undefined, 'miterLimit should be defined');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
!goog.array.equals(state.currentLineDash, lineDash) ||
|
||||
@@ -1087,19 +1087,19 @@ ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle =
|
||||
this.state_.strokeStyle = ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
var strokeStyleLineCap = strokeStyle.getLineCap();
|
||||
this.state_.lineCap = goog.isDef(strokeStyleLineCap) ?
|
||||
this.state_.lineCap = strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.canvas.defaultLineCap;
|
||||
var strokeStyleLineDash = strokeStyle.getLineDash();
|
||||
this.state_.lineDash = !goog.isNull(strokeStyleLineDash) ?
|
||||
strokeStyleLineDash : ol.render.canvas.defaultLineDash;
|
||||
var strokeStyleLineJoin = strokeStyle.getLineJoin();
|
||||
this.state_.lineJoin = goog.isDef(strokeStyleLineJoin) ?
|
||||
this.state_.lineJoin = strokeStyleLineJoin !== undefined ?
|
||||
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
|
||||
var strokeStyleWidth = strokeStyle.getWidth();
|
||||
this.state_.lineWidth = goog.isDef(strokeStyleWidth) ?
|
||||
this.state_.lineWidth = strokeStyleWidth !== undefined ?
|
||||
strokeStyleWidth : ol.render.canvas.defaultLineWidth;
|
||||
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
|
||||
this.state_.miterLimit = goog.isDef(strokeStyleMiterLimit) ?
|
||||
this.state_.miterLimit = strokeStyleMiterLimit !== undefined ?
|
||||
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
|
||||
|
||||
if (this.state_.lineWidth > this.maxLineWidth) {
|
||||
@@ -1398,19 +1398,19 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle =
|
||||
state.strokeStyle = ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
var strokeStyleLineCap = strokeStyle.getLineCap();
|
||||
state.lineCap = goog.isDef(strokeStyleLineCap) ?
|
||||
state.lineCap = strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.canvas.defaultLineCap;
|
||||
var strokeStyleLineDash = strokeStyle.getLineDash();
|
||||
state.lineDash = !goog.isNull(strokeStyleLineDash) ?
|
||||
strokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash;
|
||||
var strokeStyleLineJoin = strokeStyle.getLineJoin();
|
||||
state.lineJoin = goog.isDef(strokeStyleLineJoin) ?
|
||||
state.lineJoin = strokeStyleLineJoin !== undefined ?
|
||||
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
|
||||
var strokeStyleWidth = strokeStyle.getWidth();
|
||||
state.lineWidth = goog.isDef(strokeStyleWidth) ?
|
||||
state.lineWidth = strokeStyleWidth !== undefined ?
|
||||
strokeStyleWidth : ol.render.canvas.defaultLineWidth;
|
||||
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
|
||||
state.miterLimit = goog.isDef(strokeStyleMiterLimit) ?
|
||||
state.miterLimit = strokeStyleMiterLimit !== undefined ?
|
||||
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
|
||||
|
||||
if (state.lineWidth > this.maxLineWidth) {
|
||||
@@ -1441,17 +1441,18 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
||||
var lineJoin = state.lineJoin;
|
||||
var lineWidth = state.lineWidth;
|
||||
var miterLimit = state.miterLimit;
|
||||
if (goog.isDef(fillStyle) && state.currentFillStyle != fillStyle) {
|
||||
if (fillStyle !== undefined && state.currentFillStyle != fillStyle) {
|
||||
this.instructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle]);
|
||||
state.currentFillStyle = state.fillStyle;
|
||||
}
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(goog.isDef(lineCap), 'lineCap should be defined');
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
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(lineWidth), 'lineWidth should be defined');
|
||||
goog.asserts.assert(goog.isDef(miterLimit), 'miterLimit should be defined');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== undefined,
|
||||
'miterLimit should be defined');
|
||||
if (state.currentStrokeStyle != strokeStyle ||
|
||||
state.currentLineCap != lineCap ||
|
||||
state.currentLineDash != lineDash ||
|
||||
@@ -1722,15 +1723,15 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();
|
||||
var textStrokeStyleWidth = textStrokeStyle.getWidth();
|
||||
var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
|
||||
var lineCap = goog.isDef(textStrokeStyleLineCap) ?
|
||||
var lineCap = textStrokeStyleLineCap !== undefined ?
|
||||
textStrokeStyleLineCap : ol.render.canvas.defaultLineCap;
|
||||
var lineDash = goog.isDefAndNotNull(textStrokeStyleLineDash) ?
|
||||
textStrokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash;
|
||||
var lineJoin = goog.isDef(textStrokeStyleLineJoin) ?
|
||||
var lineJoin = textStrokeStyleLineJoin !== undefined ?
|
||||
textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
|
||||
var lineWidth = goog.isDef(textStrokeStyleWidth) ?
|
||||
var lineWidth = textStrokeStyleWidth !== undefined ?
|
||||
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth;
|
||||
var miterLimit = goog.isDef(textStrokeStyleMiterLimit) ?
|
||||
var miterLimit = textStrokeStyleMiterLimit !== undefined ?
|
||||
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
|
||||
var strokeStyle = ol.color.asString(!goog.isNull(textStrokeStyleColor) ?
|
||||
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
@@ -1761,11 +1762,11 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
var textText = textStyle.getText();
|
||||
var textTextAlign = textStyle.getTextAlign();
|
||||
var textTextBaseline = textStyle.getTextBaseline();
|
||||
var font = goog.isDef(textFont) ?
|
||||
var font = textFont !== undefined ?
|
||||
textFont : ol.render.canvas.defaultFont;
|
||||
var textAlign = goog.isDef(textTextAlign) ?
|
||||
var textAlign = textTextAlign !== undefined ?
|
||||
textTextAlign : ol.render.canvas.defaultTextAlign;
|
||||
var textBaseline = goog.isDef(textTextBaseline) ?
|
||||
var textBaseline = textTextBaseline !== undefined ?
|
||||
textTextBaseline : ol.render.canvas.defaultTextBaseline;
|
||||
if (goog.isNull(this.textState_)) {
|
||||
this.textState_ = {
|
||||
@@ -1779,11 +1780,11 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
textState.textAlign = textAlign;
|
||||
textState.textBaseline = textBaseline;
|
||||
}
|
||||
this.text_ = goog.isDef(textText) ? textText : '';
|
||||
this.textOffsetX_ = goog.isDef(textOffsetX) ? textOffsetX : 0;
|
||||
this.textOffsetY_ = goog.isDef(textOffsetY) ? textOffsetY : 0;
|
||||
this.textRotation_ = goog.isDef(textRotation) ? textRotation : 0;
|
||||
this.textScale_ = goog.isDef(textScale) ? textScale : 1;
|
||||
this.text_ = textText !== undefined ? textText : '';
|
||||
this.textOffsetX_ = textOffsetX !== undefined ? textOffsetX : 0;
|
||||
this.textOffsetY_ = textOffsetY !== undefined ? textOffsetY : 0;
|
||||
this.textRotation_ = textRotation !== undefined ? textRotation : 0;
|
||||
this.textScale_ = textScale !== undefined ? textScale : 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1917,7 +1918,7 @@ ol.render.canvas.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
|
||||
*/
|
||||
ol.render.canvas.ReplayGroup.prototype.getReplay =
|
||||
function(zIndex, replayType) {
|
||||
var zIndexKey = goog.isDef(zIndex) ? zIndex.toString() : '0';
|
||||
var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
||||
var replays = this.replaysByZIndex_[zIndexKey];
|
||||
if (replays === undefined) {
|
||||
replays = {};
|
||||
@@ -1926,7 +1927,7 @@ ol.render.canvas.ReplayGroup.prototype.getReplay =
|
||||
var replay = replays[replayType];
|
||||
if (replay === undefined) {
|
||||
var Constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType];
|
||||
goog.asserts.assert(goog.isDef(Constructor),
|
||||
goog.asserts.assert(Constructor !== undefined,
|
||||
replayType +
|
||||
' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_');
|
||||
replay = new Constructor(this.tolerance_, this.maxExtent_,
|
||||
|
||||
@@ -914,13 +914,13 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
'imageStyle hitDetectionImage is not null');
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImageSize),
|
||||
'imageStyle hitDetectionImageSize is not null');
|
||||
goog.asserts.assert(goog.isDef(opacity), 'imageStyle opacity is defined');
|
||||
goog.asserts.assert(opacity !== undefined, 'imageStyle opacity is defined');
|
||||
goog.asserts.assert(!goog.isNull(origin), 'imageStyle origin is not null');
|
||||
goog.asserts.assert(goog.isDef(rotateWithView),
|
||||
goog.asserts.assert(rotateWithView !== undefined,
|
||||
'imageStyle rotateWithView is defined');
|
||||
goog.asserts.assert(goog.isDef(rotation), 'imageStyle rotation is defined');
|
||||
goog.asserts.assert(rotation !== undefined, 'imageStyle rotation is defined');
|
||||
goog.asserts.assert(!goog.isNull(size), 'imageStyle size is not null');
|
||||
goog.asserts.assert(goog.isDef(scale), 'imageStyle scale is defined');
|
||||
goog.asserts.assert(scale !== undefined, 'imageStyle scale is defined');
|
||||
|
||||
var currentImage;
|
||||
if (this.images_.length === 0) {
|
||||
@@ -1039,7 +1039,7 @@ ol.render.webgl.ReplayGroup.prototype.getReplay =
|
||||
var replay = this.replays_[replayType];
|
||||
if (replay === undefined) {
|
||||
var constructor = ol.render.webgl.BATCH_CONSTRUCTORS_[replayType];
|
||||
goog.asserts.assert(goog.isDef(constructor),
|
||||
goog.asserts.assert(constructor !== undefined,
|
||||
replayType +
|
||||
' constructor missing from ol.render.webgl.BATCH_CONSTRUCTORS_');
|
||||
replay = new constructor(this.tolerance_, this.maxExtent_);
|
||||
@@ -1231,7 +1231,7 @@ ol.render.webgl.ReplayGroup.prototype.hasFeatureAtCoordinate = function(
|
||||
return imageData[3] > 0;
|
||||
}, false);
|
||||
|
||||
return goog.isDef(hasFeature);
|
||||
return hasFeature !== undefined;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ ol.renderer.canvas.Layer.prototype.composeFrame =
|
||||
|
||||
// clipped rendering if layer extent is set
|
||||
var extent = layerState.extent;
|
||||
var clipped = goog.isDef(extent);
|
||||
var clipped = extent !== undefined;
|
||||
if (clipped) {
|
||||
goog.asserts.assert(goog.isDef(extent),
|
||||
goog.asserts.assert(extent !== undefined,
|
||||
'layerState extent is defined');
|
||||
var pixelRatio = frameState.pixelRatio;
|
||||
var topLeft = ol.extent.getTopLeft(extent);
|
||||
@@ -126,7 +126,7 @@ ol.renderer.canvas.Layer.prototype.dispatchComposeEvent_ =
|
||||
function(type, context, frameState, opt_transform) {
|
||||
var layer = this.getLayer();
|
||||
if (layer.hasListener(type)) {
|
||||
var transform = goog.isDef(opt_transform) ?
|
||||
var transform = opt_transform !== undefined ?
|
||||
opt_transform : this.getTransform(frameState, 0);
|
||||
var render = new ol.render.canvas.Immediate(
|
||||
context, frameState.pixelRatio, frameState.extent, transform,
|
||||
|
||||
@@ -172,7 +172,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
goog.asserts.assert(goog.isDef(feature), 'received a feature');
|
||||
goog.asserts.assert(feature !== undefined, 'received a feature');
|
||||
var key = goog.getUid(feature).toString();
|
||||
if (!(key in features)) {
|
||||
features[key] = true;
|
||||
|
||||
@@ -194,7 +194,7 @@ ol.renderer.dom.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
goog.asserts.assert(goog.isDef(feature), 'received a feature');
|
||||
goog.asserts.assert(feature !== undefined, 'received a feature');
|
||||
var key = goog.getUid(feature).toString();
|
||||
if (!(key in features)) {
|
||||
features[key] = true;
|
||||
|
||||
@@ -225,7 +225,7 @@ ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate =
|
||||
function(coordinate, frameState) {
|
||||
var hasFeature = this.forEachFeatureAtCoordinate(
|
||||
coordinate, frameState, goog.functions.TRUE, this);
|
||||
return goog.isDef(hasFeature);
|
||||
return hasFeature !== undefined;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
goog.asserts.assert(goog.isDef(feature), 'received a feature');
|
||||
goog.asserts.assert(feature !== undefined, 'received a feature');
|
||||
var key = goog.getUid(feature).toString();
|
||||
if (!(key in features)) {
|
||||
features[key] = true;
|
||||
|
||||
@@ -166,7 +166,7 @@ ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
goog.asserts.assert(goog.isDef(feature), 'passed a feature');
|
||||
goog.asserts.assert(feature !== undefined, 'passed a feature');
|
||||
var key = goog.getUid(feature).toString();
|
||||
if (!(key in features)) {
|
||||
features[key] = true;
|
||||
@@ -290,7 +290,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.ImageVector.prototype.setStyle = function(style) {
|
||||
this.style_ = goog.isDef(style) ? style : ol.style.defaultStyleFunction;
|
||||
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
||||
this.styleFunction_ = goog.isNull(style) ?
|
||||
undefined : ol.style.createStyleFunction(this.style_);
|
||||
this.changed();
|
||||
|
||||
@@ -173,7 +173,7 @@ ol.source.TileArcGISRest.prototype.getUrls = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.TileArcGISRest.prototype.setUrl = function(url) {
|
||||
var urls = goog.isDef(url) ? ol.TileUrlFunction.expandUrl(url) : null;
|
||||
var urls = url !== undefined ? ol.TileUrlFunction.expandUrl(url) : null;
|
||||
this.setUrls(urls);
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ goog.inherits(ol.DebugTile_, ol.Tile);
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.DebugTile_.prototype.getImage = function(opt_context) {
|
||||
var key = goog.isDef(opt_context) ? goog.getUid(opt_context) : -1;
|
||||
var key = opt_context !== undefined ? goog.getUid(opt_context) : -1;
|
||||
if (key in this.canvasByContext_) {
|
||||
return this.canvasByContext_[key];
|
||||
} else {
|
||||
|
||||
@@ -99,8 +99,8 @@ ol.source.TileImage.prototype.getTile =
|
||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection);
|
||||
var tile = new this.tileClass(
|
||||
tileCoord,
|
||||
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
goog.isDef(tileUrl) ? tileUrl : '',
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.crossOrigin,
|
||||
this.tileLoadFunction);
|
||||
goog.events.listen(tile, goog.events.EventType.CHANGE,
|
||||
|
||||
@@ -79,7 +79,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
|
||||
if (goog.isDef(tileJSON.attribution) &&
|
||||
goog.isNull(this.getAttributions())) {
|
||||
var attributionExtent = goog.isDef(extent) ?
|
||||
var attributionExtent = extent !== undefined ?
|
||||
extent : epsg4326Projection.getExtent();
|
||||
/** @type {Object.<string, Array.<ol.TileRange>>} */
|
||||
var tileRanges = {};
|
||||
|
||||
@@ -227,7 +227,7 @@ ol.source.Tile.prototype.getTilePixelSize =
|
||||
*/
|
||||
ol.source.Tile.prototype.getTileCoordForTileUrlFunction =
|
||||
function(tileCoord, opt_projection) {
|
||||
var projection = goog.isDef(opt_projection) ?
|
||||
var projection = opt_projection !== undefined ?
|
||||
opt_projection : this.getProjection();
|
||||
var tileGrid = this.getTileGridForProjection(projection);
|
||||
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed');
|
||||
|
||||
@@ -139,7 +139,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
this.tileUrlFunction_ = ol.TileUrlFunction.createFromTemplates(grids);
|
||||
|
||||
if (tileJSON.attribution !== undefined) {
|
||||
var attributionExtent = goog.isDef(extent) ?
|
||||
var attributionExtent = extent !== undefined ?
|
||||
extent : epsg4326Projection.getExtent();
|
||||
/** @type {Object.<string, Array.<ol.TileRange>>} */
|
||||
var tileRanges = {};
|
||||
@@ -178,8 +178,8 @@ ol.source.TileUTFGrid.prototype.getTile =
|
||||
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
|
||||
var tile = new ol.source.TileUTFGridTile_(
|
||||
tileCoord,
|
||||
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
goog.isDef(tileUrl) ? tileUrl : '',
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.tileGrid.getTileCoordExtent(tileCoord),
|
||||
this.preemptive_);
|
||||
this.tileCache.set(tileCoordKey, tile);
|
||||
|
||||
@@ -337,7 +337,7 @@ ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.TileWMS.prototype.setUrl = function(url) {
|
||||
var urls = goog.isDef(url) ? ol.TileUrlFunction.expandUrl(url) : null;
|
||||
var urls = url !== undefined ? ol.TileUrlFunction.expandUrl(url) : null;
|
||||
this.setUrls(urls);
|
||||
};
|
||||
|
||||
|
||||
@@ -572,7 +572,7 @@ ol.source.Vector.prototype.getFeatures = function() {
|
||||
features, goog.object.getValues(this.nullGeometryFeatures_));
|
||||
}
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(features),
|
||||
goog.asserts.assert(features !== undefined,
|
||||
'Neither featuresRtree_ nor featuresCollection_ are available');
|
||||
return features;
|
||||
};
|
||||
@@ -692,7 +692,7 @@ ol.source.Vector.prototype.getExtent = function() {
|
||||
*/
|
||||
ol.source.Vector.prototype.getFeatureById = function(id) {
|
||||
var feature = this.idIndex_[id.toString()];
|
||||
return goog.isDef(feature) ? feature : null;
|
||||
return feature !== undefined ? feature : null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
} else {
|
||||
value = elt['values'][0];
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(value), 'value could be found');
|
||||
goog.asserts.assert(value !== undefined, 'value could be found');
|
||||
dimensions[key] = value;
|
||||
});
|
||||
}
|
||||
@@ -454,7 +454,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
/** @type {!Array.<string>} */
|
||||
var urls = [];
|
||||
var requestEncoding = config['requestEncoding'];
|
||||
requestEncoding = goog.isDef(requestEncoding) ? requestEncoding : '';
|
||||
requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
|
||||
|
||||
goog.asserts.assert(
|
||||
goog.array.contains(['REST', 'RESTful', 'KVP', ''], requestEncoding),
|
||||
|
||||
@@ -165,7 +165,8 @@ goog.inherits(ol.source.ZoomifyTile_, ol.ImageTile);
|
||||
*/
|
||||
ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) {
|
||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||
var key = goog.isDef(opt_context) ? goog.getUid(opt_context).toString() : '';
|
||||
var key = opt_context !== undefined ?
|
||||
goog.getUid(opt_context).toString() : '';
|
||||
if (key in this.zoomifyImageByContext_) {
|
||||
return this.zoomifyImageByContext_[key];
|
||||
} else {
|
||||
|
||||
@@ -130,7 +130,7 @@ ol.structs.LRUCache.prototype.forEach = function(f, opt_this) {
|
||||
*/
|
||||
ol.structs.LRUCache.prototype.get = function(key) {
|
||||
var entry = this.entries_[key];
|
||||
goog.asserts.assert(goog.isDef(entry), 'an entry exists for key %s', key);
|
||||
goog.asserts.assert(entry !== undefined, 'an entry exists for key %s', key);
|
||||
if (entry === this.newest_) {
|
||||
return entry.value_;
|
||||
} else if (entry === this.oldest_) {
|
||||
|
||||
@@ -191,7 +191,7 @@ ol.style.AtlasManager.prototype.add =
|
||||
// even if no hit-detection entry is requested, we insert a fake entry into
|
||||
// the hit-detection atlas, to make sure that the offset is the same for
|
||||
// the original image and the hit-detection image.
|
||||
var renderHitCallback = goog.isDef(opt_renderHitCallback) ?
|
||||
var renderHitCallback = opt_renderHitCallback !== undefined ?
|
||||
opt_renderHitCallback : goog.functions.NULL;
|
||||
|
||||
/** @type {?ol.style.AtlasInfo} */
|
||||
|
||||
@@ -105,10 +105,10 @@ ol.style.Icon = function(opt_options) {
|
||||
*/
|
||||
var src = options.src;
|
||||
|
||||
goog.asserts.assert(!(goog.isDef(src) && !goog.isNull(image)),
|
||||
goog.asserts.assert(!(src !== undefined && !goog.isNull(image)),
|
||||
'image and src can not provided at the same time');
|
||||
goog.asserts.assert(
|
||||
src === undefined || (goog.isDef(src) && goog.isNull(imgSize)),
|
||||
src === undefined || (src !== undefined && goog.isNull(imgSize)),
|
||||
'imgSize should not be set when src is provided');
|
||||
goog.asserts.assert(
|
||||
goog.isNull(image) || (!goog.isNull(image) && !goog.isNull(imgSize)),
|
||||
@@ -117,7 +117,7 @@ ol.style.Icon = function(opt_options) {
|
||||
if ((src === undefined || src.length === 0) && !goog.isNull(image)) {
|
||||
src = image.src;
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(src) && src.length > 0,
|
||||
goog.asserts.assert(src !== undefined && src.length > 0,
|
||||
'must provide a defined and non-empty src or image');
|
||||
|
||||
/**
|
||||
@@ -620,7 +620,7 @@ goog.addSingletonGetter(ol.style.IconImageCache);
|
||||
* @return {string} Cache key.
|
||||
*/
|
||||
ol.style.IconImageCache.getKey = function(src, crossOrigin) {
|
||||
goog.asserts.assert(goog.isDef(crossOrigin),
|
||||
goog.asserts.assert(crossOrigin !== undefined,
|
||||
'argument crossOrigin must be defined');
|
||||
return crossOrigin + ':' + src;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ ol.TileCache = function(opt_highWaterMark) {
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.highWaterMark_ = goog.isDef(opt_highWaterMark) ?
|
||||
this.highWaterMark_ = opt_highWaterMark !== undefined ?
|
||||
opt_highWaterMark : ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK;
|
||||
|
||||
};
|
||||
|
||||
@@ -72,7 +72,7 @@ ol.tilegrid.TileGrid = function(options) {
|
||||
|
||||
var extent = options.extent;
|
||||
|
||||
if (goog.isDef(extent) &&
|
||||
if (extent !== undefined &&
|
||||
goog.isNull(this.origin_) && goog.isNull(this.origins_)) {
|
||||
this.origin_ = ol.extent.getTopLeft(extent);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ ol.tilegrid.TileGrid = function(options) {
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
*/
|
||||
this.extent_ = goog.isDef(extent) ? extent : null;
|
||||
this.extent_ = extent !== undefined ? extent : null;
|
||||
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ ol.tilegrid.TileGrid = function(options) {
|
||||
var tileRange = new ol.TileRange(
|
||||
Math.min(0, size[0]), Math.max(size[0] - 1, -1),
|
||||
Math.min(0, size[1]), Math.max(size[1] - 1, -1));
|
||||
if (this.minZoom <= z && z <= this.maxZoom && goog.isDef(extent)) {
|
||||
if (this.minZoom <= z && z <= this.maxZoom && extent !== undefined) {
|
||||
goog.asserts.assert(tileRange.containsTileRange(
|
||||
this.getTileRangeForExtentAndZ(extent, z)),
|
||||
'extent tile range must not exceed tilegrid width and height');
|
||||
@@ -527,7 +527,7 @@ ol.tilegrid.getForProjection = function(projection) {
|
||||
*/
|
||||
ol.tilegrid.createForExtent =
|
||||
function(extent, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||
var corner = goog.isDef(opt_corner) ?
|
||||
var corner = opt_corner !== undefined ?
|
||||
opt_corner : ol.extent.Corner.TOP_LEFT;
|
||||
|
||||
var resolutions = ol.tilegrid.resolutionsFromExtent(
|
||||
@@ -550,7 +550,7 @@ ol.tilegrid.createForExtent =
|
||||
*/
|
||||
ol.tilegrid.createXYZ = function(opt_options) {
|
||||
var options = /** @type {olx.tilegrid.TileGridOptions} */ ({});
|
||||
goog.object.extend(options, goog.isDef(opt_options) ?
|
||||
goog.object.extend(options, opt_options !== undefined ?
|
||||
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
|
||||
if (options.extent === undefined) {
|
||||
options.extent = ol.proj.get('EPSG:3857').getExtent();
|
||||
@@ -574,13 +574,13 @@ ol.tilegrid.createXYZ = function(opt_options) {
|
||||
*/
|
||||
ol.tilegrid.resolutionsFromExtent =
|
||||
function(extent, opt_maxZoom, opt_tileSize) {
|
||||
var maxZoom = goog.isDef(opt_maxZoom) ?
|
||||
var maxZoom = opt_maxZoom !== undefined ?
|
||||
opt_maxZoom : ol.DEFAULT_MAX_ZOOM;
|
||||
|
||||
var height = ol.extent.getHeight(extent);
|
||||
var width = ol.extent.getWidth(extent);
|
||||
|
||||
var tileSize = ol.size.toSize(goog.isDef(opt_tileSize) ?
|
||||
var tileSize = ol.size.toSize(opt_tileSize !== undefined ?
|
||||
opt_tileSize : ol.DEFAULT_TILE_SIZE);
|
||||
var maxResolution = Math.max(
|
||||
width / tileSize[0], height / tileSize[1]);
|
||||
|
||||
@@ -193,7 +193,7 @@ ol.View.prototype.calculateCenterZoom = function(resolution, anchor) {
|
||||
var center;
|
||||
var currentCenter = this.getCenter();
|
||||
var currentResolution = this.getResolution();
|
||||
if (goog.isDef(currentCenter) && goog.isDef(currentResolution)) {
|
||||
if (currentCenter !== undefined && currentResolution !== undefined) {
|
||||
var x = anchor[0] -
|
||||
resolution * (anchor[0] - currentCenter[0]) / currentResolution;
|
||||
var y = anchor[1] -
|
||||
@@ -278,10 +278,10 @@ ol.View.prototype.calculateExtent = function(size) {
|
||||
goog.asserts.assert(goog.isDefAndNotNull(center),
|
||||
'The view center is not defined');
|
||||
var resolution = this.getResolution();
|
||||
goog.asserts.assert(goog.isDef(resolution),
|
||||
goog.asserts.assert(resolution !== undefined,
|
||||
'The view resolution is not defined');
|
||||
var rotation = this.getRotation();
|
||||
goog.asserts.assert(goog.isDef(rotation),
|
||||
goog.asserts.assert(rotation !== undefined,
|
||||
'The view rotation is not defined');
|
||||
|
||||
return ol.extent.getForViewAndSize(center, resolution, rotation, size);
|
||||
@@ -404,7 +404,7 @@ ol.View.prototype.getState = function() {
|
||||
Math.round(center[0] / resolution) * resolution,
|
||||
Math.round(center[1] / resolution) * resolution
|
||||
],
|
||||
projection: goog.isDef(projection) ? projection : null,
|
||||
projection: projection !== undefined ? projection : null,
|
||||
resolution: resolution,
|
||||
rotation: rotation
|
||||
});
|
||||
@@ -433,7 +433,7 @@ ol.View.prototype.getZoom = function() {
|
||||
} while (res > this.minResolution_);
|
||||
}
|
||||
|
||||
return goog.isDef(offset) ? this.minZoom_ + offset : offset;
|
||||
return offset !== undefined ? this.minZoom_ + offset : offset;
|
||||
};
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ ol.View.prototype.fit = function(geometry, size, opt_options) {
|
||||
|
||||
// calculate rotated extent
|
||||
var rotation = this.getRotation();
|
||||
goog.asserts.assert(goog.isDef(rotation), 'rotation was not defined');
|
||||
goog.asserts.assert(rotation !== undefined, 'rotation was not defined');
|
||||
var cosAngle = Math.cos(-rotation);
|
||||
var sinAngle = Math.sin(-rotation);
|
||||
var minRotX = +Infinity;
|
||||
|
||||
@@ -27,13 +27,13 @@ ol.webgl.Buffer = function(opt_arr, opt_usage) {
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
this.arr_ = goog.isDef(opt_arr) ? opt_arr : [];
|
||||
this.arr_ = opt_arr !== undefined ? opt_arr : [];
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.usage_ = goog.isDef(opt_usage) ?
|
||||
this.usage_ = opt_usage !== undefined ?
|
||||
opt_usage : ol.webgl.BufferUsage.STATIC_DRAW;
|
||||
|
||||
};
|
||||
|
||||
@@ -391,7 +391,7 @@ ol.xml.makeArrayPusher = function(valueReader, opt_this) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
var value = valueReader.call(opt_this !== undefined ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (value !== undefined) {
|
||||
var array = objectStack[objectStack.length - 1];
|
||||
@@ -418,7 +418,7 @@ ol.xml.makeReplacer = function(valueReader, opt_this) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
var value = valueReader.call(opt_this !== undefined ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (value !== undefined) {
|
||||
objectStack[objectStack.length - 1] = value;
|
||||
@@ -438,7 +438,7 @@ ol.xml.makeReplacer = function(valueReader, opt_this) {
|
||||
*/
|
||||
ol.xml.makeObjectPropertyPusher =
|
||||
function(valueReader, opt_property, opt_this) {
|
||||
goog.asserts.assert(goog.isDef(valueReader),
|
||||
goog.asserts.assert(valueReader !== undefined,
|
||||
'undefined valueReader, expected function(this: T, Node, Array.<*>)');
|
||||
return (
|
||||
/**
|
||||
@@ -446,12 +446,12 @@ ol.xml.makeObjectPropertyPusher =
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
var value = valueReader.call(opt_this !== undefined ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (value !== undefined) {
|
||||
var object = /** @type {Object} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
var property = goog.isDef(opt_property) ?
|
||||
var property = opt_property !== undefined ?
|
||||
opt_property : node.localName;
|
||||
goog.asserts.assert(goog.isObject(object),
|
||||
'entity from stack was not an object');
|
||||
@@ -472,7 +472,7 @@ ol.xml.makeObjectPropertyPusher =
|
||||
*/
|
||||
ol.xml.makeObjectPropertySetter =
|
||||
function(valueReader, opt_property, opt_this) {
|
||||
goog.asserts.assert(goog.isDef(valueReader),
|
||||
goog.asserts.assert(valueReader !== undefined,
|
||||
'undefined valueReader, expected function(this: T, Node, Array.<*>)');
|
||||
return (
|
||||
/**
|
||||
@@ -480,12 +480,12 @@ ol.xml.makeObjectPropertySetter =
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function(node, objectStack) {
|
||||
var value = valueReader.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
var value = valueReader.call(opt_this !== undefined ? opt_this : this,
|
||||
node, objectStack);
|
||||
if (value !== undefined) {
|
||||
var object = /** @type {Object} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
var property = goog.isDef(opt_property) ?
|
||||
var property = opt_property !== undefined ?
|
||||
opt_property : node.localName;
|
||||
goog.asserts.assert(goog.isObject(object),
|
||||
'entity from stack was not an object');
|
||||
@@ -507,7 +507,7 @@ ol.xml.makeObjectPropertySetter =
|
||||
*/
|
||||
ol.xml.makeChildAppender = function(nodeWriter, opt_this) {
|
||||
return function(node, value, objectStack) {
|
||||
nodeWriter.call(goog.isDef(opt_this) ? opt_this : this,
|
||||
nodeWriter.call(opt_this !== undefined ? opt_this : this,
|
||||
node, value, objectStack);
|
||||
var parent = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(parent),
|
||||
@@ -584,7 +584,7 @@ ol.xml.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) {
|
||||
if (opt_namespaceURI === undefined) {
|
||||
namespaceURI = node.namespaceURI;
|
||||
}
|
||||
goog.asserts.assert(goog.isDef(nodeName), 'nodeName was undefined');
|
||||
goog.asserts.assert(nodeName !== undefined, 'nodeName was undefined');
|
||||
return ol.xml.createElementNS(namespaceURI, nodeName);
|
||||
}
|
||||
);
|
||||
@@ -637,7 +637,7 @@ ol.xml.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) {
|
||||
/**
|
||||
* @type {Object.<string, *>}
|
||||
*/
|
||||
var structureNS = goog.isDef(opt_structureNS) ? opt_structureNS : {};
|
||||
var structureNS = opt_structureNS !== undefined ? opt_structureNS : {};
|
||||
var i, ii;
|
||||
for (i = 0, ii = namespaceURIs.length; i < ii; ++i) {
|
||||
structureNS[namespaceURIs[i]] = structure;
|
||||
@@ -711,13 +711,13 @@ ol.xml.pushParseAndPop = function(
|
||||
*/
|
||||
ol.xml.serialize = function(
|
||||
serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) {
|
||||
var length = (goog.isDef(opt_keys) ? opt_keys : values).length;
|
||||
var length = (opt_keys !== undefined ? opt_keys : values).length;
|
||||
var value, node;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
value = values[i];
|
||||
if (value !== undefined) {
|
||||
node = nodeFactory.call(opt_this, value, objectStack,
|
||||
goog.isDef(opt_keys) ? opt_keys[i] : undefined);
|
||||
opt_keys !== undefined ? opt_keys[i] : undefined);
|
||||
if (node !== undefined) {
|
||||
serializersNS[node.namespaceURI][node.localName]
|
||||
.call(opt_this, node, value, objectStack);
|
||||
|
||||
Reference in New Issue
Block a user