Merge pull request #9260 from fredj/rm_geom_param
Remove unused 'geometry' param from ol/render/canvas/Builder
This commit is contained in:
@@ -206,7 +206,7 @@ class CanvasBuilder extends VectorContext {
|
||||
* @inheritDoc.
|
||||
*/
|
||||
drawCustom(geometry, feature, renderer) {
|
||||
this.beginGeometry(geometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
const type = geometry.getType();
|
||||
const stride = geometry.getStride();
|
||||
const builderBegin = this.coordinates.length;
|
||||
@@ -248,15 +248,14 @@ class CanvasBuilder extends VectorContext {
|
||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||
builderBegin, builderEnd, geometry, renderer]);
|
||||
}
|
||||
this.endGeometry(geometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
beginGeometry(geometry, feature) {
|
||||
beginGeometry(feature) {
|
||||
this.beginGeometryInstruction1_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0];
|
||||
this.instructions.push(this.beginGeometryInstruction1_);
|
||||
this.beginGeometryInstruction2_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0];
|
||||
@@ -353,10 +352,9 @@ class CanvasBuilder extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @return {Array<*>} Fill instruction.
|
||||
*/
|
||||
createFill(state, geometry) {
|
||||
createFill(state) {
|
||||
const fillStyle = state.fillStyle;
|
||||
/** @type {Array<*>} */
|
||||
const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];
|
||||
@@ -389,14 +387,13 @@ class CanvasBuilder extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState, (import("../../geom/Geometry.js").default|import("../Feature.js").default)):Array<*>} createFill Create fill.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
|
||||
*/
|
||||
updateFillStyle(state, createFill, geometry) {
|
||||
updateFillStyle(state, createFill) {
|
||||
const fillStyle = state.fillStyle;
|
||||
if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
|
||||
if (fillStyle !== undefined) {
|
||||
this.instructions.push(createFill.call(this, state, geometry));
|
||||
this.instructions.push(createFill.call(this, state));
|
||||
}
|
||||
state.currentFillStyle = fillStyle;
|
||||
}
|
||||
@@ -435,10 +432,9 @@ class CanvasBuilder extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
endGeometry(geometry, feature) {
|
||||
endGeometry(feature) {
|
||||
this.beginGeometryInstruction1_[2] = this.instructions.length;
|
||||
this.beginGeometryInstruction1_ = null;
|
||||
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
|
||||
|
||||
@@ -113,7 +113,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
this.beginGeometry(pointGeometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
const flatCoordinates = pointGeometry.getFlatCoordinates();
|
||||
const stride = pointGeometry.getStride();
|
||||
const myBegin = this.coordinates.length;
|
||||
@@ -132,7 +132,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
|
||||
this.scale_, this.width_
|
||||
]);
|
||||
this.endGeometry(pointGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
this.beginGeometry(multiPointGeometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
const flatCoordinates = multiPointGeometry.getFlatCoordinates();
|
||||
const stride = multiPointGeometry.getStride();
|
||||
const myBegin = this.coordinates.length;
|
||||
@@ -162,7 +162,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
|
||||
this.scale_, this.width_
|
||||
]);
|
||||
this.endGeometry(multiPointGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
return;
|
||||
}
|
||||
this.updateStrokeStyle(state, this.applyStroke);
|
||||
this.beginGeometry(lineStringGeometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
this.hitDetectionInstructions.push([
|
||||
CanvasInstruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
@@ -54,7 +54,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
const stride = lineStringGeometry.getStride();
|
||||
this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
this.endGeometry(lineStringGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
return;
|
||||
}
|
||||
this.updateStrokeStyle(state, this.applyStroke);
|
||||
this.beginGeometry(multiLineStringGeometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
this.hitDetectionInstructions.push([
|
||||
CanvasInstruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
@@ -82,7 +82,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
|
||||
offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride);
|
||||
}
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
this.endGeometry(multiLineStringGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,8 +72,8 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
return;
|
||||
}
|
||||
this.setFillStrokeStyles_(circleGeometry);
|
||||
this.beginGeometry(circleGeometry, feature);
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(feature);
|
||||
if (state.fillStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push([
|
||||
CanvasInstruction.SET_FILL_STYLE,
|
||||
@@ -103,7 +103,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
this.instructions.push(strokeInstruction);
|
||||
this.hitDetectionInstructions.push(strokeInstruction);
|
||||
}
|
||||
this.endGeometry(circleGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,8 +116,8 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
return;
|
||||
}
|
||||
this.setFillStrokeStyles_(polygonGeometry);
|
||||
this.beginGeometry(polygonGeometry, feature);
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(feature);
|
||||
if (state.fillStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push([
|
||||
CanvasInstruction.SET_FILL_STYLE,
|
||||
@@ -135,7 +135,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
|
||||
const stride = polygonGeometry.getStride();
|
||||
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
|
||||
this.endGeometry(polygonGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,8 +148,8 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
return;
|
||||
}
|
||||
this.setFillStrokeStyles_(multiPolygonGeometry);
|
||||
this.beginGeometry(multiPolygonGeometry, feature);
|
||||
this.setFillStrokeStyles_();
|
||||
this.beginGeometry(feature);
|
||||
if (state.fillStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push([
|
||||
CanvasInstruction.SET_FILL_STYLE,
|
||||
@@ -170,7 +170,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
||||
offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride);
|
||||
}
|
||||
this.endGeometry(multiPolygonGeometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,13 +195,12 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
*/
|
||||
setFillStrokeStyles_(geometry) {
|
||||
setFillStrokeStyles_() {
|
||||
const state = this.state;
|
||||
const fillStyle = state.fillStyle;
|
||||
if (fillStyle !== undefined) {
|
||||
this.updateFillStyle(state, this.createFill, geometry);
|
||||
this.updateFillStyle(state, this.createFill);
|
||||
}
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.updateStrokeStyle(state, this.applyStroke);
|
||||
|
||||
@@ -184,7 +184,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
ends.push(endss[i][0]);
|
||||
}
|
||||
}
|
||||
this.beginGeometry(geometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
const textAlign = textState.textAlign;
|
||||
let flatOffset = 0;
|
||||
let flatEnd;
|
||||
@@ -204,7 +204,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
this.drawChars_(begin, end, this.declutterGroup_);
|
||||
begin = end;
|
||||
}
|
||||
this.endGeometry(geometry, feature);
|
||||
this.endGeometry(feature);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -258,8 +258,8 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
if (textState.backgroundFill || textState.backgroundStroke) {
|
||||
this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke);
|
||||
if (textState.backgroundFill) {
|
||||
this.updateFillStyle(this.state, this.createFill, geometry);
|
||||
this.hitDetectionInstructions.push(this.createFill(this.state, geometry));
|
||||
this.updateFillStyle(this.state, this.createFill);
|
||||
this.hitDetectionInstructions.push(this.createFill(this.state));
|
||||
}
|
||||
if (textState.backgroundStroke) {
|
||||
this.updateStrokeStyle(this.state, this.applyStroke);
|
||||
@@ -267,7 +267,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
this.beginGeometry(geometry, feature);
|
||||
this.beginGeometry(feature);
|
||||
|
||||
// The image is unknown at this stage so we pass null; it will be computed at render time.
|
||||
// For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at
|
||||
@@ -293,7 +293,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
this.textOffsetX_, this.textOffsetY_, geometryWidths
|
||||
]);
|
||||
|
||||
this.endGeometry(geometry, feature);
|
||||
this.endGeometry(feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user