Rename Replay to InstructionsBuilder

This commit is contained in:
Guillaume Beraudo
2018-11-13 16:50:08 +01:00
parent 8097be8419
commit f3bd08321a
7 changed files with 20 additions and 20 deletions

View File

@@ -2,9 +2,9 @@
* @module ol/render/canvas/ImageReplay * @module ol/render/canvas/ImageReplay
*/ */
import CanvasInstruction from './Instruction.js'; import CanvasInstruction from './Instruction.js';
import CanvasReplay from './Replay.js'; import CanvasInstructionsBuilder from './InstructionsBuilder.js';
class CanvasImageReplay extends CanvasReplay { class CanvasImageReplay extends CanvasInstructionsBuilder {
/** /**
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent. * @param {import("../../extent.js").Extent} maxExtent Maximum extent.

View File

@@ -31,7 +31,7 @@ import {
*/ */
class CanvasReplay extends VectorContext { class CanvasInstructionsBuilder extends VectorContext {
/** /**
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent. * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
@@ -501,7 +501,7 @@ class CanvasReplay extends VectorContext {
/** /**
* @param {import("../canvas.js").FillStrokeState} state State. * @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasReplay, import("../canvas.js").FillStrokeState, (import("../../geom/Geometry.js").default|import("../Feature.js").default)):Array<*>} createFill Create fill. * @param {function(this:CanvasInstructionsBuilder, 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 {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
*/ */
updateFillStyle(state, createFill, geometry) { updateFillStyle(state, createFill, geometry) {
@@ -516,7 +516,7 @@ class CanvasReplay extends VectorContext {
/** /**
* @param {import("../canvas.js").FillStrokeState} state State. * @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasReplay, import("../canvas.js").FillStrokeState)} applyStroke Apply stroke. * @param {function(this:CanvasInstructionsBuilder, import("../canvas.js").FillStrokeState)} applyStroke Apply stroke.
*/ */
updateStrokeStyle(state, applyStroke) { updateStrokeStyle(state, applyStroke) {
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
@@ -580,4 +580,4 @@ class CanvasReplay extends VectorContext {
} }
export default CanvasReplay; export default CanvasInstructionsBuilder;

View File

@@ -135,7 +135,7 @@ class InstructionsGroupExectuor extends ReplayGroup {
/** /**
* Recreate replays and populate them using the provided instructions. * Recreate replays and populate them using the provided instructions.
* @param {!Object<string, !Object<ReplayType, import("./Replay.js").SerializableInstructions>>} allInstructions The serializable instructions * @param {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} allInstructions The serializable instructions
*/ */
replaceInstructions(allInstructions) { replaceInstructions(allInstructions) {
this.replaysByZIndex_ = {}; this.replaysByZIndex_ = {};

View File

@@ -2,9 +2,9 @@
* @module ol/render/canvas/LineStringReplay * @module ol/render/canvas/LineStringReplay
*/ */
import CanvasInstruction, {strokeInstruction, beginPathInstruction} from './Instruction.js'; import CanvasInstruction, {strokeInstruction, beginPathInstruction} from './Instruction.js';
import CanvasReplay from './Replay.js'; import CanvasInstructionsBuilder from './InstructionsBuilder.js';
class CanvasLineStringReplay extends CanvasReplay { class CanvasLineStringReplay extends CanvasInstructionsBuilder {
/** /**
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent. * @param {import("../../extent.js").Extent} maxExtent Maximum extent.

View File

@@ -7,10 +7,10 @@ import {defaultFillStyle} from '../canvas.js';
import CanvasInstruction, { import CanvasInstruction, {
fillInstruction, strokeInstruction, beginPathInstruction, closePathInstruction fillInstruction, strokeInstruction, beginPathInstruction, closePathInstruction
} from './Instruction.js'; } from './Instruction.js';
import CanvasReplay from './Replay.js'; import CanvasInstructionsBuilder from './InstructionsBuilder.js';
class CanvasPolygonReplay extends CanvasReplay { class CanvasPolygonReplay extends CanvasInstructionsBuilder {
/** /**
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent. * @param {import("../../extent.js").Extent} maxExtent Maximum extent.

View File

@@ -9,7 +9,7 @@ import {transform2D} from '../../geom/flat/transform.js';
import {isEmpty} from '../../obj.js'; import {isEmpty} from '../../obj.js';
import ReplayGroup from '../ReplayGroup.js'; import ReplayGroup from '../ReplayGroup.js';
import ReplayType from '../ReplayType.js'; import ReplayType from '../ReplayType.js';
import CanvasReplay from './Replay.js'; import CanvasInstructionsBuilder from './InstructionsBuilder.js';
import CanvasImageReplay from './ImageReplay.js'; import CanvasImageReplay from './ImageReplay.js';
import CanvasLineStringReplay from './LineStringReplay.js'; import CanvasLineStringReplay from './LineStringReplay.js';
import CanvasPolygonReplay from './PolygonReplay.js'; import CanvasPolygonReplay from './PolygonReplay.js';
@@ -19,11 +19,11 @@ import {create as createTransform, compose as composeTransform} from '../../tran
/** /**
* @type {Object<ReplayType, typeof CanvasReplay>} * @type {Object<ReplayType, typeof CanvasInstructionsBuilder>}
*/ */
const BATCH_CONSTRUCTORS = { const BATCH_CONSTRUCTORS = {
'Circle': CanvasPolygonReplay, 'Circle': CanvasPolygonReplay,
'Default': CanvasReplay, 'Default': CanvasInstructionsBuilder,
'Image': CanvasImageReplay, 'Image': CanvasImageReplay,
'LineString': CanvasLineStringReplay, 'LineString': CanvasLineStringReplay,
'Polygon': CanvasPolygonReplay, 'Polygon': CanvasPolygonReplay,
@@ -102,7 +102,7 @@ class CanvasReplayGroup extends ReplayGroup {
/** /**
* @private * @private
* @type {!Object<string, !Object<ReplayType, CanvasReplay>>} * @type {!Object<string, !Object<ReplayType, CanvasInstructionsBuilder>>}
*/ */
this.replaysByZIndex_ = {}; this.replaysByZIndex_ = {};
@@ -152,7 +152,7 @@ class CanvasReplayGroup extends ReplayGroup {
/** /**
* Recreate replays and populate them using the provided instructions. * Recreate replays and populate them using the provided instructions.
* @param {!Object<string, !Object<ReplayType, import("./Replay.js").SerializableInstructions>>} allInstructions The serializable instructions * @param {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} allInstructions The serializable instructions
*/ */
replaceInstructions(allInstructions) { replaceInstructions(allInstructions) {
this.replaysByZIndex_ = {}; this.replaysByZIndex_ = {};
@@ -183,7 +183,7 @@ class CanvasReplayGroup extends ReplayGroup {
} }
/** /**
* @return {!Object<string, !Object<ReplayType, import("./Replay.js").SerializableInstructions>>} The serializable instructions * @return {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} The serializable instructions
*/ */
finish() { finish() {
const replaysInstructions = {}; const replaysInstructions = {};
@@ -359,7 +359,7 @@ class CanvasReplayGroup extends ReplayGroup {
} }
/** /**
* @return {Object<string, Object<ReplayType, CanvasReplay>>} Replays. * @return {Object<string, Object<ReplayType, CanvasInstructionsBuilder>>} Replays.
*/ */
getReplays() { getReplays() {
return this.replaysByZIndex_; return this.replaysByZIndex_;

View File

@@ -10,11 +10,11 @@ import GeometryType from '../../geom/GeometryType.js';
import {CANVAS_LINE_DASH} from '../../has.js'; import {CANVAS_LINE_DASH} from '../../has.js';
import {labelCache, measureTextWidth, defaultTextAlign, measureTextHeight, defaultPadding, defaultLineCap, defaultLineDashOffset, defaultLineDash, defaultLineJoin, defaultFillStyle, checkFont, defaultFont, defaultLineWidth, defaultMiterLimit, defaultStrokeStyle, defaultTextBaseline} from '../canvas.js'; import {labelCache, measureTextWidth, defaultTextAlign, measureTextHeight, defaultPadding, defaultLineCap, defaultLineDashOffset, defaultLineDash, defaultLineJoin, defaultFillStyle, checkFont, defaultFont, defaultLineWidth, defaultMiterLimit, defaultStrokeStyle, defaultTextBaseline} from '../canvas.js';
import CanvasInstruction from './Instruction.js'; import CanvasInstruction from './Instruction.js';
import CanvasReplay from './Replay.js'; import CanvasInstructionsBuilder from './InstructionsBuilder.js';
import {TEXT_ALIGN} from '../replay.js'; import {TEXT_ALIGN} from '../replay.js';
import TextPlacement from '../../style/TextPlacement.js'; import TextPlacement from '../../style/TextPlacement.js';
class CanvasTextReplay extends CanvasReplay { class CanvasTextReplay extends CanvasInstructionsBuilder {
/** /**
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent. * @param {import("../../extent.js").Extent} maxExtent Maximum extent.