Reduce usage of "replay" term
This commit is contained in:
@@ -65,7 +65,7 @@ class VectorTile extends Tile {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Object<string, import("./render/ReplayGroup.js").default>}
|
* @type {Object<string, import("./render/BuilderGroup.js").default>}
|
||||||
*/
|
*/
|
||||||
this.replayGroups_ = {};
|
this.replayGroups_ = {};
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class VectorTile extends Tile {
|
|||||||
/**
|
/**
|
||||||
* @param {import("./layer/Layer.js").default} layer Layer.
|
* @param {import("./layer/Layer.js").default} layer Layer.
|
||||||
* @param {string} key Key.
|
* @param {string} key Key.
|
||||||
* @return {import("./render/ReplayGroup.js").default} Replay group.
|
* @return {import("./render/BuilderGroup.js").default} Replay group.
|
||||||
*/
|
*/
|
||||||
getReplayGroup(layer, key) {
|
getReplayGroup(layer, key) {
|
||||||
return this.replayGroups_[getUid(layer) + ',' + key];
|
return this.replayGroups_[getUid(layer) + ',' + key];
|
||||||
@@ -153,7 +153,7 @@ class VectorTile extends Tile {
|
|||||||
* @param {import("./layer/Layer").default} layer Layer.
|
* @param {import("./layer/Layer").default} layer Layer.
|
||||||
* @param {number} zoom Zoom.
|
* @param {number} zoom Zoom.
|
||||||
* @param {import("./extent").Extent} extent Extent.
|
* @param {import("./extent").Extent} extent Extent.
|
||||||
* @return {import("./render/ReplayGroup.js").default} Replay groups.
|
* @return {import("./render/BuilderGroup.js").default} Replay groups.
|
||||||
*/
|
*/
|
||||||
getLowResReplayGroup(layer, zoom, extent) {
|
getLowResReplayGroup(layer, zoom, extent) {
|
||||||
const layerId = getUid(layer);
|
const layerId = getUid(layer);
|
||||||
@@ -244,7 +244,7 @@ class VectorTile extends Tile {
|
|||||||
/**
|
/**
|
||||||
* @param {import("./layer/Layer.js").default} layer Layer.
|
* @param {import("./layer/Layer.js").default} layer Layer.
|
||||||
* @param {string} key Key.
|
* @param {string} key Key.
|
||||||
* @param {import("./render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("./render/BuilderGroup.js").default} replayGroup Replay group.
|
||||||
*/
|
*/
|
||||||
setReplayGroup(layer, key, replayGroup) {
|
setReplayGroup(layer, key, replayGroup) {
|
||||||
this.replayGroups_[getUid(layer) + ',' + key] = replayGroup;
|
this.replayGroups_[getUid(layer) + ',' + key] = replayGroup;
|
||||||
|
|||||||
38
src/ol/render/BuilderGroup.js
Normal file
38
src/ol/render/BuilderGroup.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* @module ol/render/BuilderGroup
|
||||||
|
*/
|
||||||
|
import {abstract} from '../util.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for builder groups.
|
||||||
|
*/
|
||||||
|
class BuilderGroup {
|
||||||
|
/**
|
||||||
|
* @abstract
|
||||||
|
* @param {number|undefined} zIndex Z index.
|
||||||
|
* @param {import("./ReplayType.js").default} replayType Replay type.
|
||||||
|
* @return {import("./VectorContext.js").default} Replay.
|
||||||
|
*/
|
||||||
|
getBuilder(zIndex, replayType) {
|
||||||
|
return abstract();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @abstract
|
||||||
|
* @return {boolean} Is empty.
|
||||||
|
*/
|
||||||
|
isEmpty() {
|
||||||
|
return abstract();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @abstract
|
||||||
|
* @param {boolean} group Group with previous builder
|
||||||
|
* @return {Array<*>} The resulting instruction group
|
||||||
|
*/
|
||||||
|
addDeclutter(group) {
|
||||||
|
return abstract();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BuilderGroup;
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/ReplayGroup
|
* @module ol/render/ExecutorGroup
|
||||||
*/
|
*/
|
||||||
import {abstract} from '../util.js';
|
import {abstract} from '../util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for replay groups.
|
* Base class for replay groups.
|
||||||
*/
|
*/
|
||||||
class ReplayGroup {
|
class ExecutorGroup {
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* @abstract
|
||||||
* @param {number|undefined} zIndex Z index.
|
* @param {number|undefined} zIndex Z index.
|
||||||
* @param {import("./ReplayType.js").default} replayType Replay type.
|
* @param {import("./ReplayType.js").default} replayType Replay type.
|
||||||
* @return {import("./VectorContext.js").default} Replay.
|
* @return {import("./VectorContext.js").default} Replay.
|
||||||
*/
|
*/
|
||||||
getReplay(zIndex, replayType) {
|
getExecutor(zIndex, replayType) {
|
||||||
return abstract();
|
return abstract();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,4 +35,4 @@ class ReplayGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ReplayGroup;
|
export default ExecutorGroup;
|
||||||
@@ -10,7 +10,7 @@ class CanvasImageBuilder extends CanvasInstructionsBuilder {
|
|||||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
* @param {boolean} overlaps The builder can have overlapping geometries.
|
||||||
* @param {?} declutterTree Declutter tree.
|
* @param {?} declutterTree Declutter tree.
|
||||||
*/
|
*/
|
||||||
constructor(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
|
constructor(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class CanvasInstructionsBuilder extends VectorContext {
|
|||||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
* @param {boolean} overlaps The builder can have overlapping geometries.
|
||||||
* @param {?} declutterTree Declutter tree.
|
* @param {?} declutterTree Declutter tree.
|
||||||
*/
|
*/
|
||||||
constructor(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
|
constructor(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
|
||||||
@@ -230,14 +230,14 @@ class CanvasInstructionsBuilder extends VectorContext {
|
|||||||
* @param {number} offset Offset.
|
* @param {number} offset Offset.
|
||||||
* @param {Array<number>} ends Ends.
|
* @param {Array<number>} ends Ends.
|
||||||
* @param {number} stride Stride.
|
* @param {number} stride Stride.
|
||||||
* @param {Array<number>} replayEnds Replay ends.
|
* @param {Array<number>} builderEnds Builder ends.
|
||||||
* @return {number} Offset.
|
* @return {number} Offset.
|
||||||
*/
|
*/
|
||||||
drawCustomCoordinates_(flatCoordinates, offset, ends, stride, replayEnds) {
|
drawCustomCoordinates_(flatCoordinates, offset, ends, stride, builderEnds) {
|
||||||
for (let i = 0, ii = ends.length; i < ii; ++i) {
|
for (let i = 0, ii = ends.length; i < ii; ++i) {
|
||||||
const end = ends[i];
|
const end = ends[i];
|
||||||
const replayEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
|
const builderEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
|
||||||
replayEnds.push(replayEnd);
|
builderEnds.push(builderEnd);
|
||||||
offset = end;
|
offset = end;
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
@@ -250,44 +250,44 @@ class CanvasInstructionsBuilder extends VectorContext {
|
|||||||
this.beginGeometry(geometry, feature);
|
this.beginGeometry(geometry, feature);
|
||||||
const type = geometry.getType();
|
const type = geometry.getType();
|
||||||
const stride = geometry.getStride();
|
const stride = geometry.getStride();
|
||||||
const replayBegin = this.coordinates.length;
|
const builderBegin = this.coordinates.length;
|
||||||
let flatCoordinates, replayEnd, replayEnds, replayEndss;
|
let flatCoordinates, builderEnd, builderEnds, builderEndss;
|
||||||
let offset;
|
let offset;
|
||||||
if (type == GeometryType.MULTI_POLYGON) {
|
if (type == GeometryType.MULTI_POLYGON) {
|
||||||
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry);
|
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry);
|
||||||
flatCoordinates = geometry.getOrientedFlatCoordinates();
|
flatCoordinates = geometry.getOrientedFlatCoordinates();
|
||||||
replayEndss = [];
|
builderEndss = [];
|
||||||
const endss = geometry.getEndss();
|
const endss = geometry.getEndss();
|
||||||
offset = 0;
|
offset = 0;
|
||||||
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
||||||
const myEnds = [];
|
const myEnds = [];
|
||||||
offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds);
|
offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds);
|
||||||
replayEndss.push(myEnds);
|
builderEndss.push(myEnds);
|
||||||
}
|
}
|
||||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||||
replayBegin, replayEndss, geometry, renderer, inflateMultiCoordinatesArray]);
|
builderBegin, builderEndss, geometry, renderer, inflateMultiCoordinatesArray]);
|
||||||
} else if (type == GeometryType.POLYGON || type == GeometryType.MULTI_LINE_STRING) {
|
} else if (type == GeometryType.POLYGON || type == GeometryType.MULTI_LINE_STRING) {
|
||||||
replayEnds = [];
|
builderEnds = [];
|
||||||
flatCoordinates = (type == GeometryType.POLYGON) ?
|
flatCoordinates = (type == GeometryType.POLYGON) ?
|
||||||
/** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates() :
|
/** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates() :
|
||||||
geometry.getFlatCoordinates();
|
geometry.getFlatCoordinates();
|
||||||
offset = this.drawCustomCoordinates_(flatCoordinates, 0,
|
offset = this.drawCustomCoordinates_(flatCoordinates, 0,
|
||||||
/** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(),
|
/** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(),
|
||||||
stride, replayEnds);
|
stride, builderEnds);
|
||||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||||
replayBegin, replayEnds, geometry, renderer, inflateCoordinatesArray]);
|
builderBegin, builderEnds, geometry, renderer, inflateCoordinatesArray]);
|
||||||
} else if (type == GeometryType.LINE_STRING || type == GeometryType.MULTI_POINT) {
|
} else if (type == GeometryType.LINE_STRING || type == GeometryType.MULTI_POINT) {
|
||||||
flatCoordinates = geometry.getFlatCoordinates();
|
flatCoordinates = geometry.getFlatCoordinates();
|
||||||
replayEnd = this.appendFlatCoordinates(
|
builderEnd = this.appendFlatCoordinates(
|
||||||
flatCoordinates, 0, flatCoordinates.length, stride, false, false);
|
flatCoordinates, 0, flatCoordinates.length, stride, false, false);
|
||||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||||
replayBegin, replayEnd, geometry, renderer, inflateCoordinates]);
|
builderBegin, builderEnd, geometry, renderer, inflateCoordinates]);
|
||||||
} else if (type == GeometryType.POINT) {
|
} else if (type == GeometryType.POINT) {
|
||||||
flatCoordinates = geometry.getFlatCoordinates();
|
flatCoordinates = geometry.getFlatCoordinates();
|
||||||
this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
||||||
replayEnd = this.coordinates.length;
|
builderEnd = this.coordinates.length;
|
||||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||||
replayBegin, replayEnd, geometry, renderer]);
|
builderBegin, builderEnd, geometry, renderer]);
|
||||||
}
|
}
|
||||||
this.endGeometry(geometry, feature);
|
this.endGeometry(geometry, feature);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ class CanvasInstructionsExecutor {
|
|||||||
* @return {T|undefined} Callback result.
|
* @return {T|undefined} Callback result.
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
replay_(
|
execute_(
|
||||||
context,
|
context,
|
||||||
transform,
|
transform,
|
||||||
skippedFeaturesHash,
|
skippedFeaturesHash,
|
||||||
@@ -909,9 +909,9 @@ class CanvasInstructionsExecutor {
|
|||||||
* to skip.
|
* to skip.
|
||||||
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
|
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
|
||||||
*/
|
*/
|
||||||
replay(context, transform, viewRotation, skippedFeaturesHash, snapToPixel) {
|
execute(context, transform, viewRotation, skippedFeaturesHash, snapToPixel) {
|
||||||
this.viewRotation_ = viewRotation;
|
this.viewRotation_ = viewRotation;
|
||||||
this.replay_(context, transform,
|
this.execute_(context, transform,
|
||||||
skippedFeaturesHash, this.instructions, snapToPixel, undefined, undefined);
|
skippedFeaturesHash, this.instructions, snapToPixel, undefined, undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,7 +928,7 @@ class CanvasInstructionsExecutor {
|
|||||||
* @return {T|undefined} Callback result.
|
* @return {T|undefined} Callback result.
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
replayHitDetection(
|
executeHitDetection(
|
||||||
context,
|
context,
|
||||||
transform,
|
transform,
|
||||||
viewRotation,
|
viewRotation,
|
||||||
@@ -937,7 +937,7 @@ class CanvasInstructionsExecutor {
|
|||||||
opt_hitExtent
|
opt_hitExtent
|
||||||
) {
|
) {
|
||||||
this.viewRotation_ = viewRotation;
|
this.viewRotation_ = viewRotation;
|
||||||
return this.replay_(context, transform, skippedFeaturesHash,
|
return this.execute_(context, transform, skippedFeaturesHash,
|
||||||
this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
|
this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {createCanvasContext2D} from '../../dom.js';
|
|||||||
import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
|
import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
|
||||||
import {transform2D} from '../../geom/flat/transform.js';
|
import {transform2D} from '../../geom/flat/transform.js';
|
||||||
import {isEmpty} from '../../obj.js';
|
import {isEmpty} from '../../obj.js';
|
||||||
import ReplayGroup from '../ReplayGroup.js';
|
import BuilderGroup from '../BuilderGroup.js';
|
||||||
import ReplayType from '../ReplayType.js';
|
import ReplayType from '../ReplayType.js';
|
||||||
import CanvasInstructionsBuilder from './InstructionsBuilder.js';
|
import CanvasInstructionsBuilder from './InstructionsBuilder.js';
|
||||||
import CanvasImageBuilder from './ImageBuilder.js';
|
import CanvasImageBuilder from './ImageBuilder.js';
|
||||||
@@ -31,13 +31,13 @@ const BATCH_CONSTRUCTORS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
class CanvasBuilderGroup extends BuilderGroup {
|
||||||
/**
|
/**
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
* @param {import("../../extent.js").Extent} maxExtent Max extent.
|
* @param {import("../../extent.js").Extent} maxExtent Max extent.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {boolean} overlaps The replay group can have overlapping geometries.
|
* @param {boolean} overlaps The builder group can have overlapping geometries.
|
||||||
* @param {?} declutterTree Declutter tree for declutter processing in postrender.
|
* @param {?} declutterTree Declutter tree for declutter processing in postrender.
|
||||||
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
||||||
*/
|
*/
|
||||||
@@ -104,7 +104,7 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
* @private
|
* @private
|
||||||
* @type {!Object<string, !Object<ReplayType, CanvasInstructionsBuilder>>}
|
* @type {!Object<string, !Object<ReplayType, CanvasInstructionsBuilder>>}
|
||||||
*/
|
*/
|
||||||
this.replaysByZIndex_ = {};
|
this.buildersByZIndex_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -150,31 +150,16 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
context.clip();
|
context.clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Recreate replays and populate them using the provided instructions.
|
|
||||||
* @param {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} allInstructions The serializable instructions
|
|
||||||
*/
|
|
||||||
replaceInstructions(allInstructions) {
|
|
||||||
this.replaysByZIndex_ = {};
|
|
||||||
for (const zIndex in allInstructions) {
|
|
||||||
const instructionByZindex = allInstructions[zIndex];
|
|
||||||
for (const replayType in instructionByZindex) {
|
|
||||||
const instructions = instructionByZindex[replayType];
|
|
||||||
const replay = this.getReplay(zIndex, replayType);
|
|
||||||
replay.replaceInstructions(instructions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<ReplayType>} replays Replays.
|
* @param {Array<ReplayType>} builders Builders.
|
||||||
* @return {boolean} Has replays of the provided types.
|
* @return {boolean} Has builders of the provided types.
|
||||||
*/
|
*/
|
||||||
hasReplays(replays) {
|
hasBuilders(builders) {
|
||||||
for (const zIndex in this.replaysByZIndex_) {
|
for (const zIndex in this.buildersByZIndex_) {
|
||||||
const candidates = this.replaysByZIndex_[zIndex];
|
const candidates = this.buildersByZIndex_[zIndex];
|
||||||
for (let i = 0, ii = replays.length; i < ii; ++i) {
|
for (let i = 0, ii = builders.length; i < ii; ++i) {
|
||||||
if (replays[i] in candidates) {
|
if (builders[i] in candidates) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,16 +171,16 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
* @return {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} The serializable instructions
|
* @return {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.js").SerializableInstructions>>} The serializable instructions
|
||||||
*/
|
*/
|
||||||
finish() {
|
finish() {
|
||||||
const replaysInstructions = {};
|
const builderInstructions = {};
|
||||||
for (const zKey in this.replaysByZIndex_) {
|
for (const zKey in this.buildersByZIndex_) {
|
||||||
replaysInstructions[zKey] = replaysInstructions[zKey] || {};
|
builderInstructions[zKey] = builderInstructions[zKey] || {};
|
||||||
const replays = this.replaysByZIndex_[zKey];
|
const builders = this.buildersByZIndex_[zKey];
|
||||||
for (const replayKey in replays) {
|
for (const builderKey in builders) {
|
||||||
const replayInstructions = replays[replayKey].finish();
|
const builderInstruction = builders[builderKey].finish();
|
||||||
replaysInstructions[zKey][replayKey] = replayInstructions;
|
builderInstructions[zKey][builderKey] = builderInstruction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return replaysInstructions;
|
return builderInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,27 +268,27 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @type {Array<number>} */
|
/** @type {Array<number>} */
|
||||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
const zs = Object.keys(this.buildersByZIndex_).map(Number);
|
||||||
zs.sort(numberSafeCompareFunction);
|
zs.sort(numberSafeCompareFunction);
|
||||||
|
|
||||||
let i, j, replays, replay, result;
|
let i, j, builders, builder, result;
|
||||||
for (i = zs.length - 1; i >= 0; --i) {
|
for (i = zs.length - 1; i >= 0; --i) {
|
||||||
const zIndexKey = zs[i].toString();
|
const zIndexKey = zs[i].toString();
|
||||||
replays = this.replaysByZIndex_[zIndexKey];
|
builders = this.buildersByZIndex_[zIndexKey];
|
||||||
for (j = ORDER.length - 1; j >= 0; --j) {
|
for (j = ORDER.length - 1; j >= 0; --j) {
|
||||||
replayType = ORDER[j];
|
replayType = ORDER[j];
|
||||||
replay = replays[replayType];
|
builder = builders[replayType];
|
||||||
if (replay !== undefined) {
|
if (builder !== undefined) {
|
||||||
if (declutterReplays &&
|
if (declutterReplays &&
|
||||||
(replayType == ReplayType.IMAGE || replayType == ReplayType.TEXT)) {
|
(replayType == ReplayType.IMAGE || replayType == ReplayType.TEXT)) {
|
||||||
const declutter = declutterReplays[zIndexKey];
|
const declutter = declutterReplays[zIndexKey];
|
||||||
if (!declutter) {
|
if (!declutter) {
|
||||||
declutterReplays[zIndexKey] = [replay, transform.slice(0)];
|
declutterReplays[zIndexKey] = [builder, transform.slice(0)];
|
||||||
} else {
|
} else {
|
||||||
declutter.push(replay, transform.slice(0));
|
declutter.push(builder, transform.slice(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = replay.replayHitDetection(context, transform, rotation,
|
result = builder.executeHitDetection(context, transform, rotation,
|
||||||
skippedFeaturesHash, featureCallback, hitExtent);
|
skippedFeaturesHash, featureCallback, hitExtent);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
@@ -341,12 +326,12 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
getReplay(zIndex, replayType) {
|
getBuilder(zIndex, replayType) {
|
||||||
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
||||||
let replays = this.replaysByZIndex_[zIndexKey];
|
let replays = this.buildersByZIndex_[zIndexKey];
|
||||||
if (replays === undefined) {
|
if (replays === undefined) {
|
||||||
replays = {};
|
replays = {};
|
||||||
this.replaysByZIndex_[zIndexKey] = replays;
|
this.buildersByZIndex_[zIndexKey] = replays;
|
||||||
}
|
}
|
||||||
let replay = replays[replayType];
|
let replay = replays[replayType];
|
||||||
if (replay === undefined) {
|
if (replay === undefined) {
|
||||||
@@ -362,70 +347,14 @@ class CanvasInstructionsGroupBuilder extends ReplayGroup {
|
|||||||
* @return {Object<string, Object<ReplayType, CanvasInstructionsBuilder>>} Replays.
|
* @return {Object<string, Object<ReplayType, CanvasInstructionsBuilder>>} Replays.
|
||||||
*/
|
*/
|
||||||
getReplays() {
|
getReplays() {
|
||||||
return this.replaysByZIndex_;
|
return this.buildersByZIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
isEmpty() {
|
isEmpty() {
|
||||||
return isEmpty(this.replaysByZIndex_);
|
return isEmpty(this.buildersByZIndex_);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {CanvasRenderingContext2D} context Context.
|
|
||||||
* @param {import("../../transform.js").Transform} transform Transform.
|
|
||||||
* @param {number} viewRotation View rotation.
|
|
||||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
|
|
||||||
* @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
|
|
||||||
* @param {Array<ReplayType>=} opt_replayTypes Ordered replay types to replay.
|
|
||||||
* Default is {@link module:ol/render/replay~ORDER}
|
|
||||||
* @param {Object<string, import("../canvas.js").DeclutterGroup>=} opt_declutterReplays Declutter replays.
|
|
||||||
*/
|
|
||||||
replay(
|
|
||||||
context,
|
|
||||||
transform,
|
|
||||||
viewRotation,
|
|
||||||
skippedFeaturesHash,
|
|
||||||
snapToPixel,
|
|
||||||
opt_replayTypes,
|
|
||||||
opt_declutterReplays
|
|
||||||
) {
|
|
||||||
|
|
||||||
/** @type {Array<number>} */
|
|
||||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
|
||||||
zs.sort(numberSafeCompareFunction);
|
|
||||||
|
|
||||||
// setup clipping so that the parts of over-simplified geometries are not
|
|
||||||
// visible outside the current extent when panning
|
|
||||||
context.save();
|
|
||||||
this.clip(context, transform);
|
|
||||||
|
|
||||||
const replayTypes = opt_replayTypes ? opt_replayTypes : ORDER;
|
|
||||||
let i, ii, j, jj, replays, replay;
|
|
||||||
for (i = 0, ii = zs.length; i < ii; ++i) {
|
|
||||||
const zIndexKey = zs[i].toString();
|
|
||||||
replays = this.replaysByZIndex_[zIndexKey];
|
|
||||||
for (j = 0, jj = replayTypes.length; j < jj; ++j) {
|
|
||||||
const replayType = replayTypes[j];
|
|
||||||
replay = replays[replayType];
|
|
||||||
if (replay !== undefined) {
|
|
||||||
if (opt_declutterReplays &&
|
|
||||||
(replayType == ReplayType.IMAGE || replayType == ReplayType.TEXT)) {
|
|
||||||
const declutter = opt_declutterReplays[zIndexKey];
|
|
||||||
if (!declutter) {
|
|
||||||
opt_declutterReplays[zIndexKey] = [replay, transform.slice(0)];
|
|
||||||
} else {
|
|
||||||
declutter.push(replay, transform.slice(0));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
replay.replay(context, transform, viewRotation, skippedFeaturesHash, snapToPixel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.restore();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,10 +451,10 @@ export function replayDeclutter(declutterReplays, context, rotation, snapToPixel
|
|||||||
for (let i = 0, ii = replayData.length; i < ii;) {
|
for (let i = 0, ii = replayData.length; i < ii;) {
|
||||||
const replay = replayData[i++];
|
const replay = replayData[i++];
|
||||||
const transform = replayData[i++];
|
const transform = replayData[i++];
|
||||||
replay.replay(context, transform, rotation, skippedFeatureUids, snapToPixel);
|
replay.execute(context, transform, rotation, skippedFeatureUids, snapToPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default CanvasInstructionsGroupBuilder;
|
export default CanvasBuilderGroup;
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ import {createCanvasContext2D} from '../../dom.js';
|
|||||||
import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
|
import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
|
||||||
import {transform2D} from '../../geom/flat/transform.js';
|
import {transform2D} from '../../geom/flat/transform.js';
|
||||||
import {isEmpty} from '../../obj.js';
|
import {isEmpty} from '../../obj.js';
|
||||||
import ReplayGroup from '../ReplayGroup.js';
|
import ExecutorGroup from '../ExecutorGroup.js';
|
||||||
import ReplayType from '../ReplayType.js';
|
import ReplayType from '../ReplayType.js';
|
||||||
import {ORDER} from '../replay.js';
|
import {ORDER} from '../replay.js';
|
||||||
import {create as createTransform, compose as composeTransform} from '../../transform.js';
|
import {create as createTransform, compose as composeTransform} from '../../transform.js';
|
||||||
import CanvasInstructionsExecutor from './InstructionsExecutor.js';
|
import CanvasInstructionsExecutor from './InstructionsExecutor.js';
|
||||||
|
|
||||||
|
|
||||||
class InstructionsGroupExectuor extends ReplayGroup {
|
class InstructionsGroupExectuor extends ExecutorGroup {
|
||||||
/**
|
/**
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
* @param {import("../../extent.js").Extent} maxExtent Max extent.
|
* @param {import("../../extent.js").Extent} maxExtent Max extent.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {boolean} overlaps The replay group can have overlapping geometries.
|
* @param {boolean} overlaps The executor group can have overlapping geometries.
|
||||||
* @param {?} declutterTree Declutter tree for declutter processing in postrender.
|
* @param {?} declutterTree Declutter tree for declutter processing in postrender.
|
||||||
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
||||||
*/
|
*/
|
||||||
@@ -87,7 +87,7 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
* @private
|
* @private
|
||||||
* @type {!Object<string, !Object<ReplayType, CanvasReplay>>}
|
* @type {!Object<string, !Object<ReplayType, CanvasReplay>>}
|
||||||
*/
|
*/
|
||||||
this.replaysByZIndex_ = {};
|
this.executorsByZIndex_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -134,30 +134,30 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recreate replays and populate them using the provided instructions.
|
* Create executors and populate them using the provided instructions.
|
||||||
* @param {!Object<string, !Object<ReplayType, import("./InstructionsBuilder.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.executorsByZIndex_ = {};
|
||||||
for (const zIndex in allInstructions) {
|
for (const zIndex in allInstructions) {
|
||||||
const instructionByZindex = allInstructions[zIndex];
|
const instructionByZindex = allInstructions[zIndex];
|
||||||
for (const replayType in instructionByZindex) {
|
for (const replayType in instructionByZindex) {
|
||||||
const instructions = instructionByZindex[replayType];
|
const instructions = instructionByZindex[replayType];
|
||||||
const replay = this.getReplay(zIndex, replayType);
|
const executor = this.getExecutor(zIndex, replayType);
|
||||||
replay.replaceInstructions(instructions);
|
executor.replaceInstructions(instructions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<ReplayType>} replays Replays.
|
* @param {Array<ReplayType>} executors Executors.
|
||||||
* @return {boolean} Has replays of the provided types.
|
* @return {boolean} Has executors of the provided types.
|
||||||
*/
|
*/
|
||||||
hasReplays(replays) {
|
hasExecutors(executors) {
|
||||||
for (const zIndex in this.replaysByZIndex_) {
|
for (const zIndex in this.executorsByZIndex_) {
|
||||||
const candidates = this.replaysByZIndex_[zIndex];
|
const candidates = this.executorsByZIndex_[zIndex];
|
||||||
for (let i = 0, ii = replays.length; i < ii; ++i) {
|
for (let i = 0, ii = executors.length; i < ii; ++i) {
|
||||||
if (replays[i] in candidates) {
|
if (executors[i] in candidates) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,27 +251,27 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @type {Array<number>} */
|
/** @type {Array<number>} */
|
||||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
const zs = Object.keys(this.executorsByZIndex_).map(Number);
|
||||||
zs.sort(numberSafeCompareFunction);
|
zs.sort(numberSafeCompareFunction);
|
||||||
|
|
||||||
let i, j, replays, replay, result;
|
let i, j, executors, executor, result;
|
||||||
for (i = zs.length - 1; i >= 0; --i) {
|
for (i = zs.length - 1; i >= 0; --i) {
|
||||||
const zIndexKey = zs[i].toString();
|
const zIndexKey = zs[i].toString();
|
||||||
replays = this.replaysByZIndex_[zIndexKey];
|
executors = this.executorsByZIndex_[zIndexKey];
|
||||||
for (j = ORDER.length - 1; j >= 0; --j) {
|
for (j = ORDER.length - 1; j >= 0; --j) {
|
||||||
replayType = ORDER[j];
|
replayType = ORDER[j];
|
||||||
replay = replays[replayType];
|
executor = executors[replayType];
|
||||||
if (replay !== undefined) {
|
if (executor !== undefined) {
|
||||||
if (declutterReplays &&
|
if (declutterReplays &&
|
||||||
(replayType == ReplayType.IMAGE || replayType == ReplayType.TEXT)) {
|
(replayType == ReplayType.IMAGE || replayType == ReplayType.TEXT)) {
|
||||||
const declutter = declutterReplays[zIndexKey];
|
const declutter = declutterReplays[zIndexKey];
|
||||||
if (!declutter) {
|
if (!declutter) {
|
||||||
declutterReplays[zIndexKey] = [replay, transform.slice(0)];
|
declutterReplays[zIndexKey] = [executor, transform.slice(0)];
|
||||||
} else {
|
} else {
|
||||||
declutter.push(replay, transform.slice(0));
|
declutter.push(executor, transform.slice(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = replay.replayHitDetection(context, transform, rotation,
|
result = executor.executeHitDetection(context, transform, rotation,
|
||||||
skippedFeaturesHash, featureCallback, hitExtent);
|
skippedFeaturesHash, featureCallback, hitExtent);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
@@ -302,34 +302,34 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
getReplay(zIndex, replayType) {
|
getExecutor(zIndex, replayType) {
|
||||||
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
||||||
let replays = this.replaysByZIndex_[zIndexKey];
|
let executors = this.executorsByZIndex_[zIndexKey];
|
||||||
if (replays === undefined) {
|
if (executors === undefined) {
|
||||||
replays = {};
|
executors = {};
|
||||||
this.replaysByZIndex_[zIndexKey] = replays;
|
this.executorsByZIndex_[zIndexKey] = executors;
|
||||||
}
|
}
|
||||||
let replay = replays[replayType];
|
let executor = executors[replayType];
|
||||||
if (replay === undefined) {
|
if (executor === undefined) {
|
||||||
replay = new CanvasInstructionsExecutor(this.tolerance_, this.maxExtent_,
|
executor = new CanvasInstructionsExecutor(this.tolerance_, this.maxExtent_,
|
||||||
this.resolution_, this.pixelRatio_, this.overlaps_, this.declutterTree_);
|
this.resolution_, this.pixelRatio_, this.overlaps_, this.declutterTree_);
|
||||||
replays[replayType] = replay;
|
executors[replayType] = executor;
|
||||||
}
|
}
|
||||||
return replay;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Object<string, Object<ReplayType, CanvasReplay>>} Replays.
|
* @return {Object<string, Object<ReplayType, CanvasReplay>>} Replays.
|
||||||
*/
|
*/
|
||||||
getReplays() {
|
getExecutors() {
|
||||||
return this.replaysByZIndex_;
|
return this.executorsByZIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
isEmpty() {
|
isEmpty() {
|
||||||
return isEmpty(this.replaysByZIndex_);
|
return isEmpty(this.executorsByZIndex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -353,7 +353,7 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
/** @type {Array<number>} */
|
/** @type {Array<number>} */
|
||||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
const zs = Object.keys(this.executorsByZIndex_).map(Number);
|
||||||
zs.sort(numberSafeCompareFunction);
|
zs.sort(numberSafeCompareFunction);
|
||||||
|
|
||||||
// setup clipping so that the parts of over-simplified geometries are not
|
// setup clipping so that the parts of over-simplified geometries are not
|
||||||
@@ -365,7 +365,7 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
let i, ii, j, jj, replays, replay;
|
let i, ii, j, jj, replays, replay;
|
||||||
for (i = 0, ii = zs.length; i < ii; ++i) {
|
for (i = 0, ii = zs.length; i < ii; ++i) {
|
||||||
const zIndexKey = zs[i].toString();
|
const zIndexKey = zs[i].toString();
|
||||||
replays = this.replaysByZIndex_[zIndexKey];
|
replays = this.executorsByZIndex_[zIndexKey];
|
||||||
for (j = 0, jj = replayTypes.length; j < jj; ++j) {
|
for (j = 0, jj = replayTypes.length; j < jj; ++j) {
|
||||||
const replayType = replayTypes[j];
|
const replayType = replayTypes[j];
|
||||||
replay = replays[replayType];
|
replay = replays[replayType];
|
||||||
@@ -379,7 +379,7 @@ class InstructionsGroupExectuor extends ReplayGroup {
|
|||||||
declutter.push(replay, transform.slice(0));
|
declutter.push(replay, transform.slice(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
replay.replay(context, transform, viewRotation, skippedFeaturesHash, snapToPixel);
|
replay.execute(context, transform, viewRotation, skippedFeaturesHash, snapToPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,7 +482,7 @@ export function replayDeclutter(declutterReplays, context, rotation, snapToPixel
|
|||||||
for (let i = 0, ii = replayData.length; i < ii;) {
|
for (let i = 0, ii = replayData.length; i < ii;) {
|
||||||
const replay = replayData[i++];
|
const replay = replayData[i++];
|
||||||
const transform = replayData[i++];
|
const transform = replayData[i++];
|
||||||
replay.replay(context, transform, rotation, skippedFeatureUids, snapToPixel);
|
replay.execute(context, transform, rotation, skippedFeatureUids, snapToPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
drawText_(replayGroup, geometry) {
|
drawText_(replayGroup, geometry) {
|
||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replay = /** @type {import("./TextReplay.js").default} */ (
|
const replay = /** @type {import("./TextReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.TEXT));
|
replayGroup.getBuilder(0, ReplayType.TEXT));
|
||||||
replay.setTextStyle(this.textStyle_);
|
replay.setTextStyle(this.textStyle_);
|
||||||
replay.drawText(geometry, null);
|
replay.drawText(geometry, null);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -191,7 +191,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./ImageReplay.js").default} */ (
|
const replay = /** @type {import("./ImageReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.IMAGE));
|
replayGroup.getBuilder(0, ReplayType.IMAGE));
|
||||||
replay.setImageStyle(this.imageStyle_);
|
replay.setImageStyle(this.imageStyle_);
|
||||||
replay.drawPoint(geometry, data);
|
replay.drawPoint(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -218,7 +218,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./ImageReplay.js").default} */ (
|
const replay = /** @type {import("./ImageReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.IMAGE));
|
replayGroup.getBuilder(0, ReplayType.IMAGE));
|
||||||
replay.setImageStyle(this.imageStyle_);
|
replay.setImageStyle(this.imageStyle_);
|
||||||
replay.drawMultiPoint(geometry, data);
|
replay.drawMultiPoint(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -244,7 +244,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./LineStringReplay.js").default} */ (
|
const replay = /** @type {import("./LineStringReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.LINE_STRING));
|
replayGroup.getBuilder(0, ReplayType.LINE_STRING));
|
||||||
replay.setFillStrokeStyle(null, this.strokeStyle_);
|
replay.setFillStrokeStyle(null, this.strokeStyle_);
|
||||||
replay.drawLineString(geometry, data);
|
replay.drawLineString(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -270,7 +270,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./LineStringReplay.js").default} */ (
|
const replay = /** @type {import("./LineStringReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.LINE_STRING));
|
replayGroup.getBuilder(0, ReplayType.LINE_STRING));
|
||||||
replay.setFillStrokeStyle(null, this.strokeStyle_);
|
replay.setFillStrokeStyle(null, this.strokeStyle_);
|
||||||
replay.drawMultiLineString(geometry, data);
|
replay.drawMultiLineString(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -296,7 +296,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./PolygonReplay.js").default} */ (
|
const replay = /** @type {import("./PolygonReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.POLYGON));
|
replayGroup.getBuilder(0, ReplayType.POLYGON));
|
||||||
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
||||||
replay.drawPolygon(geometry, data);
|
replay.drawPolygon(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -322,7 +322,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./PolygonReplay.js").default} */ (
|
const replay = /** @type {import("./PolygonReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.POLYGON));
|
replayGroup.getBuilder(0, ReplayType.POLYGON));
|
||||||
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
||||||
replay.drawMultiPolygon(geometry, data);
|
replay.drawMultiPolygon(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
@@ -348,7 +348,7 @@ class WebGLImmediateRenderer extends VectorContext {
|
|||||||
const context = this.context_;
|
const context = this.context_;
|
||||||
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
const replayGroup = new WebGLReplayGroup(1, this.extent_);
|
||||||
const replay = /** @type {import("./CircleReplay.js").default} */ (
|
const replay = /** @type {import("./CircleReplay.js").default} */ (
|
||||||
replayGroup.getReplay(0, ReplayType.CIRCLE));
|
replayGroup.getBuilder(0, ReplayType.CIRCLE));
|
||||||
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
|
||||||
replay.drawCircle(geometry, data);
|
replay.drawCircle(geometry, data);
|
||||||
replay.finish(context);
|
replay.finish(context);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {numberSafeCompareFunction} from '../../array.js';
|
|||||||
import {buffer, createOrUpdateFromCoordinate} from '../../extent.js';
|
import {buffer, createOrUpdateFromCoordinate} from '../../extent.js';
|
||||||
import {isEmpty} from '../../obj.js';
|
import {isEmpty} from '../../obj.js';
|
||||||
import {ORDER} from '../replay.js';
|
import {ORDER} from '../replay.js';
|
||||||
import ReplayGroup from '../ReplayGroup.js';
|
import ReplayGroup from '../BuilderGroup.js';
|
||||||
import WebGLCircleReplay from './CircleReplay.js';
|
import WebGLCircleReplay from './CircleReplay.js';
|
||||||
import WebGLImageReplay from './ImageReplay.js';
|
import WebGLImageReplay from './ImageReplay.js';
|
||||||
import WebGLLineStringReplay from './LineStringReplay.js';
|
import WebGLLineStringReplay from './LineStringReplay.js';
|
||||||
@@ -113,7 +113,7 @@ class WebGLReplayGroup extends ReplayGroup {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
getReplay(zIndex, replayType) {
|
getBuilder(zIndex, replayType) {
|
||||||
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
|
||||||
let replays = this.replaysByZIndex_[zIndexKey];
|
let replays = this.replaysByZIndex_[zIndexKey];
|
||||||
if (replays === undefined) {
|
if (replays === undefined) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import rbush from 'rbush';
|
|||||||
import {buffer, createEmpty, containsExtent, getWidth} from '../../extent.js';
|
import {buffer, createEmpty, containsExtent, getWidth} from '../../extent.js';
|
||||||
import RenderEventType from '../../render/EventType.js';
|
import RenderEventType from '../../render/EventType.js';
|
||||||
import {labelCache, rotateAtOffset} from '../../render/canvas.js';
|
import {labelCache, rotateAtOffset} from '../../render/canvas.js';
|
||||||
import CanvasInstructionsGroupBuilder from '../../render/canvas/InstructionsGroupBuilder.js';
|
import CanvasBuilderGroup from '../../render/canvas/InstructionsGroupBuilder.js';
|
||||||
import InstructionsGroupExecutor from '../../render/canvas/InstructionsGroupExecutor.js';
|
import InstructionsGroupExecutor from '../../render/canvas/InstructionsGroupExecutor.js';
|
||||||
import CanvasLayerRenderer from './Layer.js';
|
import CanvasLayerRenderer from './Layer.js';
|
||||||
import {defaultOrder as defaultRenderOrder, getTolerance as getRenderTolerance, getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
import {defaultOrder as defaultRenderOrder, getTolerance as getRenderTolerance, getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||||
@@ -444,7 +444,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|||||||
|
|
||||||
this.dirty_ = false;
|
this.dirty_ = false;
|
||||||
|
|
||||||
const replayGroup = new CanvasInstructionsGroupBuilder(
|
const replayGroup = new CanvasBuilderGroup(
|
||||||
getRenderTolerance(resolution, pixelRatio), extent, resolution,
|
getRenderTolerance(resolution, pixelRatio), extent, resolution,
|
||||||
pixelRatio, vectorSource.getOverlaps(), this.declutterTree_, vectorLayer.getRenderBuffer());
|
pixelRatio, vectorSource.getOverlaps(), this.declutterTree_, vectorLayer.getRenderBuffer());
|
||||||
vectorSource.loadFeatures(extent, resolution, projection);
|
vectorSource.loadFeatures(extent, resolution, projection);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {equivalent as equivalentProjection} from '../../proj.js';
|
|||||||
import Units from '../../proj/Units.js';
|
import Units from '../../proj/Units.js';
|
||||||
import ReplayType from '../../render/ReplayType.js';
|
import ReplayType from '../../render/ReplayType.js';
|
||||||
import {labelCache, rotateAtOffset} from '../../render/canvas.js';
|
import {labelCache, rotateAtOffset} from '../../render/canvas.js';
|
||||||
import CanvasInstructionsGroupBuilder, {replayDeclutter} from '../../render/canvas/InstructionsGroupBuilder.js';
|
import CanvasBuilderGroup, {replayDeclutter} from '../../render/canvas/InstructionsGroupBuilder.js';
|
||||||
import {ORDER} from '../../render/replay.js';
|
import {ORDER} from '../../render/replay.js';
|
||||||
import CanvasTileLayerRenderer from './TileLayer.js';
|
import CanvasTileLayerRenderer from './TileLayer.js';
|
||||||
import {getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
import {getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
scale as scaleTransform,
|
scale as scaleTransform,
|
||||||
translate as translateTransform
|
translate as translateTransform
|
||||||
} from '../../transform.js';
|
} from '../../transform.js';
|
||||||
import InstructionsGroupExectuor from '../../render/canvas/InstructionsGroupExecutor.js';
|
import CanvasGroupExecutor from '../../render/canvas/InstructionsGroupExecutor.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,7 +187,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
sourceTile.setProjection(projection);
|
sourceTile.setProjection(projection);
|
||||||
}
|
}
|
||||||
replayState.dirty = false;
|
replayState.dirty = false;
|
||||||
const replayGroup = new CanvasInstructionsGroupBuilder(0, sharedExtent, resolution,
|
const replayGroup = new CanvasBuilderGroup(0, sharedExtent, resolution,
|
||||||
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
|
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
|
||||||
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
|
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const replayGroupInstructions = replayGroup.finish();
|
const replayGroupInstructions = replayGroup.finish();
|
||||||
const renderingReplayGroup = new InstructionsGroupExectuor(0, sharedExtent, resolution,
|
const renderingReplayGroup = new CanvasGroupExecutor(0, sharedExtent, resolution,
|
||||||
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
|
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
|
||||||
renderingReplayGroup.replaceInstructions(replayGroupInstructions);
|
renderingReplayGroup.replaceInstructions(replayGroupInstructions);
|
||||||
sourceTile.setReplayGroup(layer, tile.tileCoord.toString(), renderingReplayGroup);
|
sourceTile.setReplayGroup(layer, tile.tileCoord.toString(), renderingReplayGroup);
|
||||||
@@ -263,7 +263,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
if (sourceTile.getState() != TileState.LOADED) {
|
if (sourceTile.getState() != TileState.LOADED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const replayGroup = /** @type {CanvasInstructionsGroupBuilder} */ (sourceTile.getReplayGroup(layer,
|
const replayGroup = /** @type {CanvasBuilderGroup} */ (sourceTile.getReplayGroup(layer,
|
||||||
tile.tileCoord.toString()));
|
tile.tileCoord.toString()));
|
||||||
found = found || replayGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
|
found = found || replayGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
|
||||||
/**
|
/**
|
||||||
@@ -371,8 +371,8 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
if (sourceTile.getState() != TileState.LOADED) {
|
if (sourceTile.getState() != TileState.LOADED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const replayGroup = /** @type {CanvasInstructionsGroupBuilder} */ (sourceTile.getReplayGroup(layer, tileCoord.toString()));
|
const executorGroup = /** @type {CanvasGroupExecutor} */ (sourceTile.getReplayGroup(layer, tileCoord.toString()));
|
||||||
if (!replayGroup || !replayGroup.hasReplays(replayTypes)) {
|
if (!executorGroup || !executorGroup.hasExecutors(replayTypes)) {
|
||||||
// sourceTile was not yet loaded when this.createReplayGroup_() was
|
// sourceTile was not yet loaded when this.createReplayGroup_() was
|
||||||
// called, or it has no replays of the types we want to render
|
// called, or it has no replays of the types we want to render
|
||||||
continue;
|
continue;
|
||||||
@@ -381,7 +381,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
transform = this.getTransform(frameState, worldOffset);
|
transform = this.getTransform(frameState, worldOffset);
|
||||||
}
|
}
|
||||||
const currentZ = sourceTile.tileCoord[0];
|
const currentZ = sourceTile.tileCoord[0];
|
||||||
const currentClip = replayGroup.getClipCoords(transform);
|
const currentClip = executorGroup.getClipCoords(transform);
|
||||||
context.save();
|
context.save();
|
||||||
context.globalAlpha = layerState.opacity;
|
context.globalAlpha = layerState.opacity;
|
||||||
// Create a clip mask for regions in this low resolution tile that are
|
// Create a clip mask for regions in this low resolution tile that are
|
||||||
@@ -403,7 +403,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
context.clip();
|
context.clip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
replayGroup.replay(context, transform, rotation, {}, snapToPixel, replayTypes, declutterReplays);
|
executorGroup.replay(context, transform, rotation, {}, snapToPixel, replayTypes, declutterReplays);
|
||||||
context.restore();
|
context.restore();
|
||||||
clips.push(currentClip);
|
clips.push(currentClip);
|
||||||
zs.push(currentZ);
|
zs.push(currentZ);
|
||||||
@@ -478,7 +478,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
const transform = resetTransform(this.tmpTransform_);
|
const transform = resetTransform(this.tmpTransform_);
|
||||||
scaleTransform(transform, pixelScale, -pixelScale);
|
scaleTransform(transform, pixelScale, -pixelScale);
|
||||||
translateTransform(transform, -tileExtent[0], -tileExtent[3]);
|
translateTransform(transform, -tileExtent[0], -tileExtent[3]);
|
||||||
const replayGroup = /** @type {CanvasInstructionsGroupBuilder} */ (sourceTile.getReplayGroup(layer,
|
const replayGroup = /** @type {CanvasBuilderGroup} */ (sourceTile.getReplayGroup(layer,
|
||||||
tile.tileCoord.toString()));
|
tile.tileCoord.toString()));
|
||||||
replayGroup.replay(context, transform, 0, {}, true, replays);
|
replayGroup.replay(context, transform, 0, {}, true, replays);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {getUid} from '../util.js';
|
import {getUid} from '../util.js';
|
||||||
import ImageState from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import ReplayType from '../render/ReplayType.js';
|
import BuilderType from '../render/ReplayType.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +17,7 @@ const SIMPLIFY_TOLERANCE = 0.5;
|
|||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {Object<import("../geom/GeometryType.js").default,
|
* @type {Object<import("../geom/GeometryType.js").default,
|
||||||
* function(import("../render/ReplayGroup.js").default, import("../geom/Geometry.js").default,
|
* function(import("../render/BuilderGroup.js").default, import("../geom/Geometry.js").default,
|
||||||
* import("../style/Style.js").default, Object)>}
|
* import("../style/Style.js").default, Object)>}
|
||||||
*/
|
*/
|
||||||
const GEOMETRY_RENDERERS = {
|
const GEOMETRY_RENDERERS = {
|
||||||
@@ -64,30 +64,30 @@ export function getTolerance(resolution, pixelRatio) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Builder group.
|
||||||
* @param {import("../geom/Circle.js").default} geometry Geometry.
|
* @param {import("../geom/Circle.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").default} feature Feature.
|
* @param {import("../Feature.js").default} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderCircleGeometry(replayGroup, geometry, style, feature) {
|
function renderCircleGeometry(builderGroup, geometry, style, feature) {
|
||||||
const fillStyle = style.getFill();
|
const fillStyle = style.getFill();
|
||||||
const strokeStyle = style.getStroke();
|
const strokeStyle = style.getStroke();
|
||||||
if (fillStyle || strokeStyle) {
|
if (fillStyle || strokeStyle) {
|
||||||
const circleReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.CIRCLE);
|
const circleReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.CIRCLE);
|
||||||
circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||||
circleReplay.drawCircle(geometry, feature);
|
circleReplay.drawCircle(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} replayGroup Replay group.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {number} squaredTolerance Squared tolerance.
|
* @param {number} squaredTolerance Squared tolerance.
|
||||||
@@ -119,7 +119,7 @@ export function renderFeature(replayGroup, feature, style, squaredTolerance, lis
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} replayGroup Replay group.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {number} squaredTolerance Squared tolerance.
|
* @param {number} squaredTolerance Squared tolerance.
|
||||||
@@ -141,7 +141,7 @@ function renderFeatureInternal(replayGroup, feature, style, squaredTolerance) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} replayGroup Replay group.
|
||||||
* @param {import("../geom/Geometry.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/Geometry.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
@@ -154,13 +154,13 @@ function renderGeometry(replayGroup, geometry, style, feature) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const replay = replayGroup.getReplay(style.getZIndex(), ReplayType.DEFAULT);
|
const replay = replayGroup.getBuilder(style.getZIndex(), BuilderType.DEFAULT);
|
||||||
replay.drawCustom(/** @type {import("../geom/SimpleGeometry.js").default} */ (geometry), feature, style.getRenderer());
|
replay.drawCustom(/** @type {import("../geom/SimpleGeometry.js").default} */ (geometry), feature, style.getRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} replayGroup Replay group.
|
||||||
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
|
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").default} feature Feature.
|
* @param {import("../Feature.js").default} feature Feature.
|
||||||
@@ -177,140 +177,140 @@ function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderLineStringGeometry(replayGroup, geometry, style, feature) {
|
function renderLineStringGeometry(builderGroup, geometry, style, feature) {
|
||||||
const strokeStyle = style.getStroke();
|
const strokeStyle = style.getStroke();
|
||||||
if (strokeStyle) {
|
if (strokeStyle) {
|
||||||
const lineStringReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.LINE_STRING);
|
const lineStringReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.LINE_STRING);
|
||||||
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
||||||
lineStringReplay.drawLineString(geometry, feature);
|
lineStringReplay.drawLineString(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderMultiLineStringGeometry(replayGroup, geometry, style, feature) {
|
function renderMultiLineStringGeometry(builderGroup, geometry, style, feature) {
|
||||||
const strokeStyle = style.getStroke();
|
const strokeStyle = style.getStroke();
|
||||||
if (strokeStyle) {
|
if (strokeStyle) {
|
||||||
const lineStringReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.LINE_STRING);
|
const lineStringReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.LINE_STRING);
|
||||||
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
||||||
lineStringReplay.drawMultiLineString(geometry, feature);
|
lineStringReplay.drawMultiLineString(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
|
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").default} feature Feature.
|
* @param {import("../Feature.js").default} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderMultiPolygonGeometry(replayGroup, geometry, style, feature) {
|
function renderMultiPolygonGeometry(builderGroup, geometry, style, feature) {
|
||||||
const fillStyle = style.getFill();
|
const fillStyle = style.getFill();
|
||||||
const strokeStyle = style.getStroke();
|
const strokeStyle = style.getStroke();
|
||||||
if (strokeStyle || fillStyle) {
|
if (strokeStyle || fillStyle) {
|
||||||
const polygonReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.POLYGON);
|
const polygonReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.POLYGON);
|
||||||
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||||
polygonReplay.drawMultiPolygon(geometry, feature);
|
polygonReplay.drawMultiPolygon(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderPointGeometry(replayGroup, geometry, style, feature) {
|
function renderPointGeometry(builderGroup, geometry, style, feature) {
|
||||||
const imageStyle = style.getImage();
|
const imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != ImageState.LOADED) {
|
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const imageReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.IMAGE);
|
const imageReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.IMAGE);
|
||||||
imageReplay.setImageStyle(imageStyle, replayGroup.addDeclutter(false));
|
imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));
|
||||||
imageReplay.drawPoint(geometry, feature);
|
imageReplay.drawPoint(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(!!imageStyle));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
|
function renderMultiPointGeometry(builderGroup, geometry, style, feature) {
|
||||||
const imageStyle = style.getImage();
|
const imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != ImageState.LOADED) {
|
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const imageReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.IMAGE);
|
const imageReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.IMAGE);
|
||||||
imageReplay.setImageStyle(imageStyle, replayGroup.addDeclutter(false));
|
imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));
|
||||||
imageReplay.drawMultiPoint(geometry, feature);
|
imageReplay.drawMultiPoint(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(!!imageStyle));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
* @param {import("../render/BuilderGroup.js").default} builderGroup Replay group.
|
||||||
* @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
|
* @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||||
* @param {import("../style/Style.js").default} style Style.
|
* @param {import("../style/Style.js").default} style Style.
|
||||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||||
*/
|
*/
|
||||||
function renderPolygonGeometry(replayGroup, geometry, style, feature) {
|
function renderPolygonGeometry(builderGroup, geometry, style, feature) {
|
||||||
const fillStyle = style.getFill();
|
const fillStyle = style.getFill();
|
||||||
const strokeStyle = style.getStroke();
|
const strokeStyle = style.getStroke();
|
||||||
if (fillStyle || strokeStyle) {
|
if (fillStyle || strokeStyle) {
|
||||||
const polygonReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.POLYGON);
|
const polygonReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.POLYGON);
|
||||||
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||||
polygonReplay.drawPolygon(geometry, feature);
|
polygonReplay.drawPolygon(geometry, feature);
|
||||||
}
|
}
|
||||||
const textStyle = style.getText();
|
const textStyle = style.getText();
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
const textReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.TEXT);
|
const textReplay = builderGroup.getBuilder(style.getZIndex(), BuilderType.TEXT);
|
||||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
|
||||||
textReplay.drawText(geometry, feature);
|
textReplay.drawText(geometry, feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js';
|
|||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import CanvasReplayGroup from '../../../../src/ol/render/canvas/InstructionsGroupBuilder.js';
|
import CanvasBuilderGroup from '../../../../src/ol/render/canvas/InstructionsGroupBuilder.js';
|
||||||
import {renderFeature} from '../../../../src/ol/renderer/vector.js';
|
import {renderFeature} from '../../../../src/ol/renderer/vector.js';
|
||||||
import Fill from '../../../../src/ol/style/Fill.js';
|
import Fill from '../../../../src/ol/style/Fill.js';
|
||||||
import Icon from '../../../../src/ol/style/Icon.js';
|
import Icon from '../../../../src/ol/style/Icon.js';
|
||||||
@@ -17,12 +17,12 @@ import Feature from '../../../../src/ol/Feature.js';
|
|||||||
|
|
||||||
describe('ol.renderer.vector', function() {
|
describe('ol.renderer.vector', function() {
|
||||||
describe('#renderFeature', function() {
|
describe('#renderFeature', function() {
|
||||||
let replayGroup;
|
let builderGroup;
|
||||||
let feature, iconStyle, style, squaredTolerance, listener, listenerThis;
|
let feature, iconStyle, style, squaredTolerance, listener, listenerThis;
|
||||||
let iconStyleLoadSpy;
|
let iconStyleLoadSpy;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
replayGroup = new CanvasReplayGroup(1);
|
builderGroup = new CanvasBuilderGroup(1);
|
||||||
feature = new Feature();
|
feature = new Feature();
|
||||||
iconStyle = new Icon({
|
iconStyle = new Icon({
|
||||||
src: 'http://example.com/icon.png'
|
src: 'http://example.com/icon.png'
|
||||||
@@ -50,7 +50,7 @@ describe('ol.renderer.vector', function() {
|
|||||||
let listeners;
|
let listeners;
|
||||||
|
|
||||||
// call #1
|
// call #1
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
|
|
||||||
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
||||||
@@ -59,7 +59,7 @@ describe('ol.renderer.vector', function() {
|
|||||||
expect(listeners.length).to.eql(1);
|
expect(listeners.length).to.eql(1);
|
||||||
|
|
||||||
// call #2
|
// call #2
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
|
|
||||||
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
||||||
@@ -74,11 +74,11 @@ describe('ol.renderer.vector', function() {
|
|||||||
|
|
||||||
it('does not render the point', function() {
|
it('does not render the point', function() {
|
||||||
feature.setGeometry(new Point([0, 0]));
|
feature.setGeometry(new Point([0, 0]));
|
||||||
const imageReplay = replayGroup.getReplay(
|
const imageReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'Image');
|
style.getZIndex(), 'Image');
|
||||||
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||||
const drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(VOID);
|
const drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setImageStyleSpy.called).to.be(false);
|
expect(setImageStyleSpy.called).to.be(false);
|
||||||
setImageStyleSpy.restore();
|
setImageStyleSpy.restore();
|
||||||
@@ -87,11 +87,11 @@ describe('ol.renderer.vector', function() {
|
|||||||
|
|
||||||
it('does not render the multipoint', function() {
|
it('does not render the multipoint', function() {
|
||||||
feature.setGeometry(new MultiPoint([[0, 0], [1, 1]]));
|
feature.setGeometry(new MultiPoint([[0, 0], [1, 1]]));
|
||||||
const imageReplay = replayGroup.getReplay(
|
const imageReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'Image');
|
style.getZIndex(), 'Image');
|
||||||
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||||
const drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(VOID);
|
const drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setImageStyleSpy.called).to.be(false);
|
expect(setImageStyleSpy.called).to.be(false);
|
||||||
setImageStyleSpy.restore();
|
setImageStyleSpy.restore();
|
||||||
@@ -100,12 +100,12 @@ describe('ol.renderer.vector', function() {
|
|||||||
|
|
||||||
it('does render the linestring', function() {
|
it('does render the linestring', function() {
|
||||||
feature.setGeometry(new LineString([[0, 0], [1, 1]]));
|
feature.setGeometry(new LineString([[0, 0], [1, 1]]));
|
||||||
const lineStringReplay = replayGroup.getReplay(
|
const lineStringReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'LineString');
|
style.getZIndex(), 'LineString');
|
||||||
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||||
'setFillStrokeStyle');
|
'setFillStrokeStyle');
|
||||||
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(VOID);
|
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||||
expect(drawLineStringSpy.called).to.be(true);
|
expect(drawLineStringSpy.called).to.be(true);
|
||||||
@@ -115,12 +115,12 @@ describe('ol.renderer.vector', function() {
|
|||||||
|
|
||||||
it('does render the multilinestring', function() {
|
it('does render the multilinestring', function() {
|
||||||
feature.setGeometry(new MultiLineString([[[0, 0], [1, 1]]]));
|
feature.setGeometry(new MultiLineString([[[0, 0], [1, 1]]]));
|
||||||
const lineStringReplay = replayGroup.getReplay(
|
const lineStringReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'LineString');
|
style.getZIndex(), 'LineString');
|
||||||
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||||
'setFillStrokeStyle');
|
'setFillStrokeStyle');
|
||||||
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(VOID);
|
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||||
expect(drawMultiLineStringSpy.called).to.be(true);
|
expect(drawMultiLineStringSpy.called).to.be(true);
|
||||||
@@ -131,12 +131,12 @@ describe('ol.renderer.vector', function() {
|
|||||||
it('does render the polygon', function() {
|
it('does render the polygon', function() {
|
||||||
feature.setGeometry(new Polygon(
|
feature.setGeometry(new Polygon(
|
||||||
[[[0, 0], [1, 1], [1, 0], [0, 0]]]));
|
[[[0, 0], [1, 1], [1, 0], [0, 0]]]));
|
||||||
const polygonReplay = replayGroup.getReplay(
|
const polygonReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'Polygon');
|
style.getZIndex(), 'Polygon');
|
||||||
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||||
'setFillStrokeStyle');
|
'setFillStrokeStyle');
|
||||||
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(VOID);
|
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||||
expect(drawPolygonSpy.called).to.be(true);
|
expect(drawPolygonSpy.called).to.be(true);
|
||||||
@@ -147,12 +147,12 @@ describe('ol.renderer.vector', function() {
|
|||||||
it('does render the multipolygon', function() {
|
it('does render the multipolygon', function() {
|
||||||
feature.setGeometry(new MultiPolygon(
|
feature.setGeometry(new MultiPolygon(
|
||||||
[[[[0, 0], [1, 1], [1, 0], [0, 0]]]]));
|
[[[[0, 0], [1, 1], [1, 0], [0, 0]]]]));
|
||||||
const polygonReplay = replayGroup.getReplay(
|
const polygonReplay = builderGroup.getBuilder(
|
||||||
style.getZIndex(), 'Polygon');
|
style.getZIndex(), 'Polygon');
|
||||||
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||||
'setFillStrokeStyle');
|
'setFillStrokeStyle');
|
||||||
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(VOID);
|
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(VOID);
|
||||||
renderFeature(replayGroup, feature,
|
renderFeature(builderGroup, feature,
|
||||||
style, squaredTolerance, listener, listenerThis);
|
style, squaredTolerance, listener, listenerThis);
|
||||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||||
expect(drawMultiPolygonSpy.called).to.be(true);
|
expect(drawMultiPolygonSpy.called).to.be(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user