@poor-knight/cesium-utils 0.0.2 → 0.3.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/dist/cesium-utils.cjs +76 -10
- package/dist/cesium-utils.d.ts +82 -0
- package/dist/cesium-utils.js +3742 -2820
- package/dist/cesium-utils.umd.cjs +76 -10
- package/package.json +2 -1
package/dist/cesium-utils.d.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import * as Cesium from 'cesium';
|
|
2
|
+
import { default as default_2 } from 'eventemitter3';
|
|
1
3
|
import { EventEmitter } from 'eventemitter3';
|
|
4
|
+
import { Feature } from 'geojson';
|
|
5
|
+
import { FeatureCollection } from 'geojson';
|
|
2
6
|
import { ImageryLayer } from 'cesium';
|
|
3
7
|
import { ImageryLayerFeatureInfo } from 'cesium';
|
|
8
|
+
import { Point } from 'geojson';
|
|
9
|
+
import { Popup } from 'cesium-extends';
|
|
4
10
|
import { TerrainProvider } from 'cesium';
|
|
5
11
|
import { Viewer } from 'cesium';
|
|
6
12
|
import { WebMapServiceImageryProvider } from 'cesium';
|
|
7
13
|
import { WebMapTileServiceImageryProvider } from 'cesium';
|
|
8
14
|
|
|
15
|
+
declare type Cartesian3Like = Cesium.Cartesian3 | {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
9
21
|
/**创建天地图图层 */
|
|
10
22
|
export declare function createTdtProvider(key: 'img' | 'vec' | 'cia' | 'cva', opt: {
|
|
11
23
|
token: string;
|
|
@@ -16,6 +28,15 @@ export declare function createTdtTerrain(opt: {
|
|
|
16
28
|
token: string;
|
|
17
29
|
}): TerrainProvider;
|
|
18
30
|
|
|
31
|
+
/**根据视角参数,调整摄像头 */
|
|
32
|
+
export declare function flyToCameraParams(viewer: Cesium.Viewer, params: {
|
|
33
|
+
position: Cartesian3Like;
|
|
34
|
+
direction: Cartesian3Like;
|
|
35
|
+
up: Cartesian3Like;
|
|
36
|
+
right: Cartesian3Like;
|
|
37
|
+
transform: Matrix4Like;
|
|
38
|
+
}, duration?: number): void;
|
|
39
|
+
|
|
19
40
|
/**图层 */
|
|
20
41
|
export declare interface Layer {
|
|
21
42
|
key: string;
|
|
@@ -24,6 +45,67 @@ export declare interface Layer {
|
|
|
24
45
|
hide(viewer: Viewer): void;
|
|
25
46
|
}
|
|
26
47
|
|
|
48
|
+
/**获取左键点击事件监听器,基于viewer唯一 */
|
|
49
|
+
export declare function ListenLeftClick(viewer: Cesium.Viewer): default_2<{
|
|
50
|
+
click: (payload: Cesium.ScreenSpaceEventHandler.PositionedEvent) => void;
|
|
51
|
+
}, any>;
|
|
52
|
+
|
|
53
|
+
declare type Matrix4Like = Cesium.Matrix4 | Record<string, number> | number[];
|
|
54
|
+
|
|
55
|
+
/** 弹窗控制器 */
|
|
56
|
+
export declare class PopupCtrl extends default_2<{
|
|
57
|
+
onMount: (id: string | number) => void;
|
|
58
|
+
onUnmount: (id: string | number) => void;
|
|
59
|
+
}> {
|
|
60
|
+
private static instance;
|
|
61
|
+
private constructor();
|
|
62
|
+
static getInstance(): PopupCtrl;
|
|
63
|
+
popupMap: Map<string | number, {
|
|
64
|
+
popup: Popup;
|
|
65
|
+
destroy(): void;
|
|
66
|
+
}>;
|
|
67
|
+
popup(payload: {
|
|
68
|
+
viewer: Cesium.Viewer;
|
|
69
|
+
id: string | number;
|
|
70
|
+
position: number[];
|
|
71
|
+
offset?: [number, number];
|
|
72
|
+
element: HTMLElement;
|
|
73
|
+
}): void;
|
|
74
|
+
close(id: string | number): void;
|
|
75
|
+
closeAll(): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**保持当前的视角参数到对象 */
|
|
79
|
+
export declare function saveCameraParams(viewer: Cesium.Viewer): {
|
|
80
|
+
position: Cesium.Cartesian3;
|
|
81
|
+
direction: Cesium.Cartesian3;
|
|
82
|
+
up: Cesium.Cartesian3;
|
|
83
|
+
right: Cesium.Cartesian3;
|
|
84
|
+
transform: Cesium.Matrix4;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**船只图层 */
|
|
88
|
+
export declare class ShipLayer implements Layer {
|
|
89
|
+
key: string;
|
|
90
|
+
zIndex: number;
|
|
91
|
+
db: Cesium.CustomDataSource;
|
|
92
|
+
constructor(key: string, zIndex: number);
|
|
93
|
+
private isMounted;
|
|
94
|
+
private _viewer;
|
|
95
|
+
show(viewer: Cesium.Viewer): void;
|
|
96
|
+
hide(): void;
|
|
97
|
+
entityMap: Map<string, Cesium.Entity>;
|
|
98
|
+
/**生成entity, geojson的id优先和mmsi保持一致,没有mmsi的情况下,使用nanoid生成 */
|
|
99
|
+
render(geojson: FeatureCollection<Point>): void;
|
|
100
|
+
/**渲染feature */
|
|
101
|
+
renderFeature(feature: Feature<Point>): void;
|
|
102
|
+
/**更新or新增feature */
|
|
103
|
+
update(feature: Feature<Point>): void;
|
|
104
|
+
private readonly IS_MOVING_THRESHOLD;
|
|
105
|
+
private renderEntity;
|
|
106
|
+
private createShipPlane;
|
|
107
|
+
}
|
|
108
|
+
|
|
27
109
|
export declare class WmsLayer implements Layer {
|
|
28
110
|
private ctrl;
|
|
29
111
|
key: string;
|