@soonspacejs/plugin-tiles 2.15.16 → 2.15.17
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.esm.js +451 -326
- package/dist/plot/GroundDecalManager.d.ts +29 -17
- package/dist/plot/PlotPrimitiveBridge.d.ts +2 -2
- package/dist/plot/fly-to.d.ts +16 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/plugins/base.d.ts +24 -5
- package/dist/plot/plugins/types.d.ts +2 -1
- package/dist/terrain-tiles-renderer/TerrainTilesRenderer.d.ts +8 -0
- package/package.json +3 -3
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { default as SoonSpace } from 'soonspacejs';
|
|
2
2
|
import { CesiumGroundFrameState } from 'cesium-to-three/ground';
|
|
3
|
-
import { GisPlotBase } from './plugins/base';
|
|
3
|
+
import { GisPlotBase, GisPlotBoundingBoxResolver } from './plugins/base';
|
|
4
4
|
import { GisPlotArrowSnapshot, GisPlotSnapshot, LonLatPoint, PlotAddOptions } from './plugins/types';
|
|
5
5
|
import { PlotPrimitiveBridge } from './PlotPrimitiveBridge';
|
|
6
6
|
/** 构造 GroundDecalManager 时的选项(注入 ssp)。 */
|
|
7
7
|
export type GroundDecalManagerOptions = {
|
|
8
8
|
/** SoonSpace 实例(必传);标绘图元挂载到 ssp.viewport.scene。 */
|
|
9
9
|
ssp: SoonSpace;
|
|
10
|
+
/** 把标绘经纬度转换为当前地形场景包围盒。 */
|
|
11
|
+
boundingBoxResolver?: GisPlotBoundingBoxResolver;
|
|
10
12
|
};
|
|
11
13
|
/** getItem / getItemDeep 的联合返回类型(箭头额外带 generatedCoords)。 */
|
|
12
14
|
export type GisPlotItemSnapshot = GisPlotSnapshot | GisPlotArrowSnapshot;
|
|
@@ -34,6 +36,8 @@ export declare class GroundDecalManager {
|
|
|
34
36
|
private _overlayAttached;
|
|
35
37
|
/** 合并同一帧内多次 _markDirty,值为 requestAnimationFrame 句柄 */
|
|
36
38
|
private _redrawTimer;
|
|
39
|
+
/** 由 TerrainTilesRenderer 提供的场景包围盒计算器。 */
|
|
40
|
+
private readonly _boundingBoxResolver?;
|
|
37
41
|
constructor(options: GroundDecalManagerOptions);
|
|
38
42
|
/** 暴露内部桥接器,业务若需自定义场景接入可选择性使用 */
|
|
39
43
|
get bridge(): PlotPrimitiveBridge;
|
|
@@ -51,59 +55,67 @@ export declare class GroundDecalManager {
|
|
|
51
55
|
/**
|
|
52
56
|
* 添加标绘:由 options.type 决定实例化哪一类 GisPlot*。
|
|
53
57
|
*
|
|
54
|
-
* @returns
|
|
58
|
+
* @returns 新建标绘继承自 Object3D 的数字 id。
|
|
55
59
|
* @throws 当 options.type 未知时抛错。
|
|
56
60
|
*/
|
|
57
|
-
addPlot(options: PlotAddOptions):
|
|
61
|
+
addPlot(options: PlotAddOptions): number;
|
|
58
62
|
/** 按 id 移除标绘;存在并删除成功时触发重绘 */
|
|
59
|
-
remove(id:
|
|
63
|
+
remove(id: number): void;
|
|
60
64
|
/** 清空全部标绘 */
|
|
61
65
|
clear(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 返回所有标绘项的 [id, GisPlotBase] 数组(浅拷贝,避免外部修改 _items)。
|
|
68
|
+
* 业务可用来遍历所有标绘项,或在渲染循环中做自定义处理。
|
|
69
|
+
* 注意:返回的 GisPlotBase 实例仍是原对象,修改其 options 会影响 _items。
|
|
70
|
+
*/
|
|
71
|
+
getAllItems(): Array<GisPlotBase>;
|
|
72
|
+
/** 地形重定向或切换后清除全部标绘的场景包围盒缓存。 */
|
|
73
|
+
invalidateBoundingBoxes(): void;
|
|
62
74
|
/**
|
|
63
75
|
* 读取标绘浅快照(options 为新对象,points 仍共享引用;箭头附带 generatedCoords)。
|
|
64
76
|
*
|
|
65
77
|
* @returns 浅快照;id 不存在时返回 null。
|
|
66
78
|
*/
|
|
67
|
-
getItem(id:
|
|
79
|
+
getItem(id: number): GisPlotItemSnapshot | null;
|
|
68
80
|
/**
|
|
69
81
|
* 读取标绘深快照:points 等嵌套数组被复制;箭头额外深拷贝 generatedCoords。
|
|
70
82
|
*
|
|
71
83
|
* @returns 深快照;id 不存在时返回 null。
|
|
72
84
|
*/
|
|
73
|
-
getItemDeep(id:
|
|
85
|
+
getItemDeep(id: number): GisPlotItemSnapshot | null;
|
|
74
86
|
/**
|
|
75
87
|
* 合并更新样式与几何字段(调用对应 GisPlot*.update 做不可变整表替换)。
|
|
76
88
|
*/
|
|
77
|
-
setStyle(id:
|
|
89
|
+
setStyle(id: number, patch: GisPlotStylePatch): void;
|
|
78
90
|
/**
|
|
79
91
|
* 将第一个顶点设为新的经纬度中心(点 / 矩形中心 / 扇心 / 文字锚点等单中心
|
|
80
92
|
* 语义)。**就地修改** points[0](与 update 的不可变风格不同)。
|
|
81
93
|
*/
|
|
82
|
-
setCenter(id:
|
|
94
|
+
setCenter(id: number, center: CenterLonLat): void;
|
|
83
95
|
/**
|
|
84
96
|
* 整体替换顶点列表(每项为 [lon, lat],深拷贝防止外部引用泄漏)。
|
|
85
97
|
*/
|
|
86
|
-
setCoords(id:
|
|
98
|
+
setCoords(id: number, coords: LonLatPoint[]): void;
|
|
87
99
|
/**
|
|
88
100
|
* 修改指定下标顶点;coord 分量为 undefined 表示不改该分量。越界静默返回。
|
|
89
101
|
*/
|
|
90
|
-
setCoord(id:
|
|
102
|
+
setCoord(id: number, index: number, coord: Partial<LonLatPoint> | [number?, number?]): void;
|
|
91
103
|
/**
|
|
92
104
|
* 在 index 处插入一个顶点(可插末尾,越界钳位)。插入顶点深拷贝。
|
|
93
105
|
*/
|
|
94
|
-
insertCoord(id:
|
|
106
|
+
insertCoord(id: number, index: number, coord: LonLatPoint): void;
|
|
95
107
|
/**
|
|
96
108
|
* 删除指定下标顶点。多边形至少保留 3 点,其余至少 2 点;越界 / 触底静默返回。
|
|
97
109
|
*/
|
|
98
|
-
removeCoord(id:
|
|
110
|
+
removeCoord(id: number, index: number): void;
|
|
99
111
|
/**
|
|
100
112
|
* 对所有顶点做经纬度平移(度),就地修改。
|
|
101
113
|
*/
|
|
102
|
-
translateCoords(id:
|
|
114
|
+
translateCoords(id: number, dLon: number, dLat: number): void;
|
|
103
115
|
/**
|
|
104
116
|
* 仅对 category === 'text' 的项更新 options.content。
|
|
105
117
|
*/
|
|
106
|
-
setText(id:
|
|
118
|
+
setText(id: number, text: string): void;
|
|
107
119
|
/**
|
|
108
120
|
* 设置整个标绘层的全局不透明度(0..1)。桥接器内部钳位。
|
|
109
121
|
*/
|
|
@@ -111,11 +123,11 @@ export declare class GroundDecalManager {
|
|
|
111
123
|
/**
|
|
112
124
|
* 返回某标绘顶点数(不存在返回 0)。
|
|
113
125
|
*/
|
|
114
|
-
getCoordCount(id:
|
|
126
|
+
getCoordCount(id: number): number;
|
|
115
127
|
/**
|
|
116
128
|
* 在经纬度平面找离 (lon, lat) 最近的顶点下标(平方距离最小);无顶点返回 -1。
|
|
117
129
|
*/
|
|
118
|
-
findNearestCoord(id:
|
|
130
|
+
findNearestCoord(id: number, lon: number, lat: number): number;
|
|
119
131
|
/**
|
|
120
132
|
* 宿主每帧调用:在深度纹理渲染之后、renderer.render 之前,
|
|
121
133
|
* 把深度纹理 / 视口 / 相机透传给所有标绘图元。
|
|
@@ -136,4 +148,4 @@ export declare class GroundDecalManager {
|
|
|
136
148
|
*/
|
|
137
149
|
private _markDirty;
|
|
138
150
|
}
|
|
139
|
-
export type { PlotAddOptions
|
|
151
|
+
export type { PlotAddOptions } from './plugins/types';
|
|
@@ -27,9 +27,9 @@ export declare class PlotPrimitiveBridge {
|
|
|
27
27
|
private _disposed;
|
|
28
28
|
constructor(options: PlotPrimitiveBridgeOptions);
|
|
29
29
|
/** 接收 GroundDecalManager 交付的 Map */
|
|
30
|
-
set shapes(value: Map<
|
|
30
|
+
set shapes(value: Map<number, GisPlotBase>);
|
|
31
31
|
/** 当前持有的标绘集合(引用,与 GroundDecalManager._items 同一) */
|
|
32
|
-
get shapes(): Map<
|
|
32
|
+
get shapes(): Map<number, GisPlotBase>;
|
|
33
33
|
/** 全局不透明度,写入时钳到 [0, 1] */
|
|
34
34
|
set opacity(value: number);
|
|
35
35
|
get opacity(): number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Box3 } from 'three';
|
|
2
|
+
import { TerrainTilesRenderer } from '../terrain-tiles-renderer/TerrainTilesRenderer';
|
|
3
|
+
import { GisPlotBase } from './plugins/base';
|
|
4
|
+
/**
|
|
5
|
+
* 计算标绘在当前地形对应的 SoonSpace 场景包围盒。
|
|
6
|
+
*/
|
|
7
|
+
export declare function computePlotBoundingBox(tilesRenderer: TerrainTilesRenderer, plot: GisPlotBase): Box3 | null;
|
|
8
|
+
/**
|
|
9
|
+
* 根据 groundDecalManager.addPlot 返回的 id 飞向标绘。
|
|
10
|
+
*
|
|
11
|
+
* @param tilesRenderer 已启用的地形渲染器。
|
|
12
|
+
* @param plotId 标绘 id。
|
|
13
|
+
* @param delay 延迟执行时间(毫秒),默认 200ms。
|
|
14
|
+
* @returns true 表示已安排飞向;false 表示标绘或当前地形坐标不可用。
|
|
15
|
+
*/
|
|
16
|
+
export declare function flyToPlotById(tilesRenderer: TerrainTilesRenderer, plotId: number, delay?: number): boolean;
|
package/dist/plot/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type { NormalizedRGBA, StyleOpacityInput, } from './plugins/utils/colorUt
|
|
|
6
6
|
export * from './plugins/utils/ArrowUtils';
|
|
7
7
|
export { PlotPrimitiveBridge, } from './PlotPrimitiveBridge';
|
|
8
8
|
export type { PlotPrimitiveBridgeOptions, } from './PlotPrimitiveBridge';
|
|
9
|
+
export { computePlotBoundingBox, flyToPlotById, } from './fly-to';
|
|
9
10
|
export { EMERGENCY_RESOURCE_ICON_BY_ONTOLOGY_ID, EMERGENCY_RESOURCE_ONTOLOGY_IDS, resolveEmergencyResourceIcon, resolvePlotPointImageUrl, } from './emergency-resource-icons';
|
|
10
11
|
export type { EmergencyResourceOntologyId, } from './emergency-resource-icons';
|
|
11
12
|
export { plotOrderToRenderOrder, sanitizePlotOrder, } from './plot-order';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { GisPlotBaseOptions, GisPlotCategory, GisPlotSnapshot, LonLatPoint } from './types';
|
|
2
|
+
import { BaseMesh } from 'soonspacejs';
|
|
3
|
+
import { Box3, Sphere } from 'three';
|
|
4
|
+
/** 把标绘经纬度转换为当前 SoonSpace 场景包围盒。 */
|
|
5
|
+
export type GisPlotBoundingBoxResolver = (plot: GisPlotBase) => Box3 | null;
|
|
2
6
|
/**
|
|
3
|
-
*
|
|
4
|
-
* options,不持有任何 GPU 资源 / Three 对象 / DOM 节点。
|
|
7
|
+
* 标绘数据模型基类。继承 BaseMesh,以便作为 SoonSpace 相机飞向目标使用。
|
|
5
8
|
*/
|
|
6
|
-
export declare class GisPlotBase {
|
|
7
|
-
/** 自增字符串 id('1' / '2' / '3' ...) */
|
|
8
|
-
readonly id: string;
|
|
9
|
+
export declare class GisPlotBase extends BaseMesh {
|
|
9
10
|
/**
|
|
10
11
|
* 类别。基类构造为空串,子类用 `readonly category = 'xxx' as const` 覆写。
|
|
11
12
|
* 桥接器据此 switch 分支。
|
|
@@ -16,7 +17,25 @@ export declare class GisPlotBase {
|
|
|
16
17
|
* 收窄类型提示。
|
|
17
18
|
*/
|
|
18
19
|
options: GisPlotBaseOptions;
|
|
20
|
+
/** 当前几何对应的场景包围盒缓存。 */
|
|
21
|
+
boundingBox: Box3 | null;
|
|
22
|
+
/** 当前几何对应的场景包围球缓存。 */
|
|
23
|
+
boundingSphere: Sphere | null;
|
|
24
|
+
/** 缓存对应的 options 快照键,兼容业务侧对 points 的就地修改。 */
|
|
25
|
+
private _boundingBoxCacheKey;
|
|
26
|
+
/** 由掌握地形坐标变换的 TerrainTilesRenderer 注入。 */
|
|
27
|
+
private _boundingBoxResolver;
|
|
19
28
|
constructor(options: GisPlotBaseOptions);
|
|
29
|
+
/**
|
|
30
|
+
* 注入场景包围盒计算器。模型自身只有经纬度,不负责猜测地形坐标变换。
|
|
31
|
+
*/
|
|
32
|
+
setBoundingBoxResolver(resolver: GisPlotBoundingBoxResolver): void;
|
|
33
|
+
/** 清除包围盒缓存;地形重定向或数据改变后调用。 */
|
|
34
|
+
invalidateBoundingBox(): void;
|
|
35
|
+
/** 按 Three.js Object3D 包围盒协议更新 boundingBox。 */
|
|
36
|
+
computeBoundingBox(): void;
|
|
37
|
+
/** 按 Three.js Object3D 包围体协议更新 boundingSphere。 */
|
|
38
|
+
computeBoundingSphere(): void;
|
|
20
39
|
/**
|
|
21
40
|
* 不可变整表替换:用展开 + patch 重建 options。
|
|
22
41
|
* 子类覆写此方法仅为收窄 patch 的类型提示,方法体相同。
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseObjectInfo } from 'soonspacejs';
|
|
1
2
|
import { EmergencyResourceOntologyId } from '../emergency-resource-icons';
|
|
2
3
|
/** 经纬度顶点:[经度°, 纬度°],单位度。 */
|
|
3
4
|
export type LonLatPoint = [number, number];
|
|
@@ -11,7 +12,7 @@ export type GisPlotCategory = 'point' | 'line' | 'polygon' | 'rectangle' | 'sect
|
|
|
11
12
|
* - strokeColor / fillColor 为 CSS 颜色字符串。
|
|
12
13
|
* - points 元素顺序固定为 [lon, lat]。
|
|
13
14
|
*/
|
|
14
|
-
export type GisPlotBaseOptions = {
|
|
15
|
+
export type GisPlotBaseOptions = Omit<BaseObjectInfo, 'rotation'> & {
|
|
15
16
|
/** 图形顶点列表 [[lon, lat], ...] */
|
|
16
17
|
points: LonLatPoint[];
|
|
17
18
|
/** 描边色(CSS 字符串) */
|
|
@@ -120,6 +120,14 @@ export declare class TerrainTilesRenderer {
|
|
|
120
120
|
* })
|
|
121
121
|
*/
|
|
122
122
|
setTerrain(config: ITerrainConfig, options?: ITerrainTilesRendererOptions | undefined): void;
|
|
123
|
+
/**
|
|
124
|
+
* 根据 groundDecalManager.addPlot 返回的 id 飞向标绘。
|
|
125
|
+
*
|
|
126
|
+
* @param plotId 标绘 id。
|
|
127
|
+
* @param delay 延迟执行时间(毫秒),默认 200ms。
|
|
128
|
+
* @returns true 表示已安排飞向;false 表示标绘或当前地形坐标不可用。
|
|
129
|
+
*/
|
|
130
|
+
flyToPlotById(plotId: number, delay?: number): boolean;
|
|
123
131
|
/**
|
|
124
132
|
* 添加 Overlay
|
|
125
133
|
* 根据 options.type 自动识别类型并调用对应方法
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-tiles",
|
|
3
3
|
"pluginName": "TilesPlugin",
|
|
4
|
-
"version": "2.15.
|
|
4
|
+
"version": "2.15.17",
|
|
5
5
|
"description": "3D Tiles plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"um-3d-tiles-renderer": "^0.4.48",
|
|
22
22
|
"three": "^0.183.0",
|
|
23
23
|
"@mapbox/geojson-merge": "^1.1.1",
|
|
24
|
-
"cesium-to-three": "
|
|
25
|
-
"soonspacejs": "2.15.
|
|
24
|
+
"cesium-to-three": "0.2.4",
|
|
25
|
+
"soonspacejs": "2.15.17"
|
|
26
26
|
}
|
|
27
27
|
}
|