@krazyphish/earth-vue 1.0.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/HISTORY.md +32 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +210 -0
- package/dist/index.es.js +1 -0
- package/package.json +54 -0
package/HISTORY.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## @krazyphish/earth-vue
|
|
2
|
+
|
|
3
|
+
### 版本更新历史记录
|
|
4
|
+
|
|
5
|
+
#### Version 0.1.3
|
|
6
|
+
|
|
7
|
+
1. 新增 `useAnimationManager` 以钩子形式创建动画管理器
|
|
8
|
+
2. 新增 `useBillboardLayer` 以钩子形式创建广告牌图层
|
|
9
|
+
3. 新增 `useCloudLayer` 以钩子形式创建云朵图层
|
|
10
|
+
4. 新增 `useCluster` 以钩子形式创建聚合图层
|
|
11
|
+
5. 新增 `useContextMenu` 以钩子形式创建上下文菜单
|
|
12
|
+
6. 新增 `useCovering` 以钩子形式创建覆盖物图层
|
|
13
|
+
7. 新增 `useDiffusePointLayer` 以钩子形式创建扩散点图层
|
|
14
|
+
8. 新增 `useDrawTool` 以钩子形式创建绘制工具
|
|
15
|
+
9. 新增 `useEarth` 以钩子形式创建地球实例
|
|
16
|
+
10. 新增 `useEllipseLayer` 以钩子形式创建椭圆图层
|
|
17
|
+
11. 新增 `useEllipsoidLayer` 以钩子形式创建椭球图层
|
|
18
|
+
12. 新增 `useGlobalEvent` 以钩子形式创建全局事件
|
|
19
|
+
13. 新增 `useHeatmap` 以钩子形式创建热力图
|
|
20
|
+
14. 新增 `useLabelLayer` 以钩子形式创建标签图层
|
|
21
|
+
15. 新增 `useMeasure` 以钩子形式创建测量工具
|
|
22
|
+
16. 新增 `useModelLayer` 以钩子形式创建模型图层
|
|
23
|
+
17. 新增 `useParticleLayer` 以钩子形式创建粒子系统
|
|
24
|
+
18. 新增 `usePointLayer` 以钩子形式创建点图层
|
|
25
|
+
19. 新增 `usePolygonLayer` 以钩子形式创建多边形图层
|
|
26
|
+
20. 新增 `usePolylineLayer` 以钩子形式创建折线图层
|
|
27
|
+
21. 新增 `useRadar` 以钩子形式创建雷达图层
|
|
28
|
+
22. 新增 `useRectangleLayer` 以钩子形式创建矩形图层
|
|
29
|
+
23. 新增 `useSensor` 以钩子形式创建传感器图层
|
|
30
|
+
24. 新增 `useWallLayer` 以钩子形式创建墙体图层
|
|
31
|
+
25. 新增 `useWeather` 以钩子形式创建天气系统
|
|
32
|
+
26. 新增 `useWindField` 以钩子形式创建风场、洋流
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [KrazyPhish]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
## @krazyphish/earth-vue
|
|
2
|
+
|
|
3
|
+
Vue3 hooks for module [@krazyphish/earth](https://www.npmjs.com/package/@krazyphish/earth).
|
|
4
|
+
|
|
5
|
+
### Before start
|
|
6
|
+
|
|
7
|
+
Before start using this module, install packages blow manually: [cesium](https://www.npmjs.com/package/cesium), [vue](https://www.npmjs.com/package/vue), [@krazyphish/earth](https://www.npmjs.com/package/@krazyphish/earth).
|
|
8
|
+
|
|
9
|
+
Then install this module:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm install @krazyphish/earth-vue
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Get started
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<template>
|
|
19
|
+
<div ref="container" class="w-full h-full"></div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
// in your map module, when initializing the cesium viewer
|
|
24
|
+
import { type Earth } from "@krazyphish/earth"
|
|
25
|
+
import { useEarth } from "@krazyphish/earth-vue"
|
|
26
|
+
import { onMounted, onUnmounted, useTemplateRef, type ShallowRef } from "vue"
|
|
27
|
+
|
|
28
|
+
const containerRef = useTemplateRef("container")
|
|
29
|
+
const earthRef: ShallowRef<Earth | null> = useEarth(containerRef)
|
|
30
|
+
|
|
31
|
+
onMounted(() => {
|
|
32
|
+
if (!earthRef.value) return
|
|
33
|
+
//doing some job
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
onUnmounted(() => {
|
|
37
|
+
//do not try to recycle the earth or destroy any other components
|
|
38
|
+
//useEarth hook or other components hooks will do it for you
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("@krazyphish/earth"),l=require("vue");exports.useAnimationManager=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.AnimationManager(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useBillboardLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.BillboardLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useCloudLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.CloudLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useCluster=(u,n)=>{const o=l.shallowRef(null);return l.onMounted(()=>{u.value&&(o.value=new e.Cluster(u.value,n))}),l.onUnmounted(()=>{var e;null===(e=o.value)||void 0===e||e.destroy(),o.value=null}),o},exports.useContextMenu=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.ContextMenu(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useCovering=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Covering(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useDiffusePointLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.DiffusePointLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useDrawTool=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Draw(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useEarth=(u,n,o)=>{const a=l.shallowRef(null),r=e.Utils.uuid();return l.onMounted(()=>{u.value&&(a.value=e.createEarth(r,u.value,n,o))}),l.onUnmounted(()=>{e.recycleEarth(r)}),a},exports.useEllipseLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.EllipseLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useEllipsoidLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.EllipsoidLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useGlobalEvent=(u,n)=>{const o=l.shallowRef(null);return l.onMounted(()=>{u.value&&(o.value=new e.GlobalEvent(u.value,n))}),l.onUnmounted(()=>{var e;null===(e=o.value)||void 0===e||e.destroy(),o.value=null}),o},exports.useHeatmap=(u,n)=>{const o=l.shallowRef(null);return l.onMounted(()=>{u.value&&(o.value=new e.Heatmap(u.value,n))}),l.onUnmounted(()=>{var e;null===(e=o.value)||void 0===e||e.destroy(),o.value=null}),o},exports.useLabelLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.LabelLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useMeasure=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Measure(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useModelLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.ModelLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useParticleLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.ParticleLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.usePointLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.PointLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.usePolygonLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.PolygonLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.usePolylineLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.PolylineLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useRadar=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Radar(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useRectangleLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.RectangleLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useSensor=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Sensor(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useWallLayer=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.WallLayer(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useWeather=u=>{const n=l.shallowRef(null);return l.onMounted(()=>{u.value&&(n.value=new e.Weather(u.value))}),l.onUnmounted(()=>{var e;null===(e=n.value)||void 0===e||e.destroy(),n.value=null}),n},exports.useWindField=(u,n)=>{const o=l.shallowRef(null);return l.onMounted(()=>{u.value&&(o.value=new e.WindField(u.value,n))}),l.onUnmounted(()=>{var e;null===(e=o.value)||void 0===e||e.destroy(),o.value=null}),o};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnimationManager,
|
|
3
|
+
BillboardLayer,
|
|
4
|
+
CloudLayer,
|
|
5
|
+
Cluster,
|
|
6
|
+
ContextMenu,
|
|
7
|
+
Covering,
|
|
8
|
+
DiffusePointLayer,
|
|
9
|
+
Draw,
|
|
10
|
+
Earth,
|
|
11
|
+
EllipseLayer,
|
|
12
|
+
EllipsoidLayer,
|
|
13
|
+
GlobalEvent,
|
|
14
|
+
Heatmap,
|
|
15
|
+
LabelLayer,
|
|
16
|
+
Measure,
|
|
17
|
+
ModelLayer,
|
|
18
|
+
ParticleLayer,
|
|
19
|
+
PointLayer,
|
|
20
|
+
PolygonLayer,
|
|
21
|
+
PolylineLayer,
|
|
22
|
+
Radar,
|
|
23
|
+
RectangleLayer,
|
|
24
|
+
Sensor,
|
|
25
|
+
WallLayer,
|
|
26
|
+
Weather,
|
|
27
|
+
WindField,
|
|
28
|
+
} from "@krazyphish/earth"
|
|
29
|
+
import type { Viewer } from "cesium"
|
|
30
|
+
import type { Ref, ShallowRef } from "vue"
|
|
31
|
+
|
|
32
|
+
declare module "@krazyphish/earth-vue" {
|
|
33
|
+
type ShallowableRef<T> = Ref<T> | ShallowRef<T>
|
|
34
|
+
type Nullable<T> = T | undefined | null
|
|
35
|
+
/**
|
|
36
|
+
* @description 动画管理器钩子
|
|
37
|
+
* @param earthRef 地球实例Ref
|
|
38
|
+
* @returns 动画管理器Ref
|
|
39
|
+
*/
|
|
40
|
+
export const useAnimationManager: (earthRef: ShallowRef<Earth | null>) => ShallowRef<AnimationManager | null>
|
|
41
|
+
/**
|
|
42
|
+
* @description 广告牌图层钩子
|
|
43
|
+
* @param earthRef 地球实例Ref
|
|
44
|
+
* @returns 广告牌图层Ref
|
|
45
|
+
*/
|
|
46
|
+
export const useBillboardLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<BillboardLayer<T> | null>
|
|
47
|
+
/**
|
|
48
|
+
* @description 云朵图层钩子
|
|
49
|
+
* @param earthRef 地球实例Ref
|
|
50
|
+
* @returns 云朵图层Ref
|
|
51
|
+
*/
|
|
52
|
+
export const useCloudLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<CloudLayer<T> | null>
|
|
53
|
+
/**
|
|
54
|
+
* @description 聚合图层钩子
|
|
55
|
+
* @param earthRef 地球实例Ref
|
|
56
|
+
* @param [options] {@link Cluster.ConstructorOptions} 聚合图层构造参数
|
|
57
|
+
* @returns 聚合图层Ref
|
|
58
|
+
*/
|
|
59
|
+
export const useCluster: (
|
|
60
|
+
earthRef: ShallowRef<Earth | null>,
|
|
61
|
+
options?: Cluster.ConstructorOptions
|
|
62
|
+
) => ShallowRef<Cluster | null>
|
|
63
|
+
/**
|
|
64
|
+
* @description 上下文菜单钩子
|
|
65
|
+
* @param earthRef 地球实例Ref
|
|
66
|
+
* @returns 上下文菜单Ref
|
|
67
|
+
*/
|
|
68
|
+
export const useContextMenu: (earthRef: ShallowRef<Earth | null>) => ShallowRef<ContextMenu | null>
|
|
69
|
+
/**
|
|
70
|
+
* @description 覆盖物钩子
|
|
71
|
+
* @param earthRef 地球实例Ref
|
|
72
|
+
* @returns 覆盖物Ref
|
|
73
|
+
*/
|
|
74
|
+
export const useCovering: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<Covering<T> | null>
|
|
75
|
+
/**
|
|
76
|
+
* @description 扩散点图层钩子
|
|
77
|
+
* @param earthRef 地球实例Ref
|
|
78
|
+
* @returns 扩散点图层Ref
|
|
79
|
+
*/
|
|
80
|
+
export const useDiffusePointLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<DiffusePointLayer<T> | null>
|
|
81
|
+
/**
|
|
82
|
+
* @description 绘制工具钩子
|
|
83
|
+
* @param earthRef 地球实例Ref
|
|
84
|
+
* @returns 绘制工具Ref
|
|
85
|
+
*/
|
|
86
|
+
export const useDrawTool: (earthRef: ShallowRef<Earth | null>) => ShallowRef<Draw | null>
|
|
87
|
+
/**
|
|
88
|
+
* @description 地球创建钩子
|
|
89
|
+
* @param containerRef 容器Ref
|
|
90
|
+
* @param [cesiumOptions] {@link Viewer.ConstructorOptions} `cesium` 构造参数
|
|
91
|
+
* @param [options] {@link Earth.ConstructorOptions} 地球实例构造参数
|
|
92
|
+
* @returns 地球实例Ref
|
|
93
|
+
*/
|
|
94
|
+
export const useEarth: (
|
|
95
|
+
containerRef: ShallowableRef<Nullable<HTMLDivElement>>,
|
|
96
|
+
cesiumOptions?: Viewer.ConstructorOptions,
|
|
97
|
+
options?: Earth.ConstructorOptions
|
|
98
|
+
) => ShallowRef<Earth | null>
|
|
99
|
+
/**
|
|
100
|
+
* @description 椭圆图层钩子
|
|
101
|
+
* @param earthRef 地球实例Ref
|
|
102
|
+
* @returns 椭圆图层Ref
|
|
103
|
+
*/
|
|
104
|
+
export const useEllipseLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<EllipseLayer<T> | null>
|
|
105
|
+
/**
|
|
106
|
+
* @description 椭球图层钩子
|
|
107
|
+
* @param earthRef 地球实例Ref
|
|
108
|
+
* @returns 椭球图层Ref
|
|
109
|
+
*/
|
|
110
|
+
export const useEllipsoidLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<EllipsoidLayer<T> | null>
|
|
111
|
+
/**
|
|
112
|
+
* @description 全局事件钩子
|
|
113
|
+
* @param earthRef 地球实例Ref
|
|
114
|
+
* @param [delay] 事件节流的时延
|
|
115
|
+
* @returns 全局事件Ref
|
|
116
|
+
*/
|
|
117
|
+
export const useGlobalEvent: (earthRef: ShallowRef<Earth | null>, delay?: number) => ShallowRef<GlobalEvent | null>
|
|
118
|
+
/**
|
|
119
|
+
* @description 热力图钩子
|
|
120
|
+
* @param earthRef 地球实例Ref
|
|
121
|
+
* @param [options] {@link Heatmap.ConstructorOptions} 热力图构造参数
|
|
122
|
+
* @returns 热力图Ref
|
|
123
|
+
*/
|
|
124
|
+
export const useHeatmap: (
|
|
125
|
+
earthRef: ShallowRef<Earth | null>,
|
|
126
|
+
options?: Heatmap.ConstructorOptions
|
|
127
|
+
) => ShallowRef<Heatmap | null>
|
|
128
|
+
/**
|
|
129
|
+
* @description 标签图层钩子
|
|
130
|
+
* @param earthRef 地球实例Ref
|
|
131
|
+
* @returns 标签图层Ref
|
|
132
|
+
*/
|
|
133
|
+
export const useLabelLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<LabelLayer<T> | null>
|
|
134
|
+
/**
|
|
135
|
+
* @description 测量工具钩子
|
|
136
|
+
* @param earthRef 地球实例Ref
|
|
137
|
+
* @returns 测量工具Ref
|
|
138
|
+
*/
|
|
139
|
+
export const useMeasure: (earthRef: ShallowRef<Earth | null>) => ShallowRef<Measure | null>
|
|
140
|
+
/**
|
|
141
|
+
* @description 模型图层钩子
|
|
142
|
+
* @param earthRef 地球实例Ref
|
|
143
|
+
* @returns 模型图层Ref
|
|
144
|
+
*/
|
|
145
|
+
export const useModelLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<ModelLayer<T> | null>
|
|
146
|
+
/**
|
|
147
|
+
* @description 粒子系统图层钩子
|
|
148
|
+
* @param earthRef 地球实例Ref
|
|
149
|
+
* @returns 粒子系统图层Ref
|
|
150
|
+
*/
|
|
151
|
+
export const useParticleLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<ParticleLayer<T> | null>
|
|
152
|
+
/**
|
|
153
|
+
* @description 点图层钩子
|
|
154
|
+
* @param earthRef 地球实例Ref
|
|
155
|
+
* @returns 点图层Ref
|
|
156
|
+
*/
|
|
157
|
+
export const usePointLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<PointLayer<T> | null>
|
|
158
|
+
/**
|
|
159
|
+
* @description 多边形图层钩子
|
|
160
|
+
* @param earthRef 地球实例Ref
|
|
161
|
+
* @returns 多边形图层Ref
|
|
162
|
+
*/
|
|
163
|
+
export const usePolygonLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<PolygonLayer<T> | null>
|
|
164
|
+
/**
|
|
165
|
+
* @description 折线图层钩子
|
|
166
|
+
* @param earthRef 地球实例Ref
|
|
167
|
+
* @returns 折线图层Ref
|
|
168
|
+
*/
|
|
169
|
+
export const usePolylineLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<PolylineLayer<T> | null>
|
|
170
|
+
/**
|
|
171
|
+
* @description 雷达图层钩子
|
|
172
|
+
* @param earthRef 地球实例Ref
|
|
173
|
+
* @returns 雷达图层Ref
|
|
174
|
+
*/
|
|
175
|
+
export const useRadar: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<Radar<T> | null>
|
|
176
|
+
/**
|
|
177
|
+
* @description 矩形图层钩子
|
|
178
|
+
* @param earthRef 地球实例Ref
|
|
179
|
+
* @returns 矩形图层Ref
|
|
180
|
+
*/
|
|
181
|
+
export const useRectangleLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<RectangleLayer<T> | null>
|
|
182
|
+
/**
|
|
183
|
+
* @description 传感器图层钩子
|
|
184
|
+
* @param earthRef 地球实例Ref
|
|
185
|
+
* @returns 传感器图层Ref
|
|
186
|
+
*/
|
|
187
|
+
export const useSensor: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<Sensor<T> | null>
|
|
188
|
+
/**
|
|
189
|
+
* @description 墙体图层钩子
|
|
190
|
+
* @param earthRef 地球实例Ref
|
|
191
|
+
* @returns 墙体图层Ref
|
|
192
|
+
*/
|
|
193
|
+
export const useWallLayer: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<WallLayer<T> | null>
|
|
194
|
+
/**
|
|
195
|
+
* @description 天气系统钩子
|
|
196
|
+
* @param earthRef 地球实例Ref
|
|
197
|
+
* @returns 天气系统Ref
|
|
198
|
+
*/
|
|
199
|
+
export const useWeather: <T>(earthRef: ShallowRef<Earth | null>) => ShallowRef<Weather<T> | null>
|
|
200
|
+
/**
|
|
201
|
+
* @description 风场、洋流钩子
|
|
202
|
+
* @param earthRef 地球实例Ref
|
|
203
|
+
* @param options {@link WindField.ConstructorOptions} 风场、洋流构造参数
|
|
204
|
+
* @returns 风场、洋流Ref
|
|
205
|
+
*/
|
|
206
|
+
export const useWindField: (
|
|
207
|
+
earthRef: ShallowRef<Earth | null>,
|
|
208
|
+
options: WindField.ConstructorOptions
|
|
209
|
+
) => ShallowRef<WindField | null>
|
|
210
|
+
}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AnimationManager as l,BillboardLayer as u,CloudLayer as e,Cluster as v,ContextMenu as a,Covering as n,DiffusePointLayer as r,Draw as o,Utils as t,createEarth as s,recycleEarth as d,EllipseLayer as i,EllipsoidLayer as c,GlobalEvent as y,Heatmap as w,LabelLayer as m,Measure as p,ModelLayer as h,ParticleLayer as f,PointLayer as k,PolygonLayer as x,PolylineLayer as z,Radar as b,RectangleLayer as g,Sensor as j,WallLayer as q,Weather as A,WindField as B}from"@krazyphish/earth";import{shallowRef as C,onMounted as D,onUnmounted as E}from"vue";const useAnimationManager=u=>{const e=C(null);return D(()=>{u.value&&(e.value=new l(u.value))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e},useBillboardLayer=l=>{const e=C(null);return D(()=>{l.value&&(e.value=new u(l.value))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e},useCloudLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new e(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useCluster=(l,u)=>{const e=C(null);return D(()=>{l.value&&(e.value=new v(l.value,u))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e},useContextMenu=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new a(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useCovering=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new n(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useDiffusePointLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new r(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useDrawTool=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new o(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useEarth=(l,u,e)=>{const v=C(null),a=t.uuid();return D(()=>{l.value&&(v.value=s(a,l.value,u,e))}),E(()=>{d(a)}),v},useEllipseLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new i(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useEllipsoidLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new c(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useGlobalEvent=(l,u)=>{const e=C(null);return D(()=>{l.value&&(e.value=new y(l.value,u))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e},useHeatmap=(l,u)=>{const e=C(null);return D(()=>{l.value&&(e.value=new w(l.value,u))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e},useLabelLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new m(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useMeasure=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new p(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useModelLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new h(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useParticleLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new f(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},usePointLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new k(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},usePolygonLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new x(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},usePolylineLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new z(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useRadar=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new b(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useRectangleLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new g(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useSensor=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new j(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useWallLayer=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new q(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useWeather=l=>{const u=C(null);return D(()=>{l.value&&(u.value=new A(l.value))}),E(()=>{var l;null===(l=u.value)||void 0===l||l.destroy(),u.value=null}),u},useWindField=(l,u)=>{const e=C(null);return D(()=>{l.value&&(e.value=new B(l.value,u))}),E(()=>{var l;null===(l=e.value)||void 0===l||l.destroy(),e.value=null}),e};export{useAnimationManager,useBillboardLayer,useCloudLayer,useCluster,useContextMenu,useCovering,useDiffusePointLayer,useDrawTool,useEarth,useEllipseLayer,useEllipsoidLayer,useGlobalEvent,useHeatmap,useLabelLayer,useMeasure,useModelLayer,useParticleLayer,usePointLayer,usePolygonLayer,usePolylineLayer,useRadar,useRectangleLayer,useSensor,useWallLayer,useWeather,useWindField};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@krazyphish/earth-vue",
|
|
3
|
+
"author": "KrazyPhish",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs.js",
|
|
7
|
+
"module": "./dist/index.es.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.cjs.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"HISTORY.md",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"vue": "^3.4.21",
|
|
29
|
+
"@krazyphish/earth": "1.0.0 *"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
33
|
+
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
34
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
35
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
36
|
+
"@tsconfig/node20": "^20.1.4",
|
|
37
|
+
"@types/node": "^20.14.15",
|
|
38
|
+
"cesium": "^1.130.1",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
40
|
+
"rollup": "^4.44.1",
|
|
41
|
+
"ts-loader": "^9.5.1",
|
|
42
|
+
"ts-node": "^10.9.2",
|
|
43
|
+
"typescript": "^5.8.3",
|
|
44
|
+
"vue": "^3.4.21",
|
|
45
|
+
"@krazyphish/earth": "1.0.0",
|
|
46
|
+
"build-utils": "1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "pnpm release && pnpm type",
|
|
50
|
+
"clean": "rimraf -rf dist/",
|
|
51
|
+
"release": "pnpm clean && rollup -c rollup.config.ts --bundleConfigAsCjs",
|
|
52
|
+
"type": "ts-node ./scripts/build.ts"
|
|
53
|
+
}
|
|
54
|
+
}
|