Remove ol.DEBUG

This commit is contained in:
Tim Schaub
2016-12-29 09:09:24 -07:00
parent 7b9690a691
commit 137cdc04c8
128 changed files with 309 additions and 2027 deletions

View File

@@ -120,35 +120,15 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu
if (!this.image_) {
return;
}
ol.DEBUG && console.assert(this.anchorX_ !== undefined,
'this.anchorX_ should be defined');
ol.DEBUG && console.assert(this.anchorY_ !== undefined,
'this.anchorY_ should be defined');
ol.DEBUG && console.assert(this.height_ !== undefined,
'this.height_ should be defined');
ol.DEBUG && console.assert(this.opacity_ !== undefined,
'this.opacity_ should be defined');
ol.DEBUG && console.assert(this.originX_ !== undefined,
'this.originX_ should be defined');
ol.DEBUG && console.assert(this.originY_ !== undefined,
'this.originY_ should be defined');
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
'this.rotateWithView_ should be defined');
ol.DEBUG && console.assert(this.rotation_ !== undefined,
'this.rotation_ should be defined');
ol.DEBUG && console.assert(this.scale_ !== undefined,
'this.scale_ should be defined');
ol.DEBUG && console.assert(this.width_ !== undefined,
'this.width_ should be defined');
this.beginGeometry(pointGeometry, feature);
var flatCoordinates = pointGeometry.getFlatCoordinates();
var stride = pointGeometry.getStride();
var myBegin = this.coordinates.length;
var myEnd = this.drawCoordinates_(
flatCoordinates, 0, flatCoordinates.length, stride);
flatCoordinates, 0, flatCoordinates.length, stride);
this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_
@@ -156,7 +136,7 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu
this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_
@@ -172,35 +152,15 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome
if (!this.image_) {
return;
}
ol.DEBUG && console.assert(this.anchorX_ !== undefined,
'this.anchorX_ should be defined');
ol.DEBUG && console.assert(this.anchorY_ !== undefined,
'this.anchorY_ should be defined');
ol.DEBUG && console.assert(this.height_ !== undefined,
'this.height_ should be defined');
ol.DEBUG && console.assert(this.opacity_ !== undefined,
'this.opacity_ should be defined');
ol.DEBUG && console.assert(this.originX_ !== undefined,
'this.originX_ should be defined');
ol.DEBUG && console.assert(this.originY_ !== undefined,
'this.originY_ should be defined');
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
'this.rotateWithView_ should be defined');
ol.DEBUG && console.assert(this.rotation_ !== undefined,
'this.rotation_ should be defined');
ol.DEBUG && console.assert(this.scale_ !== undefined,
'this.scale_ should be defined');
ol.DEBUG && console.assert(this.width_ !== undefined,
'this.width_ should be defined');
this.beginGeometry(multiPointGeometry, feature);
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
var stride = multiPointGeometry.getStride();
var myBegin = this.coordinates.length;
var myEnd = this.drawCoordinates_(
flatCoordinates, 0, flatCoordinates.length, stride);
flatCoordinates, 0, flatCoordinates.length, stride);
this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_
@@ -208,7 +168,7 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome
this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_
@@ -243,18 +203,11 @@ ol.render.canvas.ImageReplay.prototype.finish = function() {
* @inheritDoc
*/
ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
ol.DEBUG && console.assert(imageStyle, 'imageStyle should not be null');
var anchor = imageStyle.getAnchor();
ol.DEBUG && console.assert(anchor, 'anchor should not be null');
var size = imageStyle.getSize();
ol.DEBUG && console.assert(size, 'size should not be null');
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
ol.DEBUG && console.assert(hitDetectionImage,
'hitDetectionImage should not be null');
var image = imageStyle.getImage(1);
ol.DEBUG && console.assert(image, 'image should not be null');
var origin = imageStyle.getOrigin();
ol.DEBUG && console.assert(origin, 'origin should not be null');
this.anchorX_ = anchor[0];
this.anchorY_ = anchor[1];
this.hitDetectionImage_ = hitDetectionImage;

View File

@@ -251,9 +251,6 @@ ol.render.canvas.Immediate.prototype.drawImages_ = function(flatCoordinates, off
if (!this.image_) {
return;
}
ol.DEBUG && console.assert(offset === 0, 'offset should be 0');
ol.DEBUG && console.assert(end == flatCoordinates.length,
'end should be equal to the length of flatCoordinates');
var pixelCoordinates = ol.geom.flat.transform.transform2D(
flatCoordinates, offset, end, 2, this.transform_,
this.pixelCoordinates_);
@@ -316,9 +313,6 @@ ol.render.canvas.Immediate.prototype.drawText_ = function(flatCoordinates, offse
this.setContextStrokeState_(this.textStrokeState_);
}
this.setContextTextState_(this.textState_);
ol.DEBUG && console.assert(offset === 0, 'offset should be 0');
ol.DEBUG && console.assert(end == flatCoordinates.length,
'end should be equal to the length of flatCoordinates');
var pixelCoordinates = ol.geom.flat.transform.transform2D(
flatCoordinates, offset, end, stride, this.transform_,
this.pixelCoordinates_);
@@ -487,7 +481,6 @@ ol.render.canvas.Immediate.prototype.drawGeometry = function(geometry) {
this.drawCircle(/** @type {ol.geom.Circle} */ (geometry));
break;
default:
ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type);
}
};
@@ -862,7 +855,6 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
var imageImage = imageStyle.getImage(1);
var imageOrigin = imageStyle.getOrigin();
var imageSize = imageStyle.getSize();
ol.DEBUG && console.assert(imageImage, 'imageImage must be truthy');
this.imageAnchorX_ = imageAnchor[0];
this.imageAnchorY_ = imageAnchor[1];
this.imageHeight_ = imageSize[1];

