Remove remaining goog.isDef() calls

This commit is contained in:
Tim Schaub
2015-09-27 11:13:58 -06:00
parent c48ce003ba
commit 29a1ea9ae3
7 changed files with 31 additions and 18 deletions

View File

@@ -297,7 +297,7 @@ ol.Overlay.prototype.handleOffsetChanged = function() {
*/ */
ol.Overlay.prototype.handlePositionChanged = function() { ol.Overlay.prototype.handlePositionChanged = function() {
this.updatePixelPosition(); this.updatePixelPosition();
if (goog.isDef(this.get(ol.OverlayProperty.POSITION)) && this.autoPan) { if (this.get(ol.OverlayProperty.POSITION) !== undefined && this.autoPan) {
this.panIntoView_(); this.panIntoView_();
} }
}; };

View File

@@ -653,7 +653,7 @@ ol.proj.get = function(projectionLike) {
var code = projectionLike; var code = projectionLike;
projection = ol.proj.projections_[code]; projection = ol.proj.projections_[code];
if (ol.ENABLE_PROJ4JS && projection === undefined && if (ol.ENABLE_PROJ4JS && projection === undefined &&
typeof proj4 == 'function' && goog.isDef(proj4.defs(code))) { typeof proj4 == 'function' && proj4.defs(code) !== undefined) {
projection = new ol.proj.Projection({code: code}); projection = new ol.proj.Projection({code: code});
ol.proj.addProjection(projection); ol.proj.addProjection(projection);
} }

View File

@@ -275,10 +275,14 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
*/ */
function(feature) { function(feature) {
var styles; var styles;
if (goog.isDef(feature.getStyleFunction())) { var styleFunction = feature.getStyleFunction();
styles = feature.getStyleFunction().call(feature, resolution); if (styleFunction) {
} else if (goog.isDef(vectorLayer.getStyleFunction())) { styles = styleFunction.call(feature, resolution);
styles = vectorLayer.getStyleFunction()(feature, resolution); } else {
styleFunction = vectorLayer.getStyleFunction();
if (styleFunction) {
styles = styleFunction(feature, resolution);
}
} }
if (goog.isDefAndNotNull(styles)) { if (goog.isDefAndNotNull(styles)) {
var dirty = this.renderFeature( var dirty = this.renderFeature(

View File

@@ -283,10 +283,14 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
*/ */
function(feature) { function(feature) {
var styles; var styles;
if (goog.isDef(feature.getStyleFunction())) { var styleFunction = feature.getStyleFunction();
styles = feature.getStyleFunction().call(feature, resolution); if (styleFunction) {
} else if (goog.isDef(vectorLayer.getStyleFunction())) { styles = styleFunction.call(feature, resolution);
styles = vectorLayer.getStyleFunction()(feature, resolution); } else {
styleFunction = vectorLayer.getStyleFunction();
if (styleFunction) {
styles = styleFunction(feature, resolution);
}
} }
if (goog.isDefAndNotNull(styles)) { if (goog.isDefAndNotNull(styles)) {
var dirty = this.renderFeature( var dirty = this.renderFeature(

View File

@@ -256,10 +256,14 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
*/ */
function(feature) { function(feature) {
var styles; var styles;
if (goog.isDef(feature.getStyleFunction())) { var styleFunction = feature.getStyleFunction();
styles = feature.getStyleFunction().call(feature, resolution); if (styleFunction) {
} else if (goog.isDef(vectorLayer.getStyleFunction())) { styles = styleFunction.call(feature, resolution);
styles = vectorLayer.getStyleFunction()(feature, resolution); } else {
styleFunction = vectorLayer.getStyleFunction();
if (styleFunction) {
styles = styleFunction(feature, resolution);
}
} }
if (goog.isDefAndNotNull(styles)) { if (goog.isDefAndNotNull(styles)) {
var dirty = this.renderFeature( var dirty = this.renderFeature(

View File

@@ -259,9 +259,10 @@ ol.source.ImageVector.prototype.handleSourceChange_ = function() {
ol.source.ImageVector.prototype.renderFeature_ = ol.source.ImageVector.prototype.renderFeature_ =
function(feature, resolution, pixelRatio, replayGroup) { function(feature, resolution, pixelRatio, replayGroup) {
var styles; var styles;
if (goog.isDef(feature.getStyleFunction())) { var styleFunction = feature.getStyleFunction();
styles = feature.getStyleFunction().call(feature, resolution); if (styleFunction) {
} else if (this.styleFunction_ !== undefined) { styles = styleFunction.call(feature, resolution);
} else if (this.styleFunction_) {
styles = this.styleFunction_(feature, resolution); styles = this.styleFunction_(feature, resolution);
} }
if (!goog.isDefAndNotNull(styles)) { if (!goog.isDefAndNotNull(styles)) {

View File

@@ -553,7 +553,7 @@ ol.View.prototype.centerOn = function(coordinate, size, position) {
*/ */
ol.View.prototype.isDef = function() { ol.View.prototype.isDef = function() {
return goog.isDefAndNotNull(this.getCenter()) && return goog.isDefAndNotNull(this.getCenter()) &&
goog.isDef(this.getResolution()); this.getResolution() !== undefined;
}; };