sat-earth 0.4.4 → 0.4.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.
Files changed (2) hide show
  1. package/README.md +391 -393
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,393 +1,391 @@
1
- ## 什么是快乐“星球” ?
2
-   [SatEarth](https://gitee.com/gengkaibo/sat-earth)是基于 [Mars3D](http://mars3d.cn/) 和 [Cesium](https://cesium.com/) 的底层API,实现的一个开源三维地球组件库,目的是支持开发人员快速搭建三维场景,目前尚在搭建中,后续会封装符合扩展性、通用性、健壮性的组件,以及完善guide文档。
3
-
4
- ## 前序准备
5
- - [node](http://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境
6
- - [Vite](https://vitejs.dev/) - 熟悉 vite 特性
7
- - [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法
8
- - [TypeScript](https://www.typescriptlang.org/) - 熟悉 `TypeScript` 基本语法
9
- - [Es6+](http://es6.ruanyifeng.com/) - 熟悉`es6`基本语法
10
- - [Cesium](https://cesium.com/) - Cesium是一个开源的,基于webgl的二、三维地图引擎
11
- - [Mars3D](http://mars3d.cn/) - 基于Cesium优化提升与B/S架构设计,支持多行业扩展的轻量级高效能GIS开发平台
12
-
13
- ## 尝鲜
14
- - 首先在命令行执行如下命令添加 `sat-earth` 的依赖
15
- ```bash
16
- npm i sat-earth
17
- ```
18
-
19
- - 将 `node_modules/mars3d-cesium/Build/Cesium` 目录拷贝到我们开发目录中的public下
20
- 然后在index.html中引入 `cesium` 库
21
- ```html
22
- <!--引入cesium基础lib-->
23
- <link href="/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
24
- <script src="/Cesium/Cesium.js" type="text/javascript"></script>
25
- ```
26
-
27
- - 在 `main.[jt]s` 中全量引入我们的 `sat-earth` 资源
28
-
29
- ```ts
30
- import { createApp } from "vue"
31
- import App from "./app.vue"
32
- import satEarth from 'sat-earth'
33
- import 'sat-earth/dist/style.css'
34
- const app = createApp(App)
35
-
36
- app.use(satEarth)
37
- app.mount("#app")
38
-
39
- ```
40
- - 因为sat-earth组件库使用按需自动导入的形式依赖了element-plus组件库的部分组件,如果您也在项目中使用element-plus组件库,请尽量使用[`按需自动导入`](https://element-plus.gitee.io/zh-CN/guide/quickstart.html#%E6%8C%89%E9%9C%80%E5%AF%BC%E5%85%A5)的形式,自动导入配置示例:
41
- ```ts
42
- import { defineConfig } from 'vite'
43
- import { resolve } from 'path'
44
- import vue from '@vitejs/plugin-vue'
45
- import DefineOptions from 'unplugin-vue-define-options/vite' // 支持在vue3 script setup语法中写入options API,如:给组件添加name
46
- import AutoImport from 'unplugin-auto-import/vite' // 函数自动导入,当前用于vite打包,如果是库模式开发请用 unplugin-auto-import/rollup
47
- import Components from 'unplugin-vue-components/vite' // 组件自动导入,当前用于vite打包,如果是库模式开发请用 unplugin-vue-components/rollup
48
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // element-plus的自动注册自动导入解析器
49
- export default defineConfig({
50
- base: '/',
51
- publicDir: 'public',
52
- resolve: {
53
- alias: {
54
- '@packages': resolve(__dirname, 'packages'),
55
- }
56
- },
57
- plugins: [
58
- DefineOptions(),
59
- vue(),
60
- AutoImport({
61
- imports: [
62
- 'vue',
63
- '@vueuse/core',
64
- 'pinia',
65
- ],
66
- dts: 'typings/auto-import.d.ts'
67
- }),
68
- Components({
69
- resolvers: [ElementPlusResolver()], // 自动暴露组件
70
- dts: 'typings/components.d.ts',
71
- }),
72
- ], // 编译vue
73
- server: {
74
- port: 8888,
75
- }
76
- })
77
-
78
- ```
79
-
80
- - 在`tsconfig.json`中引入类型声明文件`sat-earth/dist/packages/global`,来支持[Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)的代码提示功能
81
- ```json
82
- {
83
- "compilerOptions": {
84
- "target": "esnext", // 指定ts编译后的ECMAScript目标版本: 'es3' (default), 'es5', 'es2015', 'es2016', 'es2017', or 'esnext'
85
- "module": "esnext", // 指定编译后代码使用的模块化规范: 'commonjs', 'amd', 'umd' or 'es...'
86
- "declaration": false, // 是否生成声明文件
87
- "strict": true, // 开启全部严格模式
88
- "removeComments": true, // 删除注释
89
- "allowJs": true, // 是否对js文件开启编译
90
- "noImplicitAny": false, // 支持类型不标注可以默认any
91
- "allowSyntheticDefaultImports": true, // 允许没有导出的模块中导入
92
- "resolveJsonModule": true, // json文件是否可导入
93
- "isolatedModules": true, // 将每个文件作为单独的模块
94
- "useDefineForClassFields": true, // class类的变量声明方式从 = 赋值的方式变更成了Object.defineProperty;所有的字段声明都会生效,即使它没有指定默认值
95
- "moduleResolution": "node", // 置顶模块的解析策略,'node' or 'classic'
96
- "esModuleInterop": true, // 支持es6,commonjs模块
97
- "skipLibCheck": true, // 跳过类库检测
98
- "jsx": "preserve",
99
- "lib": [
100
- "esnext",
101
- "dom"
102
- ],
103
- "types": [
104
- "vite/client",
105
- "sat-earth/dist/packages/global"
106
- ],
107
- "paths": {
108
- "@src/*": [
109
- "./src/*"
110
- ]
111
- }
112
- },
113
- "include": [
114
- "**/*.ts",
115
- "**/*.d.ts",
116
- "**/*.vue"
117
- ]
118
- }
119
- ```
120
-
121
- - 开始使用,组件化调用`<SatGlobe></SatGlobe>`,或者调用 `sat-earth` 暴露的方法,例:
122
- ```ts
123
- <script setup lang="ts">
124
- import { SatMapTypes, type MenuItem } from 'sat-earth'
125
- /*
126
- 初始化参数尽量保证了和mars3d的Map构造一致性,但是任然有一些地方进行了小改动,下面请看
127
- 改动:
128
- 1. 在mars3d的Map构造参数的基础上扩展了custom对象。
129
-
130
- custom: {
131
- // 工具栏新增项
132
- toolbar: {
133
- mapSplit: true, // 开启卷帘工具
134
- bookmark: true, // 开启视角书签工具
135
- keyboardRoam: true, // 开启键盘漫游功能
136
- },
137
- layers: {
138
- // list 这是要加入到 'SatSource' 数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数
139
- // 一致,通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 如果不加pid的时候或者任意添加的
140
- // pid导致在所有图层中并没有查找到该 pid 对应图层项时,组件会给该项添加默认pid并加到树的跟节点上。
141
- list: [],
142
- // 辅助图层
143
- auxiliaryLayers: {
144
- cover: boolean, // 是否覆盖内置的辅助图层
145
- list: [] // 自定义的辅助图层Layer集合
146
- },
147
- // 地形图层
148
- terrainLayers: {
149
- cover: boolean, // 是否覆盖内置的地形图层
150
- list: [] // 自定义的地形图层Layer集合
151
- }
152
- }
153
- }
154
-
155
- 2. 对mars3d的Map构造参数中原有的basemaps的传参略作了修改。
156
-
157
- basemaps:[] => basemaps:{
158
- cover: boolean,
159
- list: []
160
- }
161
- ①. 在 'sat-earth' 中加入了默认的基础底图,这里可以选择是否覆盖重写;
162
- ②. basemaps中配置的底图最终也会出现在 'SatSource' 数据源组件中的树形结构中;
163
-
164
-
165
- */
166
- const options: SatMapTypes.SatMapOptions = {
167
- map3d: {
168
- control: {
169
- baseLayerPicker: true,
170
- animation: false,
171
- timeline: false
172
- },
173
- basemaps: {
174
- cover: false,
175
- list: []
176
- },
177
- custom: {
178
- toolbar: {
179
- mapSplit: true, // 开启卷帘工具
180
- bookmark: true, // 开启视角书签工具
181
- keyboardRoam: true, // 开启键盘漫游功能
182
- },
183
- layers: {
184
- /* list 这是要加入到数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数一致,
185
- 通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 不加 pid 的时候或者任意添加的 pid
186
- 导致所有图层中并没有该 pid 对应图层项时,组件会给该项添加默认的 pid,并加入到树的跟节点上。
187
- */
188
- list: [
189
- {
190
- 'id': 202012,
191
- 'type': '3dtiles',
192
- 'name': '石化工厂',
193
- 'url': 'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
194
- 'position': { 'lng': 117.077158, 'lat': 31.659116, 'alt': 24.6 },
195
- 'maximumScreenSpaceError': 1,
196
- 'maximumMemoryUsage': 1024,
197
- 'highlight': { 'type': 'click', 'color': '#00FF00' },
198
- 'popup': 'all',
199
- 'flyTo': true,
200
- 'scenetree': 'scenetree.json',
201
- 'center': { 'lat': 31.654916, 'lng': 117.08278, 'alt': 279, 'heading': 316, 'pitch': -29 }
202
- },
203
- ],
204
- // 辅助图层
205
- auxiliaryLayers: {
206
- cover: false, // 是否覆盖内置的辅助图层
207
- list: [] // 自定义的辅助图层Layer集合
208
- },
209
- // 地形图层
210
- terrainLayers: {
211
- cover: false, // 是否覆盖内置的地形图层
212
- list: [] // 自定义的地形图层Layer集合
213
- },
214
- },
215
- },
216
- },
217
- }
218
-
219
- const isSourceVisible = ref(true)
220
-
221
- const treeData = ref<MenuItem[]>([
222
- {
223
- name: 'hello',
224
- label: '你好',
225
- icon: {
226
- class: 'fa-commenting-o',
227
- },
228
- enable: false,
229
- active: false
230
- },
231
- ])
232
- const changeDataToEnable = (item: MenuItem) => {
233
- item.enable = true
234
- item.active = true
235
- console.log('do init...')
236
- }
237
- const changeDataToUnEnable = (item: MenuItem) => {
238
- item.enable = false
239
- item.active = false
240
- console.log('do destroy...')
241
- }
242
-
243
- const isMounted = ref(false)
244
- onMounted(() => {
245
- isMounted.value = true
246
- })
247
- </script>
248
- ```
249
- ```html
250
- <template>
251
- <SatGlobe
252
- v-if="isMounted"
253
- :sat-map-options="options"
254
- >
255
- <SatMenu>
256
- <SatSource></SatSource>
257
- <SatMapPart></SatMapPart>
258
- <SatLocation></SatLocation>
259
- <SatMeasure></SatMeasure>
260
- <SatPlot></SatPlot>
261
- <SatPicture></SatPicture>
262
- <SatSpatialAnalysis></SatSpatialAnalysis>
263
- <SatTerrainAnalysis></SatTerrainAnalysis>
264
- <SatModelAnalysis></SatModelAnalysis>
265
- <SatVideoFusion></SatVideoFusion>
266
- <SatRoam></SatRoam>
267
- <SatBallistic></SatBallistic>
268
- <!-- 自定义菜单项 -->
269
- <template #custom-enable>
270
- <SatMenuTree
271
- :custom="true"
272
- show-type="enabled"
273
- :tree-data="treeData.filter((i) => i.enable)"
274
- @custom-click="changeDataToEnable"
275
- @custom-close-click="changeDataToUnEnable"
276
- ></SatMenuTree>
277
- </template>
278
- <template #custom>
279
- <SatMenuTree
280
- :custom="true"
281
- :tree-data="treeData"
282
- @custom-click="changeDataToEnable"
283
- ></SatMenuTree>
284
- </template>
285
- </SatMenu>
286
-
287
- <!-- 使用SatPanel 面板组件 配合自定义菜单项完成自定义功能面板的开发-->
288
- <!-- <SatPanel
289
- v-if="treeData.filter(item=>item.name=='hello')[0].enable"
290
- v-show="treeData.filter(item=>item.name=='hello')[0].active"
291
- title="你好啊"
292
- :close-event="()=>{treeData.filter(item=>item.name=='hello')[0].enable = false}"
293
- :minimize-event="()=>{treeData.filter(item=>item.name=='hello')[0].active = false}"
294
- >
295
- 内容
296
- </SatPanel> -->
297
-
298
- <!-- 在内置的menu外部使用组件 -->
299
- <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
300
- </SatGlobe>
301
- <!-- 在SatGlobe外部无法使用组件 -->
302
- <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
303
- </template>
304
- <style>
305
- body {
306
- margin: 0;
307
- padding: 0;
308
- }
309
-
310
- #app {
311
- width: 100vw;
312
- height: 100vh;
313
- position: relative;
314
- }
315
- </style>
316
-
317
- ```
318
- ## 菜单计划
319
- - 1.数据源 (done)
320
- - 2.地图部件 (done)
321
- - 坐标信息
322
- - 悬浮导航
323
- - 时钟动画
324
- - 鹰眼地图
325
- - 3.工具栏
326
- - 3.1.搜索定位(done)
327
- - 地名检索
328
- - 坐标定位
329
- - 路径规划
330
- - 3.2.量测工具(done)
331
- - 坐标测量
332
- - 空间距离
333
- - 水平面积
334
- - 高度测量
335
- - 三角测量
336
- - 方位测量
337
- - 贴地距离
338
- - 贴地面积
339
- - 3.3.图上标绘(done)
340
- - 3.4.出图工具(done)
341
- - 一键出图
342
- - 自定义出图
343
- - 3.5.空间分析
344
- - 剖面分析
345
- - 方量分析
346
- - 通视分析
347
- - 可视域分析
348
- - 限高分析
349
- - 缓冲分析
350
- - 剖面分析
351
- - 3.6.地形分析
352
- - 挖地分析
353
- - 等高线分析
354
- - 坡度坡向分析
355
- - 淹没分析
356
- - 3.7.模型分析
357
- - 淹没分析
358
- - 模型压平
359
- - 模型裁剪
360
- - 模型剖切
361
- - 3.8.视频融合
362
- - 4.模拟仿真
363
- - 4.1.飞行漫游
364
- - 4.2.曲率弹道
365
-
366
- ## 其他说明
367
- 这是我第一次搭建组件库,目前状态是有时间就会写点儿,平时还要工作,所以无法保证开发进度,当然有一部分原因其实是把这次搭建组件库作为一种学习方式。如果您有什么问题或者见解欢迎指正和讨论。微信号:`KaiboGeng`
368
-
369
- ## 如何贡献
370
- 你可以[提一个 issue](https://gitee.com/gengkaibo/sat-earth/issues) 或者提交一个 Pull Request
371
-
372
- #### Pull Request
373
-
374
- 1. Fork 代码!
375
- 2. 创建自己的分支: `git checkout -b feat/xxxx`
376
- 3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'`
377
- 4. 推送您的分支: `git push origin feat/xxxx`
378
- 5. 提交`pull request`
379
-
380
- #### Git 贡献提交规范,参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范
381
- - `feat` 增加新功能
382
- - `fix` 修复问题/BUG
383
- - `style` 代码风格相关无影响运行结果的
384
- - `perf` 优化/性能提升
385
- - `refactor` 重构
386
- - `polish` 修改
387
- - `revert` 撤销修改
388
- - `test` 测试相关
389
- - `docs` 文档/注释
390
- - `chore` 依赖更新/脚手架配置修改等
391
- - `workflow` 工作流改进
392
- - `ci` 持续集成
393
- - `types` 类型定义文件更改
1
+ ## 什么是快乐“星球” ?
2
+ &emsp;&emsp;[SatEarth](https://gitee.com/gengkaibo/sat-earth)是基于 [Mars3D](http://mars3d.cn/) 和 [Cesium](https://cesium.com/) 的底层API,实现的一个开源三维地球组件库,目的是支持开发人员快速搭建三维场景,目前尚在搭建中,后续会封装符合扩展性、通用性、健壮性的组件,以及完善guide文档。
3
+
4
+ ## 前序准备
5
+ - [node](http://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境
6
+ - [Vite](https://vitejs.dev/) - 熟悉 vite 特性
7
+ - [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法
8
+ - [TypeScript](https://www.typescriptlang.org/) - 熟悉 `TypeScript` 基本语法
9
+ - [Es6+](http://es6.ruanyifeng.com/) - 熟悉`es6`基本语法
10
+ - [Cesium](https://cesium.com/) - Cesium是一个开源的,基于webgl的二、三维地图引擎
11
+ - [Mars3D](http://mars3d.cn/) - 基于Cesium优化提升与B/S架构设计,支持多行业扩展的轻量级高效能GIS开发平台
12
+
13
+ ## 尝鲜
14
+ - 首先在命令行执行如下命令添加 `sat-earth` 的依赖
15
+ ```bash
16
+ npm i sat-earth
17
+ ```
18
+
19
+ - 将 `node_modules/mars3d-cesium/Build/Cesium` 目录拷贝到我们开发目录中的public下
20
+ 然后在index.html中引入 `cesium` 库
21
+ ```html
22
+ <!--引入cesium基础lib-->
23
+ <link href="/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
24
+ <script src="/Cesium/Cesium.js" type="text/javascript"></script>
25
+ ```
26
+
27
+ - 在 `main.[jt]s` 中全量引入我们的 `sat-earth` 资源
28
+
29
+ ```ts
30
+ import { createApp } from "vue"
31
+ import App from "./app.vue"
32
+ import satEarth from 'sat-earth'
33
+ import 'sat-earth/dist/style.css'
34
+ const app = createApp(App)
35
+
36
+ app.use(satEarth)
37
+ app.mount("#app")
38
+
39
+ ```
40
+ - 因为sat-earth组件库使用按需自动导入的形式依赖了element-plus组件库的部分组件,如果您也在项目中使用element-plus组件库,请尽量使用[`按需自动导入`](https://element-plus.gitee.io/zh-CN/guide/quickstart.html#%E6%8C%89%E9%9C%80%E5%AF%BC%E5%85%A5)的形式,自动导入配置示例:
41
+ ```ts
42
+ import { defineConfig } from 'vite'
43
+ import { resolve } from 'path'
44
+ import vue from '@vitejs/plugin-vue'
45
+ import DefineOptions from 'unplugin-vue-define-options/vite' // 支持在vue3 script setup语法中写入options API,如:给组件添加name
46
+ import AutoImport from 'unplugin-auto-import/vite' // 函数自动导入,当前用于vite打包,如果是库模式开发请用 unplugin-auto-import/rollup
47
+ import Components from 'unplugin-vue-components/vite' // 组件自动导入,当前用于vite打包,如果是库模式开发请用 unplugin-vue-components/rollup
48
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // element-plus的自动注册自动导入解析器
49
+ export default defineConfig({
50
+ base: '/',
51
+ publicDir: 'public',
52
+ resolve: {
53
+ alias: {
54
+ '@packages': resolve(__dirname, 'packages'),
55
+ }
56
+ },
57
+ plugins: [
58
+ DefineOptions(),
59
+ vue(),
60
+ AutoImport({
61
+ imports: [
62
+ 'vue',
63
+ '@vueuse/core',
64
+ 'pinia',
65
+ ],
66
+ dts: 'typings/auto-import.d.ts'
67
+ }),
68
+ Components({
69
+ resolvers: [ElementPlusResolver()], // 自动暴露组件
70
+ dts: 'typings/components.d.ts',
71
+ }),
72
+ ], // 编译vue
73
+ server: {
74
+ port: 8888,
75
+ }
76
+ })
77
+
78
+ ```
79
+
80
+ - 在`tsconfig.json`中引入类型声明文件`sat-earth/dist/packages/global`,来支持[Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)的代码提示功能
81
+ ```json
82
+ {
83
+ "compilerOptions": {
84
+ "target": "esnext", // 指定ts编译后的ECMAScript目标版本: 'es3' (default), 'es5', 'es2015', 'es2016', 'es2017', or 'esnext'
85
+ "module": "esnext", // 指定编译后代码使用的模块化规范: 'commonjs', 'amd', 'umd' or 'es...'
86
+ "declaration": false, // 是否生成声明文件
87
+ "strict": true, // 开启全部严格模式
88
+ "removeComments": true, // 删除注释
89
+ "allowJs": true, // 是否对js文件开启编译
90
+ "noImplicitAny": false, // 支持类型不标注可以默认any
91
+ "allowSyntheticDefaultImports": true, // 允许没有导出的模块中导入
92
+ "resolveJsonModule": true, // json文件是否可导入
93
+ "isolatedModules": true, // 将每个文件作为单独的模块
94
+ "useDefineForClassFields": true, // class类的变量声明方式从 = 赋值的方式变更成了Object.defineProperty;所有的字段声明都会生效,即使它没有指定默认值
95
+ "moduleResolution": "node", // 置顶模块的解析策略,'node' or 'classic'
96
+ "esModuleInterop": true, // 支持es6,commonjs模块
97
+ "skipLibCheck": true, // 跳过类库检测
98
+ "jsx": "preserve",
99
+ "lib": [
100
+ "esnext",
101
+ "dom"
102
+ ],
103
+ "types": [
104
+ "vite/client",
105
+ "sat-earth/dist/packages/global"
106
+ ],
107
+ "paths": {
108
+ "@src/*": [
109
+ "./src/*"
110
+ ]
111
+ }
112
+ },
113
+ "include": [
114
+ "**/*.ts",
115
+ "**/*.d.ts",
116
+ "**/*.vue"
117
+ ]
118
+ }
119
+ ```
120
+
121
+ - 开始使用,组件化调用`<SatGlobe></SatGlobe>`,或者调用 `sat-earth` 暴露的方法,例:
122
+ ```ts
123
+ <script setup lang="ts">
124
+ import { SatMapTypes, type MenuItem } from 'sat-earth'
125
+ /*
126
+ 初始化参数尽量保证了和mars3d的Map构造一致性,但是任然有一些地方进行了小改动,下面请看
127
+ 改动:
128
+ 1. 在mars3d的Map构造参数的基础上扩展了custom对象。
129
+
130
+ custom: {
131
+ // 工具栏新增项
132
+ toolbar: {
133
+ mapSplit: true, // 开启卷帘工具
134
+ bookmark: true, // 开启视角书签工具
135
+ keyboardRoam: true, // 开启键盘漫游功能
136
+ },
137
+ layers: {
138
+ // list 这是要加入到 'SatSource' 数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数
139
+ // 一致,通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 如果不加pid的时候或者任意添加的
140
+ // pid导致在所有图层中并没有查找到该 pid 对应图层项时,组件会给该项添加默认pid并加到树的跟节点上。
141
+ list: [],
142
+ // 辅助图层
143
+ auxiliaryLayers: {
144
+ cover: boolean, // 是否覆盖内置的辅助图层
145
+ list: [] // 自定义的辅助图层Layer集合
146
+ },
147
+ // 地形图层
148
+ terrainLayers: {
149
+ cover: boolean, // 是否覆盖内置的地形图层
150
+ list: [] // 自定义的地形图层Layer集合
151
+ }
152
+ }
153
+ }
154
+
155
+ 2. 对mars3d的Map构造参数中原有的basemaps的传参略作了修改。
156
+
157
+ basemaps:[] => basemaps:{
158
+ cover: boolean,
159
+ list: []
160
+ }
161
+ ①. 在 'sat-earth' 中加入了默认的基础底图,这里可以选择是否覆盖重写;
162
+ ②. basemaps中配置的底图最终也会出现在 'SatSource' 数据源组件中的树形结构中;
163
+
164
+
165
+ */
166
+ const options: SatMapTypes.SatMapOptions = {
167
+ map3d: {
168
+ control: {
169
+ baseLayerPicker: true,
170
+ animation: false,
171
+ timeline: false
172
+ },
173
+ basemaps: {
174
+ cover: false,
175
+ list: []
176
+ },
177
+ custom: {
178
+ toolbar: {
179
+ mapSplit: true, // 开启卷帘工具
180
+ bookmark: true, // 开启视角书签工具
181
+ keyboardRoam: true, // 开启键盘漫游功能
182
+ },
183
+ layers: {
184
+ /* list 这是要加入到数据源管理中的自定义Layer图层,参数与 mars3d构造 Layer 的参数一致,
185
+ 通过 'id/pid' 在 'SatSource' 组件中形成对应的树形结构, 不加 pid 的时候或者任意添加的 pid
186
+ 导致所有图层中并没有该 pid 对应图层项时,组件会给该项添加默认的 pid,并加入到树的跟节点上。
187
+ */
188
+ list: [
189
+ {
190
+ 'id': 202012,
191
+ 'type': '3dtiles',
192
+ 'name': '石化工厂',
193
+ 'url': 'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
194
+ 'position': { 'lng': 117.077158, 'lat': 31.659116, 'alt': 24.6 },
195
+ 'maximumScreenSpaceError': 1,
196
+ 'maximumMemoryUsage': 1024,
197
+ 'highlight': { 'type': 'click', 'color': '#00FF00' },
198
+ 'popup': 'all',
199
+ 'flyTo': true,
200
+ 'scenetree': 'scenetree.json',
201
+ 'center': { 'lat': 31.654916, 'lng': 117.08278, 'alt': 279, 'heading': 316, 'pitch': -29 }
202
+ },
203
+ ],
204
+ // 辅助图层
205
+ auxiliaryLayers: {
206
+ cover: false, // 是否覆盖内置的辅助图层
207
+ list: [] // 自定义的辅助图层Layer集合
208
+ },
209
+ // 地形图层
210
+ terrainLayers: {
211
+ cover: false, // 是否覆盖内置的地形图层
212
+ list: [] // 自定义的地形图层Layer集合
213
+ },
214
+ },
215
+ },
216
+ },
217
+ }
218
+
219
+ const isSourceVisible = ref(true)
220
+
221
+ const treeData = ref<MenuItem[]>([
222
+ {
223
+ name: 'hello',
224
+ label: '你好',
225
+ icon: {
226
+ class: 'fa-commenting-o',
227
+ },
228
+ enable: false,
229
+ active: false
230
+ },
231
+ ])
232
+ const changeDataToEnable = (item: MenuItem) => {
233
+ item.enable = true
234
+ item.active = true
235
+ console.log('do init...')
236
+ }
237
+ const changeDataToUnEnable = (item: MenuItem) => {
238
+ item.enable = false
239
+ item.active = false
240
+ console.log('do destroy...')
241
+ }
242
+
243
+ const isMounted = ref(false)
244
+ onMounted(() => {
245
+ isMounted.value = true
246
+ })
247
+ </script>
248
+ ```
249
+ ```html
250
+ <template>
251
+ <SatGlobe
252
+ v-if="isMounted"
253
+ :sat-map-options="options"
254
+ >
255
+ <SatMenu>
256
+ <SatSource></SatSource>
257
+ <SatMapPart></SatMapPart>
258
+ <SatLocation></SatLocation>
259
+ <SatMeasure></SatMeasure>
260
+ <SatPlot></SatPlot>
261
+ <SatPicture></SatPicture>
262
+ <SatSpatialAnalysis></SatSpatialAnalysis>
263
+ <SatTerrainAnalysis></SatTerrainAnalysis>
264
+ <SatModelAnalysis></SatModelAnalysis>
265
+ <SatVideoFusion></SatVideoFusion>
266
+ <SatRoam></SatRoam>
267
+ <SatBallistic></SatBallistic>
268
+ <!-- 自定义菜单项 -->
269
+ <template #custom-enable>
270
+ <SatMenuTree
271
+ :custom="true"
272
+ show-type="enabled"
273
+ :tree-data="treeData.filter((i) => i.enable)"
274
+ @custom-click="changeDataToEnable"
275
+ @custom-close-click="changeDataToUnEnable"
276
+ ></SatMenuTree>
277
+ </template>
278
+ <template #custom>
279
+ <SatMenuTree
280
+ :custom="true"
281
+ :tree-data="treeData"
282
+ @custom-click="changeDataToEnable"
283
+ ></SatMenuTree>
284
+ </template>
285
+ </SatMenu>
286
+
287
+ <!-- 使用SatPanel 面板组件 配合自定义菜单项完成自定义功能面板的开发-->
288
+ <!-- <SatPanel
289
+ v-if="treeData.filter(item=>item.name=='hello')[0].enable"
290
+ v-show="treeData.filter(item=>item.name=='hello')[0].active"
291
+ title="你好啊"
292
+ :close-event="()=>{treeData.filter(item=>item.name=='hello')[0].enable = false}"
293
+ :minimize-event="()=>{treeData.filter(item=>item.name=='hello')[0].active = false}"
294
+ >
295
+ 内容
296
+ </SatPanel> -->
297
+
298
+ <!-- 在内置的menu外部使用组件 -->
299
+ <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
300
+ </SatGlobe>
301
+ <!-- 在SatGlobe外部无法使用组件 -->
302
+ <!-- <SatSource v-model:visible="isSourceVisible"></SatSource> -->
303
+ </template>
304
+ <style>
305
+ body {
306
+ margin: 0;
307
+ padding: 0;
308
+ }
309
+
310
+ #app {
311
+ width: 100vw;
312
+ height: 100vh;
313
+ position: relative;
314
+ }
315
+ </style>
316
+
317
+ ```
318
+ ## 菜单计划
319
+ - 1.数据源 (done)
320
+ - 2.地图部件 (done)
321
+ - 坐标信息
322
+ - 悬浮导航
323
+ - 时钟动画
324
+ - 鹰眼地图
325
+ - 3.工具栏
326
+ - 3.1.搜索定位(done)
327
+ - 地名检索
328
+ - 坐标定位
329
+ - 路径规划
330
+ - 3.2.量测工具(done)
331
+ - 坐标测量
332
+ - 空间距离
333
+ - 水平面积
334
+ - 高度测量
335
+ - 三角测量
336
+ - 方位测量
337
+ - 贴地距离
338
+ - 贴地面积
339
+ - 3.3.图上标绘(done)
340
+ - 3.4.出图工具(done)
341
+ - 3.5.空间分析
342
+ - 剖面分析
343
+ - 方量分析
344
+ - 通视分析
345
+ - 可视域分析
346
+ - 限高分析
347
+ - 缓冲分析
348
+ - 剖面分析
349
+ - 3.6.地形分析
350
+ - 挖地分析
351
+ - 等高线分析
352
+ - 坡度坡向分析
353
+ - 淹没分析
354
+ - 3.7.模型分析
355
+ - 淹没分析
356
+ - 模型压平
357
+ - 模型裁剪
358
+ - 模型剖切
359
+ - 3.8.视频融合
360
+ - 4.模拟仿真
361
+ - 4.1.飞行漫游
362
+ - 4.2.曲率弹道
363
+
364
+ ## 其他说明
365
+ 这是我第一次搭建组件库,目前状态是有时间就会写点儿,平时还要工作,所以无法保证开发进度,当然有一部分原因其实是把这次搭建组件库作为一种学习方式。如果您有什么问题或者见解欢迎指正和讨论。微信号:`KaiboGeng`
366
+
367
+ ## 如何贡献
368
+ 你可以[提一个 issue](https://gitee.com/gengkaibo/sat-earth/issues) 或者提交一个 Pull Request。
369
+
370
+ #### Pull Request
371
+
372
+ 1. Fork 代码!
373
+ 2. 创建自己的分支: `git checkout -b feat/xxxx`
374
+ 3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'`
375
+ 4. 推送您的分支: `git push origin feat/xxxx`
376
+ 5. 提交`pull request`
377
+
378
+ #### Git 贡献提交规范,参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范
379
+ - `feat` 增加新功能
380
+ - `fix` 修复问题/BUG
381
+ - `style` 代码风格相关无影响运行结果的
382
+ - `perf` 优化/性能提升
383
+ - `refactor` 重构
384
+ - `polish` 修改
385
+ - `revert` 撤销修改
386
+ - `test` 测试相关
387
+ - `docs` 文档/注释
388
+ - `chore` 依赖更新/脚手架配置修改等
389
+ - `workflow` 工作流改进
390
+ - `ci` 持续集成
391
+ - `types` 类型定义文件更改
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sat-earth",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "private": false,
5
5
  "description": "The sat-earth is a digital earth component library based on mars3d and cesium.",
6
6
  "main": "dist/sat-earth.umd.js",