soonspacejs 2.11.3 → 2.11.5
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 +3 -3
- package/package.json +2 -2
- package/types/Interface/viewport.d.ts +1 -3
- package/types/Manager/Canvas3DManage.d.ts +2 -1
- package/types/Manager/ModelManage.d.ts +4 -4
- package/types/Manager/TopologyManage.d.ts +17 -0
- package/types/Math/dijkstra/DijkstraWorker.d.ts +13 -0
- package/types/Math/dijkstra/dijkstra.worker.d.ts +2 -0
- package/types/Math/dijkstra/index.d.ts +2 -2
- package/types/Viewport/SoonGISManager/coords-to-matrix.d.ts +2 -2
- package/types/Viewport/SoonGISManager/index.d.ts +22 -9
- package/types/index.d.ts +26 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soonspacejs",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.5",
|
|
4
4
|
"homepage": "http://www.xwbuilders.com:8800/",
|
|
5
5
|
"description": "soonspacejs 2.x",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"three": ">=0.155.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "7e6126ef38c60b44f5232a7c803bbbbf2c050c29"
|
|
33
33
|
}
|
|
@@ -64,8 +64,7 @@ interface EmissiveSelectOptions extends Omit<BaseSelectOptions, 'opacity'> {
|
|
|
64
64
|
}
|
|
65
65
|
interface FogOptions {
|
|
66
66
|
color?: IColor;
|
|
67
|
-
|
|
68
|
-
far?: number;
|
|
67
|
+
density?: number;
|
|
69
68
|
}
|
|
70
69
|
interface SkyOptions {
|
|
71
70
|
enabled?: boolean;
|
|
@@ -99,7 +98,6 @@ interface ViewportOptions {
|
|
|
99
98
|
closeInfoLog?: boolean;
|
|
100
99
|
closeWarnLog?: boolean;
|
|
101
100
|
useIndexedDB?: boolean;
|
|
102
|
-
logarithmicDepthBuffer?: boolean;
|
|
103
101
|
}
|
|
104
102
|
interface ViewportState {
|
|
105
103
|
useFreq: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
1
2
|
import Viewport from '../Viewport';
|
|
2
3
|
import { Group, GroupInfo, Canvas3D, Canvas3DInfo } from '../Library';
|
|
3
4
|
import DefaultManage from './DefaultManage';
|
|
@@ -6,7 +7,7 @@ declare class Canvas3DManage extends DefaultManage {
|
|
|
6
7
|
readonly viewport: Viewport;
|
|
7
8
|
readonly cache: ManageCache;
|
|
8
9
|
constructor(viewport: Viewport, cache: ManageCache);
|
|
9
|
-
create(info: Canvas3DInfo): Canvas3D;
|
|
10
|
+
create(info: Canvas3DInfo, parent?: Object3D | null): Canvas3D;
|
|
10
11
|
createToGroup(groupInfo: GroupInfo, poiInfo: Canvas3DInfo[]): Group;
|
|
11
12
|
addForGroup(group: Group | null, poiInfo: Canvas3DInfo[]): Group | null;
|
|
12
13
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoadingManager, Object3D } from 'three';
|
|
2
2
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
3
|
import localforage from 'localforage';
|
|
4
4
|
import { FBXLoader } from '../Loader/FBXLoader.js';
|
|
5
5
|
import Viewport from '../Viewport';
|
|
6
|
-
import {
|
|
6
|
+
import { Group, GroupInfo, Model, ModelInfo } from '../Library';
|
|
7
7
|
import { CloneModelInfo, ManageCache } from '../Interface';
|
|
8
8
|
import DefaultManage from './DefaultManage';
|
|
9
9
|
declare class ModelManage extends DefaultManage {
|
|
@@ -36,7 +36,7 @@ declare class ModelManage extends DefaultManage {
|
|
|
36
36
|
* @param modelInfo
|
|
37
37
|
* @returns
|
|
38
38
|
*/
|
|
39
|
-
load(modelInfo: ModelInfo, parent?:
|
|
39
|
+
load(modelInfo: ModelInfo, parent?: Object3D | null): Promise<Model | null>;
|
|
40
40
|
/**
|
|
41
41
|
* 模型解析
|
|
42
42
|
* @param format
|
|
@@ -45,7 +45,7 @@ declare class ModelManage extends DefaultManage {
|
|
|
45
45
|
* @returns
|
|
46
46
|
*/
|
|
47
47
|
parse(modelInfo: ModelInfo): Promise<Model | null>;
|
|
48
|
-
clone(model: Model, info: CloneModelInfo, parent?: Object3D |
|
|
48
|
+
clone(model: Model, info: CloneModelInfo, parent?: Object3D | null): Promise<Model>;
|
|
49
49
|
loadToGroup(groupInfo: GroupInfo, modelInfo: ModelInfo[]): Promise<Group>;
|
|
50
50
|
addForGroup(group: Group | null, modelInfo: ModelInfo[]): Promise<Group | null>;
|
|
51
51
|
/**
|
|
@@ -3,10 +3,12 @@ import { Group, GroupInfo, Topology, Node, TopologyInfo } from '../Library';
|
|
|
3
3
|
import { TopologyInfoForGml, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyNodeInfo, TopologyInnerNodeInfo, Position, TopologyPassableInfo, ManageCache } from '../Interface';
|
|
4
4
|
import Viewport from '../Viewport';
|
|
5
5
|
import { Dijkstras } from '../Math/dijkstra';
|
|
6
|
+
import { DijkstraWorker } from '../Math/dijkstra/DijkstraWorker';
|
|
6
7
|
declare class TopologyManage extends DefaultManage {
|
|
7
8
|
readonly viewport: Viewport;
|
|
8
9
|
readonly cache: ManageCache;
|
|
9
10
|
dijkstra: Dijkstras;
|
|
11
|
+
dijkstraWorker: DijkstraWorker;
|
|
10
12
|
constructor(viewport: Viewport, cache: ManageCache);
|
|
11
13
|
createFromGml(topologyInfoForGml: TopologyInfoForGml): Promise<Topology>;
|
|
12
14
|
create(topologyInfo: TopologyInfo): Topology;
|
|
@@ -24,6 +26,10 @@ declare class TopologyManage extends DefaultManage {
|
|
|
24
26
|
* @returns
|
|
25
27
|
*/
|
|
26
28
|
protected _getPath(topology: Topology, info: Pick<ShortestPathInfo, 'start' | 'end'>): Node[] | null;
|
|
29
|
+
/**
|
|
30
|
+
* @todo getPath 重复代码优化
|
|
31
|
+
*/
|
|
32
|
+
protected _getPathAsync(topology: Topology, info: Pick<ShortestPathInfo, 'start' | 'end'>): Promise<Node[] | null>;
|
|
27
33
|
protected _generateNodesInfo(nodes: Node[]): TopologyInnerNodeInfo[];
|
|
28
34
|
/**
|
|
29
35
|
* 根据两点获取最短路径
|
|
@@ -32,6 +38,10 @@ declare class TopologyManage extends DefaultManage {
|
|
|
32
38
|
* @returns
|
|
33
39
|
*/
|
|
34
40
|
getShortestPath(topology: Topology, info: ShortestPathInfo): Topology | null;
|
|
41
|
+
/**
|
|
42
|
+
* @todo getShortestPathAsync 重复代码优化
|
|
43
|
+
*/
|
|
44
|
+
getShortestPathAsync(topology: Topology, info: ShortestPathInfo): Promise<Topology | null>;
|
|
35
45
|
/**
|
|
36
46
|
* 多起点或多终点最短路径
|
|
37
47
|
* @param topology
|
|
@@ -42,9 +52,16 @@ declare class TopologyManage extends DefaultManage {
|
|
|
42
52
|
* @returns
|
|
43
53
|
*/
|
|
44
54
|
protected _getShortestPathByMultiplePoints(topology: Topology, info: ShortestPathByMultipleStartPoints | ShortestPathByMultipleEndPoints, points: Position[], point: Position, pointsType: 'start' | 'end'): Topology | null;
|
|
55
|
+
/**
|
|
56
|
+
* @todo getShortestPathByMultiplePointsAsync 重复代码优化
|
|
57
|
+
*/
|
|
58
|
+
protected _getShortestPathByMultiplePointsAsync(topology: Topology, info: ShortestPathByMultipleStartPoints | ShortestPathByMultipleEndPoints, points: Position[], point: Position, pointsType: 'start' | 'end'): Promise<Topology | null>;
|
|
45
59
|
getShortestPathByMultipleStartPoints(topology: Topology, info: ShortestPathByMultipleStartPoints): Topology | null;
|
|
46
60
|
getShortestPathByMultipleEndPoints(topology: Topology, info: ShortestPathByMultipleEndPoints): Topology | null;
|
|
61
|
+
getShortestPathByMultipleStartPointsAsync(topology: Topology, info: ShortestPathByMultipleStartPoints): Promise<Topology | null>;
|
|
62
|
+
getShortestPathByMultipleEndPointsAsync(topology: Topology, info: ShortestPathByMultipleEndPoints): Promise<Topology | null>;
|
|
47
63
|
private setDijkstraGraph;
|
|
48
64
|
private generateLineTopologyInfoNodeGraphs;
|
|
65
|
+
dispose(): void;
|
|
49
66
|
}
|
|
50
67
|
export default TopologyManage;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkerPool } from 'three/examples/jsm/utils/WorkerPool.js';
|
|
2
|
+
import { BaseId, Dijkstras, InputGraph } from './index';
|
|
3
|
+
declare class DijkstraWorker {
|
|
4
|
+
readonly dijkstra: Dijkstras;
|
|
5
|
+
workerPool: WorkerPool;
|
|
6
|
+
workerSourceURL: string | null;
|
|
7
|
+
_mainThreadGraph: InputGraph;
|
|
8
|
+
_needsUpdateGraph: boolean;
|
|
9
|
+
constructor(dijkstra: Dijkstras);
|
|
10
|
+
getPath(source: BaseId, target: BaseId): Promise<BaseId[]>;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
export { DijkstraWorker, };
|
|
@@ -4,7 +4,7 @@ import { MinHeap } from '../../Shared';
|
|
|
4
4
|
* Javascript implementation of Dijkstra's algorithm
|
|
5
5
|
* Based on: http://en.wikipedia.org/wiki/Dijkstra's_algorithm
|
|
6
6
|
* Author: James Jackson (www.jamesdavidjackson.com)
|
|
7
|
-
* Source:
|
|
7
|
+
* Source: https://github.com/nojacko/dijkstras-js
|
|
8
8
|
*
|
|
9
9
|
* Useage:
|
|
10
10
|
* const d = new Dijkstras();
|
|
@@ -19,7 +19,7 @@ import { MinHeap } from '../../Shared';
|
|
|
19
19
|
* const path = d.getPath('A', 'D');
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
type BaseId = BaseObjectInfo['id'];
|
|
22
|
+
export type BaseId = BaseObjectInfo['id'];
|
|
23
23
|
type Graph = Map<BaseId, Map<BaseId, number>>;
|
|
24
24
|
type InputGraph = [BaseId, [BaseId, number][]][];
|
|
25
25
|
declare class Dijkstras {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MercatorCoordinate } from 'maplibre-gl';
|
|
2
|
-
export type
|
|
2
|
+
export type Coordinate = {
|
|
3
3
|
longitude: number;
|
|
4
4
|
latitude: number;
|
|
5
5
|
altitude: number;
|
|
6
6
|
};
|
|
7
7
|
/** calculate Matrix4 from coordinates */
|
|
8
|
-
export declare function coordsToMatrix({ longitude, latitude, altitude, }:
|
|
8
|
+
export declare function coordsToMatrix({ longitude, latitude, altitude, }: Coordinate, fromLngLat: typeof MercatorCoordinate.fromLngLat): import("three").Matrix4Tuple;
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { PerspectiveCamera } from 'three';
|
|
2
|
-
import type { Map } from 'maplibre-gl';
|
|
1
|
+
import { PerspectiveCamera, Vector3 } from 'three';
|
|
2
|
+
import type { Map, MercatorCoordinate } from 'maplibre-gl';
|
|
3
3
|
import type SoonGIS from 'soongis';
|
|
4
4
|
import Viewport from '..';
|
|
5
|
-
import {
|
|
5
|
+
import { IVector3 } from '../..';
|
|
6
|
+
import { Coordinate } from './coords-to-matrix';
|
|
6
7
|
declare class SoonGISManager {
|
|
7
8
|
readonly viewport: Viewport;
|
|
8
9
|
readonly soongis?: SoonGIS | undefined;
|
|
9
|
-
SOONSPACE_LAYER_ID
|
|
10
|
-
map: Map | undefined;
|
|
11
|
-
camera: PerspectiveCamera;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
readonly SOONSPACE_LAYER_ID = "SOONSPACE_LAYER";
|
|
11
|
+
readonly map: Map | undefined;
|
|
12
|
+
readonly camera: PerspectiveCamera;
|
|
13
|
+
readonly _basisCoordinate: Coordinate;
|
|
14
|
+
readonly _basisMercatorCoordinate: MercatorCoordinate | undefined;
|
|
15
|
+
readonly _mapResize: () => void;
|
|
14
16
|
constructor(viewport: Viewport, soongis?: SoonGIS | undefined);
|
|
17
|
+
/**
|
|
18
|
+
* 从笛卡尔转经纬度
|
|
19
|
+
* @param position
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
fromPositionToCoordinate(position: IVector3): Coordinate | null;
|
|
23
|
+
/**
|
|
24
|
+
* 从经纬度转笛卡尔
|
|
25
|
+
* @param coordinates
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
fromCoordinateToPosition(coordinates: Coordinate): Vector3 | null;
|
|
15
29
|
/**
|
|
16
30
|
* 设置经纬度、海拔
|
|
17
31
|
* @param coordinates
|
|
18
32
|
*/
|
|
19
|
-
setCoordinates(coordinates: Coordinates): void;
|
|
20
33
|
/**
|
|
21
34
|
* 使用 map 的 render 代替 soonspace render
|
|
22
35
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class SoonSpace {
|
|
|
59
59
|
Quartic: {
|
|
60
60
|
In: (amount: number) => number;
|
|
61
61
|
Out: (amount: number) => number;
|
|
62
|
-
InOut: (amount: number) => number;
|
|
62
|
+
InOut: (amount: number) => number;
|
|
63
63
|
};
|
|
64
64
|
Quintic: {
|
|
65
65
|
In: (amount: number) => number;
|
|
@@ -138,7 +138,7 @@ export declare class SoonSpace {
|
|
|
138
138
|
Quartic: {
|
|
139
139
|
In: (amount: number) => number;
|
|
140
140
|
Out: (amount: number) => number;
|
|
141
|
-
InOut: (amount: number) => number;
|
|
141
|
+
InOut: (amount: number) => number;
|
|
142
142
|
};
|
|
143
143
|
Quintic: {
|
|
144
144
|
In: (amount: number) => number;
|
|
@@ -681,7 +681,7 @@ export declare class SoonSpace {
|
|
|
681
681
|
/******* Group methods */
|
|
682
682
|
/******/
|
|
683
683
|
/******/
|
|
684
|
-
createGroup(groupInfo: GroupInfo): Group;
|
|
684
|
+
createGroup(groupInfo: GroupInfo, parent?: Object3D | null): Group;
|
|
685
685
|
getGroupById(id: GroupInfo['id']): Group | null;
|
|
686
686
|
getGroupByName(name: string): Group[];
|
|
687
687
|
getAllGroup(): Group[];
|
|
@@ -734,7 +734,7 @@ export declare class SoonSpace {
|
|
|
734
734
|
* @param modelInfo
|
|
735
735
|
* @param parent
|
|
736
736
|
*/
|
|
737
|
-
loadModel(modelInfo: ModelInfo): Promise<Model | null>;
|
|
737
|
+
loadModel(modelInfo: ModelInfo, parent?: Object3D | null): Promise<Model | null>;
|
|
738
738
|
/**
|
|
739
739
|
* 克隆 Model 模型
|
|
740
740
|
* @param model
|
|
@@ -1029,7 +1029,7 @@ export declare class SoonSpace {
|
|
|
1029
1029
|
* 创建 Canvas3D
|
|
1030
1030
|
* @param info
|
|
1031
1031
|
*/
|
|
1032
|
-
createCanvas3D(info: Canvas3DInfo): Canvas3D;
|
|
1032
|
+
createCanvas3D(info: Canvas3DInfo, parent?: Object3D | null): Canvas3D;
|
|
1033
1033
|
/**
|
|
1034
1034
|
* 根据 id 查询 Canvas3D
|
|
1035
1035
|
* @param id
|
|
@@ -1113,18 +1113,39 @@ export declare class SoonSpace {
|
|
|
1113
1113
|
* @param info
|
|
1114
1114
|
*/
|
|
1115
1115
|
getShortestPath(topology: Topology, info: ShortestPathInfo): Topology | null;
|
|
1116
|
+
/**
|
|
1117
|
+
* 获取最短路径(worker)
|
|
1118
|
+
* @param topology
|
|
1119
|
+
* @param info
|
|
1120
|
+
* @returns
|
|
1121
|
+
*/
|
|
1122
|
+
getShortestPathAsync(topology: Topology, info: ShortestPathInfo): Promise<Topology | null>;
|
|
1116
1123
|
/**
|
|
1117
1124
|
* 通过多个起点获取最短路径
|
|
1118
1125
|
* @param topology
|
|
1119
1126
|
* @param info
|
|
1120
1127
|
*/
|
|
1121
1128
|
getShortestPathByMultipleStartPoints(topology: Topology, info: ShortestPathByMultipleStartPoints): Topology | null;
|
|
1129
|
+
/**
|
|
1130
|
+
* 获取最短路径(worker)
|
|
1131
|
+
* @param topology
|
|
1132
|
+
* @param info
|
|
1133
|
+
* @returns
|
|
1134
|
+
*/
|
|
1135
|
+
getShortestPathByMultipleStartPointsAsync(topology: Topology, info: ShortestPathByMultipleStartPoints): Promise<Topology | null>;
|
|
1122
1136
|
/**
|
|
1123
1137
|
* 通过多个终点获取最短路径
|
|
1124
1138
|
* @param topology
|
|
1125
1139
|
* @param info
|
|
1126
1140
|
*/
|
|
1127
1141
|
getShortestPathByMultipleEndPoints(topology: Topology, info: ShortestPathByMultipleEndPoints): Topology | null;
|
|
1142
|
+
/**
|
|
1143
|
+
* 通过多个终点获取最短路径(worker)
|
|
1144
|
+
* @param topology
|
|
1145
|
+
* @param info
|
|
1146
|
+
* @returns
|
|
1147
|
+
*/
|
|
1148
|
+
getShortestPathByMultipleEndPointsAsync(topology: Topology, info: ShortestPathByMultipleEndPoints): Promise<Topology | null>;
|
|
1128
1149
|
/**
|
|
1129
1150
|
* 创建 Topology,从 gml 文件资源
|
|
1130
1151
|
* @param groupInfo
|