cesium_dev_kit 1.0.71 → 1.0.72
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 +93 -95
- package/dist/index.js +2 -2
- package/dist/index.min.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[![Build Status][build-main]][build-status]
|
|
4
4
|
[![NPM Package][npm]][npm-url]
|
|
5
|
-
[![Build Size][build-size]][build-size-url]
|
|
6
5
|
[![NPM DownloadsWeekly][npm-download]][npmtrends-url]
|
|
6
|
+
[![Build Size][build-size]][build-size-url]
|
|
7
|
+
[![GitHub Repo stars][repo-stars]][build-status]
|
|
7
8
|
[![license][license-uri]][license-link]
|
|
8
9
|
|
|
9
10
|
## 简介
|
|
@@ -32,63 +33,99 @@
|
|
|
32
33
|
## 安装
|
|
33
34
|
|
|
34
35
|
```shell
|
|
35
|
-
|
|
36
|
-
npm install cesium_dev_kit
|
|
37
|
-
|
|
36
|
+
npm install cesium_dev_kit
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
## 引入
|
|
41
40
|
|
|
42
41
|
```
|
|
43
|
-
|
|
44
|
-
import { initCesium } from 'cesium_dev_kit'
|
|
45
|
-
|
|
42
|
+
import { initCesium } from 'cesium_dev_kit'
|
|
46
43
|
```
|
|
47
44
|
|
|
48
45
|
## 使用
|
|
49
46
|
|
|
50
|
-
### 1
|
|
47
|
+
### 1、完整引入
|
|
48
|
+
|
|
49
|
+
通过初始化`initCesium` 可以获取到所有扩展模块
|
|
50
|
+
|
|
51
|
+
### 1.1 initCesium 参数配置
|
|
52
|
+
|
|
53
|
+
| Property | Type | Description | Default Value |
|
|
54
|
+
| -------------- | ------ | ----------------------------------------------------------------------------- | ------------- |
|
|
55
|
+
| cesiumGlobal | Object | Ceiusm 对象 | '' |
|
|
56
|
+
| containerId | String | dom 容器 id | '' |
|
|
57
|
+
| viewerConfig | Object | viewer 基础配置(与官网一致) | {} |
|
|
58
|
+
| extreaConfig | Object | 额外参数配置,如 {logo:true// 是否显示 logo, depthTest:true //开启深度检测} | {} |
|
|
59
|
+
| MapImageryList | Array | 配置底图,参考 ImageryProvider | [] |
|
|
60
|
+
| defaultStatic | Array | 着色器使用的静态资源配置(如图片 url) | '' |
|
|
61
|
+
|
|
62
|
+
### 1.2 initCesium 返回对象
|
|
63
|
+
|
|
64
|
+
| name | Type | Description |
|
|
65
|
+
| ------------------ | ------ | ------------------------------------------------ |
|
|
66
|
+
| viewer | Object | Ceiusm 实例对象 |
|
|
67
|
+
| material | Object | 材质模块(修改实体材质) |
|
|
68
|
+
| graphics | Object | 图形模块(如创建 PolygonGraphics 对象等) |
|
|
69
|
+
| math3d | Object | 三维数学工具 |
|
|
70
|
+
| primitive | Object | 图元操作对象(如使用 primivite 创建 polygon 等) |
|
|
71
|
+
| draw | Object | 绘制模块(如多边形,矩形) |
|
|
72
|
+
| passEffect | Object | 后置处理模块 |
|
|
73
|
+
| customCesiumPlugin | Object | 自定义传感器扩展 |
|
|
74
|
+
| control | Object | 控制模块(如模型位置调整,拖拽等) |
|
|
75
|
+
| plugin | Object | 额外插件(如拓展 css3 的动画 ,地形裁剪) |
|
|
76
|
+
| base | Object | 基础模块(如坐标转换,图层初始化等) |
|
|
77
|
+
| analysis | Object | 分析模块(如坡度,坡向,可视域,通视分析) |
|
|
78
|
+
| attackArrowObj | Object | 标绘(攻击) |
|
|
79
|
+
| straightArrowObj | Object | 标绘(直击) |
|
|
80
|
+
| pincerArrowObj | Object | 标绘(钳击) |
|
|
81
|
+
|
|
82
|
+
### 1.3 使用案例
|
|
51
83
|
|
|
52
84
|
```javaScript
|
|
53
85
|
// test.vue
|
|
54
86
|
<template>
|
|
55
|
-
<div id="cesiumContainer"
|
|
56
|
-
class="map3d-contaner"></div>
|
|
87
|
+
<div id="cesiumContainer" class="map3d-contaner"></div>
|
|
57
88
|
</template>
|
|
58
89
|
<script>
|
|
59
90
|
import { initCesium } from 'cesium_dev_kit'
|
|
91
|
+
import { defaultStatic } from '../defaultStaticConf'
|
|
60
92
|
export default {
|
|
61
93
|
mounted() {
|
|
62
94
|
this.initMap()
|
|
63
95
|
},
|
|
64
96
|
methods: {
|
|
65
97
|
initMap() {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
const tempData = [
|
|
99
|
+
{
|
|
100
|
+
id: 3,
|
|
101
|
+
name: '高德地图02',
|
|
102
|
+
type: 'UrlTemplateImageryProvider',
|
|
103
|
+
classConfig: {
|
|
104
|
+
url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
|
|
105
|
+
},
|
|
106
|
+
interfaceConfig: {},
|
|
107
|
+
offset: '0,0',
|
|
108
|
+
invertswitch: 0,
|
|
109
|
+
filterRGB: '#ffffff',
|
|
110
|
+
showswitch: 1,
|
|
111
|
+
weigh: 13,
|
|
112
|
+
createtime: 1624346908,
|
|
113
|
+
updatetime: 1647395260,
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
const { viewer,material,graphics} =
|
|
117
|
+
new initCesium({
|
|
84
118
|
cesiumGlobal: Cesium,
|
|
85
119
|
containerId: 'cesiumContainer',
|
|
86
120
|
viewerConfig: {
|
|
87
121
|
infoBox: false,
|
|
88
122
|
shouldAnimate: true,
|
|
89
123
|
},
|
|
90
|
-
extraConfig: {
|
|
91
|
-
|
|
124
|
+
extraConfig: {
|
|
125
|
+
depthTest: true
|
|
126
|
+
},
|
|
127
|
+
MapImageryList: tempData,
|
|
128
|
+
defaultStatic
|
|
92
129
|
})
|
|
93
130
|
}
|
|
94
131
|
}
|
|
@@ -98,20 +135,31 @@ export default {
|
|
|
98
135
|
|
|
99
136
|
### 2、按需引入
|
|
100
137
|
|
|
138
|
+
可根据功能需求导出单一扩展类,减少代码冗余
|
|
139
|
+
|
|
140
|
+
```javaScript
|
|
141
|
+
import {Graphics, Material,Primitive,Draw,Analysis,CustomCesiumPlugin,PassEffect,Plugin} from 'cesium_dev_kit'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 2.1 扩展类:
|
|
145
|
+
|
|
146
|
+
- Graphics:各种图形操作
|
|
147
|
+
- Material: 材质操作
|
|
148
|
+
- Primitive: 配合 shader 的各种图元操作
|
|
149
|
+
- Draw: 各种绘制对象
|
|
150
|
+
- Analysis: 各种分析对象
|
|
151
|
+
- CustomCesiumPlugin: 自定义相控扩展
|
|
152
|
+
- PassEffect: 后期特效对象
|
|
153
|
+
- Plugin: 各种扩展功能
|
|
154
|
+
|
|
155
|
+
### 2.2 Draw 使用案例:
|
|
156
|
+
|
|
101
157
|
```javaScript
|
|
102
158
|
// test.vue
|
|
103
159
|
<template>
|
|
104
|
-
<div id="cesiumContainer"
|
|
105
|
-
class="map3d-contaner"></div>
|
|
160
|
+
<div id="cesiumContainer" class="map3d-contaner"></div>
|
|
106
161
|
</template>
|
|
107
162
|
<script>
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* 可导出对象 {Graphics, Material,Primitive,Draw,Analysis,CustomCesiumPlugin,PassEffect,Plugin}
|
|
111
|
-
* Graphics:各种图形操作、Material: 材质操作、Primitive: 配合shader的各种图元操作
|
|
112
|
-
* Draw: 各种绘制对象、Analysis: 各种分析对象、CustomCesiumPlugin: 自定义相控扩展
|
|
113
|
-
* PassEffect: 后期特效对象、Plugin: 各种扩展功能
|
|
114
|
-
*/
|
|
115
163
|
import { Draw } from 'cesium_dev_kit'
|
|
116
164
|
export default {
|
|
117
165
|
mounted() {
|
|
@@ -181,57 +229,6 @@ export default {
|
|
|
181
229
|
new cesium_dev_kit.initCesium({...})
|
|
182
230
|
```
|
|
183
231
|
|
|
184
|
-
## API
|
|
185
|
-
|
|
186
|
-
### initCesium
|
|
187
|
-
|
|
188
|
-
**参数**
|
|
189
|
-
|
|
190
|
-
- `cesiumGlobal` **Object** Ceiusm 对象
|
|
191
|
-
- `containerId` **String** 容器 id
|
|
192
|
-
- `viewerConfig` **Object** viewer 基础配置(与官网一致)
|
|
193
|
-
- `extreaConfig` **Object** 额外参数配置,如 {logo:true// 是否显示 logo, depthTest:true //开启深度检测}
|
|
194
|
-
- `MapImageryList` **Object** 配置底图,参考 ImageryProvider
|
|
195
|
-
|
|
196
|
-
```javaScript
|
|
197
|
-
/**
|
|
198
|
-
* 初始化入口函数
|
|
199
|
-
* @param {*} param0
|
|
200
|
-
* {
|
|
201
|
-
* cesiumGlobal:{Object} Ceiusm对象(项目需要安装配置获取Cesium传入)
|
|
202
|
-
* containerId:{String} 容器id
|
|
203
|
-
* viewerConfig:{Object} viewer基础配置
|
|
204
|
-
* 【参数格式】:{与官网一致}
|
|
205
|
-
* extreaConfig:{Object }
|
|
206
|
-
* 【参数格式】:
|
|
207
|
-
* {
|
|
208
|
-
* logo:true,// 是否显示logo
|
|
209
|
-
* depthTest:true, //开启深度检测
|
|
210
|
-
* }
|
|
211
|
-
* MapImageryList:{Array} 配置底图,每一个元素格式为
|
|
212
|
-
* 【参数格式】 :
|
|
213
|
-
* [{
|
|
214
|
-
* id: 3,
|
|
215
|
-
* name: '',
|
|
216
|
-
* type: '',//ImageryProvider类型
|
|
217
|
-
* classConfig: {
|
|
218
|
-
* url: 链接地址
|
|
219
|
-
* },
|
|
220
|
-
* interfaceConfig: {},
|
|
221
|
-
* offset: '0,0',
|
|
222
|
-
* invertswitch: 0,
|
|
223
|
-
* filterRGB: '#ffffff',
|
|
224
|
-
* showswitch: 1,
|
|
225
|
-
* weight: 13,
|
|
226
|
-
* createtime: 创建时间
|
|
227
|
-
* updatetime: 更新时间,
|
|
228
|
-
* }]
|
|
229
|
-
*
|
|
230
|
-
* }
|
|
231
|
-
* @returns
|
|
232
|
-
*/
|
|
233
|
-
```
|
|
234
|
-
|
|
235
232
|
## 使用范例
|
|
236
233
|
|
|
237
234
|
- ES6 使用案例
|
|
@@ -258,19 +255,20 @@ export default {
|
|
|
258
255
|
|
|
259
256
|
## 项目不足与优化
|
|
260
257
|
|
|
261
|
-
- 1
|
|
258
|
+
- 1、扩展类未使用类型检测(TS)
|
|
262
259
|
- 2、未配备使用文档(请参考案例)
|
|
263
260
|
- 3、未作异常捕捉和处理
|
|
264
261
|
|
|
265
|
-
<small
|
|
262
|
+
<small>欢迎感兴趣朋友加入一起完善功能,让工作效更高效、开发更简单、生活更惬意。</small>
|
|
266
263
|
|
|
267
264
|
[npm]: https://img.shields.io/npm/v/cesium_dev_kit
|
|
268
265
|
[npm-url]: https://www.npmjs.com/package/cesium_dev_kit
|
|
269
|
-
[build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.
|
|
266
|
+
[build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.70?logo=travis
|
|
270
267
|
[build-size-url]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit
|
|
271
|
-
[npm-download]: https://img.shields.io/npm/dt/cesium_dev_kit
|
|
268
|
+
[npm-download]: https://img.shields.io/npm/dt/cesium_dev_kit?logo=npm
|
|
272
269
|
[npmtrends-url]: https://www.npmtrends.com/cesium_dev_kit
|
|
273
270
|
[license-uri]: https://img.shields.io/npm/l/cesium_dev_kit.svg
|
|
274
271
|
[license-link]: https://npm.im/cesium_dev_kit
|
|
275
272
|
[build-status]: https://github.com/dengxiaoning/cesium_dev_kit
|
|
276
|
-
[build-main]: https://img.shields.io/github/actions/workflow/status/dengxiaoning/cesium_dev_kit/project-build.yml?branch=main
|
|
273
|
+
[build-main]: https://img.shields.io/github/actions/workflow/status/dengxiaoning/cesium_dev_kit/project-build.yml?branch=main&logo=github
|
|
274
|
+
[repo-stars]: https://img.shields.io/github/stars/dengxiaoning/cesium_dev_kit?style=plastic&logo=github
|