cesium_dev_kit 1.0.71 → 1.0.73
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 +96 -96
- 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,100 @@
|
|
|
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
42
|
import { initCesium } from 'cesium_dev_kit'
|
|
45
|
-
|
|
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
|
+
| ThreeJs | Object | 集成 ThreeJS 扩展对象 |
|
|
82
|
+
|
|
83
|
+
### 1.3 使用案例
|
|
51
84
|
|
|
52
85
|
```javaScript
|
|
53
86
|
// test.vue
|
|
54
87
|
<template>
|
|
55
|
-
<div id="cesiumContainer"
|
|
56
|
-
class="map3d-contaner"></div>
|
|
88
|
+
<div id="cesiumContainer" class="map3d-contaner"></div>
|
|
57
89
|
</template>
|
|
58
90
|
<script>
|
|
59
91
|
import { initCesium } from 'cesium_dev_kit'
|
|
92
|
+
import { defaultStatic } from '../defaultStaticConf'
|
|
60
93
|
export default {
|
|
61
94
|
mounted() {
|
|
62
95
|
this.initMap()
|
|
63
96
|
},
|
|
64
97
|
methods: {
|
|
65
98
|
initMap() {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
const tempData = [
|
|
100
|
+
{
|
|
101
|
+
id: 3,
|
|
102
|
+
name: '高德地图02',
|
|
103
|
+
type: 'UrlTemplateImageryProvider',
|
|
104
|
+
classConfig: {
|
|
105
|
+
url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
|
|
106
|
+
},
|
|
107
|
+
interfaceConfig: {},
|
|
108
|
+
offset: '0,0',
|
|
109
|
+
invertswitch: 0,
|
|
110
|
+
filterRGB: '#ffffff',
|
|
111
|
+
showswitch: 1,
|
|
112
|
+
weigh: 13,
|
|
113
|
+
createtime: 1624346908,
|
|
114
|
+
updatetime: 1647395260,
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
const { viewer,material,graphics} =
|
|
118
|
+
new initCesium({
|
|
84
119
|
cesiumGlobal: Cesium,
|
|
85
120
|
containerId: 'cesiumContainer',
|
|
86
121
|
viewerConfig: {
|
|
87
122
|
infoBox: false,
|
|
88
123
|
shouldAnimate: true,
|
|
89
124
|
},
|
|
90
|
-
extraConfig: {
|
|
91
|
-
|
|
125
|
+
extraConfig: {
|
|
126
|
+
depthTest: true
|
|
127
|
+
},
|
|
128
|
+
MapImageryList: tempData,
|
|
129
|
+
defaultStatic
|
|
92
130
|
})
|
|
93
131
|
}
|
|
94
132
|
}
|
|
@@ -98,20 +136,32 @@ export default {
|
|
|
98
136
|
|
|
99
137
|
### 2、按需引入
|
|
100
138
|
|
|
139
|
+
可根据功能需求导出单一扩展类,减少代码冗余
|
|
140
|
+
|
|
141
|
+
```javaScript
|
|
142
|
+
import {Graphics, Material,Primitive,Draw,Analysis,CustomCesiumPlugin,PassEffect,Plugin,ThreeJs} from 'cesium_dev_kit'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 2.1 扩展类:
|
|
146
|
+
|
|
147
|
+
- Graphics:各种图形操作
|
|
148
|
+
- Material: 材质操作
|
|
149
|
+
- Primitive: 配合 shader 的各种图元操作
|
|
150
|
+
- Draw: 各种绘制对象
|
|
151
|
+
- Analysis: 各种分析对象
|
|
152
|
+
- CustomCesiumPlugin: 自定义相控扩展
|
|
153
|
+
- PassEffect: 后期特效对象
|
|
154
|
+
- Plugin: 各种扩展功能
|
|
155
|
+
- ThreeJs: 集成 ThreeJS 扩展对象
|
|
156
|
+
|
|
157
|
+
### 2.2 Draw 使用案例:
|
|
158
|
+
|
|
101
159
|
```javaScript
|
|
102
160
|
// test.vue
|
|
103
161
|
<template>
|
|
104
|
-
<div id="cesiumContainer"
|
|
105
|
-
class="map3d-contaner"></div>
|
|
162
|
+
<div id="cesiumContainer" class="map3d-contaner"></div>
|
|
106
163
|
</template>
|
|
107
164
|
<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
165
|
import { Draw } from 'cesium_dev_kit'
|
|
116
166
|
export default {
|
|
117
167
|
mounted() {
|
|
@@ -172,64 +222,13 @@ export default {
|
|
|
172
222
|
- html 中直接引入 index.umd.js
|
|
173
223
|
|
|
174
224
|
```javaScript
|
|
175
|
-
|
|
225
|
+
<script type="text/javascript" src="index.umd.js"></script>
|
|
176
226
|
```
|
|
177
227
|
|
|
178
228
|
- 初始化对象
|
|
179
229
|
|
|
180
230
|
```javaScript
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
|
|
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
|
-
*/
|
|
231
|
+
new cesium_dev_kit.initCesium({...})
|
|
233
232
|
```
|
|
234
233
|
|
|
235
234
|
## 使用范例
|
|
@@ -258,19 +257,20 @@ export default {
|
|
|
258
257
|
|
|
259
258
|
## 项目不足与优化
|
|
260
259
|
|
|
261
|
-
- 1
|
|
260
|
+
- 1、扩展类未使用类型检测(TS)
|
|
262
261
|
- 2、未配备使用文档(请参考案例)
|
|
263
262
|
- 3、未作异常捕捉和处理
|
|
264
263
|
|
|
265
|
-
<small
|
|
264
|
+
<small>欢迎感兴趣朋友加入一起完善功能,让工作效更高效、开发更简单、生活更惬意。</small>
|
|
266
265
|
|
|
267
266
|
[npm]: https://img.shields.io/npm/v/cesium_dev_kit
|
|
268
267
|
[npm-url]: https://www.npmjs.com/package/cesium_dev_kit
|
|
269
|
-
[build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.
|
|
268
|
+
[build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.70?logo=travis
|
|
270
269
|
[build-size-url]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit
|
|
271
|
-
[npm-download]: https://img.shields.io/npm/dt/cesium_dev_kit
|
|
270
|
+
[npm-download]: https://img.shields.io/npm/dt/cesium_dev_kit?logo=npm
|
|
272
271
|
[npmtrends-url]: https://www.npmtrends.com/cesium_dev_kit
|
|
273
272
|
[license-uri]: https://img.shields.io/npm/l/cesium_dev_kit.svg
|
|
274
273
|
[license-link]: https://npm.im/cesium_dev_kit
|
|
275
274
|
[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
|
|
275
|
+
[build-main]: https://img.shields.io/github/actions/workflow/status/dengxiaoning/cesium_dev_kit/project-build.yml?branch=main&logo=github
|
|
276
|
+
[repo-stars]: https://img.shields.io/github/stars/dengxiaoning/cesium_dev_kit?style=plastic&logo=github
|