Remove unused 'geometry' param from '{begin,end}Geometry' functions

This commit is contained in:
Frederic Junod
2019-02-22 16:33:11 +01:00
parent 345607be28
commit 79c6cc5159
5 changed files with 22 additions and 24 deletions

View File

@@ -206,7 +206,7 @@ class CanvasBuilder extends VectorContext {
* @inheritDoc. * @inheritDoc.
*/ */
drawCustom(geometry, feature, renderer) { drawCustom(geometry, feature, renderer) {
this.beginGeometry(geometry, feature); this.beginGeometry(feature);
const type = geometry.getType(); const type = geometry.getType();
const stride = geometry.getStride(); const stride = geometry.getStride();
const builderBegin = this.coordinates.length; const builderBegin = this.coordinates.length;
@@ -248,15 +248,14 @@ class CanvasBuilder extends VectorContext {
this.instructions.push([CanvasInstruction.CUSTOM, this.instructions.push([CanvasInstruction.CUSTOM,
builderBegin, builderEnd, geometry, renderer]); builderBegin, builderEnd, geometry, renderer]);
} }
this.endGeometry(geometry, feature); this.endGeometry(feature);
} }
/** /**
* @protected * @protected
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature. * @param {import("../../Feature.js").FeatureLike} feature Feature.
*/ */
beginGeometry(geometry, feature) { beginGeometry(feature) {
this.beginGeometryInstruction1_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0]; this.beginGeometryInstruction1_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0];
this.instructions.push(this.beginGeometryInstruction1_); this.instructions.push(this.beginGeometryInstruction1_);
this.beginGeometryInstruction2_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0]; this.beginGeometryInstruction2_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0];
@@ -435,10 +434,9 @@ class CanvasBuilder extends VectorContext {
} }
/** /**
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature. * @param {import("../../Feature.js").FeatureLike} feature Feature.
*/ */
endGeometry(geometry, feature) { endGeometry(feature) {
this.beginGeometryInstruction1_[2] = this.instructions.length; this.beginGeometryInstruction1_[2] = this.instructions.length;
this.beginGeometryInstruction1_ = null; this.beginGeometryInstruction1_ = null;
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;

View File

@@ -113,7 +113,7 @@ class CanvasImageBuilder extends CanvasBuilder {
if (!this.image_) { if (!this.image_) {
return; return;
} }
this.beginGeometry(pointGeometry, feature); this.beginGeometry(feature);
const flatCoordinates = pointGeometry.getFlatCoordinates(); const flatCoordinates = pointGeometry.getFlatCoordinates();
const stride = pointGeometry.getStride(); const stride = pointGeometry.getStride();
const myBegin = this.coordinates.length; const myBegin = this.coordinates.length;
@@ -132,7 +132,7 @@ class CanvasImageBuilder extends CanvasBuilder {
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.width_ this.scale_, this.width_
]); ]);
this.endGeometry(pointGeometry, feature); this.endGeometry(feature);
} }
/** /**
@@ -142,7 +142,7 @@ class CanvasImageBuilder extends CanvasBuilder {
if (!this.image_) { if (!this.image_) {
return; return;
} }
this.beginGeometry(multiPointGeometry, feature); this.beginGeometry(feature);
const flatCoordinates = multiPointGeometry.getFlatCoordinates(); const flatCoordinates = multiPointGeometry.getFlatCoordinates();
const stride = multiPointGeometry.getStride(); const stride = multiPointGeometry.getStride();
const myBegin = this.coordinates.length; const myBegin = this.coordinates.length;
@@ -162,7 +162,7 @@ class CanvasImageBuilder extends CanvasBuilder {
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.width_ this.scale_, this.width_
]); ]);
this.endGeometry(multiPointGeometry, feature); this.endGeometry(feature);
} }
/** /**

View File

@@ -44,7 +44,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
return; return;
} }
this.updateStrokeStyle(state, this.applyStroke); this.updateStrokeStyle(state, this.applyStroke);
this.beginGeometry(lineStringGeometry, feature); this.beginGeometry(feature);
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE, CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
@@ -54,7 +54,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
const stride = lineStringGeometry.getStride(); const stride = lineStringGeometry.getStride();
this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride); this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
this.hitDetectionInstructions.push(strokeInstruction); this.hitDetectionInstructions.push(strokeInstruction);
this.endGeometry(lineStringGeometry, feature); this.endGeometry(feature);
} }
/** /**
@@ -68,7 +68,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
return; return;
} }
this.updateStrokeStyle(state, this.applyStroke); this.updateStrokeStyle(state, this.applyStroke);
this.beginGeometry(multiLineStringGeometry, feature); this.beginGeometry(feature);
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE, CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
@@ -82,7 +82,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride); offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride);
} }
this.hitDetectionInstructions.push(strokeInstruction); this.hitDetectionInstructions.push(strokeInstruction);
this.endGeometry(multiLineStringGeometry, feature); this.endGeometry(feature);
} }
/** /**

View File

@@ -73,7 +73,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
return; return;
} }
this.setFillStrokeStyles_(circleGeometry); this.setFillStrokeStyles_(circleGeometry);
this.beginGeometry(circleGeometry, feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE, CanvasInstruction.SET_FILL_STYLE,
@@ -103,7 +103,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
this.instructions.push(strokeInstruction); this.instructions.push(strokeInstruction);
this.hitDetectionInstructions.push(strokeInstruction); this.hitDetectionInstructions.push(strokeInstruction);
} }
this.endGeometry(circleGeometry, feature); this.endGeometry(feature);
} }
/** /**
@@ -117,7 +117,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
return; return;
} }
this.setFillStrokeStyles_(polygonGeometry); this.setFillStrokeStyles_(polygonGeometry);
this.beginGeometry(polygonGeometry, feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE, CanvasInstruction.SET_FILL_STYLE,
@@ -135,7 +135,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates(); const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
const stride = polygonGeometry.getStride(); const stride = polygonGeometry.getStride();
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride); this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
this.endGeometry(polygonGeometry, feature); this.endGeometry(feature);
} }
/** /**
@@ -149,7 +149,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
return; return;
} }
this.setFillStrokeStyles_(multiPolygonGeometry); this.setFillStrokeStyles_(multiPolygonGeometry);
this.beginGeometry(multiPolygonGeometry, feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE, CanvasInstruction.SET_FILL_STYLE,
@@ -170,7 +170,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
for (let i = 0, ii = endss.length; i < ii; ++i) { for (let i = 0, ii = endss.length; i < ii; ++i) {
offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride); offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride);
} }
this.endGeometry(multiPolygonGeometry, feature); this.endGeometry(feature);
} }
/** /**

View File

@@ -184,7 +184,7 @@ class CanvasTextBuilder extends CanvasBuilder {
ends.push(endss[i][0]); ends.push(endss[i][0]);
} }
} }
this.beginGeometry(geometry, feature); this.beginGeometry(feature);
const textAlign = textState.textAlign; const textAlign = textState.textAlign;
let flatOffset = 0; let flatOffset = 0;
let flatEnd; let flatEnd;
@@ -204,7 +204,7 @@ class CanvasTextBuilder extends CanvasBuilder {
this.drawChars_(begin, end, this.declutterGroup_); this.drawChars_(begin, end, this.declutterGroup_);
begin = end; begin = end;
} }
this.endGeometry(geometry, feature); this.endGeometry(feature);
} else { } else {
@@ -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. // 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 // 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.textOffsetX_, this.textOffsetY_, geometryWidths
]); ]);
this.endGeometry(geometry, feature); this.endGeometry(feature);
} }
} }