From 300296301c2de99b53548eaf6048661fb5e4feba Mon Sep 17 00:00:00 2001 From: XiaofengZeng <798065964@qq.com> Date: Sun, 17 Nov 2024 11:49:46 +0800 Subject: [PATCH 1/5] feat(olcs): Support skipping vector synchronization through attribute configuration --- src/olcs/FeatureConverter.ts | 9 +++++++++ src/olcs/VectorSynchronizer.ts | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/olcs/FeatureConverter.ts b/src/olcs/FeatureConverter.ts index 0e8145ee4..226346a94 100644 --- a/src/olcs/FeatureConverter.ts +++ b/src/olcs/FeatureConverter.ts @@ -1165,6 +1165,10 @@ export default class FeatureConverter { if (!feature) { continue; } + const skip = feature.get('olcs_skip') + if (skip) { + continue; + } const layerStyle: StyleFunction | undefined = olLayer.getStyleFunction(); const styles = this.computePlainStyle(olLayer, feature, layerStyle, resolution); @@ -1203,6 +1207,11 @@ export default class FeatureConverter { * @api */ convert(layer: VectorLayer, view: View, feature: Feature, context: OlFeatureToCesiumContext): PrimitiveCollection { + const skip = feature.get('olcs_skip'); + if (skip) { + return null; + } + const proj = view.getProjection(); const resolution = view.getResolution(); diff --git a/src/olcs/VectorSynchronizer.ts b/src/olcs/VectorSynchronizer.ts index fceed607a..44dd16beb 100644 --- a/src/olcs/VectorSynchronizer.ts +++ b/src/olcs/VectorSynchronizer.ts @@ -96,6 +96,11 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { + const skip = feature.get('olcs_skip') + if (skip) { + return; + } const id = getUid(feature); const context: OlFeatureToCesiumContext = counterpart.context; const bbs = context.featureToCesiumMap[id]; @@ -151,7 +160,10 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { const feature = e.feature; - console.assert(feature); + const skip = feature.get('olcs_skip') + if (skip) { + return; + } onRemoveFeature(feature); onAddFeature(feature); })); From e5a6f3d8066f5171b680471c2659e56d5fc4b661 Mon Sep 17 00:00:00 2001 From: XiaofengZeng <798065964@qq.com> Date: Sun, 17 Nov 2024 12:08:51 +0800 Subject: [PATCH 2/5] style(olcs): Add missing semicolons to `feature. get ('olcs_skip')` --- src/olcs/FeatureConverter.ts | 2 +- src/olcs/VectorSynchronizer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/olcs/FeatureConverter.ts b/src/olcs/FeatureConverter.ts index 226346a94..0cd7260ae 100644 --- a/src/olcs/FeatureConverter.ts +++ b/src/olcs/FeatureConverter.ts @@ -1165,7 +1165,7 @@ export default class FeatureConverter { if (!feature) { continue; } - const skip = feature.get('olcs_skip') + const skip = feature.get('olcs_skip'); if (skip) { continue; } diff --git a/src/olcs/VectorSynchronizer.ts b/src/olcs/VectorSynchronizer.ts index 44dd16beb..889979f95 100644 --- a/src/olcs/VectorSynchronizer.ts +++ b/src/olcs/VectorSynchronizer.ts @@ -126,7 +126,7 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { - const skip = feature.get('olcs_skip') + const skip = feature.get('olcs_skip'); if (skip) { return; } @@ -160,7 +160,7 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { const feature = e.feature; - const skip = feature.get('olcs_skip') + const skip = feature.get('olcs_skip'); if (skip) { return; } From 3e49023fcd83dac1c79403a7141357e9cbad372f Mon Sep 17 00:00:00 2001 From: XiaofengZeng <798065964@qq.com> Date: Sun, 17 Nov 2024 12:13:02 +0800 Subject: [PATCH 3/5] fix(olcs): restore mistakenly deleted code. --- src/olcs/VectorSynchronizer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/olcs/VectorSynchronizer.ts b/src/olcs/VectorSynchronizer.ts index 889979f95..3844e939a 100644 --- a/src/olcs/VectorSynchronizer.ts +++ b/src/olcs/VectorSynchronizer.ts @@ -159,7 +159,8 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { - const feature = e.feature; + const feature = e.feature + console.assert(feature); const skip = feature.get('olcs_skip'); if (skip) { return; From d549b8301cd011d2feee73dc202dc3baf0212855 Mon Sep 17 00:00:00 2001 From: XiaofengZeng <798065964@qq.com> Date: Sun, 17 Nov 2024 12:14:19 +0800 Subject: [PATCH 4/5] style(olcs): Add missing semicolons. --- src/olcs/VectorSynchronizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/olcs/VectorSynchronizer.ts b/src/olcs/VectorSynchronizer.ts index 3844e939a..2a6310780 100644 --- a/src/olcs/VectorSynchronizer.ts +++ b/src/olcs/VectorSynchronizer.ts @@ -159,7 +159,7 @@ export default class VectorSynchronizer extends olcsAbstractSynchronizer { - const feature = e.feature + const feature = e.feature; console.assert(feature); const skip = feature.get('olcs_skip'); if (skip) { From cc76ec6c7c85253c8e99ac3e2667a7055c1fc625 Mon Sep 17 00:00:00 2001 From: XiaofengZeng <798065964@qq.com> Date: Sun, 17 Nov 2024 21:36:56 +0800 Subject: [PATCH 5/5] docs(contributing): update `check` to `checks`. --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 267e92eb1..77b1830d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,10 +23,10 @@ browse http://localhost:1234 The examples use a compiled version of OLCesium. If you want to use the source code directly you can define an alias. See https://en.parceljs.org/module_resolution.html#aliases -### The `check` target +### The `checks` target ```bash -npm run check +npm run checks ``` Run this before every commit. It will catch many problems quickly.