Remove goog.isNull in renderer classes
This commit is contained in:
@@ -126,19 +126,19 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (!goog.isNull(sourceProjection)) {
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
var image_ = imageSource.getImage(renderedExtent, viewResolution,
|
||||
pixelRatio, projection);
|
||||
if (!goog.isNull(image_)) {
|
||||
if (image_) {
|
||||
var loaded = this.loadImage(image_);
|
||||
if (loaded) {
|
||||
image = image_;
|
||||
texture = this.createTexture_(image_);
|
||||
if (!goog.isNull(this.texture)) {
|
||||
if (this.texture) {
|
||||
frameState.postRenderFunctions.push(
|
||||
goog.partial(
|
||||
/**
|
||||
@@ -155,8 +155,8 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
|
||||
}
|
||||
}
|
||||
|
||||
if (!goog.isNull(image)) {
|
||||
goog.asserts.assert(!goog.isNull(texture), 'texture is not null');
|
||||
if (image) {
|
||||
goog.asserts.assert(texture, 'texture is truthy');
|
||||
|
||||
var canvas = this.mapRenderer.getContext().getCanvas();
|
||||
|
||||
@@ -234,7 +234,7 @@ ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate =
|
||||
*/
|
||||
ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.image_) || goog.isNull(this.image_.getImage())) {
|
||||
if (!this.image_ || !this.image_.getImage()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
var imageSize =
|
||||
[this.image_.getImage().width, this.image_.getImage().height];
|
||||
|
||||
if (goog.isNull(this.hitTransformationMatrix_)) {
|
||||
if (!this.hitTransformationMatrix_) {
|
||||
this.hitTransformationMatrix_ = this.getHitTransformationMatrix_(
|
||||
frameState.size, imageSize);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (goog.isNull(this.hitCanvasContext_)) {
|
||||
if (!this.hitCanvasContext_) {
|
||||
this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ ol.renderer.webgl.Layer.prototype.composeFrame =
|
||||
var program = context.getProgram(fragmentShader, vertexShader);
|
||||
|
||||
var locations;
|
||||
if (goog.isNull(this.defaultLocations_)) {
|
||||
if (!this.defaultLocations_) {
|
||||
locations =
|
||||
new ol.renderer.webgl.map.shader.Default.Locations(gl, program);
|
||||
this.defaultLocations_ = locations;
|
||||
|
||||
@@ -100,7 +100,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
||||
preserveDrawingBuffer: false,
|
||||
stencil: true
|
||||
});
|
||||
goog.asserts.assert(!goog.isNull(this.gl_), 'got a WebGLRenderingContext');
|
||||
goog.asserts.assert(this.gl_, 'got a WebGLRenderingContext');
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -194,7 +194,7 @@ ol.renderer.webgl.Map.prototype.bindTileTexture =
|
||||
var tileKey = tile.getKey();
|
||||
if (this.textureCache_.containsKey(tileKey)) {
|
||||
var textureCacheEntry = this.textureCache_.get(tileKey);
|
||||
goog.asserts.assert(!goog.isNull(textureCacheEntry),
|
||||
goog.asserts.assert(textureCacheEntry,
|
||||
'a texture cache entry exists for key %s', tileKey);
|
||||
gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture);
|
||||
if (textureCacheEntry.magFilter != magFilter) {
|
||||
@@ -309,7 +309,7 @@ ol.renderer.webgl.Map.prototype.disposeInternal = function() {
|
||||
* Texture cache entry.
|
||||
*/
|
||||
function(textureCacheEntry) {
|
||||
if (!goog.isNull(textureCacheEntry)) {
|
||||
if (textureCacheEntry) {
|
||||
gl.deleteTexture(textureCacheEntry.texture);
|
||||
}
|
||||
});
|
||||
@@ -330,7 +330,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) {
|
||||
while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
|
||||
ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
|
||||
textureCacheEntry = this.textureCache_.peekLast();
|
||||
if (goog.isNull(textureCacheEntry)) {
|
||||
if (!textureCacheEntry) {
|
||||
if (+this.textureCache_.peekLastKey() == frameState.index) {
|
||||
break;
|
||||
} else {
|
||||
@@ -452,7 +452,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.canvas_, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -186,7 +186,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
extent, tileResolution);
|
||||
|
||||
var framebufferExtent;
|
||||
if (!goog.isNull(this.renderedTileRange_) &&
|
||||
if (this.renderedTileRange_ &&
|
||||
this.renderedTileRange_.equals(tileRange) &&
|
||||
this.renderedRevision_ == tileSource.getRevision()) {
|
||||
framebufferExtent = this.renderedFramebufferExtent_;
|
||||
@@ -218,7 +218,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
|
||||
var program = context.getProgram(this.fragmentShader_, this.vertexShader_);
|
||||
context.useProgram(program);
|
||||
if (goog.isNull(this.locations_)) {
|
||||
if (!this.locations_) {
|
||||
this.locations_ =
|
||||
new ol.renderer.webgl.tilelayer.shader.Locations(gl, program);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
if (!fullyLoaded) {
|
||||
childTileRange = tileGrid.getTileCoordChildTileRange(
|
||||
tile.tileCoord, tmpTileRange, tmpExtent);
|
||||
if (!goog.isNull(childTileRange)) {
|
||||
if (childTileRange) {
|
||||
findLoadedTiles(z + 1, childTileRange);
|
||||
}
|
||||
}
|
||||
@@ -377,7 +377,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
*/
|
||||
ol.renderer.webgl.TileLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.framebuffer)) {
|
||||
if (!this.framebuffer) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ ol.renderer.webgl.VectorLayer.prototype.composeFrame =
|
||||
this.layerState_ = layerState;
|
||||
var viewState = frameState.viewState;
|
||||
var replayGroup = this.replayGroup_;
|
||||
if (!goog.isNull(replayGroup) && !replayGroup.isEmpty()) {
|
||||
if (replayGroup && !replayGroup.isEmpty()) {
|
||||
replayGroup.replay(context,
|
||||
viewState.center, viewState.resolution, viewState.rotation,
|
||||
frameState.size, frameState.pixelRatio, layerState.opacity,
|
||||
@@ -93,7 +93,7 @@ ol.renderer.webgl.VectorLayer.prototype.composeFrame =
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() {
|
||||
var replayGroup = this.replayGroup_;
|
||||
if (!goog.isNull(replayGroup)) {
|
||||
if (replayGroup) {
|
||||
var context = this.mapRenderer.getContext();
|
||||
replayGroup.getDeleteResourcesFunction(context)();
|
||||
this.replayGroup_ = null;
|
||||
@@ -107,7 +107,7 @@ ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() {
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
function(coordinate, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.replayGroup_) || goog.isNull(this.layerState_)) {
|
||||
if (!this.replayGroup_ || !this.layerState_) {
|
||||
return undefined;
|
||||
} else {
|
||||
var context = this.mapRenderer.getContext();
|
||||
@@ -141,7 +141,7 @@ ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtCoordinate =
|
||||
function(coordinate, frameState) {
|
||||
if (goog.isNull(this.replayGroup_) || goog.isNull(this.layerState_)) {
|
||||
if (!this.replayGroup_ || !this.layerState_) {
|
||||
return false;
|
||||
} else {
|
||||
var context = this.mapRenderer.getContext();
|
||||
@@ -233,7 +233,7 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!goog.isNull(this.replayGroup_)) {
|
||||
if (this.replayGroup_) {
|
||||
frameState.postRenderFunctions.push(
|
||||
this.replayGroup_.getDeleteResourcesFunction(context));
|
||||
}
|
||||
@@ -266,7 +266,7 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
this.dirty_ = this.dirty_ || dirty;
|
||||
}
|
||||
};
|
||||
if (!goog.isNull(vectorLayerRenderOrder)) {
|
||||
if (vectorLayerRenderOrder) {
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
vectorSource.forEachFeatureInExtentAtResolution(extent, resolution,
|
||||
|
||||
Reference in New Issue
Block a user