Inline various goog.isDef() calls

This commit is contained in:
Tim Schaub
2015-09-27 10:51:03 -06:00
parent 83c59ee255
commit b3b31ea16d
5 changed files with 13 additions and 10 deletions

View File

@@ -257,11 +257,12 @@ ol.render.canvas.Replay.prototype.replay_ = function(
case ol.render.canvas.Instruction.BEGIN_GEOMETRY:
feature = /** @type {ol.Feature} */ (instruction[1]);
var featureUid = goog.getUid(feature).toString();
if (goog.isDef(skippedFeaturesHash[featureUid]) ||
if (skippedFeaturesHash[featureUid] !== undefined ||
!goog.isDefAndNotNull(feature.getGeometry())) {
i = /** @type {number} */ (instruction[2]);
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
opt_hitExtent, feature.getGeometry().getExtent())) {
/** @type {Array<number>} */ (opt_hitExtent),
feature.getGeometry().getExtent())) {
i = /** @type {number} */ (instruction[2]);
} else {
++i;
@@ -451,7 +452,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
'6th instruction should be a number');
goog.asserts.assert(!goog.isNull(instruction[6]),
'7th instruction should not be null');
var usePixelRatio = goog.isDef(instruction[7]) ? instruction[7] : true;
var usePixelRatio = instruction[7] !== undefined ?
instruction[7] : true;
var lineWidth = /** @type {number} */ (instruction[2]);
context.strokeStyle = /** @type {string} */ (instruction[1]);
context.lineWidth = usePixelRatio ? lineWidth * pixelRatio : lineWidth;

View File

@@ -733,7 +733,7 @@ ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ =
var feature = this.startIndicesFeature_[featureIndex];
var featureUid = goog.getUid(feature).toString();
if (goog.isDef(skippedFeaturesHash[featureUid])) {
if (skippedFeaturesHash[featureUid] !== undefined) {
// feature should be skipped
if (start !== end) {
// draw the features so far
@@ -865,10 +865,11 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne_ =
feature = this.startIndicesFeature_[featureIndex];
featureUid = goog.getUid(feature).toString();
if (!goog.isDef(skippedFeaturesHash[featureUid]) &&
if (skippedFeaturesHash[featureUid] === undefined &&
goog.isDefAndNotNull(feature.getGeometry()) &&
(opt_hitExtent === undefined || ol.extent.intersects(
opt_hitExtent, feature.getGeometry().getExtent()))) {
/** @type {Array<number>} */ (opt_hitExtent),
feature.getGeometry().getExtent()))) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
this.drawElements_(gl, start, end, elementType, elementSize);