Inline goog.isDef() calls for properties
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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_];
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+17
-17
@@ -55,7 +55,7 @@ ol.style.Icon = function(opt_options) {
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
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.<number>}
|
||||
*/
|
||||
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');
|
||||
|
||||
@@ -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_];
|
||||
}
|
||||
|
||||
@@ -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.<number>}
|
||||
*/
|
||||
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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user