remove skipFeature logic
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
/**
|
||||
* @module ol/render/canvas/Executor
|
||||
*/
|
||||
import {getUid} from '../../util.js';
|
||||
import {equals} from '../../array.js';
|
||||
import {createEmpty, createOrUpdate,
|
||||
createOrUpdateEmpty, extend, intersects} from '../../extent.js';
|
||||
import {lineStringLength} from '../../geom/flat/length.js';
|
||||
import {drawTextOnPath} from '../../geom/flat/textpath.js';
|
||||
import {transform2D} from '../../geom/flat/transform.js';
|
||||
import {isEmpty} from '../../obj.js';
|
||||
import {drawImage, defaultPadding, defaultTextBaseline} from '../canvas.js';
|
||||
import CanvasInstruction from './Instruction.js';
|
||||
import {TEXT_ALIGN} from './TextBuilder.js';
|
||||
@@ -497,8 +495,6 @@ class Executor extends Disposable {
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
* @param {Array<*>} instructions Instructions array.
|
||||
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
|
||||
* @param {function(import("../../Feature.js").FeatureLike): T|undefined} featureCallback Feature callback.
|
||||
@@ -510,7 +506,6 @@ class Executor extends Disposable {
|
||||
execute_(
|
||||
context,
|
||||
transform,
|
||||
skippedFeaturesHash,
|
||||
instructions,
|
||||
snapToPixel,
|
||||
featureCallback,
|
||||
@@ -530,7 +525,6 @@ class Executor extends Disposable {
|
||||
transform, this.pixelCoordinates_);
|
||||
transformSetFromArray(this.renderedTransform_, transform);
|
||||
}
|
||||
const skipFeatures = !isEmpty(skippedFeaturesHash);
|
||||
let i = 0; // instruction index
|
||||
const ii = instructions.length; // end of instructions
|
||||
let d = 0; // data index
|
||||
@@ -562,9 +556,7 @@ class Executor extends Disposable {
|
||||
switch (type) {
|
||||
case CanvasInstruction.BEGIN_GEOMETRY:
|
||||
feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
|
||||
if ((skipFeatures && skippedFeaturesHash[getUid(feature)]) || !feature.getGeometry()) {
|
||||
i = /** @type {number} */ (instruction[2]);
|
||||
} else if (opt_hitExtent !== undefined && !intersects(
|
||||
if (opt_hitExtent !== undefined && !intersects(
|
||||
opt_hitExtent, feature.getGeometry().getExtent())) {
|
||||
i = /** @type {number} */ (instruction[2]) + 1;
|
||||
} else {
|
||||
@@ -871,22 +863,17 @@ class Executor extends Disposable {
|
||||
* @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 text to integer pixels.
|
||||
*/
|
||||
execute(context, transform, viewRotation, skippedFeaturesHash, snapToPixel) {
|
||||
execute(context, transform, viewRotation, snapToPixel) {
|
||||
this.viewRotation_ = viewRotation;
|
||||
this.execute_(context, transform,
|
||||
skippedFeaturesHash, this.instructions, snapToPixel, undefined, undefined);
|
||||
this.execute_(context, transform, this.instructions, snapToPixel, undefined, undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 {function(import("../../Feature.js").FeatureLike): T=} opt_featureCallback
|
||||
* Feature callback.
|
||||
* @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this
|
||||
@@ -898,12 +885,11 @@ class Executor extends Disposable {
|
||||
context,
|
||||
transform,
|
||||
viewRotation,
|
||||
skippedFeaturesHash,
|
||||
opt_featureCallback,
|
||||
opt_hitExtent
|
||||
) {
|
||||
this.viewRotation_ = viewRotation;
|
||||
return this.execute_(context, transform, skippedFeaturesHash,
|
||||
return this.execute_(context, transform,
|
||||
this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ class ExecutorGroup extends Disposable {
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} rotation Rotation.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
|
||||
* @param {function(import("../../Feature.js").FeatureLike): T} callback Feature callback.
|
||||
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
|
||||
* @return {T|undefined} Callback result.
|
||||
@@ -178,7 +177,6 @@ class ExecutorGroup extends Disposable {
|
||||
resolution,
|
||||
rotation,
|
||||
hitTolerance,
|
||||
skippedFeaturesHash,
|
||||
callback,
|
||||
declutteredFeatures
|
||||
) {
|
||||
@@ -256,8 +254,7 @@ class ExecutorGroup extends Disposable {
|
||||
builderType = ORDER[j];
|
||||
executor = executors[builderType];
|
||||
if (executor !== undefined) {
|
||||
result = executor.executeHitDetection(context, transform, rotation,
|
||||
skippedFeaturesHash, featureCallback, hitExtent);
|
||||
result = executor.executeHitDetection(context, transform, rotation, featureCallback, hitExtent);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -297,14 +294,12 @@ class ExecutorGroup extends Disposable {
|
||||
* @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<BuilderType>=} opt_builderTypes Ordered replay types to replay.
|
||||
* Default is {@link module:ol/render/replay~ORDER}
|
||||
* @param {Object<string, import("../canvas.js").DeclutterGroup>=} opt_declutterReplays Declutter replays.
|
||||
*/
|
||||
execute(context, transform, viewRotation, skippedFeaturesHash, snapToPixel, opt_builderTypes,
|
||||
opt_declutterReplays) {
|
||||
execute(context, transform, viewRotation, snapToPixel, opt_builderTypes, opt_declutterReplays) {
|
||||
|
||||
/** @type {Array<number>} */
|
||||
const zs = Object.keys(this.executorsByZIndex_).map(Number);
|
||||
@@ -335,7 +330,7 @@ class ExecutorGroup extends Disposable {
|
||||
declutter.push(replay, transform.slice(0));
|
||||
}
|
||||
} else {
|
||||
replay.execute(context, transform, viewRotation, skippedFeaturesHash, snapToPixel);
|
||||
replay.execute(context, transform, viewRotation, snapToPixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,7 +431,6 @@ export function getCircleArray(radius) {
|
||||
*/
|
||||
export function replayDeclutter(declutterReplays, context, rotation, opacity, snapToPixel, declutterItems) {
|
||||
const zs = Object.keys(declutterReplays).map(Number).sort(numberSafeCompareFunction);
|
||||
const skippedFeatureUids = {};
|
||||
for (let z = 0, zz = zs.length; z < zz; ++z) {
|
||||
const executorData = declutterReplays[zs[z].toString()];
|
||||
let currentExecutor;
|
||||
@@ -450,7 +444,7 @@ export function replayDeclutter(declutterReplays, context, rotation, opacity, sn
|
||||
});
|
||||
}
|
||||
const transform = executorData[i++];
|
||||
executor.execute(context, transform, rotation, skippedFeatureUids, snapToPixel);
|
||||
executor.execute(context, transform, rotation, snapToPixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user