View File

@@ -110,13 +110,6 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
var lineJoin = state.lineJoin;
var lineWidth = state.lineWidth;
var miterLimit = state.miterLimit;
ol.DEBUG && console.assert(strokeStyle !== undefined,
'strokeStyle should be defined');
ol.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined');
ol.DEBUG && console.assert(lineDash, 'lineDash should not be null');
ol.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined');
ol.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined');
ol.DEBUG && console.assert(miterLimit !== undefined, 'miterLimit should be defined');
if (state.currentStrokeStyle != strokeStyle ||
state.currentLineCap != lineCap ||
!ol.array.equals(state.currentLineDash, lineDash) ||
@@ -148,7 +141,6 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
*/
ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth;
if (strokeStyle === undefined || lineWidth === undefined) {
@@ -176,7 +168,6 @@ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineString
*/
ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth;
if (strokeStyle === undefined || lineWidth === undefined) {
@@ -210,7 +201,6 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multi
*/
ol.render.canvas.LineStringReplay.prototype.finish = function() {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
if (state.lastStroke != this.coordinates.length) {
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
}
@@ -223,9 +213,6 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() {
* @inheritDoc
*/
ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
ol.DEBUG && console.assert(!fillStyle, 'fillStyle should be null');
ol.DEBUG && console.assert(strokeStyle, 'strokeStyle should not be null');
var strokeStyleColor = strokeStyle.getColor();
this.state_.strokeStyle = ol.colorlike.asColorLike(strokeStyleColor ?
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);

View File

@@ -108,8 +108,6 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
this.instructions.push(fillInstruction);
}
if (stroke) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
this.instructions.push(strokeInstruction);
this.hitDetectionInstructions.push(strokeInstruction);
@@ -123,16 +121,11 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
*/
ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
if (strokeStyle !== undefined) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');
}
this.setFillStrokeStyles_(circleGeometry);
this.beginGeometry(circleGeometry, feature);
// always fill the circle for hit detection
@@ -162,8 +155,6 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
this.instructions.push(fillInstruction);
}
if (state.strokeStyle !== undefined) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');
var strokeInstruction = [ol.render.canvas.Instruction.STROKE];
this.instructions.push(strokeInstruction);
this.hitDetectionInstructions.push(strokeInstruction);
@@ -177,14 +168,6 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
*/
ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var strokeStyle = state.strokeStyle;
ol.DEBUG && console.assert(state.fillStyle !== undefined || strokeStyle !== undefined,
'fillStyle or strokeStyle should be defined');
if (strokeStyle !== undefined) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');
}
this.setFillStrokeStyles_(polygonGeometry);
this.beginGeometry(polygonGeometry, feature);
// always fill the polygon for hit detection
@@ -212,16 +195,11 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
*/
ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
var state = this.state_;
ol.DEBUG && console.assert(state, 'state should not be null');
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
if (strokeStyle !== undefined) {
ol.DEBUG && console.assert(state.lineWidth !== undefined,
'state.lineWidth should be defined');
}
this.setFillStrokeStyles_(multiPolygonGeometry);
this.beginGeometry(multiPolygonGeometry, feature);
// always fill the multi-polygon for hit detection
@@ -253,7 +231,6 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygo
* @inheritDoc
*/
ol.render.canvas.PolygonReplay.prototype.finish = function() {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
this.reverseHitDetectionInstructions();
this.state_ = null;
// We want to preserve topology when drawing polygons. Polygons are
@@ -290,9 +267,6 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
* @inheritDoc
*/
ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
ol.DEBUG && console.assert(fillStyle || strokeStyle,
'fillStyle or strokeStyle should not be null');
var state = this.state_;
if (fillStyle) {
var fillStyleColor = fillStyle.getColor();
@@ -360,12 +334,6 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function(geometr
state.currentFillStyle = state.fillStyle;
}
if (strokeStyle !== undefined) {
ol.DEBUG && console.assert(lineCap !== undefined, 'lineCap should be defined');
ol.DEBUG && console.assert(lineDash, 'lineDash should not be null');
ol.DEBUG && console.assert(lineJoin !== undefined, 'lineJoin should be defined');
ol.DEBUG && console.assert(lineWidth !== undefined, 'lineWidth should be defined');
ol.DEBUG && console.assert(miterLimit !== undefined,
'miterLimit should be defined');
if (state.currentStrokeStyle != strokeStyle ||
state.currentLineCap != lineCap ||
!ol.array.equals(state.currentLineDash, lineDash) ||

View File

@@ -2,7 +2,6 @@ goog.provide('ol.render.canvas.Replay');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.colorlike');
goog.require('ol.extent');
goog.require('ol.extent.Relationship');
goog.require('ol.geom.flat.transform');
@@ -237,8 +236,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
this.coordinates, 0, this.coordinates.length, 2,
transform, this.pixelCoordinates_);
ol.transform.setFromArray(this.renderedTransform_, transform);
ol.DEBUG && console.assert(pixelCoordinates === this.pixelCoordinates_,
'pixelCoordinates should be the same as this.pixelCoordinates_');
}
var skipFeatures = !ol.obj.isEmpty(skippedFeaturesHash);
var i = 0; // instruction index
@@ -287,8 +284,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.CIRCLE:
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
'second instruction should be a number');
d = /** @type {number} */ (instruction[1]);
var x1 = pixelCoordinates[d];
var y1 = pixelCoordinates[d + 1];
@@ -306,11 +301,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.DRAW_IMAGE:
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
'second instruction should be a number');
d = /** @type {number} */ (instruction[1]);
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
'third instruction should be a number');
dd = /** @type {number} */ (instruction[2]);
var image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */
(instruction[3]);
@@ -364,32 +355,14 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.DRAW_TEXT:
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
'2nd instruction should be a number');
d = /** @type {number} */ (instruction[1]);
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
'3rd instruction should be a number');
dd = /** @type {number} */ (instruction[2]);
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
'4th instruction should be a string');
text = /** @type {string} */ (instruction[3]);
ol.DEBUG && console.assert(typeof instruction[4] === 'number',
'5th instruction should be a number');
var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio;
ol.DEBUG && console.assert(typeof instruction[5] === 'number',
'6th instruction should be a number');
var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio;
ol.DEBUG && console.assert(typeof instruction[6] === 'number',
'7th instruction should be a number');
rotation = /** @type {number} */ (instruction[6]);
ol.DEBUG && console.assert(typeof instruction[7] === 'number',
'8th instruction should be a number');
scale = /** @type {number} */ (instruction[7]) * pixelRatio;
ol.DEBUG && console.assert(typeof instruction[8] === 'boolean',
'9th instruction should be a boolean');
fill = /** @type {boolean} */ (instruction[8]);
ol.DEBUG && console.assert(typeof instruction[9] === 'boolean',
'10th instruction should be a boolean');
stroke = /** @type {boolean} */ (instruction[9]);
rotateWithView = /** @type {boolean} */ (instruction[10]);
if (rotateWithView) {
@@ -456,11 +429,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.MOVE_TO_LINE_TO:
ol.DEBUG && console.assert(typeof instruction[1] === 'number',
'2nd instruction should be a number');
d = /** @type {number} */ (instruction[1]);
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
'3rd instruction should be a number');
dd = /** @type {number} */ (instruction[2]);
x = pixelCoordinates[d];
y = pixelCoordinates[d + 1];
@@ -485,10 +454,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.SET_FILL_STYLE:
ol.DEBUG && console.assert(
ol.colorlike.isColorLike(instruction[1]),
'2nd instruction should be a string, ' +
'CanvasPattern, or CanvasGradient');
this.fillOrigin_ = instruction[2];
if (pendingFill) {
@@ -500,20 +465,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.SET_STROKE_STYLE:
ol.DEBUG && console.assert(ol.colorlike.isColorLike(instruction[1]),
'2nd instruction should be a string, CanvasPattern, or CanvasGradient');
ol.DEBUG && console.assert(typeof instruction[2] === 'number',
'3rd instruction should be a number');
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
'4rd instruction should be a string');
ol.DEBUG && console.assert(typeof instruction[4] === 'string',
'5th instruction should be a string');
ol.DEBUG && console.assert(typeof instruction[5] === 'number',
'6th instruction should be a number');
ol.DEBUG && console.assert(instruction[6],
'7th instruction should not be null');
ol.DEBUG && console.assert(typeof instruction[8] === 'number',
'9th instruction should be a number');
var usePixelRatio = instruction[7] !== undefined ?
instruction[7] : true;
var renderedPixelRatio = instruction[8];
@@ -544,12 +495,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
case ol.render.canvas.Instruction.SET_TEXT_STYLE:
ol.DEBUG && console.assert(typeof instruction[1] === 'string',
'2nd instruction should be a string');
ol.DEBUG && console.assert(typeof instruction[2] === 'string',
'3rd instruction should be a string');
ol.DEBUG && console.assert(typeof instruction[3] === 'string',
'4th instruction should be a string');
context.font = /** @type {string} */ (instruction[1]);
context.textAlign = /** @type {string} */ (instruction[2]);
context.textBaseline = /** @type {string} */ (instruction[3]);
@@ -564,7 +509,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
++i;
break;
default:
ol.DEBUG && console.assert(false, 'Unknown canvas render instruction');
++i; // consume the instruction anyway, to avoid an infinite loop
break;
}
@@ -575,9 +519,6 @@ ol.render.canvas.Replay.prototype.replay_ = function(
if (pendingStroke) {
context.stroke();
}
// assert that all instructions were consumed
ol.DEBUG && console.assert(i == instructions.length,
'all instructions should be consumed');
return undefined;
};
@@ -637,12 +578,9 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions = function() {
instruction = hitDetectionInstructions[i];
type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]);
if (type == ol.render.canvas.Instruction.END_GEOMETRY) {
ol.DEBUG && console.assert(begin == -1, 'begin should be -1');
begin = i;
} else if (type == ol.render.canvas.Instruction.BEGIN_GEOMETRY) {
instruction[2] = i;
ol.DEBUG && console.assert(begin >= 0,
'begin should be larger than or equal to 0');
ol.array.reverseSubArray(this.hitDetectionInstructions, begin, i);
begin = -1;
}
@@ -655,12 +593,8 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions = function() {
* @param {ol.Feature|ol.render.Feature} feature Feature.
*/
ol.render.canvas.Replay.prototype.endGeometry = function(geometry, feature) {
ol.DEBUG && console.assert(this.beginGeometryInstruction1_,
'this.beginGeometryInstruction1_ should not be null');
this.beginGeometryInstruction1_[2] = this.instructions.length;
this.beginGeometryInstruction1_ = null;
ol.DEBUG && console.assert(this.beginGeometryInstruction2_,
'this.beginGeometryInstruction2_ should not be null');
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
this.beginGeometryInstruction2_ = null;
var endGeometryInstruction =

View File

@@ -276,9 +276,6 @@ ol.render.canvas.ReplayGroup.prototype.getReplay = function(zIndex, replayType)
var replay = replays[replayType];
if (replay === undefined) {
var Constructor = ol.render.canvas.ReplayGroup.BATCH_CONSTRUCTORS_[replayType];
ol.DEBUG && console.assert(Constructor !== undefined,
replayType +
' constructor missing from ol.render.canvas.ReplayGroup.BATCH_CONSTRUCTORS_');
replay = new Constructor(this.tolerance_, this.maxExtent_,
this.resolution_, this.overlaps_);
replays[replayType] = replay;

View File

@@ -18,20 +18,12 @@ goog.require('ol.geom.GeometryType');
* @param {Object.<string, *>} properties Properties.
*/
ol.render.Feature = function(type, flatCoordinates, ends, properties) {
/**
* @private
* @type {ol.Extent|undefined}
*/
this.extent_;
ol.DEBUG && console.assert(type === ol.geom.GeometryType.POINT ||
type === ol.geom.GeometryType.MULTI_POINT ||
type === ol.geom.GeometryType.LINE_STRING ||
type === ol.geom.GeometryType.MULTI_LINE_STRING ||
type === ol.geom.GeometryType.POLYGON,
'Need a Point, MultiPoint, LineString, MultiLineString or Polygon type');
/**
* @private
* @type {ol.geom.GeometryType}
@@ -55,7 +47,6 @@ ol.render.Feature = function(type, flatCoordinates, ends, properties) {
* @type {Object.<string, *>}
*/
this.properties_ = properties;
};

View File

@@ -178,10 +178,6 @@ ol.render.webgl.CircleReplay.prototype.getDeleteResourcesFunction = function(con
// be used by other CircleReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
return function() {
@@ -251,9 +247,6 @@ ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippe
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -275,11 +268,6 @@ ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippe
*/
ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -326,9 +314,6 @@ ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.CircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -388,7 +373,6 @@ ol.render.webgl.CircleReplay.prototype.setStrokeStyle_ = function(gl, color, lin
* @inheritDoc
*/
ol.render.webgl.CircleReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var strokeStyleColor, strokeStyleWidth;
if (strokeStyle) {
var strokeStyleLineDash = strokeStyle.getLineDash();

View File

@@ -35,9 +35,7 @@ ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precisio
* @const
* @type {string}
*/
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.circlereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varying ve
* @const
* @type {string}
*/
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.circlereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex();
@@ -91,72 +87,60 @@ ol.render.webgl.circlereplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_fillColor = gl.getUniformLocation(
program, ol.DEBUG ? 'u_fillColor' : 'n');
this.u_fillColor = gl.getUniformLocation(program, 'n');
/**
* @type {WebGLUniformLocation}
*/
this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG ? 'u_lineWidth' : 'k');
this.u_lineWidth = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'm');
this.u_opacity = gl.getUniformLocation(program, 'm');
/**
* @type {WebGLUniformLocation}
*/
this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG ? 'u_pixelRatio' : 'l');
this.u_pixelRatio = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {WebGLUniformLocation}
*/
this.u_size = gl.getUniformLocation(
program, ol.DEBUG ? 'u_size' : 'p');
this.u_size = gl.getUniformLocation(program, 'p');
/**
* @type {WebGLUniformLocation}
*/
this.u_strokeColor = gl.getUniformLocation(
program, ol.DEBUG ? 'u_strokeColor' : 'o');
this.u_strokeColor = gl.getUniformLocation(program, 'o');
/**
* @type {number}
*/
this.a_instruction = gl.getAttribLocation(
program, ol.DEBUG ? 'a_instruction' : 'f');
this.a_instruction = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'e');
this.a_position = gl.getAttribLocation(program, 'e');
/**
* @type {number}
*/
this.a_radius = gl.getAttribLocation(
program, ol.DEBUG ? 'a_radius' : 'g');
this.a_radius = gl.getAttribLocation(program, 'g');
};

View File

@@ -142,14 +142,6 @@ ol.inherits(ol.render.webgl.ImageReplay, ol.render.webgl.Replay);
* @inheritDoc
*/
ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other ImageReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
var textures = this.textures_;
@@ -180,20 +172,6 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont
* @private
*/
ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
ol.DEBUG && console.assert(this.anchorX_ !== undefined, 'anchorX is defined');
ol.DEBUG && console.assert(this.anchorY_ !== undefined, 'anchorY is defined');
ol.DEBUG && console.assert(this.height_ !== undefined, 'height is defined');
ol.DEBUG && console.assert(this.imageHeight_ !== undefined,
'imageHeight is defined');
ol.DEBUG && console.assert(this.imageWidth_ !== undefined, 'imageWidth is defined');
ol.DEBUG && console.assert(this.opacity_ !== undefined, 'opacity is defined');
ol.DEBUG && console.assert(this.originX_ !== undefined, 'originX is defined');
ol.DEBUG && console.assert(this.originY_ !== undefined, 'originY is defined');
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
'rotateWithView is defined');
ol.DEBUG && console.assert(this.rotation_ !== undefined, 'rotation is defined');
ol.DEBUG && console.assert(this.scale_ !== undefined, 'scale is defined');
ol.DEBUG && console.assert(this.width_ !== undefined, 'width is defined');
var anchorX = /** @type {number} */ (this.anchorX_);
var anchorY = /** @type {number} */ (this.anchorY_);
var height = /** @type {number} */ (this.height_);
@@ -321,21 +299,12 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
var gl = context.getGL();
this.groupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.images_.length === this.groupIndices_.length,
'number of images and groupIndices match');
this.hitDetectionGroupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.hitDetectionImages_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionImages and hitDetectionGroupIndices match');
// create, bind, and populate the vertices buffer
this.verticesBuffer = new ol.webgl.Buffer(this.vertices);
var indices = this.indices;
var bits = context.hasOESElementIndexUint ? 32 : 16;
ol.DEBUG && console.assert(indices[indices.length - 1] < Math.pow(2, bits),
'Too large element index detected [%s] (OES_element_index_uint "%s")',
indices[indices.length - 1], context.hasOESElementIndexUint);
// create, bind, and populate the indices buffer
this.indicesBuffer = new ol.webgl.Buffer(indices);
@@ -345,14 +314,9 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
var texturePerImage = {};
this.createTextures_(this.textures_, this.images_, texturePerImage, gl);
ol.DEBUG && console.assert(this.textures_.length === this.groupIndices_.length,
'number of textures and groupIndices match');
this.createTextures_(this.hitDetectionTextures_, this.hitDetectionImages_,
texturePerImage, gl);
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionTextures and hitDetectionGroupIndices match');
this.anchorX_ = undefined;
this.anchorY_ = undefined;
@@ -382,9 +346,6 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
* @param {WebGLRenderingContext} gl Gl.
*/
ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, images, texturePerImage, gl) {
ol.DEBUG && console.assert(textures.length === 0,
'upon creation, textures is empty');
var texture, image, uid, i;
var ii = images.length;
for (i = 0; i < ii; ++i) {
@@ -468,8 +429,6 @@ ol.render.webgl.ImageReplay.prototype.shutDownProgram = function(gl, locations)
ol.render.webgl.ImageReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
var textures = hitDetection ? this.hitDetectionTextures_ : this.textures_;
var groupIndices = hitDetection ? this.hitDetectionGroupIndices_ : this.groupIndices_;
ol.DEBUG && console.assert(textures.length === groupIndices.length,
'number of textures and groupIndeces match');
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(
@@ -561,10 +520,6 @@ ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = function(gl, context
*/
ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionTextures and hitDetectionGroupIndices match');
var i, groupStart, start, end, feature, featureUid;
var featureIndex = this.startIndices.length - 1;
for (i = this.hitDetectionTextures_.length - 1; i >= 0; --i) {
@@ -609,28 +564,12 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
var image = imageStyle.getImage(1);
var imageSize = imageStyle.getImageSize();
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
var hitDetectionImageSize = imageStyle.getHitDetectionImageSize();
var opacity = imageStyle.getOpacity();
var origin = imageStyle.getOrigin();
var rotateWithView = imageStyle.getRotateWithView();
var rotation = imageStyle.getRotation();
var size = imageStyle.getSize();
var scale = imageStyle.getScale();
ol.DEBUG && console.assert(anchor, 'imageStyle anchor is not null');
ol.DEBUG && console.assert(image, 'imageStyle image is not null');
ol.DEBUG && console.assert(imageSize,
'imageStyle imageSize is not null');
ol.DEBUG && console.assert(hitDetectionImage,
'imageStyle hitDetectionImage is not null');
ol.DEBUG && console.assert(hitDetectionImageSize,
'imageStyle hitDetectionImageSize is not null');
ol.DEBUG && console.assert(opacity !== undefined, 'imageStyle opacity is defined');
ol.DEBUG && console.assert(origin, 'imageStyle origin is not null');
ol.DEBUG && console.assert(rotateWithView !== undefined,
'imageStyle rotateWithView is defined');
ol.DEBUG && console.assert(rotation !== undefined, 'imageStyle rotation is defined');
ol.DEBUG && console.assert(size, 'imageStyle size is not null');
ol.DEBUG && console.assert(scale !== undefined, 'imageStyle scale is defined');
var currentImage;
if (this.images_.length === 0) {
@@ -639,8 +578,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
currentImage = this.images_[this.images_.length - 1];
if (ol.getUid(currentImage) != ol.getUid(image)) {
this.groupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.groupIndices_.length === this.images_.length,
'number of groupIndices and images match');
this.images_.push(image);
}
}
@@ -652,9 +589,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
this.hitDetectionImages_[this.hitDetectionImages_.length - 1];
if (ol.getUid(currentImage) != ol.getUid(hitDetectionImage)) {
this.hitDetectionGroupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.hitDetectionGroupIndices_.length ===
this.hitDetectionImages_.length,
'number of hitDetectionGroupIndices and hitDetectionImages match');
this.hitDetectionImages_.push(hitDetectionImage);
}
}

View File

@@ -35,9 +35,7 @@ ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precision
* @const
* @type {string}
*/
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.imagereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varying vec
* @const
* @type {string}
*/
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.imagereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex();
@@ -91,60 +87,50 @@ ol.render.webgl.imagereplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_image = gl.getUniformLocation(
program, ol.DEBUG ? 'u_image' : 'l');
this.u_image = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'k');
this.u_opacity = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {number}
*/
this.a_offsets = gl.getAttribLocation(
program, ol.DEBUG ? 'a_offsets' : 'e');
this.a_offsets = gl.getAttribLocation(program, 'e');
/**
* @type {number}
*/
this.a_opacity = gl.getAttribLocation(
program, ol.DEBUG ? 'a_opacity' : 'f');
this.a_opacity = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'c');
this.a_position = gl.getAttribLocation(program, 'c');
/**
* @type {number}
*/
this.a_rotateWithView = gl.getAttribLocation(
program, ol.DEBUG ? 'a_rotateWithView' : 'g');
this.a_rotateWithView = gl.getAttribLocation(program, 'g');
/**
* @type {number}
*/
this.a_texCoord = gl.getAttribLocation(
program, ol.DEBUG ? 'a_texCoord' : 'd');
this.a_texCoord = gl.getAttribLocation(program, 'd');
};

