Remove goog.isNull in control classes
This commit is contained in:
@@ -164,15 +164,15 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var hiddenAttributions = {};
|
||||
var projection = frameState.viewState.projection;
|
||||
goog.asserts.assert(!goog.isNull(projection), 'projection cannot be null');
|
||||
goog.asserts.assert(projection, 'projection of viewState required');
|
||||
for (i = 0, ii = layerStatesArray.length; i < ii; i++) {
|
||||
source = layerStatesArray[i].layer.getSource();
|
||||
if (goog.isNull(source)) {
|
||||
if (!source) {
|
||||
continue;
|
||||
}
|
||||
sourceKey = goog.getUid(source).toString();
|
||||
sourceAttributions = source.getAttributions();
|
||||
if (goog.isNull(sourceAttributions)) {
|
||||
if (!sourceAttributions) {
|
||||
continue;
|
||||
}
|
||||
for (j = 0, jj = sourceAttributions.length; j < jj; j++) {
|
||||
@@ -186,7 +186,7 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
|
||||
goog.asserts.assertInstanceof(source, ol.source.Tile,
|
||||
'source should be an ol.source.Tile');
|
||||
var tileGrid = source.getTileGridForProjection(projection);
|
||||
goog.asserts.assert(!goog.isNull(tileGrid), 'tileGrid cannot be null');
|
||||
goog.asserts.assert(tileGrid, 'tileGrid required for projection');
|
||||
intersectsTileRange = sourceAttribution.intersectsAnyTileRange(
|
||||
tileRanges, tileGrid, projection);
|
||||
} else {
|
||||
@@ -223,7 +223,7 @@ ol.control.Attribution.render = function(mapEvent) {
|
||||
*/
|
||||
ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.element, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -105,7 +105,7 @@ ol.control.Control.prototype.getMap = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.control.Control.prototype.setMap = function(map) {
|
||||
if (!goog.isNull(this.map_)) {
|
||||
if (this.map_) {
|
||||
goog.dom.removeNode(this.element);
|
||||
}
|
||||
if (this.listenerKeys.length > 0) {
|
||||
@@ -113,8 +113,8 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
this.listenerKeys.length = 0;
|
||||
}
|
||||
this.map_ = map;
|
||||
if (!goog.isNull(this.map_)) {
|
||||
var target = !goog.isNull(this.target_) ?
|
||||
if (this.map_) {
|
||||
var target = this.target_ ?
|
||||
this.target_ : map.getOverlayContainerStopEvent();
|
||||
goog.dom.appendChild(target, this.element);
|
||||
if (this.render !== ol.nullFunction) {
|
||||
|
||||
@@ -107,7 +107,7 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (goog.isNull(map)) {
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
if (goog.dom.fullscreen.isFullScreen()) {
|
||||
@@ -141,7 +141,7 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
goog.dom.classlist.swap(button, opened, closed);
|
||||
goog.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
}
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
map.updateSize();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ goog.inherits(ol.control.MousePosition, ol.control.Control);
|
||||
*/
|
||||
ol.control.MousePosition.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
this.mapProjection_ = null;
|
||||
} else {
|
||||
if (this.mapProjection_ != frameState.viewState.projection) {
|
||||
@@ -182,7 +182,7 @@ ol.control.MousePosition.prototype.handleMouseOut = function(browserEvent) {
|
||||
*/
|
||||
ol.control.MousePosition.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(
|
||||
goog.events.listen(viewport, goog.events.EventType.MOUSEMOVE,
|
||||
@@ -224,8 +224,8 @@ ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||
*/
|
||||
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
var html = this.undefinedHTML_;
|
||||
if (!goog.isNull(pixel) && !goog.isNull(this.mapProjection_)) {
|
||||
if (goog.isNull(this.transform_)) {
|
||||
if (pixel && this.mapProjection_) {
|
||||
if (!this.transform_) {
|
||||
var projection = this.getProjection();
|
||||
if (projection) {
|
||||
this.transform_ = ol.proj.getTransformFromProjections(
|
||||
@@ -236,7 +236,7 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
}
|
||||
var map = this.getMap();
|
||||
var coordinate = map.getCoordinateFromPixel(pixel);
|
||||
if (!goog.isNull(coordinate)) {
|
||||
if (coordinate) {
|
||||
this.transform_(coordinate, coordinate);
|
||||
var coordinateFormat = this.getCoordinateFormat();
|
||||
if (coordinateFormat) {
|
||||
|
||||
@@ -113,7 +113,7 @@ ol.control.Rotate.prototype.handleClick_ = function(event) {
|
||||
ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (goog.isNull(view)) {
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
@@ -147,7 +147,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
*/
|
||||
ol.control.Rotate.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return;
|
||||
}
|
||||
var rotation = frameState.viewState.rotation;
|
||||
|
||||
@@ -160,7 +160,7 @@ ol.control.ScaleLine.prototype.getUnits = function() {
|
||||
*/
|
||||
ol.control.ScaleLine.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
this.viewState_ = null;
|
||||
} else {
|
||||
this.viewState_ = frameState.viewState;
|
||||
@@ -194,7 +194,7 @@ ol.control.ScaleLine.prototype.setUnits = function(units) {
|
||||
ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
var viewState = this.viewState_;
|
||||
|
||||
if (goog.isNull(viewState)) {
|
||||
if (!viewState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.element_, false);
|
||||
this.renderedVisible_ = false;
|
||||
@@ -226,7 +226,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
units == ol.control.ScaleLineUnits.DEGREES) {
|
||||
|
||||
// Convert pointResolution from other units to degrees
|
||||
if (goog.isNull(this.toEPSG4326_)) {
|
||||
if (!this.toEPSG4326_) {
|
||||
this.toEPSG4326_ = ol.proj.getTransformFromProjections(
|
||||
projection, ol.proj.get('EPSG:4326'));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (goog.isNull(view)) {
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
|
||||
@@ -130,7 +130,7 @@ ol.control.ZoomSlider.direction = {
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
map.render();
|
||||
}
|
||||
};
|
||||
@@ -179,7 +179,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
* @api
|
||||
*/
|
||||
ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
if (goog.isNull(mapEvent.frameState)) {
|
||||
if (!mapEvent.frameState) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(mapEvent.frameState.viewState,
|
||||
|
||||
@@ -71,7 +71,7 @@ ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var extent = goog.isNull(this.extent_) ?
|
||||
var extent = !this.extent_ ?
|
||||
view.getProjection().getExtent() : this.extent_;
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(size, 'size should be defined');
|
||||
|
||||
Reference in New Issue
Block a user