Remove goog.isNull in layer classes
This commit is contained in:
@@ -106,8 +106,7 @@ ol.layer.Heatmap = function(opt_options) {
|
|||||||
'weightFunction should be a function');
|
'weightFunction should be a function');
|
||||||
|
|
||||||
this.setStyle(goog.bind(function(feature, resolution) {
|
this.setStyle(goog.bind(function(feature, resolution) {
|
||||||
goog.asserts.assert(!goog.isNull(this.styleCache_),
|
goog.asserts.assert(this.styleCache_, 'this.styleCache_ expected');
|
||||||
'this.styleCache_ should not be null');
|
|
||||||
goog.asserts.assert(this.circleImage_ !== undefined,
|
goog.asserts.assert(this.circleImage_ !== undefined,
|
||||||
'this.circleImage_ should be defined');
|
'this.circleImage_ should be defined');
|
||||||
var weight = weightFunction(feature);
|
var weight = weightFunction(feature);
|
||||||
@@ -252,8 +251,7 @@ ol.layer.Heatmap.prototype.handleStyleChanged_ = function() {
|
|||||||
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
||||||
goog.asserts.assert(event.type == ol.render.EventType.RENDER,
|
goog.asserts.assert(event.type == ol.render.EventType.RENDER,
|
||||||
'event.type should be RENDER');
|
'event.type should be RENDER');
|
||||||
goog.asserts.assert(!goog.isNull(this.gradient_),
|
goog.asserts.assert(this.gradient_, 'this.gradient_ expected');
|
||||||
'this.gradient_ should not be null');
|
|
||||||
var context = event.context;
|
var context = event.context;
|
||||||
var canvas = context.canvas;
|
var canvas = context.canvas;
|
||||||
var image = context.getImageData(0, 0, canvas.width, canvas.height);
|
var image = context.getImageData(0, 0, canvas.width, canvas.height);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ ol.layer.Layer.prototype.getSource = function() {
|
|||||||
*/
|
*/
|
||||||
ol.layer.Layer.prototype.getSourceState = function() {
|
ol.layer.Layer.prototype.getSourceState = function() {
|
||||||
var source = this.getSource();
|
var source = this.getSource();
|
||||||
return goog.isNull(source) ? ol.source.State.UNDEFINED : source.getState();
|
return !source ? ol.source.State.UNDEFINED : source.getState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -134,12 +134,12 @@ ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
||||||
if (!goog.isNull(this.sourceChangeKey_)) {
|
if (this.sourceChangeKey_) {
|
||||||
goog.events.unlistenByKey(this.sourceChangeKey_);
|
goog.events.unlistenByKey(this.sourceChangeKey_);
|
||||||
this.sourceChangeKey_ = null;
|
this.sourceChangeKey_ = null;
|
||||||
}
|
}
|
||||||
var source = this.getSource();
|
var source = this.getSource();
|
||||||
if (!goog.isNull(source)) {
|
if (source) {
|
||||||
this.sourceChangeKey_ = goog.events.listen(source,
|
this.sourceChangeKey_ = goog.events.listen(source,
|
||||||
goog.events.EventType.CHANGE, this.handleSourceChange_, false, this);
|
goog.events.EventType.CHANGE, this.handleSourceChange_, false, this);
|
||||||
}
|
}
|
||||||
@@ -162,12 +162,12 @@ ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
|||||||
ol.layer.Layer.prototype.setMap = function(map) {
|
ol.layer.Layer.prototype.setMap = function(map) {
|
||||||
goog.events.unlistenByKey(this.mapPrecomposeKey_);
|
goog.events.unlistenByKey(this.mapPrecomposeKey_);
|
||||||
this.mapPrecomposeKey_ = null;
|
this.mapPrecomposeKey_ = null;
|
||||||
if (goog.isNull(map)) {
|
if (!map) {
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
goog.events.unlistenByKey(this.mapRenderKey_);
|
goog.events.unlistenByKey(this.mapRenderKey_);
|
||||||
this.mapRenderKey_ = null;
|
this.mapRenderKey_ = null;
|
||||||
if (!goog.isNull(map)) {
|
if (map) {
|
||||||
this.mapPrecomposeKey_ = goog.events.listen(
|
this.mapPrecomposeKey_ = goog.events.listen(
|
||||||
map, ol.render.EventType.PRECOMPOSE, function(evt) {
|
map, ol.render.EventType.PRECOMPOSE, function(evt) {
|
||||||
var layerState = this.getLayerState();
|
var layerState = this.getLayerState();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ol.layer.Vector = function(opt_options) {
|
|||||||
opt_options : /** @type {olx.layer.VectorOptions} */ ({});
|
opt_options : /** @type {olx.layer.VectorOptions} */ ({});
|
||||||
|
|
||||||
goog.asserts.assert(
|
goog.asserts.assert(
|
||||||
options.renderOrder === undefined || goog.isNull(options.renderOrder) ||
|
options.renderOrder === undefined || !options.renderOrder ||
|
||||||
goog.isFunction(options.renderOrder),
|
goog.isFunction(options.renderOrder),
|
||||||
'renderOrder must be a comparator function');
|
'renderOrder must be a comparator function');
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ ol.layer.Vector.prototype.getUpdateWhileInteracting = function() {
|
|||||||
*/
|
*/
|
||||||
ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
||||||
goog.asserts.assert(
|
goog.asserts.assert(
|
||||||
renderOrder === undefined || goog.isNull(renderOrder) ||
|
renderOrder === undefined || !renderOrder ||
|
||||||
goog.isFunction(renderOrder),
|
goog.isFunction(renderOrder),
|
||||||
'renderOrder must be a comparator function');
|
'renderOrder must be a comparator function');
|
||||||
this.set(ol.layer.VectorProperty.RENDER_ORDER, renderOrder);
|
this.set(ol.layer.VectorProperty.RENDER_ORDER, renderOrder);
|
||||||
@@ -181,7 +181,7 @@ ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
|||||||
*/
|
*/
|
||||||
ol.layer.Vector.prototype.setStyle = function(style) {
|
ol.layer.Vector.prototype.setStyle = function(style) {
|
||||||
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
||||||
this.styleFunction_ = goog.isNull(style) ?
|
this.styleFunction_ = style === null ?
|
||||||
undefined : ol.style.createStyleFunction(this.style_);
|
undefined : ol.style.createStyleFunction(this.style_);
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user