View File

@@ -129,7 +129,7 @@ ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
this.drawCircle(/** @type {ol.geom.Circle} */ (geometry), null);
break;
default:
ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type);
// pass
}
};
@@ -145,7 +145,6 @@ ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
return;
}
this.setStyle(style);
ol.DEBUG && console.assert(geometry, 'geometry must be truthy');
this.drawGeometry(geometry);
};

View File

@@ -149,8 +149,6 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
p2 = startCoords;
break;
} else {
//For the compiler not to complain. This will never be [0, 0].
ol.DEBUG && console.assert(p0, 'p0 should be defined');
p0 = p0 || [0, 0];
numVertices = this.addVertices_(p0, p1, [0, 0],
@@ -232,9 +230,6 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
}
if (closed) {
//Link the last triangle/rhombus to the first one.
//n will never be numVertices / 7 here. However, the compiler complains otherwise.
ol.DEBUG && console.assert(n, 'n should be defined');
n = n || numVertices / 7;
sign = ol.geom.flat.orient.linearRingIsClockwise([p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]], 0, 6, 2)
? 1 : -1;
@@ -425,11 +420,6 @@ ol.render.webgl.LineStringReplay.prototype.finish = function(context) {
* @inheritDoc
*/
ol.render.webgl.LineStringReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other LineStringReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer, 'verticesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
return function() {
@@ -514,9 +504,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, sk
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -546,9 +533,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, sk
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -587,11 +571,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, co
*/
ol.render.webgl.LineStringReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -647,7 +626,6 @@ ol.render.webgl.LineStringReplay.prototype.setStrokeStyle_ = function(gl, color,
* @inheritDoc
*/
ol.render.webgl.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var strokeStyleLineCap = strokeStyle.getLineCap();
this.state_.lineCap = strokeStyleLineCap !== undefined ?
strokeStyleLineCap : ol.render.webgl.defaultLineCap;

View File

@@ -35,9 +35,7 @@ ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'prec
* @const
* @type {string}
*/
ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.linestringreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.fragment = new ol.render.webgl.linestringreplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varyin
* @const
* @type {string}
*/
ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.linestringreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.vertex = new ol.render.webgl.linestringreplay.defaultshader.Vertex();
@@ -91,78 +87,65 @@ ol.render.webgl.linestringreplay.defaultshader.Locations = function(gl, program)
/**
* @type {WebGLUniformLocation}
*/
this.u_color = gl.getUniformLocation(
program, ol.DEBUG ? 'u_color' : 'n');
this.u_color = gl.getUniformLocation(program, 'n');
/**
* @type {WebGLUniformLocation}
*/
this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG ? 'u_lineWidth' : 'k');
this.u_lineWidth = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_miterLimit = gl.getUniformLocation(
program, ol.DEBUG ? 'u_miterLimit' : 'l');
this.u_miterLimit = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'm');
this.u_opacity = gl.getUniformLocation(program, 'm');
/**
* @type {WebGLUniformLocation}
*/
this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG ? 'u_pixelRatio' : 'p');
this.u_pixelRatio = gl.getUniformLocation(program, 'p');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {WebGLUniformLocation}
*/
this.u_size = gl.getUniformLocation(
program, ol.DEBUG ? 'u_size' : 'o');
this.u_size = gl.getUniformLocation(program, 'o');
/**
* @type {number}
*/
this.a_direction = gl.getAttribLocation(
program, ol.DEBUG ? 'a_direction' : 'g');
this.a_direction = gl.getAttribLocation(program, 'g');
/**
* @type {number}
*/
this.a_lastPos = gl.getAttribLocation(
program, ol.DEBUG ? 'a_lastPos' : 'd');
this.a_lastPos = gl.getAttribLocation(program, 'd');
/**
* @type {number}
*/
this.a_nextPos = gl.getAttribLocation(
program, ol.DEBUG ? 'a_nextPos' : 'f');
this.a_nextPos = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'e');
this.a_position = gl.getAttribLocation(program, 'e');
};

