cesium_dev_kit 1.1.21 → 1.1.23

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 (107) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +293 -291
  3. package/README.zh-CN.md +274 -0
  4. package/SECURITY.md +21 -0
  5. package/dist/Analysis-BLpVrGfg.d.mts +143 -0
  6. package/dist/Analysis-DmO1gtgS.d.ts +143 -0
  7. package/dist/Base-DH8H9suE.d.mts +635 -0
  8. package/dist/Base-DH8H9suE.d.ts +635 -0
  9. package/dist/Base-_BOXyMdS.d.ts +43 -0
  10. package/dist/Base-skqjcPfo.d.mts +43 -0
  11. package/dist/Control-B7AMFmHe.d.ts +98 -0
  12. package/dist/Control-BrpRU7RP.d.mts +98 -0
  13. package/dist/CustomCesiumPlugin-BqgAvlhi.d.ts +29 -0
  14. package/dist/CustomCesiumPlugin-CKYQ-7i9.d.mts +29 -0
  15. package/dist/Draw-1NhPP8z3.d.mts +490 -0
  16. package/dist/Draw-DRh7yNzc.d.ts +490 -0
  17. package/dist/Graphics-CuFNsQ3b.d.ts +1565 -0
  18. package/dist/Graphics-QE3Gb43w.d.mts +1565 -0
  19. package/dist/Material-CeZ4l-tY.d.mts +165 -0
  20. package/dist/Material-Cqbyf2Pn.d.ts +165 -0
  21. package/dist/Math3d-0nO-vFbT.d.mts +179 -0
  22. package/dist/Math3d-t635PYzU.d.ts +179 -0
  23. package/dist/PassEffect-DEFyytQZ.d.ts +41 -0
  24. package/dist/PassEffect-DEgElnVk.d.mts +41 -0
  25. package/dist/Plugin-BPCX0zTu.d.mts +197 -0
  26. package/dist/Plugin-DnYT0bue.d.ts +197 -0
  27. package/dist/Primitive-BNXp-9_6.d.mts +199 -0
  28. package/dist/Primitive-UEAuUimH.d.ts +199 -0
  29. package/dist/ThreeJs-BAlEWxa1.d.mts +44 -0
  30. package/dist/ThreeJs-DpAcw_qf.d.ts +44 -0
  31. package/dist/analysis.cjs +145 -0
  32. package/dist/analysis.cjs.map +1 -0
  33. package/dist/analysis.d.mts +6 -0
  34. package/dist/analysis.d.ts +6 -0
  35. package/dist/analysis.mjs +145 -0
  36. package/dist/analysis.mjs.map +1 -0
  37. package/dist/control.cjs +140 -0
  38. package/dist/control.cjs.map +1 -0
  39. package/dist/control.d.mts +4 -0
  40. package/dist/control.d.ts +4 -0
  41. package/dist/control.mjs +140 -0
  42. package/dist/control.mjs.map +1 -0
  43. package/dist/custom-cesium-plugin.cjs +507 -0
  44. package/dist/custom-cesium-plugin.cjs.map +1 -0
  45. package/dist/custom-cesium-plugin.d.mts +4 -0
  46. package/dist/custom-cesium-plugin.d.ts +4 -0
  47. package/dist/custom-cesium-plugin.mjs +507 -0
  48. package/dist/custom-cesium-plugin.mjs.map +1 -0
  49. package/dist/default-static.cjs +3 -0
  50. package/dist/default-static.cjs.map +1 -0
  51. package/dist/default-static.d.mts +37 -0
  52. package/dist/default-static.d.ts +37 -0
  53. package/dist/default-static.mjs +3 -0
  54. package/dist/default-static.mjs.map +1 -0
  55. package/dist/draw.cjs +140 -0
  56. package/dist/draw.cjs.map +1 -0
  57. package/dist/draw.d.mts +6 -0
  58. package/dist/draw.d.ts +6 -0
  59. package/dist/draw.mjs +140 -0
  60. package/dist/draw.mjs.map +1 -0
  61. package/dist/graphics.cjs +140 -0
  62. package/dist/graphics.cjs.map +1 -0
  63. package/dist/graphics.d.mts +19 -0
  64. package/dist/graphics.d.ts +19 -0
  65. package/dist/graphics.mjs +140 -0
  66. package/dist/graphics.mjs.map +1 -0
  67. package/dist/index.cjs +1030 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.mts +338 -0
  70. package/dist/index.d.ts +338 -0
  71. package/dist/index.mjs +1030 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/material.cjs +391 -0
  74. package/dist/material.cjs.map +1 -0
  75. package/dist/material.d.mts +4 -0
  76. package/dist/material.d.ts +4 -0
  77. package/dist/material.mjs +391 -0
  78. package/dist/material.mjs.map +1 -0
  79. package/dist/pass-effect.cjs +416 -0
  80. package/dist/pass-effect.cjs.map +1 -0
  81. package/dist/pass-effect.d.mts +4 -0
  82. package/dist/pass-effect.d.ts +4 -0
  83. package/dist/pass-effect.mjs +416 -0
  84. package/dist/pass-effect.mjs.map +1 -0
  85. package/dist/plugin.cjs +141 -0
  86. package/dist/plugin.cjs.map +1 -0
  87. package/dist/plugin.d.mts +4 -0
  88. package/dist/plugin.d.ts +4 -0
  89. package/dist/plugin.mjs +141 -0
  90. package/dist/plugin.mjs.map +1 -0
  91. package/dist/primitive.cjs +370 -0
  92. package/dist/primitive.cjs.map +1 -0
  93. package/dist/primitive.d.mts +4 -0
  94. package/dist/primitive.d.ts +4 -0
  95. package/dist/primitive.mjs +370 -0
  96. package/dist/primitive.mjs.map +1 -0
  97. package/dist/three.cjs +140 -0
  98. package/dist/three.cjs.map +1 -0
  99. package/dist/three.d.mts +4 -0
  100. package/dist/three.d.ts +4 -0
  101. package/dist/three.mjs +140 -0
  102. package/dist/three.mjs.map +1 -0
  103. package/package.json +289 -46
  104. package/dist/index.js +0 -1
  105. package/dist/index.min.js +0 -1
  106. package/dist/index.umd.js +0 -1
  107. package/index.js +0 -37
