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');
|
||||
|
||||
this.setStyle(goog.bind(function(feature, resolution) {
|
||||
goog.asserts.assert(!goog.isNull(this.styleCache_),
|
||||
'this.styleCache_ should not be null');
|
||||
goog.asserts.assert(this.styleCache_, 'this.styleCache_ expected');
|
||||
goog.asserts.assert(this.circleImage_ !== undefined,
|
||||
'this.circleImage_ should be defined');
|
||||
var weight = weightFunction(feature);
|
||||
@@ -252,8 +251,7 @@ ol.layer.Heatmap.prototype.handleStyleChanged_ = function() {
|
||||
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
||||
goog.asserts.assert(event.type == ol.render.EventType.RENDER,
|
||||
'event.type should be RENDER');
|
||||
goog.asserts.assert(!goog.isNull(this.gradient_),
|
||||
'this.gradient_ should not be null');
|
||||
goog.asserts.assert(this.gradient_, 'this.gradient_ expected');
|
||||
var context = event.context;
|
||||
var canvas = context.canvas;
|
||||
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() {
|
||||
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
|
||||
*/
|
||||
ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
||||
if (!goog.isNull(this.sourceChangeKey_)) {
|
||||
if (this.sourceChangeKey_) {
|
||||
goog.events.unlistenByKey(this.sourceChangeKey_);
|
||||
this.sourceChangeKey_ = null;
|
||||
}
|
||||
var source = this.getSource();
|
||||
if (!goog.isNull(source)) {
|
||||
if (source) {
|
||||
this.sourceChangeKey_ = goog.events.listen(source,
|
||||
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) {
|
||||
goog.events.unlistenByKey(this.mapPrecomposeKey_);
|
||||
this.mapPrecomposeKey_ = null;
|
||||
if (goog.isNull(map)) {
|
||||
if (!map) {
|
||||
this.changed();
|
||||
}
|
||||
goog.events.unlistenByKey(this.mapRenderKey_);
|
||||
this.mapRenderKey_ = null;
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
this.mapPrecomposeKey_ = goog.events.listen(
|
||||
map, ol.render.EventType.PRECOMPOSE, function(evt) {
|
||||
var layerState = this.getLayerState();
|
||||
|
||||
@@ -35,7 +35,7 @@ ol.layer.Vector = function(opt_options) {
|
||||
opt_options : /** @type {olx.layer.VectorOptions} */ ({});
|
||||
|
||||
goog.asserts.assert(
|
||||
options.renderOrder === undefined || goog.isNull(options.renderOrder) ||
|
||||
options.renderOrder === undefined || !options.renderOrder ||
|
||||
goog.isFunction(options.renderOrder),
|
||||
'renderOrder must be a comparator function');
|
||||
|
||||
@@ -161,7 +161,7 @@ ol.layer.Vector.prototype.getUpdateWhileInteracting = function() {
|
||||
*/
|
||||
ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
||||
goog.asserts.assert(
|
||||
renderOrder === undefined || goog.isNull(renderOrder) ||
|
||||
renderOrder === undefined || !renderOrder ||
|
||||
goog.isFunction(renderOrder),
|
||||
'renderOrder must be a comparator function');
|
||||
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) {
|
||||
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
||||
this.styleFunction_ = goog.isNull(style) ?
|
||||
this.styleFunction_ = style === null ?
|
||||
undefined : ol.style.createStyleFunction(this.style_);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user