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() {
this.updatePixelPosition();
if (goog.isDef(this.get(ol.OverlayProperty.POSITION)) && this.autoPan) {
if (this.get(ol.OverlayProperty.POSITION) !== undefined && this.autoPan) {
this.panIntoView_();
}
};

View File

@@ -653,7 +653,7 @@ ol.proj.get = function(projectionLike) {
var code = projectionLike;
projection = ol.proj.projections_[code];
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});
ol.proj.addProjection(projection);
}

View File

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

View File

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

View File

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

View File

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

View File

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