Wrap ol.render.webgl code in define condition
This commit is contained in:
@@ -1,51 +1,53 @@
|
||||
goog.provide('ol.render.webgl');
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {ol.Color}
|
||||
*/
|
||||
ol.render.webgl.defaultFillStyle = [0.0, 0.0, 0.0, 1.0];
|
||||
ol.render.webgl.defaultFillStyle = [0.0, 0.0, 0.0, 1.0];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.defaultLineCap = 'round';
|
||||
ol.render.webgl.defaultLineCap = 'round';
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
ol.render.webgl.defaultLineDash = [];
|
||||
ol.render.webgl.defaultLineDash = [];
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.defaultLineJoin = 'round';
|
||||
ol.render.webgl.defaultLineJoin = 'round';
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
ol.render.webgl.defaultMiterLimit = 10;
|
||||
ol.render.webgl.defaultMiterLimit = 10;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {ol.Color}
|
||||
*/
|
||||
ol.render.webgl.defaultStrokeStyle = [0.0, 0.0, 0.0, 1.0];
|
||||
ol.render.webgl.defaultStrokeStyle = [0.0, 0.0, 0.0, 1.0];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
ol.render.webgl.defaultLineWidth = 1;
|
||||
ol.render.webgl.defaultLineWidth = 1;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calculates the orientation of a triangle based on the determinant method.
|
||||
* @param {number} x1 First X coordinate.
|
||||
* @param {number} y1 First Y coordinate.
|
||||
@@ -55,14 +57,16 @@ ol.render.webgl.defaultLineWidth = 1;
|
||||
* @param {number} y3 Third Y coordinate.
|
||||
* @return {boolean|undefined} Triangle is clockwise.
|
||||
*/
|
||||
ol.render.webgl.triangleIsCounterClockwise = function(x1, y1, x2, y2, x3, y3) {
|
||||
ol.render.webgl.triangleIsCounterClockwise = function(x1, y1, x2, y2, x3, y3) {
|
||||
var area = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
|
||||
return (area <= ol.render.webgl.EPSILON && area >= -ol.render.webgl.EPSILON) ?
|
||||
undefined : area > 0;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
ol.render.webgl.EPSILON = Number.EPSILON || 2.220446049250313e-16;
|
||||
ol.render.webgl.EPSILON = Number.EPSILON || 2.220446049250313e-16;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,16 @@ goog.require('ol.webgl');
|
||||
goog.require('ol.webgl.Buffer');
|
||||
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.webgl.Replay}
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.CircleReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.CircleReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.Replay.call(this, tolerance, maxExtent);
|
||||
|
||||
/**
|
||||
@@ -63,18 +65,18 @@ ol.render.webgl.CircleReplay = function(tolerance, maxExtent) {
|
||||
changed: false
|
||||
};
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.CircleReplay, ol.render.webgl.Replay);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.CircleReplay, ol.render.webgl.Replay);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.drawCoordinates_ = function(
|
||||
ol.render.webgl.CircleReplay.prototype.drawCoordinates_ = function(
|
||||
flatCoordinates, offset, end, stride) {
|
||||
var numVertices = this.vertices.length;
|
||||
var numIndices = this.indices.length;
|
||||
@@ -111,13 +113,13 @@ ol.render.webgl.CircleReplay.prototype.drawCoordinates_ = function(
|
||||
|
||||
n += 4;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.drawCircle = function(circleGeometry, feature) {
|
||||
ol.render.webgl.CircleReplay.prototype.drawCircle = function(circleGeometry, feature) {
|
||||
var radius = circleGeometry.getRadius();
|
||||
var stride = circleGeometry.getStride();
|
||||
if (radius) {
|
||||
@@ -145,13 +147,13 @@ ol.render.webgl.CircleReplay.prototype.drawCircle = function(circleGeometry, fea
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
**/
|
||||
ol.render.webgl.CircleReplay.prototype.finish = function(context) {
|
||||
ol.render.webgl.CircleReplay.prototype.finish = function(context) {
|
||||
// create, bind, and populate the vertices buffer
|
||||
this.verticesBuffer = new ol.webgl.Buffer(this.vertices);
|
||||
|
||||
@@ -167,13 +169,13 @@ ol.render.webgl.CircleReplay.prototype.finish = function(context) {
|
||||
|
||||
this.vertices = null;
|
||||
this.indices = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.CircleReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
// We only delete our stuff here. The shaders and the program may
|
||||
// be used by other CircleReplay instances (for other layers). And
|
||||
// they will be deleted when disposing of the ol.webgl.Context
|
||||
@@ -184,13 +186,13 @@ ol.render.webgl.CircleReplay.prototype.getDeleteResourcesFunction = function(con
|
||||
context.deleteBuffer(verticesBuffer);
|
||||
context.deleteBuffer(indicesBuffer);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
ol.render.webgl.CircleReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
// get the program
|
||||
var fragmentShader, vertexShader;
|
||||
fragmentShader = ol.render.webgl.circlereplay.defaultshader.fragment;
|
||||
@@ -227,23 +229,23 @@ ol.render.webgl.CircleReplay.prototype.setUpProgram = function(gl, context, size
|
||||
gl.uniform1f(locations.u_pixelRatio, pixelRatio);
|
||||
|
||||
return locations;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
ol.render.webgl.CircleReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
gl.disableVertexAttribArray(locations.a_position);
|
||||
gl.disableVertexAttribArray(locations.a_instruction);
|
||||
gl.disableVertexAttribArray(locations.a_radius);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
|
||||
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
|
||||
} else {
|
||||
@@ -260,13 +262,13 @@ ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippe
|
||||
end = start;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback, opt_hitExtent) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
@@ -304,16 +306,16 @@ ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {Object} skippedFeaturesHash Ids of features to skip.
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
ol.render.webgl.CircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
end = start = this.startIndices[featureIndex + 1];
|
||||
@@ -344,35 +346,35 @@ ol.render.webgl.CircleReplay.prototype.drawReplaySkipping_ = function(gl, contex
|
||||
}
|
||||
start = end = groupStart;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {Array.<number>} color Color.
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.setFillStyle_ = function(gl, color) {
|
||||
ol.render.webgl.CircleReplay.prototype.setFillStyle_ = function(gl, color) {
|
||||
gl.uniform4fv(this.defaultLocations_.u_fillColor, color);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {Array.<number>} color Color.
|
||||
* @param {number} lineWidth Line width.
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth) {
|
||||
ol.render.webgl.CircleReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth) {
|
||||
gl.uniform4fv(this.defaultLocations_.u_strokeColor, color);
|
||||
gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.CircleReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
ol.render.webgl.CircleReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
var strokeStyleColor, strokeStyleWidth;
|
||||
if (strokeStyle) {
|
||||
var strokeStyleLineDash = strokeStyle.getLineDash();
|
||||
@@ -412,4 +414,6 @@ ol.render.webgl.CircleReplay.prototype.setFillStrokeStyle = function(fillStyle,
|
||||
this.state_.lineWidth = strokeStyleWidth;
|
||||
this.styles_.push([fillStyleColor, strokeStyleColor, strokeStyleWidth]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -11,14 +11,16 @@ goog.require('ol.webgl.Buffer');
|
||||
goog.require('ol.webgl.Context');
|
||||
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.webgl.Replay}
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.ImageReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.ImageReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.Replay.call(this, tolerance, maxExtent);
|
||||
|
||||
/**
|
||||
@@ -134,14 +136,14 @@ ol.render.webgl.ImageReplay = function(tolerance, maxExtent) {
|
||||
* @private
|
||||
*/
|
||||
this.width_ = undefined;
|
||||
};
|
||||
ol.inherits(ol.render.webgl.ImageReplay, ol.render.webgl.Replay);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.ImageReplay, ol.render.webgl.Replay);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
var verticesBuffer = this.verticesBuffer;
|
||||
var indicesBuffer = this.indicesBuffer;
|
||||
var textures = this.textures_;
|
||||
@@ -160,10 +162,10 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont
|
||||
context.deleteBuffer(verticesBuffer);
|
||||
context.deleteBuffer(indicesBuffer);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
@@ -171,7 +173,7 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont
|
||||
* @return {number} My end.
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
|
||||
ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
|
||||
var anchorX = /** @type {number} */ (this.anchorX_);
|
||||
var anchorY = /** @type {number} */ (this.anchorY_);
|
||||
var height = /** @type {number} */ (this.height_);
|
||||
@@ -263,39 +265,39 @@ ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinate
|
||||
}
|
||||
|
||||
return numVertices;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawMultiPoint = function(multiPointGeometry, feature) {
|
||||
ol.render.webgl.ImageReplay.prototype.drawMultiPoint = function(multiPointGeometry, feature) {
|
||||
this.startIndices.push(this.indices.length);
|
||||
this.startIndicesFeature.push(feature);
|
||||
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
|
||||
var stride = multiPointGeometry.getStride();
|
||||
this.drawCoordinates_(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawPoint = function(pointGeometry, feature) {
|
||||
ol.render.webgl.ImageReplay.prototype.drawPoint = function(pointGeometry, feature) {
|
||||
this.startIndices.push(this.indices.length);
|
||||
this.startIndicesFeature.push(feature);
|
||||
var flatCoordinates = pointGeometry.getFlatCoordinates();
|
||||
var stride = pointGeometry.getStride();
|
||||
this.drawCoordinates_(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
var gl = context.getGL();
|
||||
|
||||
this.groupIndices_.push(this.indices.length);
|
||||
@@ -334,10 +336,10 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
this.scale_ = undefined;
|
||||
this.vertices = null;
|
||||
this.width_ = undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {Array.<WebGLTexture>} textures Textures.
|
||||
* @param {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} images
|
||||
@@ -345,7 +347,7 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
||||
* @param {Object.<string, WebGLTexture>} texturePerImage Texture cache.
|
||||
* @param {WebGLRenderingContext} gl Gl.
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, images, texturePerImage, gl) {
|
||||
ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, images, texturePerImage, gl) {
|
||||
var texture, image, uid, i;
|
||||
var ii = images.length;
|
||||
for (i = 0; i < ii; ++i) {
|
||||
@@ -361,13 +363,13 @@ ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, image
|
||||
}
|
||||
textures[i] = texture;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
ol.render.webgl.ImageReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
// get the program
|
||||
var fragmentShader = ol.render.webgl.imagereplay.defaultshader.fragment;
|
||||
var vertexShader = ol.render.webgl.imagereplay.defaultshader.vertex;
|
||||
@@ -408,25 +410,25 @@ ol.render.webgl.ImageReplay.prototype.setUpProgram = function(gl, context, size,
|
||||
false, 32, 28);
|
||||
|
||||
return locations;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
ol.render.webgl.ImageReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
gl.disableVertexAttribArray(locations.a_position);
|
||||
gl.disableVertexAttribArray(locations.a_offsets);
|
||||
gl.disableVertexAttribArray(locations.a_texCoord);
|
||||
gl.disableVertexAttribArray(locations.a_opacity);
|
||||
gl.disableVertexAttribArray(locations.a_rotateWithView);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
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_;
|
||||
|
||||
@@ -442,10 +444,10 @@ ol.render.webgl.ImageReplay.prototype.drawReplay = function(gl, context, skipped
|
||||
start = end;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Draw the replay while paying attention to skipped features.
|
||||
*
|
||||
* This functions creates groups of features that can be drawn to together,
|
||||
@@ -471,7 +473,7 @@ ol.render.webgl.ImageReplay.prototype.drawReplay = function(gl, context, skipped
|
||||
* @param {Array.<WebGLTexture>} textures Textures.
|
||||
* @param {Array.<number>} groupIndices Texture group indices.
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash, textures,
|
||||
ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash, textures,
|
||||
groupIndices) {
|
||||
var featureIndex = 0;
|
||||
|
||||
@@ -512,13 +514,13 @@ ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = function(gl, context
|
||||
this.drawElements(gl, context, start, end);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback, opt_hitExtent) {
|
||||
var i, groupStart, start, end, feature, featureUid;
|
||||
var featureIndex = this.startIndices.length - 1;
|
||||
@@ -553,13 +555,13 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne = function(
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
var anchor = imageStyle.getAnchor();
|
||||
var image = imageStyle.getImage(1);
|
||||
var imageSize = imageStyle.getImageSize();
|
||||
@@ -605,4 +607,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
this.rotateWithView_ = rotateWithView;
|
||||
this.scale_ = scale;
|
||||
this.width_ = size[0];
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ goog.require('ol.render.webgl.ReplayGroup');
|
||||
goog.require('ol.render.webgl');
|
||||
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.VectorContext}
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
@@ -21,7 +23,7 @@ goog.require('ol.render.webgl');
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.Immediate = function(context, center, resolution, rotation, size, extent, pixelRatio) {
|
||||
ol.render.webgl.Immediate = function(context, center, resolution, rotation, size, extent, pixelRatio) {
|
||||
ol.render.VectorContext.call(this);
|
||||
|
||||
/**
|
||||
@@ -77,31 +79,31 @@ ol.render.webgl.Immediate = function(context, center, resolution, rotation, size
|
||||
*/
|
||||
this.strokeStyle_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.Immediate, ol.render.VectorContext);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.Immediate, ol.render.VectorContext);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the rendering style. Note that since this is an immediate rendering API,
|
||||
* any `zIndex` on the provided style will be ignored.
|
||||
*
|
||||
* @param {ol.style.Style} style The rendering style.
|
||||
* @api
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.setStyle = function(style) {
|
||||
ol.render.webgl.Immediate.prototype.setStyle = function(style) {
|
||||
this.setFillStrokeStyle(style.getFill(), style.getStroke());
|
||||
this.setImageStyle(style.getImage());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Render a geometry into the canvas. Call
|
||||
* {@link ol.render.webgl.Immediate#setStyle} first to set the rendering style.
|
||||
*
|
||||
* @param {ol.geom.Geometry|ol.render.Feature} geometry The geometry to render.
|
||||
* @api
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
|
||||
ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
|
||||
var type = geometry.getType();
|
||||
switch (type) {
|
||||
case ol.geom.GeometryType.POINT:
|
||||
@@ -131,14 +133,14 @@ ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
|
||||
default:
|
||||
// pass
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
var geometry = style.getGeometryFunction()(feature);
|
||||
if (!geometry ||
|
||||
!ol.extent.intersects(this.extent_, geometry.getExtent())) {
|
||||
@@ -146,25 +148,25 @@ ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
|
||||
}
|
||||
this.setStyle(style);
|
||||
this.drawGeometry(geometry);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawGeometryCollection = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawGeometryCollection = function(geometry, data) {
|
||||
var geometries = geometry.getGeometriesArray();
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
this.drawGeometry(geometries[i]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawPoint = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawPoint = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.ImageReplay} */ (
|
||||
@@ -181,13 +183,13 @@ ol.render.webgl.Immediate.prototype.drawPoint = function(geometry, data) {
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawMultiPoint = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawMultiPoint = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.ImageReplay} */ (
|
||||
@@ -203,13 +205,13 @@ ol.render.webgl.Immediate.prototype.drawMultiPoint = function(geometry, data) {
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawLineString = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawLineString = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.LineStringReplay} */ (
|
||||
@@ -225,13 +227,13 @@ ol.render.webgl.Immediate.prototype.drawLineString = function(geometry, data) {
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawMultiLineString = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawMultiLineString = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.LineStringReplay} */ (
|
||||
@@ -247,13 +249,13 @@ ol.render.webgl.Immediate.prototype.drawMultiLineString = function(geometry, dat
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawPolygon = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawPolygon = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.PolygonReplay} */ (
|
||||
@@ -269,13 +271,13 @@ ol.render.webgl.Immediate.prototype.drawPolygon = function(geometry, data) {
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawMultiPolygon = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawMultiPolygon = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.PolygonReplay} */ (
|
||||
@@ -291,13 +293,13 @@ ol.render.webgl.Immediate.prototype.drawMultiPolygon = function(geometry, data)
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawCircle = function(geometry, data) {
|
||||
ol.render.webgl.Immediate.prototype.drawCircle = function(geometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = /** @type {ol.render.webgl.CircleReplay} */ (
|
||||
@@ -313,21 +315,23 @@ ol.render.webgl.Immediate.prototype.drawCircle = function(geometry, data) {
|
||||
this.size_, this.pixelRatio_, opacity, skippedFeatures, featureCallback,
|
||||
oneByOne);
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
ol.render.webgl.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
this.imageStyle_ = imageStyle;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
ol.render.webgl.Immediate.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
this.fillStyle_ = fillStyle;
|
||||
this.strokeStyle_ = strokeStyle;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -15,14 +15,16 @@ goog.require('ol.webgl');
|
||||
goog.require('ol.webgl.Buffer');
|
||||
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.webgl.Replay}
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.LineStringReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.Replay.call(this, tolerance, maxExtent);
|
||||
|
||||
/**
|
||||
@@ -63,11 +65,11 @@ ol.render.webgl.LineStringReplay = function(tolerance, maxExtent) {
|
||||
changed: false
|
||||
};
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.LineStringReplay, ol.render.webgl.Replay);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.LineStringReplay, ol.render.webgl.Replay);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Draw one segment.
|
||||
* @private
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
@@ -75,7 +77,7 @@ ol.inherits(ol.render.webgl.LineStringReplay, ol.render.webgl.Replay);
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
|
||||
ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
|
||||
|
||||
var i, ii;
|
||||
var numVertices = this.vertices.length;
|
||||
@@ -248,9 +250,9 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
|
||||
this.indices[numIndices++] = n;
|
||||
this.indices[numIndices++] = lastSign * sign > 0 ? lastIndex : lastIndex - 1;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array.<number>} p0 Last coordinates.
|
||||
* @param {Array.<number>} p1 Current coordinates.
|
||||
* @param {Array.<number>} p2 Next coordinates.
|
||||
@@ -259,7 +261,7 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
|
||||
* @return {number} Vertex counter.
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.addVertices_ = function(p0, p1, p2, product, numVertices) {
|
||||
ol.render.webgl.LineStringReplay.prototype.addVertices_ = function(p0, p1, p2, product, numVertices) {
|
||||
this.vertices[numVertices++] = p0[0];
|
||||
this.vertices[numVertices++] = p0[1];
|
||||
this.vertices[numVertices++] = p1[0];
|
||||
@@ -269,9 +271,9 @@ ol.render.webgl.LineStringReplay.prototype.addVertices_ = function(p0, p1, p2, p
|
||||
this.vertices[numVertices++] = product;
|
||||
|
||||
return numVertices;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Check if the linestring can be drawn (i. e. valid).
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
@@ -280,7 +282,7 @@ ol.render.webgl.LineStringReplay.prototype.addVertices_ = function(p0, p1, p2, p
|
||||
* @return {boolean} The linestring can be drawn.
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.isValid_ = function(flatCoordinates, offset, end, stride) {
|
||||
ol.render.webgl.LineStringReplay.prototype.isValid_ = function(flatCoordinates, offset, end, stride) {
|
||||
var range = end - offset;
|
||||
if (range < stride * 2) {
|
||||
return false;
|
||||
@@ -291,13 +293,13 @@ ol.render.webgl.LineStringReplay.prototype.isValid_ = function(flatCoordinates,
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
|
||||
ol.render.webgl.LineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
|
||||
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
|
||||
var stride = lineStringGeometry.getStride();
|
||||
if (this.isValid_(flatCoordinates, 0, flatCoordinates.length, stride)) {
|
||||
@@ -312,13 +314,13 @@ ol.render.webgl.LineStringReplay.prototype.drawLineString = function(lineStringG
|
||||
this.drawCoordinates_(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
|
||||
ol.render.webgl.LineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
|
||||
var indexCount = this.indices.length;
|
||||
var lineStringGeometries = multiLineStringGeometry.getLineStrings();
|
||||
var i, ii;
|
||||
@@ -340,15 +342,15 @@ ol.render.webgl.LineStringReplay.prototype.drawMultiLineString = function(multiL
|
||||
this.state_.changed = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array.<Array.<number>>} holeFlatCoordinates Hole flat coordinates.
|
||||
* @param {number} stride Stride.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawPolygonCoordinates = function(
|
||||
ol.render.webgl.LineStringReplay.prototype.drawPolygonCoordinates = function(
|
||||
flatCoordinates, holeFlatCoordinates, stride) {
|
||||
if (!ol.geom.flat.topology.lineStringIsClosed(flatCoordinates, 0,
|
||||
flatCoordinates.length, stride)) {
|
||||
@@ -368,14 +370,14 @@ ol.render.webgl.LineStringReplay.prototype.drawPolygonCoordinates = function(
|
||||
holeFlatCoordinates[i].length, stride);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @param {number=} opt_index Index count.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.setPolygonStyle = function(feature, opt_index) {
|
||||
ol.render.webgl.LineStringReplay.prototype.setPolygonStyle = function(feature, opt_index) {
|
||||
var index = opt_index === undefined ? this.indices.length : opt_index;
|
||||
this.startIndices.push(index);
|
||||
this.startIndicesFeature.push(feature);
|
||||
@@ -383,21 +385,21 @@ ol.render.webgl.LineStringReplay.prototype.setPolygonStyle = function(feature, o
|
||||
this.styleIndices_.push(index);
|
||||
this.state_.changed = false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return {number} Current index.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.getCurrentIndex = function() {
|
||||
ol.render.webgl.LineStringReplay.prototype.getCurrentIndex = function() {
|
||||
return this.indices.length;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
**/
|
||||
ol.render.webgl.LineStringReplay.prototype.finish = function(context) {
|
||||
ol.render.webgl.LineStringReplay.prototype.finish = function(context) {
|
||||
// create, bind, and populate the vertices buffer
|
||||
this.verticesBuffer = new ol.webgl.Buffer(this.vertices);
|
||||
|
||||
@@ -413,26 +415,26 @@ ol.render.webgl.LineStringReplay.prototype.finish = function(context) {
|
||||
|
||||
this.vertices = null;
|
||||
this.indices = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.LineStringReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
var verticesBuffer = this.verticesBuffer;
|
||||
var indicesBuffer = this.indicesBuffer;
|
||||
return function() {
|
||||
context.deleteBuffer(verticesBuffer);
|
||||
context.deleteBuffer(indicesBuffer);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
ol.render.webgl.LineStringReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
// get the program
|
||||
var fragmentShader, vertexShader;
|
||||
fragmentShader = ol.render.webgl.linestringreplay.defaultshader.fragment;
|
||||
@@ -473,24 +475,24 @@ ol.render.webgl.LineStringReplay.prototype.setUpProgram = function(gl, context,
|
||||
gl.uniform1f(locations.u_pixelRatio, pixelRatio);
|
||||
|
||||
return locations;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
ol.render.webgl.LineStringReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
gl.disableVertexAttribArray(locations.a_lastPos);
|
||||
gl.disableVertexAttribArray(locations.a_position);
|
||||
gl.disableVertexAttribArray(locations.a_nextPos);
|
||||
gl.disableVertexAttribArray(locations.a_direction);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
//Save GL parameters.
|
||||
var tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC));
|
||||
var tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK));
|
||||
@@ -523,16 +525,16 @@ ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, sk
|
||||
gl.depthMask(tmpDepthMask);
|
||||
gl.depthFunc(tmpDepthFunc);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {Object} skippedFeaturesHash Ids of features to skip.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
end = start = this.startIndices[featureIndex + 1];
|
||||
@@ -563,13 +565,13 @@ ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, co
|
||||
}
|
||||
start = end = groupStart;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.LineStringReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback, opt_hitExtent) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
@@ -605,27 +607,27 @@ ol.render.webgl.LineStringReplay.prototype.drawHitDetectionReplayOneByOne = func
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {Array.<number>} color Color.
|
||||
* @param {number} lineWidth Line width.
|
||||
* @param {number} miterLimit Miter limit.
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth, miterLimit) {
|
||||
ol.render.webgl.LineStringReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth, miterLimit) {
|
||||
gl.uniform4fv(this.defaultLocations_.u_color, color);
|
||||
gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth);
|
||||
gl.uniform1f(this.defaultLocations_.u_miterLimit, miterLimit);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
ol.render.webgl.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
var strokeStyleLineCap = strokeStyle.getLineCap();
|
||||
this.state_.lineCap = strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.webgl.defaultLineCap;
|
||||
@@ -658,13 +660,13 @@ ol.render.webgl.LineStringReplay.prototype.setFillStrokeStyle = function(fillSty
|
||||
this.state_.miterLimit = strokeStyleMiterLimit;
|
||||
this.styles_.push([strokeStyleColor, strokeStyleWidth, strokeStyleMiterLimit]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.LineStringReplay.Instruction_ = {
|
||||
ol.render.webgl.LineStringReplay.Instruction_ = {
|
||||
ROUND: 2,
|
||||
BEGIN_LINE: 3,
|
||||
END_LINE: 5,
|
||||
@@ -674,4 +676,6 @@ ol.render.webgl.LineStringReplay.Instruction_ = {
|
||||
BEVEL_SECOND: 17,
|
||||
MITER_BOTTOM: 19,
|
||||
MITER_TOP: 23
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -19,14 +19,16 @@ goog.require('ol.webgl');
|
||||
goog.require('ol.webgl.Buffer');
|
||||
|
||||
|
||||
/**
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.webgl.Replay}
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.PolygonReplay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.Replay.call(this, tolerance, maxExtent);
|
||||
|
||||
this.lineStringReplay = new ol.render.webgl.LineStringReplay(
|
||||
@@ -60,18 +62,18 @@ ol.render.webgl.PolygonReplay = function(tolerance, maxExtent) {
|
||||
changed: false
|
||||
};
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.PolygonReplay, ol.render.webgl.Replay);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.PolygonReplay, ol.render.webgl.Replay);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Draw one polygon.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array.<Array.<number>>} holeFlatCoordinates Hole flat coordinates.
|
||||
* @param {number} stride Stride.
|
||||
* @private
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawCoordinates_ = function(
|
||||
ol.render.webgl.PolygonReplay.prototype.drawCoordinates_ = function(
|
||||
flatCoordinates, holeFlatCoordinates, stride) {
|
||||
// Triangulate the polygon
|
||||
var outerRing = new ol.structs.LinkedList();
|
||||
@@ -101,10 +103,10 @@ ol.render.webgl.PolygonReplay.prototype.drawCoordinates_ = function(
|
||||
}
|
||||
this.classifyPoints_(outerRing, rtree, false);
|
||||
this.triangulate_(outerRing, rtree);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Inserts flat coordinates in a linked list and adds them to the vertex buffer.
|
||||
* @private
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
@@ -114,7 +116,7 @@ ol.render.webgl.PolygonReplay.prototype.drawCoordinates_ = function(
|
||||
* @param {boolean} clockwise Coordinate order should be clockwise.
|
||||
* @return {number} Maximum X value.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.processFlatCoordinates_ = function(
|
||||
ol.render.webgl.PolygonReplay.prototype.processFlatCoordinates_ = function(
|
||||
flatCoordinates, stride, list, rtree, clockwise) {
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates,
|
||||
0, flatCoordinates.length, stride);
|
||||
@@ -163,10 +165,10 @@ ol.render.webgl.PolygonReplay.prototype.processFlatCoordinates_ = function(
|
||||
rtree.load(extents, segments);
|
||||
|
||||
return maxX;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Classifies the points of a polygon list as convex, reflex. Removes collinear vertices.
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Polygon ring.
|
||||
@@ -174,7 +176,7 @@ ol.render.webgl.PolygonReplay.prototype.processFlatCoordinates_ = function(
|
||||
* @param {boolean} ccw The orientation of the polygon is counter-clockwise.
|
||||
* @return {boolean} There were reclassified points.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.classifyPoints_ = function(list, rtree, ccw) {
|
||||
ol.render.webgl.PolygonReplay.prototype.classifyPoints_ = function(list, rtree, ccw) {
|
||||
var start = list.firstItem();
|
||||
var s0 = start;
|
||||
var s1 = list.nextItem();
|
||||
@@ -200,10 +202,10 @@ ol.render.webgl.PolygonReplay.prototype.classifyPoints_ = function(list, rtree,
|
||||
s1 = list.nextItem();
|
||||
} while (s0 !== start);
|
||||
return pointsReclassified;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} hole Linked list of the hole.
|
||||
* @param {number} holeMaxX Maximum X value of the hole.
|
||||
@@ -211,7 +213,7 @@ ol.render.webgl.PolygonReplay.prototype.classifyPoints_ = function(list, rtree,
|
||||
* @param {number} listMaxX Maximum X value of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.bridgeHole_ = function(hole, holeMaxX,
|
||||
ol.render.webgl.PolygonReplay.prototype.bridgeHole_ = function(hole, holeMaxX,
|
||||
list, listMaxX, rtree) {
|
||||
this.classifyPoints_(hole, rtree, true);
|
||||
var seg = hole.firstItem();
|
||||
@@ -276,15 +278,15 @@ ol.render.webgl.PolygonReplay.prototype.bridgeHole_ = function(hole, holeMaxX,
|
||||
seg.p1 = p1Bridge;
|
||||
hole.setFirstItem();
|
||||
list.concat(hole);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
|
||||
ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
|
||||
var ccw = false;
|
||||
var simple = this.isSimple_(list, rtree);
|
||||
|
||||
@@ -326,10 +328,10 @@ ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
|
||||
this.indices[numIndices++] = list.getCurrItem().p0.i;
|
||||
this.indices[numIndices++] = list.getNextItem().p0.i;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
@@ -337,7 +339,7 @@ ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
|
||||
* @param {boolean} ccw Orientation of the polygon is counter-clockwise.
|
||||
* @return {boolean} There were processed ears.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.clipEars_ = function(list, rtree, simple, ccw) {
|
||||
ol.render.webgl.PolygonReplay.prototype.clipEars_ = function(list, rtree, simple, ccw) {
|
||||
var numIndices = this.indices.length;
|
||||
var start = list.firstItem();
|
||||
var s0 = list.getPrevItem();
|
||||
@@ -380,17 +382,17 @@ ol.render.webgl.PolygonReplay.prototype.clipEars_ = function(list, rtree, simple
|
||||
} while (s1 !== start && list.getLength() > 3);
|
||||
|
||||
return processedEars;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
* @param {boolean=} opt_touch Resolve touching segments.
|
||||
* @return {boolean} There were resolved intersections.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.resolveLocalSelfIntersections_ = function(
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.resolveLocalSelfIntersections_ = function(
|
||||
list, rtree, opt_touch) {
|
||||
var start = list.firstItem();
|
||||
list.nextItem();
|
||||
@@ -449,16 +451,16 @@ ol.render.webgl.PolygonReplay.prototype.resolveLocalSelfIntersections_ = functio
|
||||
s1 = list.nextItem();
|
||||
} while (s0 !== start);
|
||||
return resolvedIntersections;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
* @return {boolean} The polygon is simple.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.isSimple_ = function(list, rtree) {
|
||||
ol.render.webgl.PolygonReplay.prototype.isSimple_ = function(list, rtree) {
|
||||
var start = list.firstItem();
|
||||
var seg = start;
|
||||
do {
|
||||
@@ -468,15 +470,15 @@ ol.render.webgl.PolygonReplay.prototype.isSimple_ = function(list, rtree) {
|
||||
seg = list.nextItem();
|
||||
} while (seg !== start);
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @return {boolean} Orientation is clockwise.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.isClockwise_ = function(list) {
|
||||
ol.render.webgl.PolygonReplay.prototype.isClockwise_ = function(list) {
|
||||
var length = list.getLength() * 2;
|
||||
var flatCoordinates = new Array(length);
|
||||
var start = list.firstItem();
|
||||
@@ -488,15 +490,15 @@ ol.render.webgl.PolygonReplay.prototype.isClockwise_ = function(list) {
|
||||
seg = list.nextItem();
|
||||
} while (seg !== start);
|
||||
return ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, 0, length, 2);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.structs.LinkedList} list Linked list of the polygon.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.splitPolygon_ = function(list, rtree) {
|
||||
ol.render.webgl.PolygonReplay.prototype.splitPolygon_ = function(list, rtree) {
|
||||
var start = list.firstItem();
|
||||
var s0 = start;
|
||||
do {
|
||||
@@ -532,17 +534,17 @@ ol.render.webgl.PolygonReplay.prototype.splitPolygon_ = function(list, rtree) {
|
||||
}
|
||||
s0 = list.nextItem();
|
||||
} while (s0 !== start);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {number} x X coordinate.
|
||||
* @param {number} y Y coordinate.
|
||||
* @param {number} i Index.
|
||||
* @return {ol.WebglPolygonVertex} List item.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.createPoint_ = function(x, y, i) {
|
||||
ol.render.webgl.PolygonReplay.prototype.createPoint_ = function(x, y, i) {
|
||||
var numVertices = this.vertices.length;
|
||||
this.vertices[numVertices++] = x;
|
||||
this.vertices[numVertices++] = y;
|
||||
@@ -554,10 +556,10 @@ ol.render.webgl.PolygonReplay.prototype.createPoint_ = function(x, y, i) {
|
||||
reflex: undefined
|
||||
};
|
||||
return p;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.WebglPolygonVertex} p0 First point of segment.
|
||||
* @param {ol.WebglPolygonVertex} p1 Second point of segment.
|
||||
@@ -565,7 +567,7 @@ ol.render.webgl.PolygonReplay.prototype.createPoint_ = function(x, y, i) {
|
||||
* @param {ol.structs.RBush=} opt_rtree Insert the segment into the R-Tree.
|
||||
* @return {ol.WebglPolygonSegment} segment.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) {
|
||||
ol.render.webgl.PolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) {
|
||||
var seg = {
|
||||
p0: p0,
|
||||
p1: p1
|
||||
@@ -576,7 +578,7 @@ ol.render.webgl.PolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt
|
||||
Math.max(p0.x, p1.x), Math.max(p0.y, p1.y)], seg);
|
||||
}
|
||||
return seg;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -586,7 +588,7 @@ ol.render.webgl.PolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt
|
||||
* @param {ol.structs.LinkedList} list Polygon ring.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtree) {
|
||||
ol.render.webgl.PolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtree) {
|
||||
if (list.getCurrItem() === s1) {
|
||||
list.removeItem();
|
||||
s0.p1 = s1.p1;
|
||||
@@ -594,10 +596,10 @@ ol.render.webgl.PolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtr
|
||||
rtree.update([Math.min(s0.p0.x, s0.p1.x), Math.min(s0.p0.y, s0.p1.y),
|
||||
Math.max(s0.p0.x, s0.p1.x), Math.max(s0.p0.y, s0.p1.y)], s0);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.WebglPolygonVertex} p0 First point.
|
||||
* @param {ol.WebglPolygonVertex} p1 Second point.
|
||||
@@ -606,7 +608,7 @@ ol.render.webgl.PolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtr
|
||||
* @param {boolean=} opt_reflex Only include reflex points.
|
||||
* @return {Array.<ol.WebglPolygonVertex>} Points in the triangle.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1,
|
||||
ol.render.webgl.PolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1,
|
||||
p2, rtree, opt_reflex) {
|
||||
var i, ii, j, p;
|
||||
var result = [];
|
||||
@@ -627,17 +629,17 @@ ol.render.webgl.PolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1,
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.WebglPolygonSegment} segment Segment.
|
||||
* @param {ol.structs.RBush} rtree R-Tree of the polygon.
|
||||
* @param {boolean=} opt_touch Touching segments should be considered an intersection.
|
||||
* @return {Array.<ol.WebglPolygonSegment>} Intersecting segments.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_touch) {
|
||||
ol.render.webgl.PolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_touch) {
|
||||
var p0 = segment.p0;
|
||||
var p1 = segment.p1;
|
||||
var segmentsInExtent = rtree.getInExtent([Math.min(p0.x, p1.x),
|
||||
@@ -652,10 +654,10 @@ ol.render.webgl.PolygonReplay.prototype.getIntersections_ = function(segment, rt
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Line intersection algorithm by Paul Bourke.
|
||||
* @see http://paulbourke.net/geometry/pointlineplane/
|
||||
*
|
||||
@@ -667,7 +669,7 @@ ol.render.webgl.PolygonReplay.prototype.getIntersections_ = function(segment, rt
|
||||
* @param {boolean=} opt_touch Touching segments should be considered an intersection.
|
||||
* @return {Array.<number>|undefined} Intersection coordinates.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.calculateIntersection_ = function(p0,
|
||||
ol.render.webgl.PolygonReplay.prototype.calculateIntersection_ = function(p0,
|
||||
p1, p2, p3, opt_touch) {
|
||||
var denom = (p3.y - p2.y) * (p1.x - p0.x) - (p3.x - p2.x) * (p1.y - p0.y);
|
||||
if (denom !== 0) {
|
||||
@@ -680,10 +682,10 @@ ol.render.webgl.PolygonReplay.prototype.calculateIntersection_ = function(p0,
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.WebglPolygonVertex} p0 Point before the start of the diagonal.
|
||||
* @param {ol.WebglPolygonVertex} p1 Start point of the diagonal.
|
||||
@@ -692,7 +694,7 @@ ol.render.webgl.PolygonReplay.prototype.calculateIntersection_ = function(p0,
|
||||
* @param {ol.WebglPolygonVertex} p4 Point after the end of the diagonal.
|
||||
* @return {boolean} Diagonal is inside the polygon.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) {
|
||||
ol.render.webgl.PolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) {
|
||||
if (p1.reflex === undefined || p3.reflex === undefined) {
|
||||
return false;
|
||||
}
|
||||
@@ -703,13 +705,13 @@ ol.render.webgl.PolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2,
|
||||
var p1InCone = p3.reflex ? p1IsRightOf || p1IsLeftOf : p1IsRightOf && p1IsLeftOf;
|
||||
var p3InCone = p1.reflex ? p3IsRightOf || p3IsLeftOf : p3IsRightOf && p3IsLeftOf;
|
||||
return p1InCone && p3InCone;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
|
||||
ol.render.webgl.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
|
||||
var polygons = multiPolygonGeometry.getPolygons();
|
||||
var stride = multiPolygonGeometry.getStride();
|
||||
var currIndex = this.indices.length;
|
||||
@@ -744,13 +746,13 @@ ol.render.webgl.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygon
|
||||
if (this.lineStringReplay.getCurrentIndex() > currLineIndex) {
|
||||
this.lineStringReplay.setPolygonStyle(feature, currLineIndex);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
|
||||
ol.render.webgl.PolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
|
||||
var linearRings = polygonGeometry.getLinearRings();
|
||||
var stride = polygonGeometry.getStride();
|
||||
if (linearRings.length > 0) {
|
||||
@@ -776,13 +778,13 @@ ol.render.webgl.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
|
||||
this.lineStringReplay.drawPolygonCoordinates(flatCoordinates, holes, stride);
|
||||
this.drawCoordinates_(flatCoordinates, holes, stride);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
**/
|
||||
ol.render.webgl.PolygonReplay.prototype.finish = function(context) {
|
||||
ol.render.webgl.PolygonReplay.prototype.finish = function(context) {
|
||||
// create, bind, and populate the vertices buffer
|
||||
this.verticesBuffer = new ol.webgl.Buffer(this.vertices);
|
||||
|
||||
@@ -800,13 +802,13 @@ ol.render.webgl.PolygonReplay.prototype.finish = function(context) {
|
||||
|
||||
this.vertices = null;
|
||||
this.indices = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.PolygonReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
var verticesBuffer = this.verticesBuffer;
|
||||
var indicesBuffer = this.indicesBuffer;
|
||||
var lineDeleter = this.lineStringReplay.getDeleteResourcesFunction(context);
|
||||
@@ -815,13 +817,13 @@ ol.render.webgl.PolygonReplay.prototype.getDeleteResourcesFunction = function(co
|
||||
context.deleteBuffer(indicesBuffer);
|
||||
lineDeleter();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
ol.render.webgl.PolygonReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
|
||||
// get the program
|
||||
var fragmentShader, vertexShader;
|
||||
fragmentShader = ol.render.webgl.polygonreplay.defaultshader.fragment;
|
||||
@@ -846,21 +848,21 @@ ol.render.webgl.PolygonReplay.prototype.setUpProgram = function(gl, context, siz
|
||||
false, 8, 0);
|
||||
|
||||
return locations;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
ol.render.webgl.PolygonReplay.prototype.shutDownProgram = function(gl, locations) {
|
||||
gl.disableVertexAttribArray(locations.a_position);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||
//Save GL parameters.
|
||||
var tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC));
|
||||
var tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK));
|
||||
@@ -892,13 +894,13 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skipp
|
||||
gl.depthMask(tmpDepthMask);
|
||||
gl.depthFunc(tmpDepthFunc);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback, opt_hitExtent) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
@@ -934,16 +936,16 @@ ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = functio
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {Object} skippedFeaturesHash Ids of features to skip.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
ol.render.webgl.PolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
|
||||
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
|
||||
featureIndex = this.startIndices.length - 2;
|
||||
end = start = this.startIndices[featureIndex + 1];
|
||||
@@ -974,23 +976,23 @@ ol.render.webgl.PolygonReplay.prototype.drawReplaySkipping_ = function(gl, conte
|
||||
}
|
||||
start = end = groupStart;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {Array.<number>} color Color.
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.setFillStyle_ = function(gl, color) {
|
||||
ol.render.webgl.PolygonReplay.prototype.setFillStyle_ = function(gl, color) {
|
||||
gl.uniform4fv(this.defaultLocations_.u_color, color);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
ol.render.webgl.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
var fillStyleColor = fillStyle ? fillStyle.getColor() : [0, 0, 0, 0];
|
||||
if (!(fillStyleColor instanceof CanvasGradient) &&
|
||||
!(fillStyleColor instanceof CanvasPattern)) {
|
||||
@@ -1015,4 +1017,6 @@ ol.render.webgl.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle,
|
||||
});
|
||||
this.lineStringReplay.setFillStrokeStyle(null, nullStrokeStyle);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,14 +7,17 @@ goog.require('ol.transform');
|
||||
goog.require('ol.vec.Mat4');
|
||||
goog.require('ol.webgl');
|
||||
|
||||
/**
|
||||
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.VectorContext}
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.Replay = function(tolerance, maxExtent) {
|
||||
ol.render.webgl.Replay = function(tolerance, maxExtent) {
|
||||
ol.render.VectorContext.call(this);
|
||||
|
||||
/**
|
||||
@@ -109,26 +112,26 @@ ol.render.webgl.Replay = function(tolerance, maxExtent) {
|
||||
*/
|
||||
this.lineStringReplay = undefined;
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.Replay, ol.render.VectorContext);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.Replay, ol.render.VectorContext);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @param {ol.webgl.Context} context WebGL context.
|
||||
* @return {function()} Delete resources function.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.getDeleteResourcesFunction = function(context) {};
|
||||
ol.render.webgl.Replay.prototype.getDeleteResourcesFunction = function(context) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.finish = function(context) {};
|
||||
ol.render.webgl.Replay.prototype.finish = function(context) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
@@ -140,10 +143,10 @@ ol.render.webgl.Replay.prototype.finish = function(context) {};
|
||||
ol.render.webgl.linestringreplay.defaultshader.Locations|
|
||||
ol.render.webgl.polygonreplay.defaultshader.Locations} Locations.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {};
|
||||
ol.render.webgl.Replay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
@@ -152,10 +155,10 @@ ol.render.webgl.Replay.prototype.setUpProgram = function(gl, context, size, pixe
|
||||
ol.render.webgl.linestringreplay.defaultshader.Locations|
|
||||
ol.render.webgl.polygonreplay.defaultshader.Locations} locations Locations.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.shutDownProgram = function(gl, locations) {};
|
||||
ol.render.webgl.Replay.prototype.shutDownProgram = function(gl, locations) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
@@ -164,10 +167,10 @@ ol.render.webgl.Replay.prototype.shutDownProgram = function(gl, locations) {};
|
||||
* to skip.
|
||||
* @param {boolean} hitDetection Hit detection mode.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {};
|
||||
ol.render.webgl.Replay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
@@ -180,10 +183,10 @@ ol.render.webgl.Replay.prototype.drawReplay = function(gl, context, skippedFeatu
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {};
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
@@ -196,7 +199,7 @@ ol.render.webgl.Replay.prototype.drawHitDetectionReplayOneByOne = function(gl, c
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplay = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplay = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback, oneByOne, opt_hitExtent) {
|
||||
if (!oneByOne) {
|
||||
// draw all hit-detection features in "once" (by texture group)
|
||||
@@ -207,10 +210,10 @@ ol.render.webgl.Replay.prototype.drawHitDetectionReplay = function(gl, context,
|
||||
return this.drawHitDetectionReplayOneByOne(gl, context,
|
||||
skippedFeaturesHash, featureCallback, opt_hitExtent);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
@@ -220,7 +223,7 @@ ol.render.webgl.Replay.prototype.drawHitDetectionReplay = function(gl, context,
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplayAll = function(gl, context, skippedFeaturesHash,
|
||||
ol.render.webgl.Replay.prototype.drawHitDetectionReplayAll = function(gl, context, skippedFeaturesHash,
|
||||
featureCallback) {
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||
this.drawReplay(gl, context, skippedFeaturesHash, true);
|
||||
@@ -231,10 +234,10 @@ ol.render.webgl.Replay.prototype.drawHitDetectionReplayAll = function(gl, contex
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
* @param {number} resolution Resolution.
|
||||
@@ -251,7 +254,7 @@ ol.render.webgl.Replay.prototype.drawHitDetectionReplayAll = function(gl, contex
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.replay = function(context,
|
||||
ol.render.webgl.Replay.prototype.replay = function(context,
|
||||
center, resolution, rotation, size, pixelRatio,
|
||||
opacity, skippedFeaturesHash,
|
||||
featureCallback, oneByOne, opt_hitExtent) {
|
||||
@@ -338,16 +341,16 @@ ol.render.webgl.Replay.prototype.replay = function(context,
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @protected
|
||||
* @param {WebGLRenderingContext} gl gl.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {number} start Start index.
|
||||
* @param {number} end End index.
|
||||
*/
|
||||
ol.render.webgl.Replay.prototype.drawElements = function(
|
||||
ol.render.webgl.Replay.prototype.drawElements = function(
|
||||
gl, context, start, end) {
|
||||
var elementType = context.hasOESElementIndexUint ?
|
||||
ol.webgl.UNSIGNED_INT : ol.webgl.UNSIGNED_SHORT;
|
||||
@@ -356,4 +359,6 @@ ol.render.webgl.Replay.prototype.drawElements = function(
|
||||
var numItems = end - start;
|
||||
var offsetInBytes = start * elementSize;
|
||||
gl.drawElements(ol.webgl.TRIANGLES, numItems, elementType, offsetInBytes);
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ goog.require('ol.render.webgl.LineStringReplay');
|
||||
goog.require('ol.render.webgl.PolygonReplay');
|
||||
goog.require('ol.render.webgl.TextReplay');
|
||||
|
||||
/**
|
||||
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.render.ReplayGroup}
|
||||
* @param {number} tolerance Tolerance.
|
||||
@@ -21,7 +24,7 @@ goog.require('ol.render.webgl.TextReplay');
|
||||
* @param {number=} opt_renderBuffer Render buffer.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup = function(tolerance, maxExtent, opt_renderBuffer) {
|
||||
ol.render.webgl.ReplayGroup = function(tolerance, maxExtent, opt_renderBuffer) {
|
||||
ol.render.ReplayGroup.call(this);
|
||||
|
||||
/**
|
||||
@@ -49,15 +52,15 @@ ol.render.webgl.ReplayGroup = function(tolerance, maxExtent, opt_renderBuffer) {
|
||||
*/
|
||||
this.replaysByZIndex_ = {};
|
||||
|
||||
};
|
||||
ol.inherits(ol.render.webgl.ReplayGroup, ol.render.ReplayGroup);
|
||||
};
|
||||
ol.inherits(ol.render.webgl.ReplayGroup, ol.render.ReplayGroup);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context WebGL context.
|
||||
* @return {function()} Delete resources function.
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.ReplayGroup.prototype.getDeleteResourcesFunction = function(context) {
|
||||
var functions = [];
|
||||
var zKey;
|
||||
for (zKey in this.replaysByZIndex_) {
|
||||
@@ -76,13 +79,13 @@ ol.render.webgl.ReplayGroup.prototype.getDeleteResourcesFunction = function(cont
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.finish = function(context) {
|
||||
ol.render.webgl.ReplayGroup.prototype.finish = function(context) {
|
||||
var zKey;
|
||||
for (zKey in this.replaysByZIndex_) {
|
||||
var replays = this.replaysByZIndex_[zKey];
|
||||
@@ -91,13 +94,13 @@ ol.render.webgl.ReplayGroup.prototype.finish = function(context) {
|
||||
replays[replayKey].finish(context);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
|
||||
ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
|
||||
var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
||||
var replays = this.replaysByZIndex_[zIndexKey];
|
||||
if (replays === undefined) {
|
||||
@@ -111,18 +114,18 @@ ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
|
||||
replays[replayType] = replay;
|
||||
}
|
||||
return replay;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.isEmpty = function() {
|
||||
ol.render.webgl.ReplayGroup.prototype.isEmpty = function() {
|
||||
return ol.obj.isEmpty(this.replaysByZIndex_);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
* @param {number} resolution Resolution.
|
||||
@@ -133,7 +136,7 @@ ol.render.webgl.ReplayGroup.prototype.isEmpty = function() {
|
||||
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.replay = function(context,
|
||||
ol.render.webgl.ReplayGroup.prototype.replay = function(context,
|
||||
center, resolution, rotation, size, pixelRatio,
|
||||
opacity, skippedFeaturesHash) {
|
||||
/** @type {Array.<number>} */
|
||||
@@ -153,10 +156,10 @@ ol.render.webgl.ReplayGroup.prototype.replay = function(context,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
@@ -174,7 +177,7 @@ ol.render.webgl.ReplayGroup.prototype.replay = function(context,
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
|
||||
ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
|
||||
center, resolution, rotation, size, pixelRatio, opacity,
|
||||
skippedFeaturesHash, featureCallback, oneByOne, opt_hitExtent) {
|
||||
/** @type {Array.<number>} */
|
||||
@@ -199,10 +202,10 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
@@ -217,7 +220,7 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
|
||||
ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
|
||||
coordinate, context, center, resolution, rotation, size, pixelRatio,
|
||||
opacity, skippedFeaturesHash,
|
||||
callback) {
|
||||
@@ -256,10 +259,10 @@ ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
|
||||
}
|
||||
}
|
||||
}, true, hitExtent);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
@@ -272,7 +275,7 @@ ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
|
||||
* to skip.
|
||||
* @return {boolean} Is there a feature at the given coordinate?
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.hasFeatureAtCoordinate = function(
|
||||
ol.render.webgl.ReplayGroup.prototype.hasFeatureAtCoordinate = function(
|
||||
coordinate, context, center, resolution, rotation, size, pixelRatio,
|
||||
opacity, skippedFeaturesHash) {
|
||||
var gl = context.getGL();
|
||||
@@ -293,26 +296,28 @@ ol.render.webgl.ReplayGroup.prototype.hasFeatureAtCoordinate = function(
|
||||
}, false);
|
||||
|
||||
return hasFeature !== undefined;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.HIT_DETECTION_SIZE_ = [1, 1];
|
||||
ol.render.webgl.ReplayGroup.HIT_DETECTION_SIZE_ = [1, 1];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {Object.<ol.render.ReplayType,
|
||||
* function(new: ol.render.webgl.Replay, number,
|
||||
* ol.Extent)>}
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_ = {
|
||||
ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_ = {
|
||||
'Circle': ol.render.webgl.CircleReplay,
|
||||
'Image': ol.render.webgl.ImageReplay,
|
||||
'LineString': ol.render.webgl.LineStringReplay,
|
||||
'Polygon': ol.render.webgl.PolygonReplay,
|
||||
'Text': ol.render.webgl.TextReplay
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,20 +2,23 @@ goog.provide('ol.render.webgl.TextReplay');
|
||||
|
||||
goog.require('ol');
|
||||
|
||||
/**
|
||||
|
||||
if (ol.ENABLE_WEBGL) {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {ol.Extent} maxExtent Max extent.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.TextReplay = function(tolerance, maxExtent) {};
|
||||
ol.render.webgl.TextReplay = function(tolerance, maxExtent) {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.style.Text} textStyle Text style.
|
||||
*/
|
||||
ol.render.webgl.TextReplay.prototype.setTextStyle = function(textStyle) {};
|
||||
ol.render.webgl.TextReplay.prototype.setTextStyle = function(textStyle) {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
* @param {ol.Coordinate} center Center.
|
||||
* @param {number} resolution Resolution.
|
||||
@@ -32,14 +35,14 @@ ol.render.webgl.TextReplay.prototype.setTextStyle = function(textStyle) {};
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
ol.render.webgl.TextReplay.prototype.replay = function(context,
|
||||
ol.render.webgl.TextReplay.prototype.replay = function(context,
|
||||
center, resolution, rotation, size, pixelRatio,
|
||||
opacity, skippedFeaturesHash,
|
||||
featureCallback, oneByOne, opt_hitExtent) {
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
@@ -47,19 +50,21 @@ ol.render.webgl.TextReplay.prototype.replay = function(context,
|
||||
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
*/
|
||||
ol.render.webgl.TextReplay.prototype.drawText = function(flatCoordinates, offset,
|
||||
ol.render.webgl.TextReplay.prototype.drawText = function(flatCoordinates, offset,
|
||||
end, stride, geometry, feature) {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @abstract
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
ol.render.webgl.TextReplay.prototype.finish = function(context) {};
|
||||
ol.render.webgl.TextReplay.prototype.finish = function(context) {};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {ol.webgl.Context} context WebGL context.
|
||||
* @return {function()} Delete resources function.
|
||||
*/
|
||||
ol.render.webgl.TextReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
ol.render.webgl.TextReplay.prototype.getDeleteResourcesFunction = function(context) {
|
||||
return ol.nullFunction;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user