package/README.md CHANGED
@@ -1,291 +1,293 @@
1
- ## cesium_dev_kit
2
-
3
- [![Build Status][build-main]][build-status]
4
- [![NPM Package][npm]][npm-url]
5
- [![NPM DownloadsWeekly][npm-download]][npmtrends-url]
6
- [![Build Size][build-size]][build-size-url]
7
- [![GitHub Repo stars][repo-stars]][star-chart]
8
- [![license][license-uri]][license-link]
9
-
10
- **English** | [中文](./README.zh-CN.md)
11
-
12
- ## Introduction
13
-
14
-  This is a Cesium development kit that includes functionalities such as layer loading, coordinate conversion, coordinate picking, camera control, measurement, plotting, model loading and manipulation (translation, rotation scaling), 3Dtiles view position adjustment, weather effects (rain, snow, fog), scene rendering with radar scan and information box display capabilities. It also provides features for flow line visualization, lighting effects including dynamic wall and other luminous materials rendering.
15
- Additionally it supports Post effects, visibility analysis tools for perspective analysis and slope analysis. Furthermore it offers Inundation analysis as well as volume analysis capabilities and terrain excavation functionality.
16
-
17
- ## API documentation
18
-
19
- See [:bookmark_tabs: https://benpaodehenji.com/cesiumDevKitDoc](https://benpaodehenji.com/cesiumDevKitDoc)
20
-
21
- ## Features
22
-
23
- | ![material](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/material.gif) | ![analysis](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/analysis.gif) | ![plot](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/plot.gif) |
24
- | :-------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------: |
25
- | material | analysis | plot |
26
- | ![dynamicRiver](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/dnyRiver.gif) | ![extrude](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/extrude.gif) | ![effect](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/effect.gif) |
27
- | dynamicRiver | extrude | effect |
28
- | ![radar](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/radar.gif) | ![roaming](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/pathRoam.gif) | ![drag](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/drag.gif) |
29
- | radar | roaming | drag |
30
- | ![rayCast](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/rayCast.gif) | ![fireworksEffect](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/fireworksEffect.gif) | ![aniSoldier](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/aniSoldier.gif) |
31
- | rayCast | fireworksEffect | aniSoldier |
32
- | ![pathPlan](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/pathPlan.gif) | ![customPrimitive](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/custPrimitive.gif) | ![clusterLayer](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/clusterLayer.gif) |
33
- | pathPlan | customPrimitive | clusterLayer |
34
- | ![bar3D](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/bar3d.gif) | ![rollerBlind](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/rollerBlind.gif) | ![heatmap3d](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/heatmap3d.gif) |
35
- | bar3D | rollerBlind | heatmap3d |
36
-
37
- [More>>](https://benpaodehenji.com/cesiumDevKit)
38
-
39
- ## Install
40
-
41
- ```shell
42
- npm install cesium_dev_kit
43
- ```
44
-
45
- ## Use
46
-
47
- ### 1、Import all
48
-
49
- The initialization of 'initCesium' allows for the acquisition of all extension modules.
50
-
51
- #### 1. General method
52
-
53
- ```javaScript
54
- import * as Cesium from 'cesium';
55
- import * as THREE from 'three';
56
- import { initCesium } from 'cesium_dev_kit'
57
- import { defaultStatic } from '/src/views/example/defaultStaticConf/index.js'
58
-
59
- export default {
60
- methods: {
61
- // add terrain
62
- async addWorldTerrainAsync (viewer) {
63
- try {
64
- const terrainProvider = await Cesium.CesiumTerrainProvider.fromIonAssetId(1);
65
- viewer.terrainProvider = terrainProvider;
66
- } catch (error) {
67
- console.log(`Failed to add world imagery: ${error}`);
68
- }
69
- },
70
- initMap () {
71
- // Configure multiple imagelayer arrays
72
- const tempData = [
73
- {
74
- type: 'UrlTemplateImageryProvider',
75
- option: {
76
- url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}'
77
- }
78
- },
79
- {
80
- type: 'UrlTemplateImageryProvider',
81
- option: {
82
- url: 'https://webst03.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&style=7',
83
- }
84
- }
85
- ]
86
- // init .
87
- const { viewer, material, graphics,sceneMang } =
88
- new initCesium({
89
- cesiumGlobal: Cesium,
90
- threeGlobal: THREE,
91
- containerId: 'cesiumContainer',
92
- threeContainerId: 'threeContainer',
93
- viewerConfig: {
94
- infoBox: false,
95
- shouldAnimate: true,
96
- useDefaultRenderLoop: false,
97
- selectionIndicator: false,
98
- sceneModePicker: false
99
- },
100
- extraConfig: {
101
- depthTest: true,
102
- AccessToken:"your access token"
103
- },
104
- imageryProvider: {
105
- type: "WebMapTileServiceImageryProvider",
106
- option: {
107
- url: "http://t0.tianditu.gov.cn/img_w/wmts?tk=65a5f62a964c1d5b23fa81bc34147973",
108
- layer: "img",
109
- style: "default",
110
- tileMatrixSetID: "w",
111
- format: "tiles",
112
- maximumLevel: 18,
113
- },
114
- },
115
- MapImageryList: tempData,
116
- defaultStatic
117
- })
118
- // Call method to add terrain
119
- this.addWorldTerrainAsync(viewer);
120
- }
121
- }
122
- }
123
- ```
124
-
125
- [For details, see :bookmark_tabs: https://benpaodehenji.com/cesiumDevKitDoc/module-initCesium.html ](https://benpaodehenji.com/cesiumDevKitDoc/module-initCesium.html)
126
-
127
- #### 2. Custom viewer
128
-
129
- ```javaScript
130
- import { initCesium } from 'cesium_dev_kit'
131
- // custom viewer
132
- var myViewer = new Cesium.Viewer('cesiumContainer', {
133
- animation: false, //Whether to display animation controls
134
- homeButton: false, //Whether to display the home button
135
- geocoder: false, //Whether to display the place name lookup control If set to true, it cannot be queried
136
- baseLayerPicker: false, //Whether to display layer selection controls
137
- timeline: false, //Whether to display the timeline control
138
- fullscreenButton: true, //Whether to display the button in full screen
139
- scene3DOnly: false, //If set to true, all geometry is drawn in 3D mode to save GPU resources
140
- infoBox: false, //Whether to display the information displayed after clicking the element
141
- sceneModePicker: false, //Whether to display projection mode controls 3D / 2D
142
- navigationInstructionsInitiallyVisible: false,
143
- navigationHelpButton: false, //Whether to display the help control
144
- selectionIndicator: false //Whether to display indicator components
145
- });
146
-
147
- //Allowing an existing Viewer to be passed in, cesium_dev_kit will use the passed Viewer directly without re-instantiating it with "new Cesium.Viewer()".
148
- const { viewer, material, ... } = new initCesium({
149
- cesiumGlobal: Cesium,
150
- containerId: 'cesiumContainer',
151
- viewer: myViewer,
152
- ...})
153
- ```
154
-
155
- ### 2、Import on demand
156
-
157
- The import of a single extension class can be tailored to meet specific functional requirements, thereby minimizing code redundancy.
158
-
159
- ```javaScript
160
- import {Graphics} from 'cesium_dev_kit'
161
- // custom viewer
162
- var myViewer = new Cesium.Viewer('cesiumContainer', {
163
- animation: false, //Whether to display animation controls
164
- homeButton: false, //Whether to display the home button
165
- geocoder: false, //Whether to display the place name lookup control If set to true, it cannot be queried
166
- baseLayerPicker: false, //Whether to display layer selection controls
167
- timeline: false, //Whether to display the timeline control
168
- fullscreenButton: true, //Whether to display the button in full screen
169
- scene3DOnly: false, //If set to true, all geometry is drawn in 3D mode to save GPU resources
170
- infoBox: false, //Whether to display the information displayed after clicking the element
171
- sceneModePicker: false, //Whether to display projection mode controls 3D / 2D
172
- navigationInstructionsInitiallyVisible: false,
173
- navigationHelpButton: false, //Whether to display the help control
174
- selectionIndicator: false //Whether to display indicator components
175
- });
176
-
177
- //Allowing an existing Viewer to be passed in, cesium_dev_kit will use the passed Viewer directly without re-instantiating it with "new Cesium.Viewer()".
178
- const {viewer,graphics} = new Graphics({
179
- cesiumGlobal: Cesium,
180
- //containerId: 'cesiumContainer',
181
- viewer: myViewer
182
- })
183
- graphics.getPointGraphics({
184
- color:Cesium.Color.GREEN,
185
- pixelSize:5,
186
- outlineColor:Cesium.Color.WHITE,
187
- outlineWidth:1
188
- })
189
- ```
190
-
191
- ### Used in h5
192
-
193
- - Import index.umd.js directly into html
194
-
195
- ```javaScript
196
- <script type="text/javascript" src="index.umd.js"></script>
197
- ```
198
-
199
- - Initialize object
200
-
201
- ```javaScript
202
- new cesium_dev_kit.initCesium({...})
203
- ```
204
-
205
- ---
206
-
207
- ## Use example
208
-
209
- - Vue Use case
210
- [https://github.com/dengxiaoning/cesium_kit_test](https://github.com/dengxiaoning/cesium_kit_test)
211
-
212
- - React Use case
213
- [https://github.com/dengxiaoning/react-cesium](https://github.com/dengxiaoning/react-cesium)
214
- - H5 Use case
215
- [https://github.com/dengxiaoning/cesium_kit_test_h5](https://github.com/dengxiaoning/cesium_kit_test_h5)
216
-
217
- ## Donate
218
-
219
- Do you use and like cesium_dev_kit but you don’t find a way to show some love? If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though😄
220
-
221
- - [![Support via PayPal](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/paypal-logo-129x32.svg)](https://paypal.me/xiaoningdeng?country.x=C2&locale.x=en_US)
222
-
223
- - WeChat / AliPay
224
- <div style="display: flex">
225
- <img alt="wechat" title="wechat" src="https://benpaodehenji.com/cesium_dev_kit/static/data/images/wechat.png">
226
- <img alt="alipay" title="alipay" src="https://benpaodehenji.com/cesium_dev_kit/static/data/images/alipay.png">
227
- </div>
228
-
229
- ##
230
-
231
- ## Browser support
232
-
233
- The 'Chrome 80+' browser is recommended for local development
234
-
235
- Modern browsers (chrome, Firefox, Microsoft edge, etc.) are supported. Internet Explorer is not supported
236
-
237
- ## Thanks
238
-
239
- [cesium-d3kit](https://github.com/zhangti0708/cesium-d3kit)<br/>
240
- [drawarrowforcesium](https://gitcode.net/mirrors/gitgitczl/drawarrowforcesium)<br/>
241
- [vue3-ts-cesium-map-show](https://gitee.com/hawk86104/vue3-ts-cesium-map-show)<br/>
242
-
243
- This project includes but is not limited to the reference and reference of the above materials, thank you very much for sharing
244
-
245
- ## Project deficiency and optimization
246
-
247
- - 1、Extended classes not using type detection (TS)
248
- - 2、No exception catching and handling
249
-
250
- ## How to contribute
251
-
252
- This project exists thanks to all the people who contribute.<br/>
253
-
254
- <a href="https://github.com/dengxiaoning/cesium_dev_kit/graphs/contributors">
255
- <img src="https://contrib.rocks/image?repo=dengxiaoning/cesium_dev_kit" />
256
- </a>
257
-
258
- - If you want to contribute, you can [Raise an issue](https://github.com/dengxiaoning/cesium_dev_kit/issues/new) Or submit a Pull Request.
259
-
260
- See [CONTRIBUTING](./CONTRIBUTING.md) for more details on donations...
261
-
262
- ---
263
-
264
- ## `Star`
265
-
266
- I am grateful to the generous individuals who awarded me these little stars, thank you for your support :heart:
267
-
268
- [![Stargazers repo roster for @dengxiaoning/cesium_dev_kit][stargazers-url]][stargazers-link]
269
-
270
- ## `Fork`
271
-
272
- @sincely、`@ooil929`、 @InPanda、 `luyufanzhi`、AllenChiangCN、`Liquid-Zhangliquan`... thank you for your attention :heart:
273
-
274
- [![Forkers repo roster for @dengxiaoning/cesium_dev_kit][forkers-url]][forkers-link]
275
-
276
- [npm]: https://img.shields.io/npm/v/cesium_dev_kit
277
- [npm-url]: https://www.npmjs.com/package/cesium_dev_kit
278
- [build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.70?logo=travis
279
- [build-size-url]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit
280
- [npm-download]: https://img.shields.io/npm/dy/cesium_dev_kit?logo=npm
281
- [npmtrends-url]: https://www.npmtrends.com/cesium_dev_kit
282
- [license-uri]: https://img.shields.io/npm/l/cesium_dev_kit.svg
283
- [license-link]: https://npm.im/cesium_dev_kit
284
- [build-status]: https://github.com/dengxiaoning/cesium_dev_kit
285
- [build-main]: https://img.shields.io/github/actions/workflow/status/dengxiaoning/cesium_dev_kit/project-build.yml?branch=main&logo=github
286
- [repo-stars]: https://img.shields.io/github/stars/dengxiaoning/cesium_dev_kit?style=plastic&logo=github
287
- [forkers-url]: https://bytecrank.com/nastyox/reporoster/php/forkersSVG.php?user=dengxiaoning&repo=cesium_dev_kit
288
- [forkers-link]: https://github.com/dengxiaoning/cesium_dev_kit/network/members
289
- [stargazers-url]: https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=dengxiaoning&repo=cesium_dev_kit
290
- [stargazers-link]: https://github.com/dengxiaoning/cesium_dev_kit/stargazers
291
- [star-chart]: https://api.star-history.com/svg?repos=dengxiaoning/cesium_dev_kit&type=Date
1
+ ## cesium_dev_kit
2
+
3
+ [![Build Status][build-main]][build-status]
4
+ [![NPM Package][npm]][npm-url]
5
+ [![NPM DownloadsWeekly][npm-download]][npmtrends-url]
6
+ [![Build Size][build-size]][build-size-url]
7
+ [![GitHub Repo stars][repo-stars]][star-chart]
8
+ [![license][license-uri]][license-link]
9
+
10
+ **English** | [中文](./README.zh-CN.md)
11
+
12
+ ## Introduction
13
+
14
+ &emsp;This is a Cesium development kit that includes functionalities such as layer loading, coordinate conversion, coordinate picking, camera control, measurement, plotting, model loading and manipulation (translation, rotation scaling), 3Dtiles view position adjustment, weather effects (rain, snow, fog), scene rendering with radar scan and information box display capabilities. It also provides features for flow line visualization, lighting effects including dynamic wall and other luminous materials rendering.
15
+ Additionally it supports Post effects, visibility analysis tools for perspective analysis and slope analysis. Furthermore it offers Inundation analysis as well as volume analysis capabilities and terrain excavation functionality.
16
+
17
+ ## API documentation
18
+
19
+ See [:bookmark_tabs: https://dengxiaoning.github.io/cesium_dev_kit/](https://dengxiaoning.github.io/cesium_dev_kit/)
20
+
21
+ The docs are generated from the JSDoc comments under `src/utils/cesiumPluginsExtends` (TypeDoc):
22
+
23
+ ```bash
24
+ npm run docs # output to docs/
25
+ npm run docs:serve # local preview at http://localhost:5174
26
+ ```
27
+
28
+ Pushing to `main` triggers `.github/workflows/docs.yml`, which builds and deploys to GitHub Pages.
29
+
30
+ ## Features
31
+
32
+ | ![material](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/material.gif) | ![analysis](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/analysis.gif) | ![plot](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/plot.gif) |
33
+ | :-------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------: |
34
+ | material | analysis | plot |
35
+ | ![dynamicRiver](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/dnyRiver.gif) | ![extrude](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/extrude.gif) | ![effect](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/effect.gif) |
36
+ | dynamicRiver | extrude | effect |
37
+ | ![radar](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/radar.gif) | ![roaming](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/pathRoam.gif) | ![drag](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/drag.gif) |
38
+ | radar | roaming | drag |
39
+ | ![rayCast](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/rayCast.gif) | ![fireworksEffect](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/fireworksEffect.gif) | ![aniSoldier](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/aniSoldier.gif) |
40
+ | rayCast | fireworksEffect | aniSoldier |
41
+ | ![pathPlan](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/pathPlan.gif) | ![customPrimitive](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/custPrimitive.gif) | ![clusterLayer](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/clusterLayer.gif) |
42
+ | pathPlan | customPrimitive | clusterLayer |
43
+ | ![bar3D](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/bar3d.gif) | ![rollerBlind](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/rollerBlind.gif) | ![heatmap3d](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/heatmap3d.gif) |
44
+ | bar3D | rollerBlind | heatmap3d |
45
+
46
+ [More>>](https://benpaodehenji.com/cesiumDevKit)
47
+
48
+ ## Install
49
+
50
+ ```shell
51
+ npm install cesium_dev_kit cesium
52
+ # optional: only needed for the Three.js integration
53
+ npm install three
54
+ ```
55
+
56
+ > Requires Cesium `>=1.105`. `three`, `echarts`, `dat.gui` and `libgif` are optional peer dependencies (installed only when their features are used).
57
+ > The library no longer ships a Cesium Ion token. Pass your own token via
58
+ > `extraConfig.AccessToken` or set `Cesium.Ion.defaultAccessToken` before creating the viewer.
59
+
60
+ ## Quick start
61
+
62
+ ### Import only what you need (recommended)
63
+
64
+ ```ts
65
+ import * as Cesium from 'cesium'
66
+ import { Graphics } from 'cesium_dev_kit/graphics'
67
+
68
+ // Your own token, e.g. from an environment variable
69
+ Cesium.Ion.defaultAccessToken = import.meta.env.VITE_CESIUM_ION_TOKEN
70
+
71
+ const { viewer, graphics, dispose } = Graphics({
72
+ cesiumGlobal: Cesium,
73
+ containerId: 'cesiumContainer'
74
+ })
75
+
76
+ graphics.flyTo({
77
+ position: { x: -1337132, y: 5330611, z: 3228680 }
78
+ })
79
+
80
+ // Call this when the page / route is unmounted
81
+ dispose()
82
+ ```
83
+
84
+ Each subpath only bundles its own dependency graph. For example
85
+ `cesium_dev_kit/graphics` does not pull in `echarts` or `dat.gui`.
86
+ Available subpaths: `/graphics`, `/material`, `/primitive`, `/draw`, `/analysis`,
87
+ `/plugin`, `/pass-effect`, `/control`, `/three`, `/custom-cesium-plugin`,
88
+ `/default-static`.
89
+
90
+ ### Default images and assets
91
+
92
+ Many helpers (sky box, point icon, light cone, water, analysis textures) fall
93
+ back to a small set of default images. If you do not pass `defaultStatic`, the
94
+ kit uses its built-in CDN config so that a fresh install works without 404s:
95
+
96
+ ```ts
97
+ import { defaultStatic, createDefaultStatic } from 'cesium_dev_kit/default-static'
98
+
99
+ // 1. Use the built-in CDN (default)
100
+ // 2. Use your own CDN
101
+ const myStatic = createDefaultStatic('https://cdn.example.com/')
102
+ // 3. Use relative paths and self-host ./public/static from this repo
103
+ const localStatic = createDefaultStatic('')
104
+ ```
105
+
106
+ ### Import all modules
107
+
108
+ ```ts
109
+ import * as Cesium from 'cesium'
110
+ import { initCesium } from 'cesium_dev_kit'
111
+
112
+ const kit = initCesium({
113
+ cesiumGlobal: Cesium,
114
+ containerId: 'cesiumContainer',
115
+ extraConfig: { AccessToken: 'YOUR_CESIUM_ION_TOKEN' }
116
+ })
117
+
118
+ const { viewer, graphics, primitive, analysis } = kit
119
+ // ...
120
+
121
+ // Destroys the viewer created by the kit.
122
+ // If you passed an existing `viewer`, the kit will not destroy it.
123
+ kit.dispose()
124
+ ```
125
+
126
+ ### Recommended entry: `createKit`
127
+
128
+ `createKit` takes the same options as `initCesium` but returns an explicit context and has a clearer `dispose()` contract:
129
+
130
+ ```ts
131
+ import * as Cesium from 'cesium'
132
+ import { createKit } from 'cesium_dev_kit'
133
+
134
+ const kit = createKit({
135
+ Cesium, // `cesiumGlobal` also works
136
+ containerId: 'cesiumContainer',
137
+ assetsBaseUrl: '/static/', // same as createDefaultStatic('/static/')
138
+ extraConfig: { AccessToken: import.meta.env.VITE_CESIUM_ION_TOKEN },
139
+ onError: (err, ctx) => console.warn(ctx?.scope, err)
140
+ })
141
+
142
+ kit.context.viewer // identical to kit.viewer
143
+ kit.graphics.createDynamicCircleGraphics({ /* ... */ })
144
+ kit.dispose() // idempotent; kit.isDisposed() reports the state
145
+ ```
146
+
147
+ Contract:
148
+
149
+ - If the kit created the viewer, `dispose()` calls `viewer.destroy()`;
150
+ - If you passed your own viewer, `dispose()` only removes DataSources/listeners added by the kit and never destroys your viewer;
151
+ - Multiple kits can coexist on one page — modules no longer share module-level `Cesium` / `dfSt` state;
152
+ - The legacy `new initCesium({...})` form still works but is a compatibility entry; prefer `createKit` for new code.
153
+
154
+ ### Error handling
155
+
156
+ Errors thrown by the library are `CesiumDevKitError` with a stable `code`:
157
+
158
+ ```ts
159
+ import { isCesiumDevKitError, setErrorHandler } from 'cesium_dev_kit'
160
+
161
+ try {
162
+ const kit = createKit({ Cesium, containerId: 'cesiumContainer' })
163
+ } catch (err) {
164
+ if (isCesiumDevKitError(err) && err.code === 'MISSING_VIEWER') {
165
+ // provide a container
166
+ }
167
+ }
168
+
169
+ // Non-fatal errors caught internally default to console.warn
170
+ setErrorHandler((err, ctx) => console.warn(ctx?.scope, err))
171
+ ```
172
+
173
+ Codes: `MISSING_CESIUM`, `MISSING_VIEWER`, `INVALID_ARGUMENT`, `IMAGERY_FAILED`,
174
+ `OPTIONAL_DEPENDENCY_MISSING`, `UNSUPPORTED_ENVIRONMENT`, `UNSUPPORTED_CESIUM_VERSION`, `INTERNAL`.
175
+
176
+ > Naming: `craete*` methods now have canonical `create*` names (e.g. `craeteDynamicCricleGraphics` →
177
+ > `createDynamicCircleGraphics`). The old names remain and are marked `@deprecated`.
178
+
179
+
180
+ ### Used in h5
181
+
182
+ - Import index.umd.js directly into html
183
+
184
+ ```javaScript
185
+ <script type="text/javascript" src="index.umd.js"></script>
186
+ ```
187
+
188
+ - Initialize object
189
+
190
+ ```javaScript
191
+ new cesium_dev_kit.initCesium({...})
192
+ ```
193
+
194
+
195
+ ## Development
196
+
197
+ ```shell
198
+ npm install
199
+ npm run dev # demo site
200
+ npm run typecheck
201
+ npm test
202
+ npm run build:lib # dist: ESM + CJS + .d.ts + sourcemaps
203
+ npm run build # demo site
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Use example
209
+
210
+ - Vue Use case
211
+ [https://github.com/dengxiaoning/cesium_kit_test](https://github.com/dengxiaoning/cesium_kit_test)
212
+
213
+ - React Use case
214
+ [https://github.com/dengxiaoning/react-cesium](https://github.com/dengxiaoning/react-cesium)
215
+ - H5 Use case
216
+ [https://github.com/dengxiaoning/cesium_kit_test_h5](https://github.com/dengxiaoning/cesium_kit_test_h5)
217
+
218
+ ## Donate
219
+
220
+ Do you use and like cesium_dev_kit but you don’t find a way to show some love? If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though😄
221
+
222
+ - [![Support via PayPal](https://github.com/dengxiaoning/cesium_dev_kit/blob/main/src/assets/image/preview/paypal-logo-129x32.svg)](https://paypal.me/xiaoningdeng?country.x=C2&locale.x=en_US)
223
+
224
+ - WeChat / AliPay
225
+ <div style="display: flex">
226
+ <img alt="wechat" title="wechat" src="https://benpaodehenji.com/cesium_dev_kit/static/data/images/wechat.png">
227
+ <img alt="alipay" title="alipay" src="https://benpaodehenji.com/cesium_dev_kit/static/data/images/alipay.png">
228
+ </div>
229
+
230
+ ##
231
+
232
+ ## Browser support
233
+
234
+ The 'Chrome 80+' browser is recommended for local development
235
+
236
+ Modern browsers (chrome, Firefox, Microsoft edge, etc.) are supported. Internet Explorer is not supported
237
+
238
+ ## Thanks
239
+
240
+ [cesium-d3kit](https://github.com/zhangti0708/cesium-d3kit)<br/>
241
+ [drawarrowforcesium](https://gitcode.net/mirrors/gitgitczl/drawarrowforcesium)<br/>
242
+ [vue3-ts-cesium-map-show](https://gitee.com/hawk86104/vue3-ts-cesium-map-show)<br/>
243
+
244
+ This project includes but is not limited to the reference and reference of the above materials, thank you very much for sharing
245
+
246
+ ## Project deficiency and optimization
247
+
248
+ - 1、Cesium-related types are intentionally loose (`any`) to support CDN / global `window.Cesium` usage; precise types can be extended if you install cesium via npm
249
+ - 2、No exception catching and handling
250
+ - 3、Missing unit tests and automated release pipeline
251
+
252
+ ## How to contribute
253
+
254
+ This project exists thanks to all the people who contribute.<br/>
255
+
256
+ <a href="https://github.com/dengxiaoning/cesium_dev_kit/graphs/contributors">
257
+ <img src="https://contrib.rocks/image?repo=dengxiaoning/cesium_dev_kit" />
258
+ </a>
259
+
260
+ - If you want to contribute, you can [Raise an issue](https://github.com/dengxiaoning/cesium_dev_kit/issues/new) Or submit a Pull Request.
261
+
262
+ See [CONTRIBUTING](./CONTRIBUTING.md) for more details on donations...
263
+
264
+ ---
265
+
266
+ ## `Star`
267
+
268
+ I am grateful to the generous individuals who awarded me these little stars, thank you for your support :heart:
269
+
270
+ [![Stargazers repo roster for @dengxiaoning/cesium_dev_kit][stargazers-url]][stargazers-link]
271
+
272
+ ## `Fork`
273
+
274
+ @sincely、`@ooil929`、 @InPanda、 `luyufanzhi`、AllenChiangCN、`Liquid-Zhangliquan`... thank you for your attention :heart:
275
+
276
+ [![Forkers repo roster for @dengxiaoning/cesium_dev_kit][forkers-url]][forkers-link]
277
+
278
+ [npm]: https://img.shields.io/npm/v/cesium_dev_kit
279
+ [npm-url]: https://www.npmjs.com/package/cesium_dev_kit
280
+ [build-size]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit/1.0.70?logo=travis
281
+ [build-size-url]: https://img.shields.io/bundlephobia/minzip/cesium_dev_kit
282
+ [npm-download]: https://img.shields.io/npm/dy/cesium_dev_kit?logo=npm
283
+ [npmtrends-url]: https://www.npmtrends.com/cesium_dev_kit
284
+ [license-uri]: https://img.shields.io/npm/l/cesium_dev_kit.svg
285
+ [license-link]: https://npm.im/cesium_dev_kit
286
+ [build-status]: https://github.com/dengxiaoning/cesium_dev_kit
287
+ [build-main]: https://img.shields.io/github/actions/workflow/status/dengxiaoning/cesium_dev_kit/project-build.yml?branch=main&logo=github
288
+ [repo-stars]: https://img.shields.io/github/stars/dengxiaoning/cesium_dev_kit?style=plastic&logo=github
289
+ [forkers-url]: https://bytecrank.com/nastyox/reporoster/php/forkersSVG.php?user=dengxiaoning&repo=cesium_dev_kit
290
+ [forkers-link]: https://github.com/dengxiaoning/cesium_dev_kit/network/members
291
+ [stargazers-url]: https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=dengxiaoning&repo=cesium_dev_kit
292
+ [stargazers-link]: https://github.com/dengxiaoning/cesium_dev_kit/stargazers
293
+ [star-chart]: https://api.star-history.com/svg?repos=dengxiaoning/cesium_dev_kit&type=Date