View File

@@ -296,8 +296,6 @@ ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
// Due to the behavior of OL's PIP algorithm, the ear clipping cannot
// introduce touching segments. However, the original data may have some.
if (!this.resolveLocalSelfIntersections_(list, rtree, true)) {
// Something went wrong.
ol.DEBUG && console.assert(false, 'Unexpected simple polygon geometry');
break;
}
}
@@ -809,14 +807,6 @@ ol.render.webgl.PolygonReplay.prototype.finish = function(context) {
* @inheritDoc
*/
ol.render.webgl.PolygonReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other PolygonReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
var lineDeleter = this.lineStringReplay.getDeleteResourcesFunction(context);
@@ -884,9 +874,6 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skipp
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -913,11 +900,6 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skipp
*/
ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -962,9 +944,6 @@ ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = functio
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.PolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -1012,7 +991,6 @@ ol.render.webgl.PolygonReplay.prototype.setFillStyle_ = function(gl, color) {
* @inheritDoc
*/
ol.render.webgl.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var fillStyleColor = fillStyle ? fillStyle.getColor() : [0, 0, 0, 0];
if (!(fillStyleColor instanceof CanvasGradient) &&
!(fillStyleColor instanceof CanvasPattern)) {

View File

@@ -35,9 +35,7 @@ ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precisi
* @const
* @type {string}
*/
ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.polygonreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.fragment = new ol.render.webgl.polygonreplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'attribute
* @const
* @type {string}
*/
ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.polygonreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.vertex = new ol.render.webgl.polygonreplay.defaultshader.Vertex();
@@ -91,36 +87,30 @@ ol.render.webgl.polygonreplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_color = gl.getUniformLocation(
program, ol.DEBUG ? 'u_color' : 'e');
this.u_color = gl.getUniformLocation(program, 'e');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'd');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'd');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'c');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'c');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'f');
this.u_opacity = gl.getUniformLocation(program, 'f');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'b');
this.u_projectionMatrix = gl.getUniformLocation(program, 'b');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'a');
this.a_position = gl.getAttribLocation(program, 'a');
};

