@octostar/map-component 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +898 -475
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +898 -475
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/layers-panel.d.ts +3 -1
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/components/timebar.d.ts +7 -1
- package/dist/types/components/timebar.d.ts.map +1 -1
- package/dist/types/lib/custom-layer-stack.d.ts +2 -1
- package/dist/types/lib/custom-layer-stack.d.ts.map +1 -1
- package/dist/types/lib/label-pinning.d.ts +4 -1
- package/dist/types/lib/label-pinning.d.ts.map +1 -1
- package/dist/types/lib/paint-feature.d.ts +9 -27
- package/dist/types/lib/paint-feature.d.ts.map +1 -1
- package/dist/types/lib/selection-diff.d.ts +0 -51
- package/dist/types/lib/selection-diff.d.ts.map +1 -1
- package/dist/types/lib/selection-overlay.d.ts +0 -8
- package/dist/types/lib/selection-overlay.d.ts.map +1 -1
- package/dist/types/lib/selection-paint.d.ts +9 -1
- package/dist/types/lib/selection-paint.d.ts.map +1 -1
- package/dist/types/lib/selection-state.d.ts +2 -2
- package/dist/types/lib/selection-state.d.ts.map +1 -1
- package/dist/types/lib/shard-locator.d.ts +2 -0
- package/dist/types/lib/shard-locator.d.ts.map +1 -1
- package/dist/types/lib/shard-pipeline.d.ts +4 -5
- package/dist/types/lib/shard-pipeline.d.ts.map +1 -1
- package/dist/types/lib/shard-registry.d.ts +0 -28
- package/dist/types/lib/shard-registry.d.ts.map +1 -1
- package/dist/types/lib/timeline-index.d.ts +56 -0
- package/dist/types/lib/timeline-index.d.ts.map +1 -0
- package/dist/types/lib/timeline-state.d.ts +64 -0
- package/dist/types/lib/timeline-state.d.ts.map +1 -0
- package/dist/types/lib/timeline-window.d.ts +19 -0
- package/dist/types/lib/timeline-window.d.ts.map +1 -0
- package/dist/types/lib/trace-group-suggestion.d.ts +17 -0
- package/dist/types/lib/trace-group-suggestion.d.ts.map +1 -0
- package/dist/types/lib/trace-groups.d.ts +6 -5
- package/dist/types/lib/trace-groups.d.ts.map +1 -1
- package/dist/types/lib/trace-timeline.d.ts +56 -49
- package/dist/types/lib/trace-timeline.d.ts.map +1 -1
- package/dist/types/lib/visible-feature-count.d.ts +18 -4
- package/dist/types/lib/visible-feature-count.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/lib/timeline-diff.d.ts +0 -43
- package/dist/types/lib/timeline-diff.d.ts.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The timeline window as numbers, and the one visibility predicate the map
|
|
3
|
+
* paints with. It reproduces `isFeatureInRange` (timeline-store.ts) exactly,
|
|
4
|
+
* on epoch milliseconds instead of `Date`s: untimed features are always
|
|
5
|
+
* visible, a one-sided interval is a point, and the overlap is inclusive at
|
|
6
|
+
* both ends — so a zero-width window `[from, from]` shows what is dated at
|
|
7
|
+
* `from`.
|
|
8
|
+
*/
|
|
9
|
+
/** Inclusive bounds in epoch ms. */
|
|
10
|
+
export interface TimelineWindow {
|
|
11
|
+
readonly t0: number;
|
|
12
|
+
readonly t1: number;
|
|
13
|
+
}
|
|
14
|
+
/** null while the timeline filters nothing: closed, no temporal data, or either bound unset or invalid. */
|
|
15
|
+
export declare function windowFromRange(start: Date | null, end: Date | null): TimelineWindow | null;
|
|
16
|
+
export declare function sameWindow(a: TimelineWindow | null, b: TimelineWindow | null): boolean;
|
|
17
|
+
/** `s` / `e` are NaN for "no date". */
|
|
18
|
+
export declare function isIntervalVisible(s: number, e: number, w: TimelineWindow | null): boolean;
|
|
19
|
+
//# sourceMappingURL=timeline-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-window.d.ts","sourceRoot":"","sources":["../../../client/src/lib/timeline-window.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,2GAA2G;AAC3G,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,cAAc,GAAG,IAAI,CAM3F;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI,EAAE,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAGtF;AAED,uCAAuC;AACvC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAMzF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The field a trace layer groups by when the user first turns trace lines on.
|
|
3
|
+
*
|
|
4
|
+
* Connecting every point of a layer into one line is rarely what a dated
|
|
5
|
+
* point layer means: it usually holds several people, devices or vehicles
|
|
6
|
+
* over time. So the first switch-on picks a field that names who each point
|
|
7
|
+
* belongs to, and "Connect all points" stays one click away.
|
|
8
|
+
*
|
|
9
|
+
* Only a field whose name says it is an identity is picked, and only when it
|
|
10
|
+
* actually splits the points into tracks: present on nearly every trace
|
|
11
|
+
* point, more than one value, and at least two points per value on average (a
|
|
12
|
+
* per-point id fails that). A field picked by its value counts alone could be
|
|
13
|
+
* a category or a status, which would connect unrelated events; with no
|
|
14
|
+
* identity-like field the layer keeps connecting all points.
|
|
15
|
+
*/
|
|
16
|
+
export declare function suggestTraceGroupField(features: readonly (GeoJSON.Feature | undefined)[], fields: readonly string[]): string | null;
|
|
17
|
+
//# sourceMappingURL=trace-group-suggestion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-group-suggestion.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-group-suggestion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqCH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,EAClD,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,GAAG,IAAI,CA+Bf"}
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* between maps beyond the object itself.
|
|
29
29
|
*
|
|
30
30
|
* The timeline filter is applied by the consumers AFTER the sort (filtering
|
|
31
|
-
* preserves order),
|
|
31
|
+
* preserves order), through each point's position in the array's interval
|
|
32
|
+
* index (timeline-index.ts), so the grouping is filter-independent: group membership,
|
|
32
33
|
* group order and therefore group colours no longer shift while the timebar
|
|
33
34
|
* scrubs, and the timeline fast path can keep trace layers on the O(delta)
|
|
34
35
|
* route (trace-timeline.ts).
|
|
@@ -53,6 +54,8 @@ export interface TraceGroup {
|
|
|
53
54
|
ids: string[];
|
|
54
55
|
/** `startDate` parsed once per point, parallel to `points` (NaN when unparsable). */
|
|
55
56
|
times: number[];
|
|
57
|
+
/** Each point's position in the feature array the group was built from, parallel to `points`. */
|
|
58
|
+
positions: number[];
|
|
56
59
|
color: string;
|
|
57
60
|
/** Painted on the group's last visible point; null when the group is the ungrouped remainder. */
|
|
58
61
|
label: string | null;
|
|
@@ -66,10 +69,8 @@ export interface TraceGroup {
|
|
|
66
69
|
export declare function getTraceGroups(features: readonly GeoJSON.Feature[], groupByField: string | null | undefined): readonly TraceGroup[];
|
|
67
70
|
/** Evenly spaced hues by group position (the ungrouped remainder counts as a position but keeps the default blue). */
|
|
68
71
|
export declare function traceGroupColor(key: string, index: number, count: number): string;
|
|
69
|
-
/**
|
|
70
|
-
export declare function visibleTraceIndices(group: TraceGroup, isVisible: (
|
|
71
|
-
/** Visibility predicate for a timeline visible set (null = no filter). */
|
|
72
|
-
export declare function timelineVisibility(visibleSet: ReadonlySet<string> | null): (id: string) => boolean;
|
|
72
|
+
/** Indices (ascending) of the group's points the predicate keeps; it is called with each point's array position. */
|
|
73
|
+
export declare function visibleTraceIndices(group: TraceGroup, isVisible: (position: number) => boolean): number[];
|
|
73
74
|
export declare function traceSegmentStats(group: TraceGroup, fromIndex: number, toIndex: number): TraceSegmentStats;
|
|
74
75
|
/**
|
|
75
76
|
* Segment ids are positional — `${painted group}:${from}:${to}` — so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-groups.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-groups.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"trace-groups.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-groups.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,qFAAqF;IACrF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iGAAiG;IACjG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC3C;AAUD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,EACpC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACtC,SAAS,UAAU,EAAE,CAcvB;AAgDD,sHAAsH;AACtH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjF;AAED,oHAAoH;AACpH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAMzG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAmB1G;AAWD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7F;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAkBjB"}
|
|
@@ -1,72 +1,79 @@
|
|
|
1
|
-
import type { GeoJSONSourceDiff } from 'maplibre-gl';
|
|
2
|
-
import type {
|
|
1
|
+
import type { GeoJSONSourceDiff, SymbolLayerSpecification } from 'maplibre-gl';
|
|
2
|
+
import type { FeatureStateHost } from './selection-state';
|
|
3
|
+
import { type TimelineIndex } from './timeline-index';
|
|
4
|
+
import type { TimelineWindow } from './timeline-window';
|
|
3
5
|
import { type TraceGroup } from './trace-groups';
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
7
|
+
* The timeline on trace layers.
|
|
6
8
|
*
|
|
7
|
-
* With the trace
|
|
8
|
-
* changes exactly two things about a visible trace layer: which point of
|
|
9
|
+
* With the trace grouping filter-independent (trace-groups.ts), a timeline
|
|
10
|
+
* tick changes exactly two things about a visible trace layer: which point of
|
|
9
11
|
* each group is its ENDPOINT — the last visible one, painted larger and, when
|
|
10
|
-
* grouped,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* opacity flip (timeline-diff.ts) reveals it correctly.
|
|
12
|
+
* grouped, labelled with the group — and which consecutive visible pairs the
|
|
13
|
+
* segment source connects. Everything else about a trace point is painted the
|
|
14
|
+
* same whether the timeline hides it or not, so its timeline feature state
|
|
15
|
+
* (timeline-state.ts) reveals it correctly.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* Neither change touches the base source's payload. The endpoint radius is
|
|
18
|
+
* feature state (`traceEndpoint`) over a radius the styler bakes on every
|
|
19
|
+
* trace point (`_endpointRadius`); the segments and the endpoint labels are
|
|
20
|
+
* features of the small `trace-features` source, which a tick diffs through
|
|
21
|
+
* `updateData`. A group whose points are all instants (the usual GPS track)
|
|
22
|
+
* finds its visible run by binary search and diffs its segments by range
|
|
23
|
+
* arithmetic, O(log k + changed) per group.
|
|
23
24
|
*
|
|
24
|
-
* maplibre reports an unusable diff ASYNCHRONOUSLY (an ErrorEvent,
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* point updates only name ids the full sync painted.
|
|
25
|
+
* maplibre reports an unusable diff ASYNCHRONOUSLY (an ErrorEvent), so
|
|
26
|
+
* correctness rests on construction, not on the catch: every segment and
|
|
27
|
+
* label carries a positional id unique across groups.
|
|
28
28
|
*/
|
|
29
|
-
export declare const TRACE_ENDPOINT_LABEL_PRIORITY = 5;
|
|
30
29
|
export declare const TRACE_POINT_RADIUS = 2;
|
|
31
30
|
export declare const TRACE_ENDPOINT_MIN_RADIUS = 8;
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
name: string;
|
|
35
|
-
/** Radius it paints as the endpoint: `max(size-config radius, TRACE_ENDPOINT_MIN_RADIUS)`. */
|
|
36
|
-
endpointRadius: number;
|
|
37
|
-
/** Label priority it paints when it is not a labelled endpoint (the full sync's non-trace ranking). */
|
|
38
|
-
basePriority: number;
|
|
39
|
-
}
|
|
31
|
+
export declare const TRACE_SOURCE_ID = "trace-features";
|
|
32
|
+
export declare const TRACE_ENDPOINT_LABEL_LAYER_ID = "trace-endpoint-labels";
|
|
40
33
|
export interface TracePaintCache {
|
|
41
34
|
/** Every group of every visible trace layer, in paint order (= the segment ids' group index). */
|
|
42
35
|
groups: readonly TraceGroup[];
|
|
43
|
-
|
|
36
|
+
/** The interval index of the array each group was built from, parallel to `groups`. */
|
|
37
|
+
indexes: readonly TimelineIndex[];
|
|
38
|
+
/** The window the endpoints, segments and labels are painted at. */
|
|
39
|
+
window: TimelineWindow | null;
|
|
40
|
+
}
|
|
41
|
+
/** Minimal surface of maplibre's GeoJSONSource the diff needs. */
|
|
42
|
+
export interface UpdatableGeoJSONSource {
|
|
43
|
+
updateData(diff: GeoJSONSourceDiff): unknown;
|
|
44
44
|
}
|
|
45
|
+
/** The endpoint labels, one per labelled group, drawn above every base label and below the selection overlay's. */
|
|
46
|
+
export declare function buildTraceEndpointLabelLayer(): SymbolLayerSpecification;
|
|
47
|
+
/** Indices of the group's points visible under `w`, ascending. */
|
|
48
|
+
export declare function visibleGroupIndices(group: TraceGroup, index: TimelineIndex, w: TimelineWindow | null): number[];
|
|
49
|
+
export declare function traceEndpointLabelId(groupIndex: number): string;
|
|
45
50
|
export interface TraceTimelineDiff {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
/** Ids whose `traceEndpoint` state goes off, then on, on the shared source. */
|
|
52
|
+
endpointOff: string[];
|
|
53
|
+
endpointOn: string[];
|
|
54
|
+
/** `trace-features`: segments and endpoint labels added (a moved label is re-added under its id) and removed. */
|
|
55
|
+
add: GeoJSON.Feature[];
|
|
56
|
+
remove: string[];
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
/** Pure diff from the painted window (`trace.window`) to `nextWindow`. */
|
|
59
|
+
export declare function buildTraceTimelineDiff(trace: TracePaintCache, nextWindow: TimelineWindow | null): TraceTimelineDiff;
|
|
60
|
+
/** What the full sync paints at `w`: every group's endpoint, and the trace source's segments and labels. */
|
|
61
|
+
export declare function paintTraceAt(groups: readonly TraceGroup[], indexes: readonly TimelineIndex[], w: TimelineWindow | null): {
|
|
62
|
+
endpoints: string[];
|
|
63
|
+
features: GeoJSON.Feature[];
|
|
64
|
+
};
|
|
65
|
+
/** Moves the `traceEndpoint` state on the shared source; `applied` is the set it is on. */
|
|
66
|
+
export declare function setTraceEndpoints(host: FeatureStateHost, applied: Set<string>, off: readonly string[], on: readonly string[]): void;
|
|
57
67
|
/**
|
|
58
68
|
* Consecutive pairs of two ascending index lists, merged in (from, to)
|
|
59
69
|
* order: a pair only in `prev` is removed, one only in `next` is added.
|
|
60
70
|
*/
|
|
61
71
|
export declare function diffConsecutivePairs(prev: readonly number[], next: readonly number[], onRemove: (from: number, to: number) => void, onAdd: (from: number, to: number) => void): void;
|
|
62
72
|
/**
|
|
63
|
-
* Apply a built diff:
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* full sync, which repaints everything, cache included; the diff itself is
|
|
68
|
-
* cheap to lose.
|
|
73
|
+
* Apply a built diff: one `updateData` on the trace source, then the endpoint
|
|
74
|
+
* state. A synchronous throw (a source gone between the diff being built and
|
|
75
|
+
* applied, or a diff maplibre rejects up front) is logged and reported as
|
|
76
|
+
* false, before any state moved, so the caller falls back to the full sync.
|
|
69
77
|
*/
|
|
70
|
-
export declare function applyTraceTimelineDiff(diff: TraceTimelineDiff,
|
|
71
|
-
export {};
|
|
78
|
+
export declare function applyTraceTimelineDiff(diff: TraceTimelineDiff, traceSource: UpdatableGeoJSONSource, host: FeatureStateHost, appliedEndpoints: Set<string>): boolean;
|
|
72
79
|
//# sourceMappingURL=trace-timeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-timeline.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"trace-timeline.d.ts","sourceRoot":"","sources":["../../../client/src/lib/trace-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAI/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAA4D,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,6BAA6B,0BAA0B,CAAC;AAIrE,MAAM,WAAW,eAAe;IAC9B,iGAAiG;IACjG,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IAC9B,uFAAuF;IACvF,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,oEAAoE;IACpE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAED,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC;CAC9C;AAED,mHAAmH;AACnH,wBAAgB,4BAA4B,IAAI,wBAAwB,CAwBvE;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,EAAE,CAE/G;AA0DD,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAiBD,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iHAAiH;IACjH,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAiCD,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,GAAG,IAAI,GAAG,iBAAiB,CAMnH;AAED,4GAA4G;AAC5G,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,CAAC,EAAE,cAAc,GAAG,IAAI,GACvB;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;CAAE,CActD;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,EAAE,EAAE,SAAS,MAAM,EAAE,GACpB,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EAC5C,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,GACxC,IAAI,CAmBN;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,sBAAsB,EACnC,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC5B,OAAO,CAST"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GroupSpatialIndex } from './selection-spatial-index';
|
|
1
2
|
/**
|
|
2
3
|
* Cheap visible-feature counting for the auto-label threshold and the status
|
|
3
4
|
* text. Replaces whole-viewport `queryRenderedFeatures(undefined, ...)`
|
|
@@ -20,15 +21,28 @@ export interface CountOptions {
|
|
|
20
21
|
* this replaces already early-broke there.
|
|
21
22
|
*/
|
|
22
23
|
threshold: number;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
}
|
|
25
|
+
export interface CountGroup {
|
|
26
|
+
features: readonly GeoJSON.Feature[];
|
|
27
|
+
/** Timeline visibility by position; absent while the timeline filters nothing. */
|
|
28
|
+
isVisible?: (position: number) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A large array's spatial index and its timeline-visible total. A view that
|
|
31
|
+
* covers the array's bounds then takes the total as is, and any other view
|
|
32
|
+
* visits only the features whose bounds meet it.
|
|
33
|
+
*/
|
|
34
|
+
indexed?: {
|
|
35
|
+
spatial: GroupSpatialIndex;
|
|
36
|
+
visibleTotal: number;
|
|
37
|
+
};
|
|
25
38
|
}
|
|
26
39
|
/**
|
|
27
40
|
* Count features whose Point geometry falls inside `bounds`, stopping once
|
|
28
41
|
* the count exceeds `threshold`. Longitudes are tested at ±360° too, since
|
|
29
42
|
* maplibre bounds can extend past the antimeridian. Non-point geometries
|
|
30
|
-
* count unconditionally
|
|
43
|
+
* count unconditionally in a linear group, and when their bounds meet the
|
|
44
|
+
* view in an indexed one — they are few (hand-drawn shapes) and over-counting
|
|
31
45
|
* only keeps auto-labels off.
|
|
32
46
|
*/
|
|
33
|
-
export declare function countFeaturesInBounds(
|
|
47
|
+
export declare function countFeaturesInBounds(groups: readonly CountGroup[], bounds: ViewBounds, options: CountOptions): number;
|
|
34
48
|
//# sourceMappingURL=visible-feature-count.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visible-feature-count.d.ts","sourceRoot":"","sources":["../../../client/src/lib/visible-feature-count.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"visible-feature-count.d.ts","sourceRoot":"","sources":["../../../client/src/lib/visible-feature-count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE;;;;;;;GAOG;AAEH,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,kFAAkF;IAClF,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAChE;AAmED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,YAAY,GACpB,MAAM,CAUR"}
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { GeoJSONSourceDiff } from 'maplibre-gl';
|
|
2
|
-
import { type SelectionPaintCache, type UpdatableGeoJSONSource } from './selection-diff';
|
|
3
|
-
/**
|
|
4
|
-
* Minimal GeoJSON source diff for timeline-visibility changes.
|
|
5
|
-
*
|
|
6
|
-
* Timeline filtering never adds or removes features from the source — the
|
|
7
|
-
* full sync paints hidden features with `stroke-opacity: 0`,
|
|
8
|
-
* `fill-opacity: 0`, `isTimelineHidden: 1` (labels derive `text-opacity`
|
|
9
|
-
* from `stroke-opacity`, radius/stroke-width paint cases read
|
|
10
|
-
* `isTimelineHidden`). So a scrub/playback tick only needs to flip those
|
|
11
|
-
* three properties on the features whose hidden-state toggled, via
|
|
12
|
-
* `updateData`. The scan below is still O(present-features) per tick (a Set
|
|
13
|
-
* iteration + lookups); only the diff handed to the GPU is O(toggled) — the
|
|
14
|
-
* win over the full rebuild is skipping restyle + setData, not the scan. If
|
|
15
|
-
* the scan ever profiles hot, it can be driven from
|
|
16
|
-
* `hiddenIds ∪ appliedHiddenIds` (the caller already receives `hiddenIds`).
|
|
17
|
-
*/
|
|
18
|
-
export type TimelinePaintCache = Pick<SelectionPaintCache, 'presentIds' | 'appliedHiddenIds' | 'visibleStrokeOpacityById' | 'visibleFillOpacityById'>;
|
|
19
|
-
/**
|
|
20
|
-
* Diff between the painted hidden set and the next visible set (null means
|
|
21
|
-
* no filter — everything visible). Show entries restore the recorded
|
|
22
|
-
* as-if-visible opacities, so features hidden for other reasons (3D-only)
|
|
23
|
-
* round-trip back to 0. Returns the diff (null when nothing toggles) and
|
|
24
|
-
* the full next hidden set for the caller to store on success.
|
|
25
|
-
*/
|
|
26
|
-
export declare function buildTimelineVisibilityDiff(cache: TimelinePaintCache, nextVisibleSet: ReadonlySet<string> | null): {
|
|
27
|
-
diff: GeoJSONSourceDiff | null;
|
|
28
|
-
nextHiddenIds: Set<string>;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Apply a timeline-visibility change to the source as an updateData diff.
|
|
32
|
-
* Returns false when the caller must fall back to a full sync — no cache,
|
|
33
|
-
* non-updatable cache (duplicate painted ids), missing source, or a
|
|
34
|
-
* synchronous updateData throw (the cache is then left untouched; the full
|
|
35
|
-
* sync rebuilds it). Async updateData failures are pre-empted by the
|
|
36
|
-
* `updatable` gate, exactly like the selection fast path. On success the
|
|
37
|
-
* cache's applied hidden set is advanced to the painted state.
|
|
38
|
-
*/
|
|
39
|
-
export declare function applyTimelineFastPath(cache: SelectionPaintCache | null, nextVisibleSet: ReadonlySet<string> | null, source: UpdatableGeoJSONSource | null | undefined): {
|
|
40
|
-
applied: boolean;
|
|
41
|
-
toggled: number;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=timeline-diff.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-diff.d.ts","sourceRoot":"","sources":["../../../client/src/lib/timeline-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,mBAAmB,EACnB,YAAY,GAAG,kBAAkB,GAAG,0BAA0B,GAAG,wBAAwB,CAC1F,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,GACzC;IAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CA4BhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GAAG,IAAI,EACjC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,EAC1C,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAChD;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAYvC"}
|