cesium-multi-target-framework 0.1.0
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/README.md +474 -0
- package/dist/assets/renderWorker-118e8f3b.js +1 -0
- package/dist/cesium-multi-target-framework.js +4605 -0
- package/dist/cesium-multi-target-framework.umd.cjs +101 -0
- package/dist/cluster/QuadCluster.d.ts +66 -0
- package/dist/cluster/clusterClient.d.ts +44 -0
- package/dist/cluster/clusterWorker.d.ts +1 -0
- package/dist/config/types.d.ts +266 -0
- package/dist/core/EventEmitter.d.ts +9 -0
- package/dist/core/MultiTargetFramework.d.ts +184 -0
- package/dist/core/MultiTargetScene.d.ts +224 -0
- package/dist/data/types.d.ts +67 -0
- package/dist/events/bus.d.ts +336 -0
- package/dist/index.d.ts +22 -0
- package/dist/render/AirGroundReferenceRenderer.d.ts +20 -0
- package/dist/render/InstancedGltfBatch.d.ts +37 -0
- package/dist/render/InstancedSymbolRenderer.d.ts +65 -0
- package/dist/render/LowModelInstancedRenderer.d.ts +39 -0
- package/dist/render/ModelPoolRenderer.d.ts +43 -0
- package/dist/render/PointCloudRenderer.d.ts +135 -0
- package/dist/render/SelectionOverlayRenderer.d.ts +37 -0
- package/dist/render/targetVisualMetrics.d.ts +9 -0
- package/dist/site/SiteLayer.d.ts +43 -0
- package/dist/site/SiteLowModelRenderer.d.ts +12 -0
- package/dist/site/SiteSpatialIndex.d.ts +10 -0
- package/dist/site/types.d.ts +72 -0
- package/dist/track/TrackHoverPicker.d.ts +26 -0
- package/dist/track/TrackManager.d.ts +42 -0
- package/dist/track/TrackRenderer.d.ts +29 -0
- package/dist/track/types.d.ts +27 -0
- package/dist/worker/protocol.d.ts +182 -0
- package/dist/worker/renderWorker.d.ts +1 -0
- package/doc//345/244/232/347/233/256/346/240/207/344/274/230/345/214/226/344/270/216/351/242/204/346/265/213/346/270/262/346/237/223/350/257/264/346/230/216.md +186 -0
- package/doc//345/244/232/347/273/204/344/273/266/344/272/213/344/273/266/346/226/271/346/241/210.md +410 -0
- package/doc//345/257/271/345/244/226/346/216/245/345/217/243/350/257/264/346/230/216.md +519 -0
- package/doc//345/267/245/344/275/234/350/256/241/345/210/222.md +59 -0
- package/doc//346/270/262/346/237/223/344/270/232/345/212/241/351/200/273/350/276/221.md +202 -0
- package/doc//347/253/231/347/202/271/346/270/262/346/237/223/344/270/216/345/217/263/351/224/256/350/217/234/345/215/225/345/256/236/347/216/260/350/257/264/346/230/216.md +49 -0
- package/doc//350/247/206/345/217/243/351/251/261/345/212/250/346/225/260/346/215/256/346/265/201/347/250/213/344/277/256/346/224/271/350/256/241/345/210/222.md +69 -0
- package/doc//351/241/271/347/233/256/350/257/264/346/230/216/344/271/246.md +729 -0
- package/package.json +51 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Cartesian3, Scene } from 'cesium';
|
|
2
|
+
import { RenderPacket } from '../worker/protocol';
|
|
3
|
+
import { LabelConfig, LabelStyleConfig, NameplateContext } from '../config/types';
|
|
4
|
+
|
|
5
|
+
export interface PointCloudRenderTypeStyle {
|
|
6
|
+
type: string;
|
|
7
|
+
targetDomain?: "surface" | "air" | "underwater";
|
|
8
|
+
iconPath: string;
|
|
9
|
+
defaultColor: string;
|
|
10
|
+
pointHeadingOffset?: number;
|
|
11
|
+
lowModel?: PointCloudRenderModelStyle;
|
|
12
|
+
highModel?: PointCloudRenderModelStyle;
|
|
13
|
+
lowModelUrl?: string;
|
|
14
|
+
highModelUrl?: string;
|
|
15
|
+
scale?: number;
|
|
16
|
+
modelHeadingOffset?: number;
|
|
17
|
+
modelPitchOffset?: number;
|
|
18
|
+
modelRollOffset?: number;
|
|
19
|
+
predictMove?: boolean;
|
|
20
|
+
predictMinCameraHeight?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface PointCloudRenderModelStyle {
|
|
23
|
+
url: string;
|
|
24
|
+
scale?: number;
|
|
25
|
+
headingOffset?: number;
|
|
26
|
+
pitchOffset?: number;
|
|
27
|
+
rollOffset?: number;
|
|
28
|
+
runAnimations?: boolean;
|
|
29
|
+
animationLoop?: "none" | "repeat" | "mirroredRepeat";
|
|
30
|
+
animationMultiplier?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface PointCloudRendererOptions {
|
|
33
|
+
targetTypes?: PointCloudRenderTypeStyle[];
|
|
34
|
+
label?: LabelConfig;
|
|
35
|
+
labelTextResolver?: LabelTextResolver;
|
|
36
|
+
}
|
|
37
|
+
export type LabelResolveResult = string | string[] | {
|
|
38
|
+
text: string | string[];
|
|
39
|
+
style?: Partial<LabelStyleConfig>;
|
|
40
|
+
} | null | undefined;
|
|
41
|
+
export type LabelTextResolver = (ctx: NameplateContext) => LabelResolveResult;
|
|
42
|
+
/**
|
|
43
|
+
* 三角方向点对照版:使用 Cesium BillboardCollection 复用三角贴图。
|
|
44
|
+
* 相比 PointPrimitive,它可以通过 rotation 表示 heading。
|
|
45
|
+
*/
|
|
46
|
+
export declare class PointCloudRenderer {
|
|
47
|
+
private readonly scene;
|
|
48
|
+
private readonly glowCollection;
|
|
49
|
+
private readonly collection;
|
|
50
|
+
private readonly labelCollection;
|
|
51
|
+
private readonly pool;
|
|
52
|
+
private readonly glowPool;
|
|
53
|
+
private readonly labelPool;
|
|
54
|
+
private readonly typeStyles;
|
|
55
|
+
private labelConfig;
|
|
56
|
+
private labelTextResolver;
|
|
57
|
+
private readonly imageIds;
|
|
58
|
+
private readonly imageUrls;
|
|
59
|
+
private readonly processedImages;
|
|
60
|
+
private readonly glowImage;
|
|
61
|
+
private readonly labelImageCache;
|
|
62
|
+
private readonly glowSourceIndexes;
|
|
63
|
+
private readonly labelSourceIndexes;
|
|
64
|
+
private readonly labelIds;
|
|
65
|
+
private readonly labelSmoothStarts;
|
|
66
|
+
private readonly labelSmoothTargets;
|
|
67
|
+
private readonly labelSmoothElapsedSec;
|
|
68
|
+
private readonly labelSmoothDurationSec;
|
|
69
|
+
private readonly labelScales;
|
|
70
|
+
private readonly labelTargetScales;
|
|
71
|
+
private readonly labelPositionsById;
|
|
72
|
+
private readonly labelScalesById;
|
|
73
|
+
private readonly labelLastClearVisibleAt;
|
|
74
|
+
private labelVisibleIds;
|
|
75
|
+
private readonly poolCategories;
|
|
76
|
+
private readonly poolIds;
|
|
77
|
+
private readonly poolHeadings;
|
|
78
|
+
private readonly poolMerged;
|
|
79
|
+
private readonly colorCache;
|
|
80
|
+
private readonly glowColorCache;
|
|
81
|
+
private readonly smoothStarts;
|
|
82
|
+
private readonly smoothTargets;
|
|
83
|
+
private readonly smoothElapsedSec;
|
|
84
|
+
private readonly smoothDurationSec;
|
|
85
|
+
private readonly baseWidths;
|
|
86
|
+
private readonly baseHeights;
|
|
87
|
+
private readonly pointScales;
|
|
88
|
+
private modelTargetIds;
|
|
89
|
+
private modelHandoffEnabled;
|
|
90
|
+
private anchorPositionResolver;
|
|
91
|
+
private readonly anchorPositionScratch;
|
|
92
|
+
private directionalExternal;
|
|
93
|
+
private targetVisible;
|
|
94
|
+
private visibleCount;
|
|
95
|
+
private glowActiveCount;
|
|
96
|
+
private labelActiveCount;
|
|
97
|
+
private glowPhase;
|
|
98
|
+
private readonly labelRtcRef;
|
|
99
|
+
private readonly labelRtcScratch;
|
|
100
|
+
constructor(scene: Scene, _fadeMs: number, options?: PointCloudRendererOptions);
|
|
101
|
+
setPacket(packet: RenderPacket): void;
|
|
102
|
+
clear(): void;
|
|
103
|
+
getTargetFrame(id: string, result?: Cartesian3): {
|
|
104
|
+
position: Cartesian3;
|
|
105
|
+
heading: number;
|
|
106
|
+
} | undefined;
|
|
107
|
+
update(_dtSec: number): void;
|
|
108
|
+
setPointLayerVisible(visible: boolean): void;
|
|
109
|
+
/** 单目标有向图标是否交由外部(实例化符号层)渲染。开启后本渲染器对 count===1 的条目不显示 billboard,
|
|
110
|
+
* 仍保留 merged 簇 billboard、glow、姓名版。 */
|
|
111
|
+
setDirectionalHandledExternally(external: boolean): void;
|
|
112
|
+
private slotVisible;
|
|
113
|
+
setModelTargetIds(ids: readonly string[], handoffEnabled?: boolean): void;
|
|
114
|
+
setAnchorPositionResolver(resolver: ((id: string, result: Cartesian3) => Cartesian3 | undefined) | null): void;
|
|
115
|
+
private syncLabelRtcReference;
|
|
116
|
+
private updateLabelPosition;
|
|
117
|
+
setLabelOptions(label: LabelConfig, labelTextResolver?: LabelTextResolver): void;
|
|
118
|
+
get pointLayerVisible(): boolean;
|
|
119
|
+
get heatmapActive(): boolean;
|
|
120
|
+
destroy(): void;
|
|
121
|
+
private ensurePool;
|
|
122
|
+
private ensureGlowPool;
|
|
123
|
+
private ensureLabelPool;
|
|
124
|
+
private applyLabelStyle;
|
|
125
|
+
private setLabelPosition;
|
|
126
|
+
private updateLabelScale;
|
|
127
|
+
private trimInactiveLabels;
|
|
128
|
+
private selectLabelInfos;
|
|
129
|
+
private labelImageOf;
|
|
130
|
+
private isLabelWithinOcclusionGrace;
|
|
131
|
+
private hideUnused;
|
|
132
|
+
private hideUnusedGlows;
|
|
133
|
+
private hideUnusedLabels;
|
|
134
|
+
private preprocessImages;
|
|
135
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Cartesian3, Scene } from 'cesium';
|
|
2
|
+
import { ResolvedNodeTypeConfig } from '../config/types';
|
|
3
|
+
import { RenderPacket } from '../worker/protocol';
|
|
4
|
+
|
|
5
|
+
export interface SelectionTargetRef {
|
|
6
|
+
id: string;
|
|
7
|
+
position: Cartesian3;
|
|
8
|
+
size: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class SelectionOverlayRenderer {
|
|
11
|
+
private readonly scene;
|
|
12
|
+
private readonly renderTypes;
|
|
13
|
+
private readonly collection;
|
|
14
|
+
private readonly pool;
|
|
15
|
+
private readonly baseSizes;
|
|
16
|
+
private readonly selectedIds;
|
|
17
|
+
private readonly pulseElapsedById;
|
|
18
|
+
private hoveredId;
|
|
19
|
+
private lastPacket;
|
|
20
|
+
private activeCount;
|
|
21
|
+
private readonly selectionImage;
|
|
22
|
+
private readonly hoverImage;
|
|
23
|
+
private readonly hoverBillboard;
|
|
24
|
+
constructor(scene: Scene, renderTypes: readonly ResolvedNodeTypeConfig[]);
|
|
25
|
+
setSelectedIds(ids: readonly string[]): void;
|
|
26
|
+
setPacket(packet: RenderPacket): void;
|
|
27
|
+
setHoveredId(id: string | null): void;
|
|
28
|
+
update(dtSec: number): void;
|
|
29
|
+
getRenderedTarget(id: string): SelectionTargetRef | undefined;
|
|
30
|
+
clear(): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
private refresh;
|
|
33
|
+
private ensurePool;
|
|
34
|
+
private hideUnused;
|
|
35
|
+
private refreshHover;
|
|
36
|
+
private overlaySizeOf;
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TargetVisualDimensions {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
maxDimension: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const TARGET_OVERLAY_SIZE_MULTIPLIER = 1.75;
|
|
7
|
+
export declare const TARGET_OVERLAY_MIN_SIZE = 36;
|
|
8
|
+
export declare function targetVisualDimensionsOf(type: string, packetSize: number, merged?: boolean): TargetVisualDimensions;
|
|
9
|
+
export declare function targetOverlaySizeOf(type: string, packetSize: number, merged?: boolean): number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Cartesian2, Viewer } from 'cesium';
|
|
2
|
+
import { EventEmitter } from '../core/EventEmitter';
|
|
3
|
+
import { ResolvedSiteLayerOptions, SiteData, SiteLayerEvents, SiteLayerOptions, SiteRenderStats } from './types';
|
|
4
|
+
|
|
5
|
+
export declare class SiteLayer extends EventEmitter<SiteLayerEvents> {
|
|
6
|
+
private readonly viewer;
|
|
7
|
+
readonly options: ResolvedSiteLayerOptions;
|
|
8
|
+
readonly stats: SiteRenderStats;
|
|
9
|
+
private readonly iconRenderer;
|
|
10
|
+
private readonly lowModelRenderer;
|
|
11
|
+
private readonly spatialIndex;
|
|
12
|
+
private readonly typeIndex;
|
|
13
|
+
private readonly typeColor;
|
|
14
|
+
private visibleSites;
|
|
15
|
+
private sites;
|
|
16
|
+
private screenPickIndex;
|
|
17
|
+
private hoverPosition;
|
|
18
|
+
private hoverRafId;
|
|
19
|
+
private lastHoverSiteId;
|
|
20
|
+
private destroyed;
|
|
21
|
+
private lastUpdateAt;
|
|
22
|
+
private lastFrameAt;
|
|
23
|
+
private rafId;
|
|
24
|
+
private readonly removeCameraListener;
|
|
25
|
+
private readonly inputHandler;
|
|
26
|
+
private readonly eventBusBinding;
|
|
27
|
+
constructor(viewer: Viewer, options: SiteLayerOptions);
|
|
28
|
+
/** 屏幕坐标拾取最近站点(实例化符号/低模无法 drillPick,按位置最近命中)。 */
|
|
29
|
+
pickAt(position: Cartesian2, thresholdPx?: number): SiteData | null;
|
|
30
|
+
setData(sites: SiteData[]): void;
|
|
31
|
+
clear(): void;
|
|
32
|
+
destroy(): void;
|
|
33
|
+
private tick;
|
|
34
|
+
private scheduleRefresh;
|
|
35
|
+
private refresh;
|
|
36
|
+
private handleContextMenuAt;
|
|
37
|
+
private scheduleHoverAt;
|
|
38
|
+
private flushHover;
|
|
39
|
+
private repickHover;
|
|
40
|
+
private clearHover;
|
|
41
|
+
private buildScreenPickIndex;
|
|
42
|
+
private nearestSiteAtScreen;
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Scene } from 'cesium';
|
|
2
|
+
import { ResolvedSiteTypeConfig, SiteData } from './types';
|
|
3
|
+
|
|
4
|
+
export declare class SiteLowModelRenderer {
|
|
5
|
+
private readonly renderer;
|
|
6
|
+
private readonly typeByName;
|
|
7
|
+
constructor(scene: Scene, siteTypes: readonly ResolvedSiteTypeConfig[], fadeMs: number);
|
|
8
|
+
setSites(sites: readonly SiteData[]): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
update(dtSec: number): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SiteData, SiteViewBounds } from './types';
|
|
2
|
+
|
|
3
|
+
export declare class SiteSpatialIndex {
|
|
4
|
+
private readonly cellDeg;
|
|
5
|
+
private readonly buckets;
|
|
6
|
+
private sites;
|
|
7
|
+
constructor(cellDeg: number);
|
|
8
|
+
build(sites: readonly SiteData[]): void;
|
|
9
|
+
query(bounds: SiteViewBounds): number[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Viewer, Cartesian3 } from 'cesium';
|
|
2
|
+
import { ModelAssetConfig } from '../config/types';
|
|
3
|
+
|
|
4
|
+
export type SiteCategory = "optical" | "radar" | "ais";
|
|
5
|
+
export interface SiteTypeConfig {
|
|
6
|
+
type: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
category: SiteCategory;
|
|
9
|
+
iconPath: string;
|
|
10
|
+
defaultColor?: string;
|
|
11
|
+
pointPixelSize?: number;
|
|
12
|
+
lowModel?: ModelAssetConfig;
|
|
13
|
+
}
|
|
14
|
+
export interface SiteData {
|
|
15
|
+
id: string;
|
|
16
|
+
type: string;
|
|
17
|
+
lon: number;
|
|
18
|
+
lat: number;
|
|
19
|
+
height: number;
|
|
20
|
+
heading?: number;
|
|
21
|
+
extra?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface SiteLayerOptions {
|
|
24
|
+
siteTypes: SiteTypeConfig[];
|
|
25
|
+
modelSwitchHeight: number;
|
|
26
|
+
maxVisibleLowModels?: number;
|
|
27
|
+
updateThrottleMs?: number;
|
|
28
|
+
indexCellDeg?: number;
|
|
29
|
+
fadeMs?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolvedSiteTypeConfig extends SiteTypeConfig {
|
|
32
|
+
name: string;
|
|
33
|
+
defaultColor: string;
|
|
34
|
+
pointPixelSize: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ResolvedSiteLayerOptions {
|
|
37
|
+
siteTypes: ResolvedSiteTypeConfig[];
|
|
38
|
+
siteTypesByType: Map<string, ResolvedSiteTypeConfig>;
|
|
39
|
+
modelSwitchHeight: number;
|
|
40
|
+
maxVisibleLowModels: number;
|
|
41
|
+
updateThrottleMs: number;
|
|
42
|
+
indexCellDeg: number;
|
|
43
|
+
fadeMs: number;
|
|
44
|
+
}
|
|
45
|
+
export interface SiteViewBounds {
|
|
46
|
+
west: number;
|
|
47
|
+
east: number;
|
|
48
|
+
south: number;
|
|
49
|
+
north: number;
|
|
50
|
+
}
|
|
51
|
+
export interface SiteRenderStats {
|
|
52
|
+
total: number;
|
|
53
|
+
inView: number;
|
|
54
|
+
iconCount: number;
|
|
55
|
+
lowModelCount: number;
|
|
56
|
+
lowModelEligibleCount: number;
|
|
57
|
+
mode: "icon" | "low-model";
|
|
58
|
+
}
|
|
59
|
+
export interface SiteLayerContext {
|
|
60
|
+
viewer: Viewer;
|
|
61
|
+
}
|
|
62
|
+
export interface SiteContextMenuPayload {
|
|
63
|
+
site: SiteData;
|
|
64
|
+
screenX: number;
|
|
65
|
+
screenY: number;
|
|
66
|
+
cartesian?: Cartesian3;
|
|
67
|
+
}
|
|
68
|
+
export interface SiteLayerEvents {
|
|
69
|
+
contextmenu: SiteContextMenuPayload;
|
|
70
|
+
pick: SiteData | null;
|
|
71
|
+
hover: SiteData | null;
|
|
72
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Cartesian2, Cartesian3, Scene } from 'cesium';
|
|
2
|
+
import { TrackPoint } from '../data/types';
|
|
3
|
+
import { TrackHoverInfo } from './types';
|
|
4
|
+
|
|
5
|
+
interface HoverPointRef {
|
|
6
|
+
targetId: string;
|
|
7
|
+
pointIndex: number;
|
|
8
|
+
point: TrackPoint;
|
|
9
|
+
position: Cartesian3;
|
|
10
|
+
}
|
|
11
|
+
export declare class TrackHoverPicker {
|
|
12
|
+
private readonly scene;
|
|
13
|
+
private readonly pixelThreshold;
|
|
14
|
+
private points;
|
|
15
|
+
private index;
|
|
16
|
+
private builtCameraPosition;
|
|
17
|
+
private builtCameraDirection;
|
|
18
|
+
private lastBuiltAt;
|
|
19
|
+
constructor(scene: Scene, pixelThreshold: number);
|
|
20
|
+
setPoints(points: readonly HoverPointRef[]): void;
|
|
21
|
+
invalidate(): void;
|
|
22
|
+
rebuild(): void;
|
|
23
|
+
pick(position: Cartesian2): TrackHoverInfo | null;
|
|
24
|
+
private ensureIndex;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Viewer } from 'cesium';
|
|
2
|
+
import { RenderPacket } from '../worker/protocol';
|
|
3
|
+
import { EventEmitter } from '../core/EventEmitter';
|
|
4
|
+
import { TrackManagerApi, TrackManagerEvents, TrackRecord } from './types';
|
|
5
|
+
|
|
6
|
+
export declare class TrackManager extends EventEmitter<TrackManagerEvents> implements TrackManagerApi {
|
|
7
|
+
private readonly viewer;
|
|
8
|
+
private readonly records;
|
|
9
|
+
private readonly renderer;
|
|
10
|
+
private readonly hoverPicker;
|
|
11
|
+
private lastPacket;
|
|
12
|
+
private hoverPosition;
|
|
13
|
+
private lastPointerPosition;
|
|
14
|
+
private hoverRafId;
|
|
15
|
+
private rebuildHoverIndexTimer;
|
|
16
|
+
private currentHoverKey;
|
|
17
|
+
private readonly removeCameraListener;
|
|
18
|
+
private readonly onPointerMoveBound;
|
|
19
|
+
private readonly onPointerLeaveBound;
|
|
20
|
+
private readonly onPointerDownBound;
|
|
21
|
+
private readonly onWheelBound;
|
|
22
|
+
constructor(viewer: Viewer, pixelThreshold: number);
|
|
23
|
+
setTracks(tracks: readonly TrackRecord[]): void;
|
|
24
|
+
getTracks(targetIds?: readonly string[]): TrackRecord[];
|
|
25
|
+
showTracks(targetIds: readonly string[]): void;
|
|
26
|
+
hideTracks(targetIds: readonly string[]): void;
|
|
27
|
+
removeTracks(targetIds: readonly string[]): void;
|
|
28
|
+
clearTracks(): void;
|
|
29
|
+
setRenderPacket(packet: RenderPacket): void;
|
|
30
|
+
update(dtSec: number): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
private setVisible;
|
|
33
|
+
private refresh;
|
|
34
|
+
private getVisibleRecords;
|
|
35
|
+
private toRenderRecords;
|
|
36
|
+
private onPointerMove;
|
|
37
|
+
private flushHoverPick;
|
|
38
|
+
private clearHover;
|
|
39
|
+
private scheduleHoverPick;
|
|
40
|
+
private scheduleHoverPickFromLastPointer;
|
|
41
|
+
private scheduleHoverIndexRebuild;
|
|
42
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Cartesian3, Scene } from 'cesium';
|
|
2
|
+
import { TrackPoint } from '../data/types';
|
|
3
|
+
|
|
4
|
+
export interface TrackRenderRecord {
|
|
5
|
+
targetId: string;
|
|
6
|
+
points: TrackPoint[];
|
|
7
|
+
cartesianPoints: Cartesian3[];
|
|
8
|
+
currentPosition: Cartesian3 | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class TrackRenderer {
|
|
11
|
+
private readonly scene;
|
|
12
|
+
private readonly historyCollection;
|
|
13
|
+
private readonly connectorCollection;
|
|
14
|
+
private readonly pointCollection;
|
|
15
|
+
private readonly linePool;
|
|
16
|
+
private readonly pointPool;
|
|
17
|
+
private lineCount;
|
|
18
|
+
private readonly pointImage;
|
|
19
|
+
constructor(scene: Scene);
|
|
20
|
+
setTracks(records: readonly TrackRenderRecord[]): void;
|
|
21
|
+
updateConnectors(records: readonly TrackRenderRecord[]): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
private ensureLinePool;
|
|
25
|
+
private ensurePoint;
|
|
26
|
+
private createLineSlot;
|
|
27
|
+
private hideUnusedLines;
|
|
28
|
+
private hideUnusedPoints;
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TrackPoint } from '../data/types';
|
|
2
|
+
|
|
3
|
+
export interface TrackRecord {
|
|
4
|
+
targetId: string;
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
pointList?: TrackPoint[];
|
|
7
|
+
trackLine?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TrackHoverInfo {
|
|
10
|
+
targetId: string;
|
|
11
|
+
pointIndex: number;
|
|
12
|
+
point: TrackPoint;
|
|
13
|
+
screenX: number;
|
|
14
|
+
screenY: number;
|
|
15
|
+
}
|
|
16
|
+
export interface TrackManagerApi {
|
|
17
|
+
on<K extends keyof TrackManagerEvents>(event: K, handler: (payload: TrackManagerEvents[K]) => void): () => void;
|
|
18
|
+
setTracks(tracks: readonly TrackRecord[]): void;
|
|
19
|
+
getTracks(targetIds?: readonly string[]): TrackRecord[];
|
|
20
|
+
showTracks(targetIds: readonly string[]): void;
|
|
21
|
+
hideTracks(targetIds: readonly string[]): void;
|
|
22
|
+
removeTracks(targetIds: readonly string[]): void;
|
|
23
|
+
clearTracks(): void;
|
|
24
|
+
}
|
|
25
|
+
export interface TrackManagerEvents {
|
|
26
|
+
hover: TrackHoverInfo | null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { IncrementalPayload, PackedTargetData, TargetData } from '../data/types';
|
|
2
|
+
|
|
3
|
+
export interface ViewBounds {
|
|
4
|
+
west: number;
|
|
5
|
+
east: number;
|
|
6
|
+
south: number;
|
|
7
|
+
north: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkerConfigPacket {
|
|
10
|
+
maxVisible: number;
|
|
11
|
+
rootLimit: number;
|
|
12
|
+
maxLevels: number;
|
|
13
|
+
cameraMergeBaseHeight: number;
|
|
14
|
+
cameraMergeStepHeight: number;
|
|
15
|
+
cameraMergeStepRadius: number;
|
|
16
|
+
globalViewportHeight: number;
|
|
17
|
+
globalCacheIntervalMs: number;
|
|
18
|
+
innerRatio: number;
|
|
19
|
+
viewportBufferRatio: number;
|
|
20
|
+
viewportBufferMinMeters: number;
|
|
21
|
+
pointAbove: number;
|
|
22
|
+
animatedBelow: number;
|
|
23
|
+
predictSeconds: number;
|
|
24
|
+
predictFitSeconds: number;
|
|
25
|
+
targetTypes: WorkerTargetTypeConfig[];
|
|
26
|
+
}
|
|
27
|
+
export interface WorkerTargetTypeConfig {
|
|
28
|
+
type: string;
|
|
29
|
+
category: number;
|
|
30
|
+
targetDomain: "surface" | "air" | "underwater";
|
|
31
|
+
forceHighModelInLowLod: boolean;
|
|
32
|
+
iconPath: string;
|
|
33
|
+
defaultColor: number;
|
|
34
|
+
smoothMove: boolean;
|
|
35
|
+
smoothMoveMinCameraHeight: number;
|
|
36
|
+
smoothMoveDurationMs: number;
|
|
37
|
+
predictMove: boolean;
|
|
38
|
+
predictMinCameraHeight: number;
|
|
39
|
+
predictSeconds?: number;
|
|
40
|
+
predictFitSeconds?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface TargetStylePatch {
|
|
43
|
+
id: string;
|
|
44
|
+
styleKind?: "color" | "glow" | "hidden";
|
|
45
|
+
clearBefore?: boolean;
|
|
46
|
+
renderColor?: string;
|
|
47
|
+
openAnimate?: boolean;
|
|
48
|
+
animateType?: string;
|
|
49
|
+
animateColor?: string;
|
|
50
|
+
hidden?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface TargetSnapshot {
|
|
53
|
+
id: string;
|
|
54
|
+
type: string;
|
|
55
|
+
lon: number;
|
|
56
|
+
lat: number;
|
|
57
|
+
height: number;
|
|
58
|
+
heading: number;
|
|
59
|
+
speedH: number;
|
|
60
|
+
renderColor: string;
|
|
61
|
+
openAnimate: boolean;
|
|
62
|
+
animateColor: string;
|
|
63
|
+
hidden: boolean;
|
|
64
|
+
nationality?: string;
|
|
65
|
+
customInfo?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
export type SceneWorkerRequest = {
|
|
68
|
+
type: "init";
|
|
69
|
+
config: WorkerConfigPacket;
|
|
70
|
+
} | {
|
|
71
|
+
type: "stage-packed";
|
|
72
|
+
payload: PackedTargetData;
|
|
73
|
+
} | {
|
|
74
|
+
type: "set-data";
|
|
75
|
+
targets: TargetData[];
|
|
76
|
+
} | {
|
|
77
|
+
type: "incremental";
|
|
78
|
+
payload: IncrementalPayload;
|
|
79
|
+
} | {
|
|
80
|
+
type: "realtime-upsert";
|
|
81
|
+
targets: TargetData[];
|
|
82
|
+
} | {
|
|
83
|
+
type: "realtime-remove";
|
|
84
|
+
ids: string[];
|
|
85
|
+
} | {
|
|
86
|
+
type: "style-patch";
|
|
87
|
+
patches: TargetStylePatch[];
|
|
88
|
+
} | {
|
|
89
|
+
type: "target-query";
|
|
90
|
+
requestId: number;
|
|
91
|
+
id: string;
|
|
92
|
+
} | {
|
|
93
|
+
type: "commit";
|
|
94
|
+
requestId: number;
|
|
95
|
+
} | {
|
|
96
|
+
type: "viewport";
|
|
97
|
+
requestId: number;
|
|
98
|
+
bounds: ViewBounds;
|
|
99
|
+
global?: boolean;
|
|
100
|
+
cameraHeight: number;
|
|
101
|
+
cameraLon?: number;
|
|
102
|
+
cameraLat?: number;
|
|
103
|
+
cameraPitch?: number;
|
|
104
|
+
horizonCullDistance?: number;
|
|
105
|
+
maxRender: number;
|
|
106
|
+
} | {
|
|
107
|
+
type: "destroy";
|
|
108
|
+
};
|
|
109
|
+
export interface WorkerRenderStats {
|
|
110
|
+
total: number;
|
|
111
|
+
level: number;
|
|
112
|
+
outsideLevel: number;
|
|
113
|
+
rawInView: number;
|
|
114
|
+
rawInBuffer: number;
|
|
115
|
+
rendered: number;
|
|
116
|
+
clusters: number;
|
|
117
|
+
lastMergeRadius: number;
|
|
118
|
+
pointCount: number;
|
|
119
|
+
lowModelCount: number;
|
|
120
|
+
highModelCount: number;
|
|
121
|
+
plainPointCount: number;
|
|
122
|
+
mergedPointCount: number;
|
|
123
|
+
mergedLowModelCount: number;
|
|
124
|
+
mergedHighModelCount: number;
|
|
125
|
+
forcedPointMode: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface RenderPacket {
|
|
128
|
+
requestId: number;
|
|
129
|
+
computeMs: number;
|
|
130
|
+
lon: Float64Array;
|
|
131
|
+
lat: Float64Array;
|
|
132
|
+
height: Float32Array;
|
|
133
|
+
heading: Float32Array;
|
|
134
|
+
speedH: Float32Array;
|
|
135
|
+
size: Float32Array;
|
|
136
|
+
count: Uint32Array;
|
|
137
|
+
flags: Uint8Array;
|
|
138
|
+
category: Uint8Array;
|
|
139
|
+
ids: string[];
|
|
140
|
+
moveDurationMs: Float32Array;
|
|
141
|
+
color: Uint32Array;
|
|
142
|
+
animation: Uint8Array;
|
|
143
|
+
animationColor: Uint32Array;
|
|
144
|
+
stats: WorkerRenderStats;
|
|
145
|
+
}
|
|
146
|
+
export type SceneWorkerResponse = {
|
|
147
|
+
type: "ready";
|
|
148
|
+
} | {
|
|
149
|
+
type: "input";
|
|
150
|
+
kind: "packed" | "set-data" | "incremental";
|
|
151
|
+
upserts: number;
|
|
152
|
+
removes: number;
|
|
153
|
+
pendingBatches: number;
|
|
154
|
+
} | {
|
|
155
|
+
type: "commit-done";
|
|
156
|
+
requestId: number;
|
|
157
|
+
added: number;
|
|
158
|
+
updated: number;
|
|
159
|
+
removed: number;
|
|
160
|
+
size: number;
|
|
161
|
+
computeMs: number;
|
|
162
|
+
} | {
|
|
163
|
+
type: "realtime-done";
|
|
164
|
+
upserts: number;
|
|
165
|
+
removes: number;
|
|
166
|
+
size: number;
|
|
167
|
+
computeMs: number;
|
|
168
|
+
} | {
|
|
169
|
+
type: "style-done";
|
|
170
|
+
updated: number;
|
|
171
|
+
} | {
|
|
172
|
+
type: "target-info";
|
|
173
|
+
requestId: number;
|
|
174
|
+
target: TargetSnapshot | null;
|
|
175
|
+
} | {
|
|
176
|
+
type: "viewport-cache-ready";
|
|
177
|
+
level: number;
|
|
178
|
+
buildMs: number;
|
|
179
|
+
} | {
|
|
180
|
+
type: "render-done";
|
|
181
|
+
packet: RenderPacket;
|
|
182
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|