View File

@@ -284,14 +284,8 @@ ol.render.webgl.Replay.prototype.replay = function(context,
gl.stencilFunc(gl.NOTEQUAL, 1, 255);
}
// bind the vertices buffer
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.verticesBuffer);
// bind the indices buffer
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
context.bindBuffer(ol.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
var locations = this.setUpProgram(gl, context, size, pixelRatio);
@@ -311,11 +305,11 @@ ol.render.webgl.Replay.prototype.replay = function(context,
}
gl.uniformMatrix4fv(locations.u_projectionMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, projectionMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, projectionMatrix));
gl.uniformMatrix4fv(locations.u_offsetScaleMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetScaleMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetScaleMatrix));
gl.uniformMatrix4fv(locations.u_offsetRotateMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetRotateMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetRotateMatrix));
gl.uniform1f(locations.u_opacity, opacity);
// draw!
@@ -337,10 +331,10 @@ ol.render.webgl.Replay.prototype.replay = function(context,
}
gl.clear(gl.STENCIL_BUFFER_BIT);
gl.stencilFunc(/** @type {number} */ (tmpStencilFunc),
/** @type {number} */ (tmpStencilRef), /** @type {number} */ (tmpStencilMaskVal));
/** @type {number} */ (tmpStencilRef), /** @type {number} */ (tmpStencilMaskVal));
gl.stencilMask(/** @type {number} */ (tmpStencilMask));
gl.stencilOp(/** @type {number} */ (tmpStencilOpFail),
/** @type {number} */ (tmpStencilOpZFail), /** @type {number} */ (tmpStencilOpPass));
/** @type {number} */ (tmpStencilOpZFail), /** @type {number} */ (tmpStencilOpPass));
}
return result;

View File

@@ -107,9 +107,6 @@ ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
var replay = replays[replayType];
if (replay === undefined) {
var Constructor = ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_[replayType];
ol.DEBUG && console.assert(Constructor !== undefined,
replayType +
' constructor missing from ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_');
replay = new Constructor(this.tolerance_, this.maxExtent_);
replays[replayType] = replay;
}