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