sat-earth 0.7.1 → 0.7.2

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 CHANGED
@@ -1,345 +1,345 @@
1
- ## 什么是快乐“星球” ?
2
-   [SatEarth](https://gitee.com/gengkaibo/sat-earth)是一个三维地球组件库,目的是支持开发人员快速搭建三维场景。
3
-
4
- ## 组件库亮点
5
- - 内置丰富基础功能组件以及菜单组件,如果不需要定制化开发,可以分分钟出一个平台级应用系统
6
- - 对外暴露API,可随意调用sat-earth、mars3d、cesium API 进行定制化开发
7
- - 功能组件可配合菜单组件也可独立运行,兼顾灵活与便捷
8
- - 对样式进行了友好的移动端适配,兼顾大屏与小屏视觉体验
9
- - ...
10
-
11
- ## 当前开发进度
12
- - 1.数据源 (done)
13
- - 2.地图部件 (done)
14
- - 坐标信息
15
- - 悬浮导航
16
- - 时钟动画
17
- - 鹰眼地图
18
- - 3.工具栏
19
- - 3.1.搜索定位(done)
20
- - 地名检索
21
- - 坐标定位
22
- - 路径规划
23
- - 3.2.量测工具(done)
24
- - 坐标测量
25
- - 空间距离
26
- - 水平面积
27
- - 高度测量
28
- - 三角测量
29
- - 方位测量
30
- - 贴地距离
31
- - 贴地面积
32
- - 3.3.图上标绘(done)
33
- - 3.4.出图工具(done)
34
- - 3.5.空间分析
35
- - 剖面分析
36
- - 方量分析
37
- - 通视分析
38
- - 可视域分析
39
- - 限高分析
40
- - 缓冲分析
41
- - 剖面分析
42
- - 3.6.地形分析
43
- - 挖地分析
44
- - 等高线分析
45
- - 坡度坡向分析
46
- - 淹没分析
47
- - 3.7.模型分析
48
- - 淹没分析
49
- - 模型压平
50
- - 模型裁剪
51
- - 模型剖切
52
- - 3.8.视频融合
53
- - 3.9.飞行漫游
54
-
55
- ## 前序准备
56
- - [node](http://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境
57
- - [Vite](https://vitejs.dev/) - 熟悉 vite 特性
58
- - [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法
59
- - [TypeScript](https://www.typescriptlang.org/) - 熟悉 `TypeScript` 基本语法
60
- - [Es6+](http://es6.ruanyifeng.com/) - 熟悉`es6`基本语法
61
- - [Cesium](https://cesium.com/) - Cesium是一个开源的,基于webgl的二、三维地图引擎
62
- - [Mars3D](http://mars3d.cn/) - 基于Cesium优化提升与B/S架构设计,支持多行业扩展的轻量级高效能GIS开发平台
63
-
64
- ## 安装
65
- - 首先在命令行执行如下命令添加 `sat-earth` 的依赖
66
- ```bash
67
- npm i sat-earth
68
- ```
69
-
70
- - 将 `node_modules/mars3d-cesium/Build/Cesium` 目录拷贝到我们开发目录中的public下
71
- 然后在index.html中引入 `cesium` 库
72
- ```html
73
- <!--引入cesium基础lib-->
74
- <link href="/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
75
- <script src="/Cesium/Cesium.js" type="text/javascript"></script>
76
- ```
77
-
78
- - 如果您的项目也用了`pinia`,请修改您项目中的piniaStore直接使用`sat-earth`的导出,并且main.ts中不需要在调用App.use(piniaStore)
79
- ```ts
80
- // const piniaStore = createPinia()
81
- // export { piniaStore }
82
- export { piniaStore } from 'sat-earth'
83
- ```
84
-
85
- - 在 `main.[jt]s` 中引入我们的 `sat-earth` 资源
86
-
87
- ```ts
88
- import { createApp } from "vue"
89
- import App from "./app.vue"
90
- import satEarth from 'sat-earth'
91
- import 'sat-earth/dist/style.css'
92
- const app = createApp(App)
93
-
94
- app.use(satEarth)
95
- app.mount("#app")
96
-
97
- ```
98
-
99
- - 在`tsconfig.json`中的`types`加入类型声明文件`sat-earth/dist/auto-components`,来支持[Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)的类型提示
100
- ```json
101
- {
102
- "compilerOptions": {
103
- "target": "esnext", // 指定ts编译后的ECMAScript目标版本: 'es3' (default), 'es5', 'es2015', 'es2016', 'es2017', or 'esnext'
104
- "module": "esnext", // 指定编译后代码使用的模块化规范: 'commonjs', 'amd', 'umd' or 'es...'
105
- "declaration": false, // 是否生成声明文件
106
- "strict": true, // 开启全部严格模式
107
- "removeComments": true, // 删除注释
108
- "allowJs": true, // 是否对js文件开启编译
109
- "noImplicitAny": false, // 支持类型不标注可以默认any
110
- "allowSyntheticDefaultImports": true, // 允许没有导出的模块中导入
111
- "resolveJsonModule": true, // json文件是否可导入
112
- "isolatedModules": true, // 将每个文件作为单独的模块
113
- "useDefineForClassFields": true, // class类的变量声明方式从 = 赋值的方式变更成了Object.defineProperty;所有的字段声明都会生效,即使它没有指定默认值
114
- "moduleResolution": "node", // 置顶模块的解析策略,'node' or 'classic'
115
- "esModuleInterop": true, // 支持es6,commonjs模块
116
- "skipLibCheck": true, // 跳过类库检测
117
- "jsx": "preserve",
118
- "lib": [
119
- "esnext",
120
- "dom"
121
- ],
122
- "types": [
123
- "vite/client",
124
- "sat-earth/dist/auto-components"
125
- ],
126
- "paths": {
127
- "@src/*": [
128
- "./src/*"
129
- ]
130
- }
131
- },
132
- "include": [
133
- "**/*.ts",
134
- "**/*.d.ts",
135
- "**/*.vue"
136
- ]
137
- }
138
- ```
139
-
140
- ## 快速开始
141
- ```ts
142
- <script setup lang="ts">
143
- import { satMapTypes, type SatMenu_Type_MenuItem } from 'sat-earth'
144
- /*
145
- 初始化参数尽量保证了和mars3d的Map构造一致性,但是任然有一些地方进行了小改动,具体查看类型SatMapOptions,下面请看改动:
146
- 1. 在mars3d的Map构造参数的基础上扩展了custom对象。
147
-
148
- custom: {
149
- // 工具栏新增项
150
- layoutTheme: {
151
- primaryColor: '#409eff',
152
- isDark: true,
153
- showDarkRadio: true
154
- },
155
- toolbar: {
156
- mapSplit: true // 开启卷帘工具
157
- bookmark: true // 开启视角书签工具
158
- keyboardRoam: true // 开启键盘漫游功能
159
- },
160
- plotModelUrlPrefix?: string // 标绘模型地址前缀
161
- layers: {
162
- // list 这是要加入到 'SatSource' 数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数
163
- // 一致,通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 如果不加pid的时候或者任意添加的
164
- // pid导致在所有图层中并没有查找到该 pid 对应图层项时,组件会给该项添加默认pid并加到树的跟节点上。
165
- list: []
166
- // 辅助图层
167
- auxiliaryLayers: {
168
- cover: boolean // 是否覆盖内置的辅助图层
169
- list: [] // 自定义的辅助图层Layer集合
170
- },
171
- // 地形图层
172
- terrainLayers: {
173
- cover: boolean // 是否覆盖内置的地形图层
174
- list: [] // 自定义的地形图层Layer集合
175
- }
176
- }
177
- }
178
-
179
- 2. 对mars3d的Map构造参数中原有的basemaps的传参略作了修改。
180
-
181
- basemaps:[] => basemaps:{
182
- cover: boolean
183
- list: []
184
- }
185
- ①. 在 'sat-earth' 中加入了默认的基础底图,这里可以选择是否覆盖重写;
186
- ②. basemaps中配置的底图最终也会出现在 'SatSource' 数据源组件中的树形结构中;
187
-
188
-
189
- */
190
- const options: satMapTypes.SatMapOptions = {
191
- map3d: {
192
- control: {
193
- baseLayerPicker: true,
194
- animation: false,
195
- timeline: false
196
- },
197
- basemaps: {
198
- cover: false,
199
- list: []
200
- },
201
- custom: {
202
- layoutTheme: {
203
- primaryColor: '#409eff',
204
- isDark: true,
205
- showDarkRadio: true
206
- },
207
- toolbar: {
208
- mapSplit: true, // 开启卷帘工具
209
- bookmark: true, // 开启视角书签工具
210
- keyboardRoam: true, // 开启键盘漫游功能
211
- },
212
- layers: {
213
- /* list 这是要加入到数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数一致,
214
- 通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 不加 pid 的时候或者任意添加的 pid
215
- 导致所有图层中并没有该 pid 对应图层项时,组件会给该项添加默认的 pid,并加入到树的跟节点上。
216
- */
217
- list: [
218
- {
219
- 'id': 202012,
220
- 'type': '3dtiles',
221
- 'name': '石化工厂',
222
- 'url': 'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
223
- 'position': { 'lng': 117.077158, 'lat': 31.659116, 'alt': 24.6 },
224
- 'maximumScreenSpaceError': 1,
225
- 'maximumMemoryUsage': 1024,
226
- 'highlight': { 'type': 'click', 'color': '#00FF00' },
227
- 'popup': 'all',
228
- 'flyTo': true,
229
- 'scenetree': 'scenetree.json',
230
- 'center': { 'lat': 31.654916, 'lng': 117.08278, 'alt': 279, 'heading': 316, 'pitch': -29 }
231
- },
232
- ],
233
- // 辅助图层
234
- auxiliaryLayers: {
235
- cover: false, // 是否覆盖内置的辅助图层
236
- list: [] // 自定义的辅助图层Layer集合
237
- },
238
- // 地形图层
239
- terrainLayers: {
240
- cover: false, // 是否覆盖内置的地形图层
241
- list: [] // 自定义的地形图层Layer集合
242
- },
243
- },
244
- },
245
- },
246
- }
247
-
248
- const isSourceVisible = ref(true)
249
-
250
- const treeData = ref<SatMenu_Type_MenuItem[]>([
251
- {
252
- name: 'hello',
253
- label: '你好',
254
- icon: {
255
- class: 'fa-commenting-o',
256
- },
257
- enable: false,
258
- active: false
259
- },
260
- ])
261
- const changeDataToEnable = (item: SatMenu_Type_MenuItem) => {
262
- item.enable = true
263
- item.active = true
264
- console.log('do init...')
265
- }
266
- const changeDataToUnEnable = (item: SatMenu_Type_MenuItem) => {
267
- item.enable = false
268
- item.active = false
269
- console.log('do destroy...')
270
- }
271
-
272
- const isMounted = ref(false)
273
- onMounted(() => {
274
- isMounted.value = true
275
- })
276
- </script>
277
- ```
278
- ```html
279
- <template>
280
- <SatGlobe
281
- v-if="isMounted"
282
- :sat-map-options="options"
283
- >
284
- <SatMenu>
285
- <SatSource></SatSource>
286
- <SatMapPart></SatMapPart>
287
- <SatLocation></SatLocation>
288
- <SatMeasure></SatMeasure>
289
- <SatPlot></SatPlot>
290
- <SatPicture></SatPicture>
291
- <SatSpatialAnalysis></SatSpatialAnalysis>
292
- <SatTerrainAnalysis></SatTerrainAnalysis>
293
- <SatModelAnalysis></SatModelAnalysis>
294
- <SatVideoFusion></SatVideoFusion>
295
- <SatRoam></SatRoam>
296
- <!-- 自定义菜单项 -->
297
- <template #custom-enable>
298
- <SatMenuTree
299
- :custom="true"
300
- show-type="enabled"
301
- :tree-data="treeData.filter((i) => i.enable)"
302
- @custom-click="changeDataToEnable"
303
- @custom-close-click="changeDataToUnEnable"
304
- ></SatMenuTree>
305
- </template>
306
- <template #custom>
307
- <SatMenuTree
308
- :custom="true"
309
- :tree-data="treeData"
310
- @custom-click="changeDataToEnable"
311
- ></SatMenuTree>
312
- </template>
313
- </SatMenu>
314
-
315
- <!-- 使用SatPanel 面板组件 配合自定义菜单项完成自定义功能面板的开发-->
316
- <!-- <SatPanel
317
- v-if="treeData.filter(item=>item.name=='hello')[0].enable"
318
- v-show="treeData.filter(item=>item.name=='hello')[0].active"
319
- title="你好啊"
320
- :close-event="()=>{treeData.filter(item=>item.name=='hello')[0].enable = false}"
321
- :minimize-event="()=>{treeData.filter(item=>item.name=='hello')[0].active = false}"
322
- >
323
- 内容
324
- </SatPanel> -->
325
-
326
- <!-- 在内置的menu外部使用组件 -->
327
- <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
328
- </SatGlobe>
329
- <!-- 在SatGlobe外部无法使用组件 -->
330
- <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
331
- </template>
332
- <style>
333
- body {
334
- margin: 0;
335
- padding: 0;
336
- }
337
-
338
- #app {
339
- width: 100vw;
340
- height: 100vh;
341
- position: relative;
342
- }
343
- </style>
344
-
345
- ```
1
+ ## 什么是快乐“星球” ?
2
+ &emsp;&emsp;[SatEarth](https://gitee.com/gengkaibo/sat-earth)是一个三维地球组件库,目的是支持开发人员快速搭建三维场景。
3
+
4
+ ## 组件库亮点
5
+ - 内置丰富基础功能组件以及菜单组件,如果不需要定制化开发,可以分分钟出一个平台级应用系统
6
+ - 对外暴露API,可随意调用sat-earth、mars3d、cesium API 进行定制化开发
7
+ - 功能组件可配合菜单组件也可独立运行,兼顾灵活与便捷
8
+ - 对样式进行了友好的移动端适配,兼顾大屏与小屏视觉体验
9
+ - ...
10
+
11
+ ## 当前开发进度
12
+ - 1.数据源 (done)
13
+ - 2.地图部件 (done)
14
+ - 坐标信息
15
+ - 悬浮导航
16
+ - 时钟动画
17
+ - 鹰眼地图
18
+ - 3.工具栏
19
+ - 3.1.搜索定位(done)
20
+ - 地名检索
21
+ - 坐标定位
22
+ - 路径规划
23
+ - 3.2.量测工具(done)
24
+ - 坐标测量
25
+ - 空间距离
26
+ - 水平面积
27
+ - 高度测量
28
+ - 三角测量
29
+ - 方位测量
30
+ - 贴地距离
31
+ - 贴地面积
32
+ - 3.3.图上标绘(done)
33
+ - 3.4.出图工具(done)
34
+ - 3.5.空间分析
35
+ - 剖面分析
36
+ - 方量分析
37
+ - 通视分析
38
+ - 可视域分析
39
+ - 限高分析
40
+ - 缓冲分析
41
+ - 剖面分析
42
+ - 3.6.地形分析
43
+ - 挖地分析
44
+ - 等高线分析
45
+ - 坡度坡向分析
46
+ - 淹没分析
47
+ - 3.7.模型分析
48
+ - 淹没分析
49
+ - 模型压平
50
+ - 模型裁剪
51
+ - 模型剖切
52
+ - 3.8.视频融合
53
+ - 3.9.飞行漫游
54
+
55
+ ## 前序准备
56
+ - [node](http://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境
57
+ - [Vite](https://vitejs.dev/) - 熟悉 vite 特性
58
+ - [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法
59
+ - [TypeScript](https://www.typescriptlang.org/) - 熟悉 `TypeScript` 基本语法
60
+ - [Es6+](http://es6.ruanyifeng.com/) - 熟悉`es6`基本语法
61
+ - [Cesium](https://cesium.com/) - Cesium是一个开源的,基于webgl的二、三维地图引擎
62
+ - [Mars3D](http://mars3d.cn/) - 基于Cesium优化提升与B/S架构设计,支持多行业扩展的轻量级高效能GIS开发平台
63
+
64
+ ## 安装
65
+ - 首先在命令行执行如下命令添加 `sat-earth` 的依赖
66
+ ```bash
67
+ npm i sat-earth
68
+ ```
69
+
70
+ - 将 `node_modules/mars3d-cesium/Build/Cesium` 目录拷贝到我们开发目录中的public下
71
+ 然后在index.html中引入 `cesium` 库
72
+ ```html
73
+ <!--引入cesium基础lib-->
74
+ <link href="/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
75
+ <script src="/Cesium/Cesium.js" type="text/javascript"></script>
76
+ ```
77
+
78
+ - 如果您的项目也用了`pinia`,请修改您项目中的piniaStore直接使用`sat-earth`的导出,并且main.ts中不需要在调用App.use(piniaStore)
79
+ ```ts
80
+ // const piniaStore = createPinia()
81
+ // export { piniaStore }
82
+ export { piniaStore } from 'sat-earth'
83
+ ```
84
+
85
+ - 在 `main.[jt]s` 中引入我们的 `sat-earth` 资源
86
+
87
+ ```ts
88
+ import { createApp } from "vue"
89
+ import App from "./app.vue"
90
+ import satEarth from 'sat-earth'
91
+ import 'sat-earth/dist/style.css'
92
+ const app = createApp(App)
93
+
94
+ app.use(satEarth)
95
+ app.mount("#app")
96
+
97
+ ```
98
+
99
+ - 在`tsconfig.json`中的`types`加入类型声明文件`sat-earth/dist/auto-components`,来支持[Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)的类型提示
100
+ ```json
101
+ {
102
+ "compilerOptions": {
103
+ "target": "esnext", // 指定ts编译后的ECMAScript目标版本: 'es3' (default), 'es5', 'es2015', 'es2016', 'es2017', or 'esnext'
104
+ "module": "esnext", // 指定编译后代码使用的模块化规范: 'commonjs', 'amd', 'umd' or 'es...'
105
+ "declaration": false, // 是否生成声明文件
106
+ "strict": true, // 开启全部严格模式
107
+ "removeComments": true, // 删除注释
108
+ "allowJs": true, // 是否对js文件开启编译
109
+ "noImplicitAny": false, // 支持类型不标注可以默认any
110
+ "allowSyntheticDefaultImports": true, // 允许没有导出的模块中导入
111
+ "resolveJsonModule": true, // json文件是否可导入
112
+ "isolatedModules": true, // 将每个文件作为单独的模块
113
+ "useDefineForClassFields": true, // class类的变量声明方式从 = 赋值的方式变更成了Object.defineProperty;所有的字段声明都会生效,即使它没有指定默认值
114
+ "moduleResolution": "node", // 置顶模块的解析策略,'node' or 'classic'
115
+ "esModuleInterop": true, // 支持es6,commonjs模块
116
+ "skipLibCheck": true, // 跳过类库检测
117
+ "jsx": "preserve",
118
+ "lib": [
119
+ "esnext",
120
+ "dom"
121
+ ],
122
+ "types": [
123
+ "vite/client",
124
+ "sat-earth/dist/auto-components"
125
+ ],
126
+ "paths": {
127
+ "@src/*": [
128
+ "./src/*"
129
+ ]
130
+ }
131
+ },
132
+ "include": [
133
+ "**/*.ts",
134
+ "**/*.d.ts",
135
+ "**/*.vue"
136
+ ]
137
+ }
138
+ ```
139
+
140
+ ## 快速开始
141
+ ```ts
142
+ <script setup lang="ts">
143
+ import { satMapTypes, type SatMenu_Type_MenuItem } from 'sat-earth'
144
+ /*
145
+ 初始化参数尽量保证了和mars3d的Map构造一致性,但是任然有一些地方进行了小改动,具体查看类型SatMapOptions,下面请看改动:
146
+ 1. 在mars3d的Map构造参数的基础上扩展了custom对象。
147
+
148
+ custom: {
149
+ // 工具栏新增项
150
+ layoutTheme: {
151
+ primaryColor: '#409eff',
152
+ isDark: true,
153
+ showDarkRadio: true
154
+ },
155
+ toolbar: {
156
+ mapSplit: true // 开启卷帘工具
157
+ bookmark: true // 开启视角书签工具
158
+ keyboardRoam: true // 开启键盘漫游功能
159
+ },
160
+ plotModelUrlPrefix?: string // 标绘模型地址前缀
161
+ layers: {
162
+ // list 这是要加入到 'SatSource' 数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数
163
+ // 一致,通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 如果不加pid的时候或者任意添加的
164
+ // pid导致在所有图层中并没有查找到该 pid 对应图层项时,组件会给该项添加默认pid并加到树的跟节点上。
165
+ list: []
166
+ // 辅助图层
167
+ auxiliaryLayers: {
168
+ cover: boolean // 是否覆盖内置的辅助图层
169
+ list: [] // 自定义的辅助图层Layer集合
170
+ },
171
+ // 地形图层
172
+ terrainLayers: {
173
+ cover: boolean // 是否覆盖内置的地形图层
174
+ list: [] // 自定义的地形图层Layer集合
175
+ }
176
+ }
177
+ }
178
+
179
+ 2. 对mars3d的Map构造参数中原有的basemaps的传参略作了修改。
180
+
181
+ basemaps:[] => basemaps:{
182
+ cover: boolean
183
+ list: []
184
+ }
185
+ ①. 在 'sat-earth' 中加入了默认的基础底图,这里可以选择是否覆盖重写;
186
+ ②. basemaps中配置的底图最终也会出现在 'SatSource' 数据源组件中的树形结构中;
187
+
188
+
189
+ */
190
+ const options: satMapTypes.SatMapOptions = {
191
+ map3d: {
192
+ control: {
193
+ baseLayerPicker: true,
194
+ animation: false,
195
+ timeline: false
196
+ },
197
+ basemaps: {
198
+ cover: false,
199
+ list: []
200
+ },
201
+ custom: {
202
+ layoutTheme: {
203
+ primaryColor: '#409eff',
204
+ isDark: true,
205
+ showDarkRadio: true
206
+ },
207
+ toolbar: {
208
+ mapSplit: true, // 开启卷帘工具
209
+ bookmark: true, // 开启视角书签工具
210
+ keyboardRoam: true, // 开启键盘漫游功能
211
+ },
212
+ layers: {
213
+ /* list 这是要加入到数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数一致,
214
+ 通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 不加 pid 的时候或者任意添加的 pid
215
+ 导致所有图层中并没有该 pid 对应图层项时,组件会给该项添加默认的 pid,并加入到树的跟节点上。
216
+ */
217
+ list: [
218
+ {
219
+ 'id': 202012,
220
+ 'type': '3dtiles',
221
+ 'name': '石化工厂',
222
+ 'url': 'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
223
+ 'position': { 'lng': 117.077158, 'lat': 31.659116, 'alt': 24.6 },
224
+ 'maximumScreenSpaceError': 1,
225
+ 'maximumMemoryUsage': 1024,
226
+ 'highlight': { 'type': 'click', 'color': '#00FF00' },
227
+ 'popup': 'all',
228
+ 'flyTo': true,
229
+ 'scenetree': 'scenetree.json',
230
+ 'center': { 'lat': 31.654916, 'lng': 117.08278, 'alt': 279, 'heading': 316, 'pitch': -29 }
231
+ },
232
+ ],
233
+ // 辅助图层
234
+ auxiliaryLayers: {
235
+ cover: false, // 是否覆盖内置的辅助图层
236
+ list: [] // 自定义的辅助图层Layer集合
237
+ },
238
+ // 地形图层
239
+ terrainLayers: {
240
+ cover: false, // 是否覆盖内置的地形图层
241
+ list: [] // 自定义的地形图层Layer集合
242
+ },
243
+ },
244
+ },
245
+ },
246
+ }
247
+
248
+ const isSourceVisible = ref(true)
249
+
250
+ const treeData = ref<SatMenu_Type_MenuItem[]>([
251
+ {
252
+ name: 'hello',
253
+ label: '你好',
254
+ icon: {
255
+ class: 'fa-commenting-o',
256
+ },
257
+ enable: false,
258
+ active: false
259
+ },
260
+ ])
261
+ const changeDataToEnable = (item: SatMenu_Type_MenuItem) => {
262
+ item.enable = true
263
+ item.active = true
264
+ console.log('do init...')
265
+ }
266
+ const changeDataToUnEnable = (item: SatMenu_Type_MenuItem) => {
267
+ item.enable = false
268
+ item.active = false
269
+ console.log('do destroy...')
270
+ }
271
+
272
+ const isMounted = ref(false)
273
+ onMounted(() => {
274
+ isMounted.value = true
275
+ })
276
+ </script>
277
+ ```
278
+ ```html
279
+ <template>
280
+ <SatGlobe
281
+ v-if="isMounted"
282
+ :sat-map-options="options"
283
+ >
284
+ <SatMenu>
285
+ <SatSource></SatSource>
286
+ <SatMapPart></SatMapPart>
287
+ <SatLocation></SatLocation>
288
+ <SatMeasure></SatMeasure>
289
+ <SatPlot></SatPlot>
290
+ <SatPicture></SatPicture>
291
+ <SatSpatialAnalysis></SatSpatialAnalysis>
292
+ <SatTerrainAnalysis></SatTerrainAnalysis>
293
+ <SatModelAnalysis></SatModelAnalysis>
294
+ <SatVideoFusion></SatVideoFusion>
295
+ <SatRoam></SatRoam>
296
+ <!-- 自定义菜单项 -->
297
+ <template #custom-enable>
298
+ <SatMenuTree
299
+ :custom="true"
300
+ show-type="enabled"
301
+ :tree-data="treeData.filter((i) => i.enable)"
302
+ @custom-click="changeDataToEnable"
303
+ @custom-close-click="changeDataToUnEnable"
304
+ ></SatMenuTree>
305
+ </template>
306
+ <template #custom>
307
+ <SatMenuTree
308
+ :custom="true"
309
+ :tree-data="treeData"
310
+ @custom-click="changeDataToEnable"
311
+ ></SatMenuTree>
312
+ </template>
313
+ </SatMenu>
314
+
315
+ <!-- 使用SatPanel 面板组件 配合自定义菜单项完成自定义功能面板的开发-->
316
+ <!-- <SatPanel
317
+ v-if="treeData.filter(item=>item.name=='hello')[0].enable"
318
+ v-show="treeData.filter(item=>item.name=='hello')[0].active"
319
+ title="你好啊"
320
+ :close-event="()=>{treeData.filter(item=>item.name=='hello')[0].enable = false}"
321
+ :minimize-event="()=>{treeData.filter(item=>item.name=='hello')[0].active = false}"
322
+ >
323
+ 内容
324
+ </SatPanel> -->
325
+
326
+ <!-- 在内置的menu外部使用组件 -->
327
+ <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
328
+ </SatGlobe>
329
+ <!-- 在SatGlobe外部无法使用组件 -->
330
+ <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
331
+ </template>
332
+ <style>
333
+ body {
334
+ margin: 0;
335
+ padding: 0;
336
+ }
337
+
338
+ #app {
339
+ width: 100vw;
340
+ height: 100vh;
341
+ position: relative;
342
+ }
343
+ </style>
344
+
345
+ ```