瀏覽代碼

update project

tags/2.6.1
duanhuyin 4 年之前
父節點
當前提交
cfe5b43349
共有 100 個文件被更改,包括 1411 次插入271 次删除
  1. 1
    1
      .eslintignore
  2. 1
    1
      .github/FUNDING.yml
  3. 134
    0
      CHANGES_en.md
  4. 133
    5
      CHANGES_zh.md
  5. 4
    4
      README.md
  6. 4
    4
      README_zh.md
  7. 8
    0
      modules/animation/AnimationType.js
  8. 1
    0
      modules/animation/index.js
  9. 7
    1
      modules/animation/type/AroundPoint.js
  10. 15
    3
      modules/animation/type/AroundView.js
  11. 7
    1
      modules/animation/type/CircleScan.js
  12. 7
    1
      modules/animation/type/Flying.js
  13. 7
    1
      modules/animation/type/GlobeRotate.js
  14. 7
    1
      modules/animation/type/RadarScan.js
  15. 5
    2
      modules/chart/ChartLayer.js
  16. 9
    9
      modules/chart/extension/CoordinateSystem.js
  17. 1
    1
      modules/copy-right/index.js
  18. 4
    1
      modules/effect/type/BlackAndWhite.js
  19. 4
    1
      modules/effect/type/Bloom.js
  20. 4
    1
      modules/effect/type/Brightness.js
  21. 4
    1
      modules/effect/type/DepthOfField.js
  22. 4
    1
      modules/effect/type/LensFlare.js
  23. 4
    1
      modules/effect/type/NightVision.js
  24. 4
    1
      modules/effect/type/Silhouette.js
  25. 4
    0
      modules/effect/type/Sun.js
  26. 8
    2
      modules/event/Event.js
  27. 34
    2
      modules/event/EventType.js
  28. 5
    0
      modules/event/index.js
  29. 101
    23
      modules/event/type/MouseEvent.js
  30. 27
    0
      modules/event/type/PlotEvent.js
  31. 7
    3
      modules/heat/HeatLayer.js
  32. 94
    44
      modules/history-track/Track.js
  33. 2
    2
      modules/history-track/TrackController.js
  34. 40
    15
      modules/layer/Layer.js
  35. 4
    1
      modules/layer/LayerGroup.js
  36. 5
    1
      modules/layer/type/ClusterLayer.js
  37. 4
    1
      modules/layer/type/CzmlLayer.js
  38. 4
    1
      modules/layer/type/DynamicLayer.js
  39. 5
    2
      modules/layer/type/FeatureGridLayer.js
  40. 4
    1
      modules/layer/type/GeoJsonLayer.js
  41. 15
    4
      modules/layer/type/HtmlLayer.js
  42. 4
    1
      modules/layer/type/KmlLayer.js
  43. 4
    1
      modules/layer/type/LabelLayer.js
  44. 7
    1
      modules/layer/type/PrimitiveLayer.js
  45. 4
    1
      modules/layer/type/TilesetLayer.js
  46. 5
    1
      modules/layer/type/TopoJsonLayer.js
  47. 4
    1
      modules/layer/type/VectorLayer.js
  48. 12
    0
      modules/loader/Loader.js
  49. 4
    0
      modules/loader/index.js
  50. 18
    1
      modules/loader/type/ViewerLoader.js
  51. 4
    0
      modules/loader/type/WeatherLoader.js
  52. 5
    1
      modules/mapv/MapvLayer.js
  53. 3
    0
      modules/material/shader/polyline/PolylineImageTrailMaterial.glsl
  54. 50
    9
      modules/math/area.js
  55. 3
    2
      modules/math/index.js
  56. 13
    0
      modules/math/midCartesian.js
  57. 1
    2
      modules/math/midPosition.js
  58. 4
    1
      modules/option/ViewerOption.js
  59. 1
    0
      modules/option/index.js
  60. 13
    8
      modules/overlay/Overlay.js
  61. 5
    2
      modules/overlay/custom/CustomBillboard.js
  62. 5
    2
      modules/overlay/custom/CustomLabel.js
  63. 7
    4
      modules/overlay/dynamic/DynamicBillboard.js
  64. 8
    5
      modules/overlay/dynamic/DynamicModel.js
  65. 4
    6
      modules/overlay/dynamic/DynamicOverlay.js
  66. 34
    20
      modules/overlay/html/DivIcon.js
  67. 3
    0
      modules/overlay/index.js
  68. 5
    2
      modules/overlay/model/Model.js
  69. 4
    1
      modules/overlay/model/Tileset.js
  70. 4
    1
      modules/overlay/plot/AttackArrow.js
  71. 4
    1
      modules/overlay/plot/DoubleArrow.js
  72. 4
    1
      modules/overlay/plot/FineArrow.js
  73. 4
    1
      modules/overlay/plot/GatheringPlace.js
  74. 4
    1
      modules/overlay/plot/TailedAttackArrow.js
  75. 4
    1
      modules/overlay/primitive/BillboardPrimitive.js
  76. 73
    0
      modules/overlay/primitive/BounceBillboardPrimitive.js
  77. 73
    0
      modules/overlay/primitive/BounceLabelPrimitive.js
  78. 13
    28
      modules/overlay/primitive/DiffuseWallPrimitive.js
  79. 4
    1
      modules/overlay/primitive/ElecEllipsoidPrimitive.js
  80. 4
    1
      modules/overlay/primitive/FlowLinePrimitive.js
  81. 4
    1
      modules/overlay/primitive/LabelPrimitive.js
  82. 133
    0
      modules/overlay/primitive/ModelCollectionPrimitive.js
  83. 41
    1
      modules/overlay/primitive/ModelPrimitive.js
  84. 5
    1
      modules/overlay/primitive/PointPrimitive.js
  85. 4
    1
      modules/overlay/primitive/PolylinePrimitive.js
  86. 4
    1
      modules/overlay/primitive/ScanCirclePrimitive.js
  87. 4
    1
      modules/overlay/primitive/TrailLinePrimitive.js
  88. 4
    1
      modules/overlay/primitive/VideoPrimitive.js
  89. 4
    1
      modules/overlay/primitive/WaterPrimitive.js
  90. 4
    1
      modules/overlay/vector/Billboard.js
  91. 4
    1
      modules/overlay/vector/Box.js
  92. 5
    2
      modules/overlay/vector/Circle.js
  93. 4
    1
      modules/overlay/vector/Corridor.js
  94. 4
    1
      modules/overlay/vector/Cylinder.js
  95. 4
    1
      modules/overlay/vector/Ellipse.js
  96. 4
    1
      modules/overlay/vector/Ellipsoid.js
  97. 4
    1
      modules/overlay/vector/Label.js
  98. 4
    1
      modules/overlay/vector/Plane.js
  99. 4
    1
      modules/overlay/vector/Point.js
  100. 0
    0
      modules/overlay/vector/Polygon.js

+ 1
- 1
.eslintignore 查看文件

/libs/ /libs/
/web/ /web/
/pack/ /pack/
dist/*

+ 1
- 1
.github/FUNDING.yml 查看文件

custom: ["https://www.paypal.com/paypalme/cavencj","https://www.dvgis.cn","https://www.cavencj.cn"]
custom: ["https://resource.dvgis.cn/dc-docs/v2.x/zh/introduction/#%E6%94%AF%E6%8C%81","https://www.paypal.com/paypalme/cavencj","https://www.dvgis.cn","https://www.cavencj.cn"]

+ 134
- 0
CHANGES_en.md 查看文件

# Change Log # Change Log


### 2.6.0 - 2021-10-10

#### Breaking Changes 📣

- Upgrade Cesium to version 1.86.0

#### Fixes 🔧

- Improve the MapSwitch [#70](https://github.com/dvgis/dc-sdk/issues/70)
- Improve the AroundView [#72](https://github.com/dvgis/dc-sdk/issues/72)

### 2.5.0 - 2021-09-04

#### Breaking Changes 📣

- Upgrade Cesium to version 1.85.0

#### Fixes 🔧

- Fix the problem that roaming cannot set parameters and the failed camera cannot move [#65](https://github.com/dvgis/dc-sdk/issues/65)
- Fix the problem that the gradient setting of heat layer [#66](https://github.com/dvgis/dc-sdk/issues/66)
- Improve the DivIcon style

### 2.4.2 - 2021-08-28

#### Fixes 🔧

- Hide the chart layer at the back [#55](https://github.com/dvgis/dc-sdk/issues/55)
- Hide the div icon at the back [#56](https://github.com/dvgis/dc-sdk/issues/56)
- Improve the position editor [#57](https://github.com/dvgis/dc-sdk/issues/57)
- Improve the terrain clipping [#58](https://github.com/dvgis/dc-sdk/issues/58)

### 2.4.1 - 2021-08-21

#### Additions 🎉

- Added support for layer mouse events [#53](https://github.com/dvgis/dc-sdk/issues/54)
- Add partial mouse default events [#54](https://github.com/dvgis/dc-sdk/issues/54)
- Add function to get tile information

#### Fixes 🔧

- Improve the plot function

### 2.4.0 - 2021-08-07

#### Breaking Changes 📣

- Upgrade Cesium to version 1.84.0

#### Additions 🎉

- Add bounce primitive overlays
- Add model collection primitive

#### Fixes 🔧

- Refine type property
- Improve mouse event
- Improve once event

### 2.3.2 - 2021-07-25

#### Additions 🎉

- Add model primitive to get node-related functions [#51](https://github.com/dvgis/dc-sdk/issues/51)

#### Fixes 🔧

- Improve the history track restore function [#50](https://github.com/dvgis/dc-sdk/issues/50)

### 2.3.1 - 2021-07-19

#### Breaking Changes 📣

- Refactored plotting function
- Remove Position rounding function
- Refine the infrastructure part of the script

#### Additions 🎉

- Add spatial measurement tools
- Add the plotting tool module
- Add function midCartesian to calculate the middle point of Cartesian3

#### Fixes 🔧

- Improve the Position copy function
- Improve the model editing tool for 3dtiles position editing function
- Improve the function area
- Improve the function of calculating the point position of a sector


### 2.3.0 - 2021-07-03

#### Breaking Changes 📣

- Upgrade Cesium to version 1.83.0

#### Additions 🎉

- Add constants for mouse mode
- Add property settings for globe terrain exaggeration

#### Fixes 🔧

- Improve the parsePositions for string coords

### 2.2.5 - 2021-06-26

#### Additions 🎉

- Adds line and face rotation conversion calculations

#### Fixes 🔧

- Improve the interpolation of history track
- Improve the function of plot for above the overlay
- Fix the problem of flickering when analyzing transformation parameters in the viewable field [#37](https://github.com/dvgis/dc-sdk/issues/37)
- Fix the problem that DivIcon cannot get the current coordinates set to (0,0,0) by default [#38](https://github.com/dvgis/dc-sdk/issues/38)

### 2.2.4 - 2021-06-12

#### Breaking Changes 📣

- Refactored the roaming function into first-person roaming and keyboard roaming [#34](https://github.com/dvgis/dc-sdk/issues/34)
- Original roaming function becomes history track, refine its pause and play [#35](https://github.com/dvgis/dc-sdk/issues/35)

#### Fixes 🔧

- Improve heading function
- Improve diffuse wall primitive
- Fixes RadarScan missing Cesium issue [#33](https://github.com/dvgis/dc-sdk/issues/33)

### 2.2.3 - 2021-06-05 ### 2.2.3 - 2021-06-05


#### Breaking Changes 📣 #### Breaking Changes 📣

+ 133
- 5
CHANGES_zh.md 查看文件

# Change Log # Change Log


### 2.6.0 - 2021-10-10

#### Breaking Changes 📣

- 升级 Cesium 到 1.86.0 版本

#### Fixes 🔧

- 完善地图切换组件样式 [#70](https://github.com/dvgis/dc-sdk/issues/70)
- 完善相机环绕功能 [#72](https://github.com/dvgis/dc-sdk/issues/72)

### 2.5.0 - 2021-09-04

#### Breaking Changes 📣

- 升级 Cesium 到 1.85.0 版本

#### Fixes 🔧

- 修复漫游无法设置参数以及失效相机无法移动的问题 [#65](https://github.com/dvgis/dc-sdk/issues/65)
- 修复热区图层渐变设置失效的问题 [#66](https://github.com/dvgis/dc-sdk/issues/66)
- 完善DivIcon的样式设定

### 2.4.2 - 2021-08-28

#### Fixes 🔧

- 隐藏图表图层当在地球背面 [#55](https://github.com/dvgis/dc-sdk/issues/55)
- 隐藏DivIcon当在地球背面时 [#56](https://github.com/dvgis/dc-sdk/issues/56)
- 完善模型位置编辑工具 [#57](https://github.com/dvgis/dc-sdk/issues/57)
- 完善地形裁剪分析 [#58](https://github.com/dvgis/dc-sdk/issues/58)

### 2.4.1 - 2021-08-21

#### Additions 🎉

- 添加图层鼠标事件的支持 [#53](https://github.com/dvgis/dc-sdk/issues/54)
- 添加部分鼠标默认事件 [#54](https://github.com/dvgis/dc-sdk/issues/54)
- 添加获取瓦片信息的函数

#### Fixes 🔧

- 完善标绘功能

### 2.4.0 - 2021-08-07

#### Breaking Changes 📣

- 升级 Cesium 到 1.84.0 版本

#### Additions 🎉

- 添加跳动图元覆盖物
- 添加模型集合图元

#### Fixes 🔧

- 完善类型属性
- 完善鼠标事件的管理
- 完善 once 事件

### 2.3.2 - 2021-07-25

#### Additions 🎉

- 添加模型图元获取节点相关函数 [#51](https://github.com/dvgis/dc-sdk/issues/51)

#### Fixes 🔧

- 完善历史轨迹恢复功能 [#50](https://github.com/dvgis/dc-sdk/issues/50)

### 2.3.1 - 2021-07-19

#### Breaking Changes 📣

- 重构标绘功能
- 移除Position舍弃函数
- 完善基础架构部分脚本

#### Additions 🎉

- 添加空间测量工具
- 添加标绘工具模块
- 添加函数 midCartesian,计算笛卡尔坐标系的中间点位

#### Fixes 🔧

- 完善Position复制功能
- 完善模型编辑工具对于3dtiles的位置编辑功能
- 完善函数 area
- 完善扇形的点位计算功能

### 2.3.0 - 2021-07-03

#### Breaking Changes 📣

- 升级 Cesium 到 1.83.0 版本

#### Additions 🎉

- 添加鼠标模式的常量
- 添加地球地形夸张的属性设置

#### Fixes 🔧

- 完善字符串坐标转换功能

### 2.2.5 - 2021-06-26

#### Additions 🎉

- 添加线和面的旋转转换计算

#### Fixes 🔧

- 完善历史轨迹的插值方式
- 完善标绘模块在模型上标绘的功能
- 修复可视域分析变换参数时闪烁的问题[#37](https://github.com/dvgis/dc-sdk/issues/37)
- 修复 DivIcon 无法获取当前坐标默认设置为 (0,0,0) 的问题[#38](https://github.com/dvgis/dc-sdk/issues/38)

### 2.2.4 - 2021-06-12

#### Breaking Changes 📣

- 重构漫游功能,漫游功能分为第一人称漫游和键盘漫游[#34](https://github.com/dvgis/dc-sdk/issues/34)
- 原有的漫游功能变为历史轨迹,完善其暂停和播放[#35](https://github.com/dvgis/dc-sdk/issues/35)

#### Fixes 🔧

- 完善 heading 函数
- 完善扩散墙功能
- 修复 RadarScan 缺少 Cesium 的问题[#33](https://github.com/dvgis/dc-sdk/issues/33)

### 2.2.3 - 2021-06-05 ### 2.2.3 - 2021-06-05


#### Breaking Changes 📣 #### Breaking Changes 📣
- 开放部分 Cesium 内部函数 - 开放部分 Cesium 内部函数
- 添加 FeatureGridLayer - 添加 FeatureGridLayer


#### Additions 🎉

- 添加 DivIcon 鼠标移入和移出功能
- 添加地图当前分辨率和视野范围属性

#### Fixes 🔧 #### Fixes 🔧


- 修复部分军标无法使用的问题[#24](https://github.com/dvgis/dc-sdk/issues/24) - 修复部分军标无法使用的问题[#24](https://github.com/dvgis/dc-sdk/issues/24)

+ 4
- 4
README.md 查看文件



[**🇨🇳 中文**](./README_zh.md) | [**🇬🇧English**](./README.md) [**🇨🇳 中文**](./README_zh.md) | [**🇬🇧English**](./README.md)


**_`DC-SDK`_** is based on the open source project **_`Cesium`_** for the second development of two three-dimensional **_`WebGis`_** application framework , the framework optimizes the use of **_`Cesium`_** and adds some additional features , designed for developers to quickly build **_`WebGis`_** application.
`DC-SDK` is based on the open source project `Cesium` for the second development of two three-dimensional `WebGis` application framework , the framework optimizes the use of `Cesium` and adds some additional features , designed for developers to quickly build `WebGis` application.


```warning ```warning
Tips:This SDK is JS+GIS framework package. Developers need to have some front-end technology and GIS related technology Tips:This SDK is JS+GIS framework package. Developers need to have some front-end technology and GIS related technology


> The configuration is mainly used in the `NPM / YARN` way > The configuration is mainly used in the `NPM / YARN` way


Since the DC framework sets `CESIUM_BASE_URL` to `JSON.stringify('. /libs/dc-sdk/resources/')`, you need to copy `Cesium` static resource files: `Assets`, `Workers`, `ThirdParty` to the `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly.
Since the `DC` framework sets `CESIUM_BASE_URL` to `./libs/dc-sdk/resources/` , you need to copy `Cesium` related static resources files: `Assets` , `Workers` , `ThirdParty `to `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly. You can also use `DC.baseUrl` to set the static resource base related to `Cesium` .


`Webpack` `Webpack`




## Demo ## Demo


| ![picture](http://dc.dvgis.cn/examples/images/baselayer/baidu.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/tdt.png?v=1) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/arcgis.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/china.gif) |
| ![picture](http://dc.dvgis.cn/examples/images/baselayer/baidu.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/tdt.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/arcgis.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/china.gif) |
| :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: | | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: |
| ![picture](http://dc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://dc.dvgis.cn/examples/images/model/shp_custom_shader.gif) | | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://dc.dvgis.cn/examples/images/model/shp_custom_shader.gif) |
| ![picture](http://dc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://dc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/overlay/water.gif?v=2) | ![picture](http://dc.dvgis.cn/examples/images/overlay/plot-overlay.png) |
| ![picture](http://dc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://dc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/overlay/water.gif?v=4) | ![picture](http://dc.dvgis.cn/examples/images/overlay/plot-overlay.png?v=4) |


[More>>](http://dc.dvgis.cn/#/examples) [More>>](http://dc.dvgis.cn/#/examples)



+ 4
- 4
README_zh.md 查看文件



[**🇨🇳 中文**](./README_zh.md) | [**🇬🇧English**](./README.md) [**🇨🇳 中文**](./README_zh.md) | [**🇬🇧English**](./README.md)


> DC-SDK 是基于 Cesium 进行二次开发的2、3D一体 WebGis 应用框架,该框架优化了 Cesium 的使用方式和增添了一些额外功能,旨在为开发者快速构建 WebGis 应用。
> `DC-SDK` 是基于开源项目 `Cesium` 进行二次开发的二三维一体的 `WebGis` 应用框架,该框架优化了部分 `Cesium` 的使用方式和增添一些通用功能,旨在为开发者快速构建 `WebGis` 应用。


```warning ```warning
Tips:本框架是 JS+GIS 的框架包。开发者需要有一定的前端技术和 GIS 相关技术 Tips:本框架是 JS+GIS 的框架包。开发者需要有一定的前端技术和 GIS 相关技术


> 配置主要用于 `NPM / YARN` 的方式 > 配置主要用于 `NPM / YARN` 的方式


由于 DC 框架中将 `CESIUM_BASE_URL` 设置为 `JSON.stringify('./libs/dc-sdk/resources/')`,这样需将 `Cesium` 相关的静态资源文件: `Assets`、`Workers` 、`ThirdParty` 复制到工程的 `libs/dc-sdk/resources` 目录下以保证三维场景能够正常呈现
由于 `DC` 框架中将 `CESIUM_BASE_URL` 设置为 `./libs/dc-sdk/resources/` ,这样需将 Cesium 相关的静态资源文件: `Assets` 、`Workers` 、`ThirdParty` 复制到工程的 `libs/dc-sdk/resources` 目录下以保证三维场景能够正常呈现,也可通过 `DC.baseUrl` 进行 `Cesium` 相关的静态资源路基设置


`Webpack` `Webpack`




## 示例 ## 示例


| ![picture](http://dc.dvgis.cn/examples/images/baselayer/baidu.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/tdt.png?v=1) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/arcgis.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/china.gif) |
| ![picture](http://dc.dvgis.cn/examples/images/baselayer/baidu.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/tdt.png?v=2) | ![picture](http://dc.dvgis.cn/examples/images/baselayer/arcgis.png?v=3) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/china.gif) |
| :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: | | :-----------------------------------------------------------: | :-----------------------------------------------------------: | :------------------------------------------------------------------: | :--------------------------------------------------------------: |
| ![picture](http://dc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://dc.dvgis.cn/examples/images/model/shp_custom_shader.gif) | | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/dfmz.gif) | ![picture](http://dc.dvgis.cn/examples/images/mini-scene/factory.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/layer/cluster_circle.gif) | ![picture](http://dc.dvgis.cn/examples/images/model/shp_custom_shader.gif) |
| ![picture](http://dc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://dc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/overlay/water.gif?v=2) | ![picture](http://dc.dvgis.cn/examples/images/overlay/plot-overlay.png) |
| ![picture](http://dc.dvgis.cn/examples/images/overlay/polyline_image_trail.gif) | ![picture](http://dc.dvgis.cn/examples/images/overlay/wall_trail.gif?v=1) | ![picture](http://dc.dvgis.cn/examples/images/overlay/water.gif?v=2) | ![picture](http://dc.dvgis.cn/examples/images/overlay/plot-overlay.png?v=3) |


[更多>>](http://dc.dvgis.cn/#/examples) [更多>>](http://dc.dvgis.cn/#/examples)



+ 8
- 0
modules/animation/AnimationType.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-01 00:12:06
*/

let AnimationType = {}

export default AnimationType

+ 1
- 0
modules/animation/index.js 查看文件

*/ */


export { default as Animation } from './Animation' export { default as Animation } from './Animation'
export { default as AnimationType } from './AnimationType'


/** /**
* types * types

+ 7
- 1
modules/animation/type/AroundPoint.js 查看文件

import { Cesium } from '@dc-modules/namespace' import { Cesium } from '@dc-modules/namespace'
import { Transform } from '@dc-modules/transform' import { Transform } from '@dc-modules/transform'
import Parse from '@dc-modules/parse/Parse' import Parse from '@dc-modules/parse/Parse'
import AnimationType from '../AnimationType'


import Animation from '../Animation' import Animation from '../Animation'


this._options = options this._options = options
this._heading = viewer.camera.heading this._heading = viewer.camera.heading
this._aroundAmount = 0.2 this._aroundAmount = 0.2
this.type = 'around_point'
}

get type() {
return AnimationType.AROUND_POINT
} }


set position(position) { set position(position) {
} }
} }


AnimationType.AROUND_POINT = 'around_point'

export default AroundPoint export default AroundPoint

+ 15
- 3
modules/animation/type/AroundView.js 查看文件



import { Cesium } from '@dc-modules/namespace' import { Cesium } from '@dc-modules/namespace'
import Animation from '../Animation' import Animation from '../Animation'
import AnimationType from '../AnimationType'


class AroundView extends Animation { class AroundView extends Animation {
constructor(viewer, options = {}) { constructor(viewer, options = {}) {
this._options = options this._options = options
this._heading = viewer.camera.heading this._heading = viewer.camera.heading
this._aroundAmount = 0.2 this._aroundAmount = 0.2
this.type = 'around_view'
}

get type() {
return AnimationType.AROUND_VIEW
} }


set aroundAmount(aroundAmount) { set aroundAmount(aroundAmount) {
if (this._heading >= Math.PI * 2 || this._heading <= -Math.PI * 2) { if (this._heading >= Math.PI * 2 || this._heading <= -Math.PI * 2) {
this._heading = 0 this._heading = 0
} }
this._viewer.scene.camera.setView({
this._viewer.camera.setView({
orientation: { orientation: {
heading: this._heading
heading: this._heading,
pitch: this._options.pitch
? Cesium.Math.toRadians(this._options.pitch)
: this._viewer.camera.pitch,
roll: this._options.roll
? Cesium.Math.toRadians(this._options.roll)
: this._viewer.camera.roll
} }
}) })
} }
} }


AnimationType.AROUND_VIEW = 'around_view'

export default AroundView export default AroundView

+ 7
- 1
modules/animation/type/CircleScan.js 查看文件

import { Util } from '@dc-modules/utils' import { Util } from '@dc-modules/utils'
import { Transform } from '@dc-modules/transform' import { Transform } from '@dc-modules/transform'
import Animation from '../Animation' import Animation from '../Animation'
import AnimationType from '../AnimationType'


const CircleScanShader = require('@dc-modules/material/shader/circle/CircleScanShader.glsl') const CircleScanShader = require('@dc-modules/material/shader/circle/CircleScanShader.glsl')


this._radius = radius || 100 this._radius = radius || 100
this._color = options.color || Cesium.Color.RED this._color = options.color || Cesium.Color.RED
this._speed = options.speed || 2 this._speed = options.speed || 2
this.type = 'circle_scan'
}

get type() {
return AnimationType.CIRCLE_SCAN
} }


/** /**
} }
} }


AnimationType.CIRCLE_SCAN = 'circle_scan'

export default CircleScan export default CircleScan

+ 7
- 1
modules/animation/type/Flying.js 查看文件

import Parse from '@dc-modules/parse/Parse' import Parse from '@dc-modules/parse/Parse'
import { Transform } from '@dc-modules/transform' import { Transform } from '@dc-modules/transform'
import Animation from '../Animation' import Animation from '../Animation'
import AnimationType from '../AnimationType'


class Flying extends Animation { class Flying extends Animation {
constructor(viewer, options = {}) { constructor(viewer, options = {}) {
this._positions = [] this._positions = []
this._durations = [3] this._durations = [3]
this._currentIndex = 0 this._currentIndex = 0

this._timer = undefined this._timer = undefined
} }


get type() {
return AnimationType.FLYING
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
return this return this
} }
} }


AnimationType.FLYING = 'flying'

export default Flying export default Flying

+ 7
- 1
modules/animation/type/GlobeRotate.js 查看文件



import { Cesium } from '@dc-modules/namespace' import { Cesium } from '@dc-modules/namespace'
import Animation from '../Animation' import Animation from '../Animation'
import AnimationType from '../AnimationType'


class GlobeRotate extends Animation { class GlobeRotate extends Animation {
constructor(viewer, options = {}) { constructor(viewer, options = {}) {
super(viewer) super(viewer)
this._options = options this._options = options
this.type = 'globe_rotate'
}

get type() {
return AnimationType.GLOBE_ROTATE
} }


/** /**
} }
} }


AnimationType.GLOBE_ROTATE = 'globe_rotate'

export default GlobeRotate export default GlobeRotate

+ 7
- 1
modules/animation/type/RadarScan.js 查看文件

import { Util } from '@dc-modules/utils' import { Util } from '@dc-modules/utils'
import { Transform } from '@dc-modules/transform' import { Transform } from '@dc-modules/transform'
import Animation from '../Animation' import Animation from '../Animation'
import AnimationType from '../AnimationType'


const RadarScanShader = require('@dc-modules/material/shader/radar/RadarScanShader.glsl') const RadarScanShader = require('@dc-modules/material/shader/radar/RadarScanShader.glsl')


this._color = options.color || Cesium.Color.BLUE this._color = options.color || Cesium.Color.BLUE
this._speed = options.speed || 3 this._speed = options.speed || 3
this._delegate = undefined this._delegate = undefined
this.type = 'radar_scan'
}

get type() {
return AnimationType.RADAR_SCAN
} }


/** /**
} }
} }


AnimationType.RADAR_SCAN = 'radar_scan'

export default RadarScan export default RadarScan

+ 5
- 2
modules/chart/ChartLayer.js 查看文件

super(id) super(id)
this._option = option this._option = option
this._delegate = DomUtil.create('div', 'dc-chart') this._delegate = DomUtil.create('div', 'dc-chart')
this._setWrapperStyle()
this._chart = undefined this._chart = undefined
this.type = Layer.getLayerType('chart')
this._setWrapperStyle()
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('chart')
}

get chart() { get chart() {
return this._chart return this._chart
} }

+ 9
- 9
modules/chart/extension/CoordinateSystem.js 查看文件

} }


dataToPoint(data) { dataToPoint(data) {
let scene = this._viewer.scene
let result = [0, 0]
let result = []
let cartesian3 = Cesium.Cartesian3.fromDegrees(data[0], data[1]) let cartesian3 = Cesium.Cartesian3.fromDegrees(data[0], data[1])
if (!cartesian3) { if (!cartesian3) {
return result return result
} }
if (
scene.mode === Cesium.SceneMode.SCENE3D &&
Cesium.Cartesian3.angleBetween(scene.camera.position, cartesian3) >
Cesium.Math.toRadians(80)
) {
return false
let up = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(
cartesian3,
new Cesium.Cartesian3()
)
let cd = this._viewer.camera.direction
if (Cesium.Cartesian3.dot(up, cd) >= 0) {
return result
} }
let coords = scene.cartesianToCanvasCoordinates(cartesian3)
let coords = this._viewer.scene.cartesianToCanvasCoordinates(cartesian3)
if (!coords) { if (!coords) {
return result return result
} }

+ 1
- 1
modules/copy-right/index.js 查看文件

console.log( console.log(
`%c \n DC-SDK \n %c \n 用数字描绘世界之美 %c \n `%c \n DC-SDK \n %c \n 用数字描绘世界之美 %c \n
版本:${__VERSION__} - ${__TIME__} 版本:${__VERSION__} - ${__TIME__}
Cesium版本:1.81.0
Cesium版本:1.86.0
开发作者:${__AUTHOR__} 开发作者:${__AUTHOR__}
网站主页: ${__HOME_PAGE__} 网站主页: ${__HOME_PAGE__}
github:${__REPOSITORY__} github:${__REPOSITORY__}

+ 4
- 1
modules/effect/type/BlackAndWhite.js 查看文件

this._enable = false this._enable = false
this._gradations = 1 this._gradations = 1
this._selected = [] this._selected = []
this.type = 'black_and_white'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'black_and_white'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if (enable && this._viewer && !this._delegate) { if (enable && this._viewer && !this._delegate) {

+ 4
- 1
modules/effect/type/Bloom.js 查看文件

this._sigma = 3.8 this._sigma = 3.8
this._stepSize = 5 this._stepSize = 5
this._selected = [] this._selected = []
this.type = 'bloom'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'bloom'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if (enable && this._viewer && !this._delegate) { if (enable && this._viewer && !this._delegate) {

+ 4
- 1
modules/effect/type/Brightness.js 查看文件

this._enable = false this._enable = false
this._intensity = 1 this._intensity = 1
this._selected = [] this._selected = []
this.type = 'brightness'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'brightness'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if (enable && this._viewer && !this._delegate) { if (enable && this._viewer && !this._delegate) {

+ 4
- 1
modules/effect/type/DepthOfField.js 查看文件

this._sigma = 3.8 this._sigma = 3.8
this._stepSize = 2.5 this._stepSize = 2.5
this._selected = [] this._selected = []
this.type = 'depth_of_field'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'depth_of_field'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if ( if (

+ 4
- 1
modules/effect/type/LensFlare.js 查看文件

this._dirtAmount = 0.4 this._dirtAmount = 0.4
this._haloWidth = 0.4 this._haloWidth = 0.4
this._selected = [] this._selected = []
this.type = 'lens_flare'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'lens_flare'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if (enable && this._viewer && !this._delegate) { if (enable && this._viewer && !this._delegate) {

+ 4
- 1
modules/effect/type/NightVision.js 查看文件

constructor() { constructor() {
this._enable = false this._enable = false
this._selected = [] this._selected = []
this.type = 'night'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'night'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if (enable && this._viewer && !this._delegate) { if (enable && this._viewer && !this._delegate) {

+ 4
- 1
modules/effect/type/Silhouette.js 查看文件

this._color = Cesium.Color.GREEN this._color = Cesium.Color.GREEN
this._length = 0.5 this._length = 0.5
this._selected = [] this._selected = []
this.type = 'silhouette'
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return 'silhouette'
}

set enable(enable) { set enable(enable) {
this._enable = enable this._enable = enable
if ( if (

+ 4
- 0
modules/effect/type/Sun.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-01 00:22:00
*/

+ 8
- 2
modules/event/Event.js 查看文件

* @param context * @param context
*/ */
once(type, callback, context) { once(type, callback, context) {
let removeCallback = this._on(type, callback, context)
removeCallback && removeCallback()
let removeCallback = this._on(
type,
e => {
callback(e)
removeCallback && removeCallback()
},
context
)
} }


/** /**

+ 34
- 2
modules/event/EventType.js 查看文件

} }


const MouseEventType = { const MouseEventType = {
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK, CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK, RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE, MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
REMOVE_LAYER: 'removeLayer', REMOVE_LAYER: 'removeLayer',
ADD_EFFECT: 'addEffect', ADD_EFFECT: 'addEffect',
REMOVE_EFFECT: 'removeEffect', REMOVE_EFFECT: 'removeEffect',
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK, CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK, RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE, MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,


const OverlayEventType = { const OverlayEventType = {
...BaseEventType, ...BaseEventType,
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK, CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK, RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE, MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,


const LayerEventType = { const LayerEventType = {
...BaseEventType, ...BaseEventType,
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
} }


const TrackEventType = { const TrackEventType = {
RESET_TIME_LINE: 'restTimeLine' RESET_TIME_LINE: 'restTimeLine'
} }


const PlotEventType = {
DRAW_START: 'drawStart',
DRAW_STOP: 'drawStop',
EDIT_START: 'editStart',
EDIT_STOP: 'editEnd',
DRAW_ANCHOR: 'drawAnchor',
CREATE_ANCHOR: 'createAnchor',
UPDATE_ANCHOR: 'updateAnchor',
ANCHOR_MOVING: 'anchorMoving',
EDIT_ANCHOR_STOP: 'editAnchorStop',
CLEAR_ANCHOR: 'clearAnchor'
}

export { export {
MouseEventType, MouseEventType,
ViewerEventType, ViewerEventType,
LayerEventType, LayerEventType,
OverlayEventType, OverlayEventType,
TrackEventType, TrackEventType,
PathEventType
PathEventType,
PlotEventType
} }

+ 5
- 0
modules/event/index.js 查看文件

*/ */
export { default as TrackEvent } from './type/TrackEvent' export { default as TrackEvent } from './type/TrackEvent'
export { default as PathEvent } from './type/PathEvent' export { default as PathEvent } from './type/PathEvent'

/**
* plot
*/
export { default as PlotEvent } from './type/PlotEvent'

+ 101
- 23
modules/event/type/MouseEvent.js 查看文件

this._viewer = viewer this._viewer = viewer
this._selected = undefined this._selected = undefined
this._setInputAction() this._setInputAction()
this.on(MouseEventType.LEFT_DOWN, this._leftDownHandler, this)
this.on(MouseEventType.LEFT_UP, this._leftUpHandler, this)
this.on(MouseEventType.CLICK, this._clickHandler, this) this.on(MouseEventType.CLICK, this._clickHandler, this)
this.on(MouseEventType.DB_CLICK, this._dbClickHandler, this) this.on(MouseEventType.DB_CLICK, this._dbClickHandler, this)
this.on(MouseEventType.RIGHT_DOWN, this._rightDownHandler, this)
this.on(MouseEventType.RIGHT_UP, this._rightUpHandler, this)
this.on(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this) this.on(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this)
this.on(MouseEventType.MOUSE_MOVE, this._mouseMoveHandler, this) this.on(MouseEventType.MOUSE_MOVE, this._mouseMoveHandler, this)
this.on(MouseEventType.WHEEL, this._mouseWheelHandler, this) this.on(MouseEventType.WHEEL, this._mouseWheelHandler, this)
let overlayId = undefined let overlayId = undefined


// for Entity // for Entity
if (target && target.id && target.id instanceof Cesium.Entity) {
if (target?.id instanceof Cesium.Entity) {
overlayId = target.id.overlayId overlayId = target.id.overlayId
} }


// for Cesium3DTileFeature // for Cesium3DTileFeature
if (target && target instanceof Cesium.Cesium3DTileFeature) {
else if (target instanceof Cesium.Cesium3DTileFeature) {
overlayId = target.tileset.overlayId overlayId = target.tileset.overlayId
} }


// for Cesium3DTileset
else if (target?.primitive instanceof Cesium.Cesium3DTileset) {
overlayId = target.primitive.overlayId
}

// for Primitve
else if (target?.primitive) {
overlayId = target.primitive.overlayId
}

return overlayId return overlayId
} }


/** /**
* Returns the target information for the mouse event * Returns the target information for the mouse event
* @param target * @param target
* @returns {{overlay: any, feature: any, layer: any}}
* @returns {{instanceId: *, overlay: undefined, feature: undefined, layer: undefined}}
* @private * @private
*/ */
_getTargetInfo(target) { _getTargetInfo(target) {
let feature = undefined let feature = undefined


// for Entity // for Entity
if (target && target.id && target.id instanceof Cesium.Entity) {
if (target?.id instanceof Cesium.Entity) {
layer = this._viewer layer = this._viewer
.getLayers() .getLayers()
.filter(item => item.layerId === target.id.layerId)[0] .filter(item => item.layerId === target.id.layerId)[0]
if (layer && layer.getOverlay) {
if (layer?.getOverlay) {
overlay = layer.getOverlay(target.id.overlayId) overlay = layer.getOverlay(target.id.overlayId)
} }
} }


// for Cesium3DTileFeature // for Cesium3DTileFeature
else if (target && target instanceof Cesium.Cesium3DTileFeature) {
else if (target instanceof Cesium.Cesium3DTileFeature) {
layer = this._viewer layer = this._viewer
.getLayers() .getLayers()
.filter(item => item.layerId === target.tileset.layerId)[0] .filter(item => item.layerId === target.tileset.layerId)[0]
feature = target feature = target
if (layer && layer.getOverlay) {
if (layer?.getOverlay) {
overlay = layer.getOverlay(target.tileset.overlayId) overlay = layer.getOverlay(target.tileset.overlayId)
if (feature && feature.getPropertyNames) { if (feature && feature.getPropertyNames) {
let propertyNames = feature.getPropertyNames() let propertyNames = feature.getPropertyNames()
} }


// for Cesium3DTileset // for Cesium3DTileset
else if (
target &&
target.primitive &&
target.primitive instanceof Cesium.Cesium3DTileset
) {
else if (target?.primitive instanceof Cesium.Cesium3DTileset) {
layer = this._viewer layer = this._viewer
.getLayers() .getLayers()
.filter(item => item.layerId === target.primitive.layerId)[0] .filter(item => item.layerId === target.primitive.layerId)[0]
if (layer && layer.getOverlay) {
if (layer?.getOverlay) {
overlay = layer.getOverlay(target.primitive.overlayId) overlay = layer.getOverlay(target.primitive.overlayId)
} }
} }


// for Primitve // for Primitve
else if (target && target.primitive) {
else if (target?.primitive) {
layer = this._viewer layer = this._viewer
.getLayers() .getLayers()
.filter(item => item.layerId === target.primitive.layerId)[0] .filter(item => item.layerId === target.primitive.layerId)[0]
if (layer && layer.getOverlay) {
if (layer?.getOverlay) {
overlay = layer.getOverlay(target.primitive.overlayId) overlay = layer.getOverlay(target.primitive.overlayId)
} }
} }


return { layer: layer, overlay: overlay, feature: feature }
return {
layer: layer,
overlay: overlay,
feature: feature,
instanceId: target?.instanceId
}
} }


/** /**
let event = undefined let event = undefined
let targetInfo = this._getTargetInfo(mouseInfo.target) let targetInfo = this._getTargetInfo(mouseInfo.target)
let overlay = targetInfo?.overlay let overlay = targetInfo?.overlay
let layer = targetInfo?.layer
// get Overlay Event // get Overlay Event
if (overlay && overlay.overlayEvent) {
if (overlay?.overlayEvent) {
event = overlay.overlayEvent.getEvent(type) event = overlay.overlayEvent.getEvent(type)
} }


// get Layer Event
if ((!event || event.numberOfListeners === 0) && layer?.layerEvent) {
event = layer.layerEvent.getEvent(type)
}

// get Viewer Event // get Viewer Event
if (!event || event.numberOfListeners === 0) {
if (
(!event || event.numberOfListeners === 0) &&
this._viewer?.viewerEvent
) {
event = this._viewer.viewerEvent.getEvent(type) event = this._viewer.viewerEvent.getEvent(type)
} }

event && event &&
event.numberOfListeners > 0 && event.numberOfListeners > 0 &&
event.raiseEvent({ event.raiseEvent({
}) })


// get Drill Pick Event // get Drill Pick Event
if (overlay && overlay.allowDrillPicking) {
if (overlay?.allowDrillPicking) {
let drillInfos = this._getDrillInfos(mouseInfo.windowPosition) let drillInfos = this._getDrillInfos(mouseInfo.windowPosition)
drillInfos.forEach(drillInfo => { drillInfos.forEach(drillInfo => {
let dillOverlay = drillInfo?.overlay let dillOverlay = drillInfo?.overlay
let dillLayer = drillInfo?.layer
if ( if (
dillOverlay?.overlayId !== overlay.overlayId && dillOverlay?.overlayId !== overlay.overlayId &&
dillOverlay?.overlayEvent dillOverlay?.overlayEvent
) { ) {
// get Overlay Event
event = dillOverlay.overlayEvent.getEvent(type) event = dillOverlay.overlayEvent.getEvent(type)
// get Layer Event
if (
(!event || event.numberOfListeners === 0) &&
dillLayer?.layerEvent
) {
event = dillLayer.layerEvent.getEvent(type)
}
event && event &&
event.numberOfListeners > 0 && event.numberOfListeners > 0 &&
event.raiseEvent({ event.raiseEvent({
* @private * @private
*/ */
_clickHandler(movement) { _clickHandler(movement) {
if (!movement || !movement.position) {
if (!movement?.position) {
return false return false
} }
let mouseInfo = this._getMouseInfo(movement.position) let mouseInfo = this._getMouseInfo(movement.position)
* @private * @private
*/ */
_dbClickHandler(movement) { _dbClickHandler(movement) {
if (!movement || !movement.position) {
if (!movement?.position) {
return false return false
} }
let mouseInfo = this._getMouseInfo(movement.position) let mouseInfo = this._getMouseInfo(movement.position)
* @private * @private
*/ */
_rightClickHandler(movement) { _rightClickHandler(movement) {
if (!movement || !movement.position) {
if (!movement?.position) {
return false return false
} }
let mouseInfo = this._getMouseInfo(movement.position) let mouseInfo = this._getMouseInfo(movement.position)
* @private * @private
*/ */
_mouseMoveHandler(movement) { _mouseMoveHandler(movement) {
if (!movement || !movement.endPosition) {
if (!movement?.endPosition) {
return false return false
} }
let mouseInfo = this._getMouseInfo(movement.endPosition) let mouseInfo = this._getMouseInfo(movement.endPosition)
} }
} }


/**
* Default mouse left down event handler
* @param movement
* @private
*/
_leftDownHandler(movement) {
if (!movement?.position) {
return false
}
let mouseInfo = this._getMouseInfo(movement.position)
this._raiseEvent(MouseEventType.LEFT_DOWN, mouseInfo)
}

/**
* Default mouse left up event handler
* @param movement
* @private
*/
_leftUpHandler(movement) {
this._raiseEvent(MouseEventType.LEFT_UP, { movement })
}

/**
* Default mouse right down event handler
* @param movement
* @private
*/
_rightDownHandler(movement) {
if (!movement?.position) {
return false
}
let mouseInfo = this._getMouseInfo(movement.position)
this._raiseEvent(MouseEventType.RIGHT_DOWN, mouseInfo)
}

/**
* Default mouse right up event handler
* @param movement
* @private
*/
_rightUpHandler(movement) {
this._raiseEvent(MouseEventType.RIGHT_UP, { movement })
}

/** /**
* Default mouse wheel event handler * Default mouse wheel event handler
* @param movement * @param movement

+ 27
- 0
modules/event/type/PlotEvent.js 查看文件

/**
* @Author: Caven
* @Date: 2020-05-11 23:28:13
*/

import { Cesium } from '@dc-modules/namespace'
import { PlotEventType } from '../EventType'
import Event from '../Event'

class PlotEvent extends Event {
constructor() {
super()
}

/**
*
* @private
*/
_registerEvent() {
Object.keys(PlotEventType).forEach(key => {
let type = PlotEventType[key]
this._cache[type] = new Cesium.Event()
})
}
}

export default PlotEvent

+ 7
- 3
modules/heat/HeatLayer.js 查看文件

this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('heat')
}

/** /**
* *
* @private * @private


/** /**
* *
* @returns {string|undefined}
* @returns {HTMLCanvasElement|undefined}
* @private * @private
*/ */
_createGradientTexture() { _createGradientTexture() {
let ctx = canvas.getContext('2d') let ctx = canvas.getContext('2d')
let grd = ctx.createLinearGradient(0, 0, 200, 0) let grd = ctx.createLinearGradient(0, 0, 200, 0)
for (let key in this._options.gradient) { for (let key in this._options.gradient) {
grd.addColorStop(+key, this._options.gradient[+key])
grd.addColorStop(+key, this._options.gradient[key])
} }
ctx.fillStyle = grd ctx.fillStyle = grd
ctx.fillRect(0, 0, 200, 10) ctx.fillRect(0, 0, 200, 10)
return canvas.toDataURL()
return canvas
} }


/** /**

+ 94
- 44
modules/history-track/Track.js 查看文件

import TrackViewMode from './TrackViewMode' import TrackViewMode from './TrackViewMode'


const DEF_OPTS = { const DEF_OPTS = {
showPath: false,
pathWidth: 1,
pathMaterial: Cesium.Color.ORANGE.withAlpha(0.8),
pathLeadTime: 1,
clampToGround: false, clampToGround: false,
clampToTileset: false
clampToTileset: false,
interpolationType: 'Linear',
interpolationDegree: 2
}

const DEF_PATH_STYLE = {
width: 2,
material: Cesium.Color.ORANGE,
clampToGround: true,
depthFailMaterial: Cesium.Color.ORANGE.withAlpha(0.8)
} }


class Track { class Track {
...options ...options
} }
this._controller = undefined this._controller = undefined
this._sampledPosition = undefined
this._velocityOrientation = undefined
this._viewed = false this._viewed = false
this._delegate = new Cesium.Entity() this._delegate = new Cesium.Entity()
this._pathPositions = []
this._path = new Cesium.Entity({
show: false,
polyline: {
positions: new Cesium.CallbackProperty(() => {
return this._pathPositions
})
}
})
this._positionIndex = 0 this._positionIndex = 0
this._timeLine = [] this._timeLine = []
this._startTime = undefined this._startTime = undefined
this._trackEvent.on(TrackEventType.POST_RENDER, this._onPostRender, this) this._trackEvent.on(TrackEventType.POST_RENDER, this._onPostRender, this)
this._trackEvent.on(TrackEventType.ADD, this._onAdd, this) this._trackEvent.on(TrackEventType.ADD, this._onAdd, this)
this._trackEvent.on(TrackEventType.REMOVE, this._onRemove, this) this._trackEvent.on(TrackEventType.REMOVE, this._onRemove, this)
this._trackEvent.on(
TrackEventType.RESET_TIME_LINE,
this._resetTimeLine,
this
)
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }




set positions(postions) { set positions(postions) {
this._positions = Parse.parsePositions(postions) this._positions = Parse.parsePositions(postions)
this._resetTimeLine()
this._resetTimeLine({})
return this return this
} }




set duration(duration) { set duration(duration) {
this._duration = duration this._duration = duration
this._resetTimeLine()
this._resetTimeLine({})
return this return this
} }


} else { } else {
this._startTime = startTime this._startTime = startTime
} }
this._resetTimeLine()
this._resetTimeLine({})
return this return this
} }


} }
this._controller = controller this._controller = controller
this._controller.delegate.add(this._delegate) this._controller.delegate.add(this._delegate)
this._controller.delegate.add(this._path)
!this._startTime && (this._startTime = Cesium.JulianDate.now()) !this._startTime && (this._startTime = Cesium.JulianDate.now())
this._state = State.ADDED this._state = State.ADDED
} }
* @private * @private
*/ */
_onRemove() { _onRemove() {
if (this._controller) {
this._controller.delegate.remove(this._delegate)
if (!this._controller) {
return false
} }
this._controller.delegate.remove(this._delegate)
this._controller.delegate.remove(this._path)
this._viewed = false this._viewed = false
this._startTime = undefined
this._state = State.REMOVED this._state = State.REMOVED
} }


return false return false
} }
let now = Cesium.JulianDate.now() let now = Cesium.JulianDate.now()
if (Cesium.JulianDate.lessThan(now, this._endTime)) {
if (Cesium.JulianDate.lessThanOrEquals(now, this._endTime)) {
let p = this._sampledPosition.getValue(now)
this._pathPositions.push(p)
if (this._options.clampToTileset) { if (this._options.clampToTileset) {
this._delegate.position = viewer.scene.clampToHeight(
this._sampledPosition.getValue(now),
[this._delegate]
)
this._delegate.position = viewer.scene.clampToHeight(p, [
this._delegate
])
} else { } else {
this._delegate.position = this._sampledPosition.getValue(now)
this._delegate.position = p
}
let orientation = this._velocityOrientation.getValue(now)
if (orientation) {
this._delegate.orientation = orientation
} }
let time = this._timeLine[this._positionIndex] let time = this._timeLine[this._positionIndex]
if (time) { if (time) {
let timeDiff = Cesium.JulianDate.secondsDifference(now, time) let timeDiff = Cesium.JulianDate.secondsDifference(now, time)
if (timeDiff >= 0 && timeDiff <= 1) { if (timeDiff >= 0 && timeDiff <= 1) {
let position = this._positions[this._positionIndex] || undefined let position = this._positions[this._positionIndex] || undefined
if (position) {
let mat = Cesium.Matrix3.fromQuaternion(
this._delegate.orientation.getValue(now)
)
let mat4 = Cesium.Matrix4.fromRotationTranslation(
mat,
this._sampledPosition.getValue(now)
)
if (position && orientation) {
let mat = Cesium.Matrix3.fromQuaternion(orientation)
let mat4 = Cesium.Matrix4.fromRotationTranslation(mat, p)
let hpr = Cesium.Transforms.fixedFrameToHeadingPitchRoll(mat4) let hpr = Cesium.Transforms.fixedFrameToHeadingPitchRoll(mat4)
position.heading = Cesium.Math.toDegrees(hpr.heading) position.heading = Cesium.Math.toDegrees(hpr.heading)
position.pitch = Cesium.Math.toDegrees(hpr.pitch) position.pitch = Cesium.Math.toDegrees(hpr.pitch)
return false return false
} }
let interval = 0 let interval = 0
let v = distance(this._positions) / this._duration
this._timeLine = this._positions.map((item, index, arr) => {
if (index !== 0) {
interval += distance([arr[index - 1], item]) / v
}
return Cesium.JulianDate.addSeconds(
this._startTime,
interval,
new Cesium.JulianDate()
)
})
if (params?.stopTime && params?.duration) {
if (!params?.stopTime && !params?.duration) {
let v = distance(this._positions) / this._duration
this._timeLine = this._positions.map((item, index, arr) => {
if (index !== 0) {
interval += distance([arr[index - 1], item]) / v
}
return Cesium.JulianDate.addSeconds(
this._startTime,
interval,
new Cesium.JulianDate()
)
})
this._pathPositions = []
} else if (params?.stopTime && params?.duration) {
this._duration += params.duration this._duration += params.duration
this._timeLine = this._timeLine.map(item => { this._timeLine = this._timeLine.map(item => {
if (Cesium.JulianDate.greaterThan(item, params.stopTime)) { if (Cesium.JulianDate.greaterThan(item, params.stopTime)) {
item = Cesium.JulianDate.addSeconds( item = Cesium.JulianDate.addSeconds(
item, item,
params.stopTime,
params.duration,
new Cesium.JulianDate() new Cesium.JulianDate()
) )
} }
) )
this._sampledPosition.forwardExtrapolationType = this._sampledPosition.forwardExtrapolationType =
Cesium.ExtrapolationType.HOLD Cesium.ExtrapolationType.HOLD
this._sampledPosition.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm: Cesium.HermitePolynomialApproximation
})
this._delegate.orientation = new Cesium.VelocityOrientationProperty(
/// setInterpolationOptions
if (this._options.interpolationType === 'Hermite') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 2,
interpolationAlgorithm: Cesium.HermitePolynomialApproximation
})
} else if (this._options.interpolationType === 'Linear') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 1,
interpolationAlgorithm: Cesium.LinearApproximation
})
} else if (this._options.interpolationType === 'Lagrange') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 5,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
})
}
this._velocityOrientation = new Cesium.VelocityOrientationProperty(
this._sampledPosition this._sampledPosition
) )
this._endTime = this._timeLine[this._timeLine.length - 1] this._endTime = this._timeLine[this._timeLine.length - 1]
addPosition(position, duration) { addPosition(position, duration) {
this._positions.push(Parse.parsePosition(position)) this._positions.push(Parse.parsePosition(position))
this._duration += duration this._duration += duration
this._resetTimeLine()
this._resetTimeLine({})
return this return this
} }


return this return this
} }


setPath() {}
/**
*
* @param visible
* @param style
* @returns {Track}
*/
setPath(visible, style = {}) {
this._path.show = !!visible
Util.merge(this._path.polyline, DEF_PATH_STYLE, style)
return this
}
} }


export default Track export default Track

+ 2
- 2
modules/history-track/TrackController.js 查看文件

this._viewer = viewer this._viewer = viewer
this._cache = {} this._cache = {}
this._delegete = new Cesium.CustomDataSource('history-track-layer') this._delegete = new Cesium.CustomDataSource('history-track-layer')
viewer.dataSources.add(this._delegete)
this._viewer.dataSources.add(this._delegete)
this._activedTrack = undefined this._activedTrack = undefined
this._viewMode = undefined this._viewMode = undefined
this._viewOption = {} this._viewOption = {}
let track = this._cache[key] let track = this._cache[key]
track.trackEvent.fire(TrackEventType.RESET_TIME_LINE, { track.trackEvent.fire(TrackEventType.RESET_TIME_LINE, {
stopTime: this._stopTime, stopTime: this._stopTime,
duration: Cesium.JulianDate.secondsDifference(this._stopTime, now)
duration: Cesium.JulianDate.secondsDifference(now, this._stopTime)
}) })
}) })
} }

+ 40
- 15
modules/layer/Layer.js 查看文件

this._layerEvent = new LayerEvent() this._layerEvent = new LayerEvent()
this._layerEvent.on(LayerEventType.ADD, this._onAdd, this) this._layerEvent.on(LayerEventType.ADD, this._onAdd, this)
this._layerEvent.on(LayerEventType.REMOVE, this._onRemove, this) this._layerEvent.on(LayerEventType.REMOVE, this._onRemove, this)
this._state = undefined
this.type = undefined
} }


get layerId() { get layerId() {
* @private * @private
*/ */
_addOverlay(overlay) { _addOverlay(overlay) {
if (
overlay &&
overlay.overlayEvent &&
!this._cache.hasOwnProperty(overlay.overlayId)
) {
if (!this._cache.hasOwnProperty(overlay.overlayId)) {
this._cache[overlay.overlayId] = overlay this._cache[overlay.overlayId] = overlay
this._delegate && overlay.overlayEvent.fire(OverlayEventType.ADD, this)
this._delegate && overlay.fire(OverlayEventType.ADD, this)
if (this._state === State.CLEARED) { if (this._state === State.CLEARED) {
this._state = State.ADDED this._state = State.ADDED
} }
* @private * @private
*/ */
_removeOverlay(overlay) { _removeOverlay(overlay) {
if (
overlay &&
overlay.overlayEvent &&
this._cache.hasOwnProperty(overlay.overlayId)
) {
this._delegate && overlay.overlayEvent.fire(OverlayEventType.REMOVE, this)
if (this._cache.hasOwnProperty(overlay.overlayId)) {
this._delegate && overlay.fire(OverlayEventType.REMOVE, this)
delete this._cache[overlay.overlayId] delete this._cache[overlay.overlayId]
} }
} }
* @returns {Layer} * @returns {Layer}
*/ */
addTo(viewer) { addTo(viewer) {
if (viewer && viewer.addLayer) {
if (viewer?.addLayer) {
viewer.addLayer(this) viewer.addLayer(this)
} }
return this return this
*/ */
setStyle(style) {} setStyle(style) {}


/**
* Subscribe event
* @param type
* @param callback
* @param context
* @returns {Layer}
*/
on(type, callback, context) {
this._layerEvent.on(type, callback, context || this)
return this
}

/**
* Unsubscribe event
* @param type
* @param callback
* @param context
* @returns {Layer}
*/
off(type, callback, context) {
this._layerEvent.off(type, callback, context || this)
return this
}

/**
* Trigger subscription event
* @param type
* @param params
* @returns {Layer}
*/
fire(type, params) {
this._layerEvent.fire(type, params)
return this
}

/** /**
* Registers Type * Registers Type
* @param type * @param type

+ 4
- 1
modules/layer/LayerGroup.js 查看文件

this._layerGroupEvent = new LayerGroupEvent() this._layerGroupEvent = new LayerGroupEvent()
this._layerGroupEvent.on(LayerGroupEventType.ADD, this._onAdd, this) this._layerGroupEvent.on(LayerGroupEventType.ADD, this._onAdd, this)
this._layerGroupEvent.on(LayerGroupEventType.REMOVE, this._onRemove, this) this._layerGroupEvent.on(LayerGroupEventType.REMOVE, this._onRemove, this)
this.type = Layer.getLayerType('layer_group')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


return this._id return this._id
} }


get type() {
return Layer.getLayerType('layer_group')
}

set show(show) { set show(show) {
this._show = show this._show = show
Object.keys(this._cache).forEach(key => { Object.keys(this._cache).forEach(key => {

+ 5
- 1
modules/layer/type/ClusterLayer.js 查看文件

this this
) )
this._delegate.clustering.pixelRange = this._options.pixelRange this._delegate.clustering.pixelRange = this._options.pixelRange
this.type = Layer.getLayerType('cluster')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('cluster')
}

set enableCluster(enableCluster) { set enableCluster(enableCluster) {
this._delegate.clustering.enabled = enableCluster this._delegate.clustering.enabled = enableCluster
return this return this

+ 4
- 1
modules/layer/type/CzmlLayer.js 查看文件

constructor(id, url = '', options = {}) { constructor(id, url = '', options = {}) {
super(id) super(id)
this._delegate = Cesium.CzmlDataSource.load(url, options) this._delegate = Cesium.CzmlDataSource.load(url, options)
this.type = Layer.getLayerType('czml')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('czml')
}

set show(show) { set show(show) {
this._show = show this._show = show
this._delegate && this._delegate &&

+ 4
- 1
modules/layer/type/DynamicLayer.js 查看文件

constructor(id) { constructor(id) {
super(id) super(id)
this._delegate = new Cesium.CustomDataSource(id) this._delegate = new Cesium.CustomDataSource(id)
this.type = Layer.getLayerType('dynamic')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('dynamic')
}

/** /**
* Clears all entities * Clears all entities
* @returns {DynamicLayer} * @returns {DynamicLayer}

+ 5
- 2
modules/layer/type/FeatureGridLayer.js 查看文件

count: 10, count: 10,
maximumLevel: 21, maximumLevel: 21,
dataProperty: '', dataProperty: '',
callback: record => {
callback: () => {
return null return null
} }
} }
this._rectangle = this._tilingScheme.rectangle this._rectangle = this._tilingScheme.rectangle
this._credit = undefined this._credit = undefined
this._token = undefined this._token = undefined
this.type = Layer.getLayerType('feature_grid')
for (let i = 0; i < this.maximumLevel; i++) { for (let i = 0; i < this.maximumLevel; i++) {
this._levelLayers[String(i)] = new VectorLayer(id + '-grid-' + i) this._levelLayers[String(i)] = new VectorLayer(id + '-grid-' + i)
} }
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('feature_grid')
}

get url() { get url() {
return this._url return this._url
} }

+ 4
- 1
modules/layer/type/GeoJsonLayer.js 查看文件

} }
super(id) super(id)
this._delegate = Cesium.GeoJsonDataSource.load(url, options) this._delegate = Cesium.GeoJsonDataSource.load(url, options)
this.type = Layer.getLayerType('geojson')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('geojson')
}

set show(show) { set show(show) {
this._show = show this._show = show
this._delegate && this._delegate &&

+ 15
- 4
modules/layer/type/HtmlLayer.js 查看文件

this._delegate = DomUtil.create('div', 'html-layer', undefined) this._delegate = DomUtil.create('div', 'html-layer', undefined)
this._delegate.setAttribute('id', this._id) this._delegate.setAttribute('id', this._id)
this._renderRemoveCallback = undefined this._renderRemoveCallback = undefined
this.type = Layer.getLayerType('html')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('html')
}

set show(show) { set show(show) {
this._show = show this._show = show
this._delegate.style.visibility = this._show ? 'visible' : 'hidden' this._delegate.style.visibility = this._show ? 'visible' : 'hidden'
this._viewer.dcContainer.appendChild(this._delegate) this._viewer.dcContainer.appendChild(this._delegate)
let scene = this._viewer.scene let scene = this._viewer.scene
this._renderRemoveCallback = scene.postRender.addEventListener(() => { this._renderRemoveCallback = scene.postRender.addEventListener(() => {
let cameraPosition = this._viewer.camera.positionWC
let cp = this._viewer.camera.positionWC
let cd = this._viewer.camera.direction
this.eachOverlay(item => { this.eachOverlay(item => {
if (item && item.position) { if (item && item.position) {
let position = Transform.transformWGS84ToCartesian(item.position) let position = Transform.transformWGS84ToCartesian(item.position)
let up = scene.globe.ellipsoid.geodeticSurfaceNormal(
position,
new Cesium.Cartesian3()
)
let windowCoord = Cesium.SceneTransforms.wgs84ToWindowCoordinates( let windowCoord = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
scene, scene,
position position
) )
let distance = Cesium.Cartesian3.distance(position, cameraPosition)
item._updateStyle({ transform: windowCoord }, distance)
item._updateStyle(
windowCoord,
Cesium.Cartesian3.distance(position, cp),
Cesium.Cartesian3.dot(cd, up) <= 0
)
} }
}, this) }, this)
}, this) }, this)

+ 4
- 1
modules/layer/type/KmlLayer.js 查看文件

} }
super(id) super(id)
this._delegate = Cesium.KmlDataSource.load(url, options) this._delegate = Cesium.KmlDataSource.load(url, options)
this.type = Layer.getLayerType('kml')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('kml')
}

set show(show) { set show(show) {
this._show = show this._show = show
this._delegate && this._delegate &&

+ 4
- 1
modules/layer/type/LabelLayer.js 查看文件

this._dataSource = Cesium.GeoJsonDataSource.load(url) this._dataSource = Cesium.GeoJsonDataSource.load(url)
this._delegate = new Cesium.CustomDataSource(id) this._delegate = new Cesium.CustomDataSource(id)
this._initLabel() this._initLabel()
this.type = Layer.registerType('label')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('label')
}

_createLabel(entity) { _createLabel(entity) {
if (entity.position && entity.name) { if (entity.position && entity.name) {
return Label.fromEntity(entity) return Label.fromEntity(entity)

+ 7
- 1
modules/layer/type/PrimitiveLayer.js 查看文件

import State from '@dc-modules/state/State' import State from '@dc-modules/state/State'
import Layer from '../Layer' import Layer from '../Layer'


/**
* PrimitiveLayer is used to add primitve
*/
class PrimitiveLayer extends Layer { class PrimitiveLayer extends Layer {
constructor(id) { constructor(id) {
super(id) super(id)
this._labels = this._delegate.add(new Cesium.LabelCollection()) this._labels = this._delegate.add(new Cesium.LabelCollection())
this._billboards = this._delegate.add(new Cesium.BillboardCollection()) this._billboards = this._delegate.add(new Cesium.BillboardCollection())
this._polylines = this._delegate.add(new Cesium.PolylineCollection()) this._polylines = this._delegate.add(new Cesium.PolylineCollection())
this.type = Layer.getLayerType('primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('primitive')
}

get points() { get points() {
return this._points return this._points
} }

+ 4
- 1
modules/layer/type/TilesetLayer.js 查看文件

constructor(id) { constructor(id) {
super(id) super(id)
this._delegate = new Cesium.PrimitiveCollection() this._delegate = new Cesium.PrimitiveCollection()
this.type = Layer.getLayerType('tileset')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('tileset')
}

/** /**
* Clear all tileset * Clear all tileset
* @returns {TilesetLayer} * @returns {TilesetLayer}

+ 5
- 1
modules/layer/type/TopoJsonLayer.js 查看文件



import State from '@dc-modules/state/State' import State from '@dc-modules/state/State'
import GeoJsonLayer from './GeoJsonLayer' import GeoJsonLayer from './GeoJsonLayer'
import Layer from '../Layer'


class TopoJsonLayer extends GeoJsonLayer { class TopoJsonLayer extends GeoJsonLayer {
constructor(id, url, options = {}) { constructor(id, url, options = {}) {
throw new Error('TopoJsonLayer:the url invalid') throw new Error('TopoJsonLayer:the url invalid')
} }
super(id, url, options) super(id, url, options)
this.type = GeoJsonLayer.getLayerType('topojson')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }

get type() {
return Layer.getLayerType('topojson')
}
} }


GeoJsonLayer.registerType('topojson') GeoJsonLayer.registerType('topojson')

+ 4
- 1
modules/layer/type/VectorLayer.js 查看文件

constructor(id) { constructor(id) {
super(id) super(id)
this._delegate = new Cesium.CustomDataSource(id) this._delegate = new Cesium.CustomDataSource(id)
this.type = Layer.getLayerType('vector')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Layer.getLayerType('vector')
}

/** /**
* Clears all entities * Clears all entities
* @returns {VectorLayer} * @returns {VectorLayer}

+ 12
- 0
modules/loader/Loader.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-17 20:43:05
*/

class Loader {
static loadDCP() {}

static loadDPS(fileName, is) {}
}

export default Loader

+ 4
- 0
modules/loader/index.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-17 20:42:39
*/

+ 18
- 1
modules/loader/type/ViewerLoader.js 查看文件

/** /**
* @Author: Caven * @Author: Caven
* @Date: 2021-03-15 10:56:54
* @Date: 2021-08-17 20:41:50
*/ */

class ViewerLoader {
constructor() {}

/**
*
* @param options
* @returns {DC.Viewer}
*/
loader(options = {}) {
let viewer = new DC.Viewer(options.container || 'viewer-container')
viewer.setOptions(options)
return viewer
}
}

export default ViewerLoader

+ 4
- 0
modules/loader/type/WeatherLoader.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-17 20:52:16
*/

+ 5
- 1
modules/mapv/MapvLayer.js 查看文件

this._option = option this._option = option
this._dataSet = undefined this._dataSet = undefined
this._delegate = undefined this._delegate = undefined
this.type = Layer.getLayerType('mapv')
this._state = State.INITIALIZED
}

get type() {
return Layer.getLayerType('mapv')
} }


set show(show) { set show(show) {

+ 3
- 0
modules/material/shader/polyline/PolylineImageTrailMaterial.glsl 查看文件

float time = fract(czm_frameNumber * speed / 1000.0); float time = fract(czm_frameNumber * speed / 1000.0);
vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t)); vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));
if(color.a == 0.0){ if(color.a == 0.0){
if(colorImage.rgb == vec3(1.0) || colorImage.rgb == vec3(0.0)){
discard;
}
material.alpha = colorImage.a; material.alpha = colorImage.a;
material.diffuse = colorImage.rgb; material.diffuse = colorImage.rgb;
}else{ }else{

+ 50
- 9
modules/math/area.js 查看文件

* @Date: 2020-04-24 14:49:37 * @Date: 2020-04-24 14:49:37
*/ */


import { Cesium } from '@dc-modules/namespace'
import { Transform } from '@dc-modules/transform' import { Transform } from '@dc-modules/transform'


/**
*
* @param p0
* @param p1
* @param p2
* @returns {number}
* @private
*/
function triangleArea(p0, p1, p2) {
let v0 = Cesium.Cartesian3.subtract(p0, p1, new Cesium.Cartesian3())
let v1 = Cesium.Cartesian3.subtract(p2, p1, new Cesium.Cartesian3())
let cross = Cesium.Cartesian3.cross(v0, v1, v0)
return Cesium.Cartesian3.magnitude(cross) * 0.5
}

export default function area(positions) { export default function area(positions) {
let result = 0 let result = 0
if (positions && Array.isArray(positions)) {
let h = 0
let pos = positions.concat(positions[0])
for (let i = 1; i < pos.length; i++) {
let oel = Transform.transformWGS84ToCartesian(pos[i - 1])
let el = Transform.transformWGS84ToCartesian(pos[i])
h += oel.x * el.y - el.x * oel.y
}
result = Math.abs(h).toFixed(2)
if (!Array.isArray(positions)) {
return result
}
if (!(positions[0] instanceof Cesium.Cartesian3)) {
positions = Transform.transformWGS84ArrayToCartesianArray(positions)
}
let geometry = Cesium.CoplanarPolygonGeometry.createGeometry(
Cesium.CoplanarPolygonGeometry.fromPositions({
positions: positions,
vertexFormat: Cesium.VertexFormat.POSITION_ONLY
})
)
if (!geometry) {
return result
}
let flatPositions = geometry.attributes.position.values
let indices = geometry.indices
for (let i = 0; i < indices.length; i += 3) {
let p0 = Cesium.Cartesian3.unpack(
flatPositions,
indices[i] * 3,
new Cesium.Cartesian3()
)
let p1 = Cesium.Cartesian3.unpack(
flatPositions,
indices[i + 1] * 3,
new Cesium.Cartesian3()
)
let p2 = Cesium.Cartesian3.unpack(
flatPositions,
indices[i + 2] * 3,
new Cesium.Cartesian3()
)
result += triangleArea(p0, p1, p2)
} }
return result return result
} }

+ 3
- 2
modules/math/index.js 查看文件



export { default as area } from './area' export { default as area } from './area'
export { default as bounds } from './bounds' export { default as bounds } from './bounds'
export { default as mid } from './mid'
export { default as center } from './center' export { default as center } from './center'
export { default as curve } from './curve'
export { default as distance } from './distance' export { default as distance } from './distance'
export { default as heading } from './heading' export { default as heading } from './heading'
export { default as isBetween } from './isBetween' export { default as isBetween } from './isBetween'
export { default as midCartesian } from './midCartesian'
export { default as midPosition } from './midPosition'
export { default as parabola } from './parabola' export { default as parabola } from './parabola'
export { default as curve } from './curve'

+ 13
- 0
modules/math/midCartesian.js 查看文件

/**
* @Author: Caven
* @Date: 2020-08-21 18:16:52
*/

import { Cesium } from '@dc-modules/namespace'

export default function midCartesian(start, end) {
let c1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(start)
let c2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(end)
let cm = new Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5)
return Cesium.Ellipsoid.WGS84.cartographicToCartesian(cm)
}

modules/math/mid.js → modules/math/midPosition.js 查看文件

import Parse from '@dc-modules/parse/Parse' import Parse from '@dc-modules/parse/Parse'
import Position from '@dc-modules/position/Position' import Position from '@dc-modules/position/Position'


export default function mid(start, end) {
export default function midPosition(start, end) {
let startPosition = Parse.parsePosition(start) let startPosition = Parse.parsePosition(start)
let endPosition = Parse.parsePosition(end) let endPosition = Parse.parsePosition(end)
startPosition = Transform.transformWGS84ToCartographic(startPosition) startPosition = Transform.transformWGS84ToCartographic(startPosition)
endPosition = Transform.transformWGS84ToCartographic(endPosition) endPosition = Transform.transformWGS84ToCartographic(endPosition)

let mc = new Cesium.EllipsoidGeodesic( let mc = new Cesium.EllipsoidGeodesic(
startPosition, startPosition,
endPosition endPosition

+ 4
- 1
modules/option/ViewerOption.js 查看文件

depthTestAgainstTerrain: globeOption?.depthTestAgainstTerrain ?? false, depthTestAgainstTerrain: globeOption?.depthTestAgainstTerrain ?? false,
tileCacheSize: +globeOption?.tileCacheSize || 100, tileCacheSize: +globeOption?.tileCacheSize || 100,
preloadSiblings: globeOption?.enableLighting ?? false, preloadSiblings: globeOption?.enableLighting ?? false,
baseColor: globeOption?.baseColor || new Cesium.Color(0, 0, 0.5, 1)
baseColor: globeOption?.baseColor || new Cesium.Color(0, 0, 0.5, 1),
terrainExaggeration: globeOption?.terrainExaggeration || 1,
terrainExaggerationRelativeHeight:
globeOption?.terrainExaggerationRelativeHeight || 0
}) })


Util.merge(globe.translucency, { Util.merge(globe.translucency, {

+ 1
- 0
modules/option/index.js 查看文件

* @Date: 2020-03-05 22:00:17 * @Date: 2020-03-05 22:00:17
*/ */


export { default as MouseMode } from './MouseMode'
export { default as ViewerOption } from './ViewerOption' export { default as ViewerOption } from './ViewerOption'
export { default as CameraOption } from './CameraOption' export { default as CameraOption } from './CameraOption'

+ 13
- 8
modules/overlay/Overlay.js 查看文件

this._allowDrillPicking = false this._allowDrillPicking = false
this._contextMenu = [] this._contextMenu = []
this._overlayEvent = new OverlayEvent() this._overlayEvent = new OverlayEvent()
this.type = undefined
this.on(OverlayEventType.ADD, this._onAdd, this)
this.on(OverlayEventType.REMOVE, this._onRemove, this)
this._overlayEvent.on(OverlayEventType.ADD, this._onAdd, this)
this._overlayEvent.on(OverlayEventType.REMOVE, this._onRemove, this)
} }


get overlayId() { get overlayId() {
this._layer.delegate.entities.add(this._delegate) this._layer.delegate.entities.add(this._delegate)
} else if (this._layer?.delegate?.add && this._delegate) { } else if (this._layer?.delegate?.add && this._delegate) {
// for Primitive // for Primitive
if (this.type === 'point_primitive' && this._layer.points) {
if (this.type && this.type === 'point_primitive' && this._layer.points) {
this._delegate = this._layer.points.add(this._delegate) this._delegate = this._layer.points.add(this._delegate)
} else if ( } else if (
this.type === 'billboard_primitive' &&
this.type.indexOf('billboard_primitive') >= 0 &&
this._layer.billboards this._layer.billboards
) { ) {
this._delegate = this._layer.billboards.add(this._delegate) this._delegate = this._layer.billboards.add(this._delegate)
} else if (this.type === 'polyline_primitive' && this._layer.polylines) { } else if (this.type === 'polyline_primitive' && this._layer.polylines) {
this._delegate = this._layer.polylines.add(this._delegate) this._delegate = this._layer.polylines.add(this._delegate)
} else if (this.type === 'label_primitive' && this._layer.labels) {
} else if (
this.type.indexOf('label_primitive') >= 0 &&
this._layer.labels
) {
this._delegate = this._layer.labels.add(this._delegate) this._delegate = this._layer.labels.add(this._delegate)
} else { } else {
this._layer.delegate.add(this._delegate) this._layer.delegate.add(this._delegate)
if (this.type === 'point_primitive' && this._layer.points) { if (this.type === 'point_primitive' && this._layer.points) {
this._layer.points.remove(this._delegate) this._layer.points.remove(this._delegate)
} else if ( } else if (
this.type === 'billboard_primitive' &&
this.type.indexOf('billboard_primitive') >= 0 &&
this._layer.billboards this._layer.billboards
) { ) {
this._layer.billboards.remove(this._delegate) this._layer.billboards.remove(this._delegate)
} else if (this.type === 'polyline_primitive' && this._layer.polylines) { } else if (this.type === 'polyline_primitive' && this._layer.polylines) {
this._layer.polylines.remove(this._delegate) this._layer.polylines.remove(this._delegate)
} else if (this.type === 'label_primitive' && this._layer.labels) {
} else if (
this.type.indexOf('label_primitive') >= 0 &&
this._layer.labels
) {
this._layer.labels.remove(this._delegate) this._layer.labels.remove(this._delegate)
} else { } else {
this._layer.delegate.remove(this._delegate) this._layer.delegate.remove(this._delegate)

+ 5
- 2
modules/overlay/custom/CustomBillboard.js 查看文件

this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._icon = icon this._icon = icon
this._size = [32, 32] this._size = [32, 32]
this.type = Overlay.getOverlayType('custom_billboard')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('custom_billboard')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(
...style, ...style,
semiMajorAxis: radius, semiMajorAxis: radius,
semiMinorAxis: radius, semiMinorAxis: radius,
stRotation: new Cesium.CallbackProperty(time => {
stRotation: new Cesium.CallbackProperty(() => {
stRotation += amount stRotation += amount
if (stRotation >= 360 || stRotation <= -360) { if (stRotation >= 360 || stRotation <= -360) {
stRotation = 0 stRotation = 0

+ 5
- 2
modules/overlay/custom/CustomLabel.js 查看文件

this._delegate = new Cesium.Entity({ label: {} }) this._delegate = new Cesium.Entity({ label: {} })
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._text = text this._text = text
this.type = Overlay.getOverlayType('custom_label')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('custom_label')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(
...style, ...style,
semiMajorAxis: radius, semiMajorAxis: radius,
semiMinorAxis: radius, semiMinorAxis: radius,
stRotation: new Cesium.CallbackProperty(time => {
stRotation: new Cesium.CallbackProperty(() => {
stRotation += amount stRotation += amount
if (stRotation >= 360 || stRotation <= -360) { if (stRotation >= 360 || stRotation <= -360) {
stRotation = 0 stRotation = 0

+ 7
- 4
modules/overlay/dynamic/DynamicBillboard.js 查看文件

this._posistion = Parse.parsePosition(position) this._posistion = Parse.parsePosition(position)
this._icon = icon this._icon = icon
this._delegate = new Cesium.Entity({ billboard: {} }) this._delegate = new Cesium.Entity({ billboard: {} })
this.type = Overlay.getOverlayType('dynamic_billboard')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('dynamic_billboard')
}

set icon(icon) { set icon(icon) {
this._icon = icon this._icon = icon
this._delegate.billboard.image = this._icon this._delegate.billboard.image = this._icon
/** /**
* set the location * set the location
*/ */
this._samplePosition.forwardExtrapolationType =
this._sampledPosition.forwardExtrapolationType =
Cesium.ExtrapolationType.HOLD Cesium.ExtrapolationType.HOLD
this._startTime = Cesium.JulianDate.now() this._startTime = Cesium.JulianDate.now()
this._samplePosition.addSample(
this._sampledPosition.addSample(
this._startTime, this._startTime,
Transform.transformWGS84ToCartesian(this._posistion) Transform.transformWGS84ToCartesian(this._posistion)
) )
this._delegate.position = this._samplePosition
this._delegate.position = this._sampledPosition
this._cache.push(this._startTime) this._cache.push(this._startTime)
/** /**
* initialize the Overlay parameter * initialize the Overlay parameter

+ 8
- 5
modules/overlay/dynamic/DynamicModel.js 查看文件

this._posistion = Parse.parsePosition(position) this._posistion = Parse.parsePosition(position)
this._modelUrl = modelUrl this._modelUrl = modelUrl
this._delegate = new Cesium.Entity({ model: {} }) this._delegate = new Cesium.Entity({ model: {} })
this.type = Overlay.getOverlayType('dynamic_model')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('dynamic_model')
}

set modelUrl(modelUrl) { set modelUrl(modelUrl) {
this._modelUrl = modelUrl this._modelUrl = modelUrl
this._delegate.model.uri = this._modelUrl this._delegate.model.uri = this._modelUrl
/** /**
* set the location * set the location
*/ */
this._samplePosition.forwardExtrapolationType =
this._sampledPosition.forwardExtrapolationType =
Cesium.ExtrapolationType.HOLD Cesium.ExtrapolationType.HOLD
this._startTime = Cesium.JulianDate.now() this._startTime = Cesium.JulianDate.now()
this._samplePosition.addSample(
this._sampledPosition.addSample(
this._startTime, this._startTime,
Transform.transformWGS84ToCartesian(this._posistion) Transform.transformWGS84ToCartesian(this._posistion)
) )
this._delegate.position = this._samplePosition
this._delegate.position = this._sampledPosition
this._delegate.orientation = new Cesium.VelocityOrientationProperty( this._delegate.orientation = new Cesium.VelocityOrientationProperty(
this._samplePosition
this._sampledPosition
) )
this._cache.push(this._startTime) this._cache.push(this._startTime)
/** /**

+ 4
- 6
modules/overlay/dynamic/DynamicOverlay.js 查看文件

super() super()
this._startTime = undefined this._startTime = undefined
this._lastTime = undefined this._lastTime = undefined
this._samplePosition = new Cesium.SampledPositionProperty()
this._sampledPosition = new Cesium.SampledPositionProperty()
this._cache = [] this._cache = []
this._maxCacheSize = 10 this._maxCacheSize = 10
this._state = State.INITIALIZED this._state = State.INITIALIZED


get position() { get position() {
return Transform.transformCartesianToWGS84( return Transform.transformCartesianToWGS84(
this._samplePosition.getValue(Cesium.JulianDate.now())
this._sampledPosition.getValue(Cesium.JulianDate.now())
) )
} }


-0.2, -0.2,
new Cesium.JulianDate() new Cesium.JulianDate()
) )
this._samplePosition.removeSamples(
this._sampledPosition.removeSamples(
new Cesium.TimeInterval({ new Cesium.TimeInterval({
start: start, start: start,
stop: stop stop: stop
interval, interval,
new Cesium.JulianDate() new Cesium.JulianDate()
) )
this._samplePosition.addSample(
this._sampledPosition.addSample(
time, time,
Transform.transformWGS84ToCartesian(Parse.parsePosition(position)) Transform.transformWGS84ToCartesian(Parse.parsePosition(position))
) )
} }
} }


Overlay.registerType('dynamic-model')

export default DynamicOverlay export default DynamicOverlay

+ 34
- 20
modules/overlay/html/DivIcon.js 查看文件

left: '0' left: '0'
}) })
this.content = content this.content = content
this.type = Overlay.getOverlayType('div_icon')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('div_icon')
}

set show(show) { set show(show) {
this._show = show this._show = show
this._delegate.style.visibility = this._show ? 'visible' : 'hidden' this._delegate.style.visibility = this._show ? 'visible' : 'hidden'


/** /**
* Updates style * Updates style
* @param style
* @param windowCoord
* @param distance * @param distance
* @param isFront
* @private * @private
*/ */
_updateStyle(style, distance) {
let translate3d = 'translate3d(0,0,0)'
if (style.transform) {
let x = style.transform.x - this._delegate.offsetWidth / 2
let y = style.transform.y - this._delegate.offsetHeight / 2
translate3d = `translate3d(${Math.round(x)}px,${Math.round(y)}px, 0)`
_updateStyle(windowCoord, distance, isFront) {
if (!this._show || !windowCoord) {
return
} }


// set translate
let x = windowCoord.x - this._delegate.offsetWidth / 2
let y = windowCoord.y - this._delegate.offsetHeight / 2
let translate3d = `translate3d(${Math.round(x)}px,${Math.round(y)}px, 0)`

// set scale
let scale3d = 'scale3d(1,1,1)' let scale3d = 'scale3d(1,1,1)'
let scaleByDistance = this._style.scaleByDistance let scaleByDistance = this._style.scaleByDistance
if (distance && scaleByDistance) { if (distance && scaleByDistance) {
let nearValue = scaleByDistance.nearValue
let farValue = scaleByDistance.farValue
let f = distance / scaleByDistance.far
if (distance < scaleByDistance.near) {
let near = scaleByDistance.near || 0.0
let nearValue = scaleByDistance.nearValue || 1.0
let far = scaleByDistance.far || Number.MAX_VALUE
let farValue = scaleByDistance.farValue || 0.0
let f = distance / far
if (distance < near) {
scale3d = `scale3d(${nearValue},${nearValue},1)` scale3d = `scale3d(${nearValue},${nearValue},1)`
} else if (distance > scaleByDistance.far) {
} else if (distance > far) {
scale3d = `scale3d(${farValue},${farValue},1)` scale3d = `scale3d(${farValue},${farValue},1)`
} else { } else {
let scale = farValue + f * (nearValue - farValue) let scale = farValue + f * (nearValue - farValue)
} }
} }


// set condition
let isDisplay = true
let distanceDisplayCondition = this._style.distanceDisplayCondition let distanceDisplayCondition = this._style.distanceDisplayCondition
if (distance && distanceDisplayCondition) { if (distance && distanceDisplayCondition) {
this.show =
this._show &&
isBetween(
distance,
distanceDisplayCondition.near,
distanceDisplayCondition.far
)
isDisplay = isBetween(
distance,
distanceDisplayCondition.near || 0.0,
distanceDisplayCondition.far || Number.MAX_VALUE
)
} }

// update style
this._delegate.style.transform = `${translate3d} ${scale3d}` this._delegate.style.transform = `${translate3d} ${scale3d}`
this._delegate.style.visibility =
isDisplay && isFront ? 'visible' : 'hidden'
} }


/** /**
overlay: this, overlay: this,
position: Transform.transformWGS84ToCartesian(this._position) position: Transform.transformWGS84ToCartesian(this._position)
} }

this._delegate.addEventListener('click', () => { this._delegate.addEventListener('click', () => {
this._overlayEvent.fire(MouseEventType.CLICK, params) this._overlayEvent.fire(MouseEventType.CLICK, params)
}) })

+ 3
- 0
modules/overlay/index.js 查看文件

* primitive * primitive
*/ */
export { default as BillboardPrimitive } from './primitive/BillboardPrimitive.js' export { default as BillboardPrimitive } from './primitive/BillboardPrimitive.js'
export { default as BounceBillboardPrimitive } from './primitive/BounceBillboardPrimitive'
export { default as BounceLabelPrimitive } from './primitive/BounceLabelPrimitive'
export { default as DiffuseWallPrimitive } from './primitive/DiffuseWallPrimitive.js' export { default as DiffuseWallPrimitive } from './primitive/DiffuseWallPrimitive.js'
export { default as ElecEllipsoidPrimitive } from './primitive/ElecEllipsoidPrimitive' export { default as ElecEllipsoidPrimitive } from './primitive/ElecEllipsoidPrimitive'
export { default as FlowLinePrimitive } from './primitive/FlowLinePrimitive' export { default as FlowLinePrimitive } from './primitive/FlowLinePrimitive'
export { default as LabelPrimitive } from './primitive/LabelPrimitive' export { default as LabelPrimitive } from './primitive/LabelPrimitive'
export { default as ModelCollectionPrimitive } from './primitive/ModelCollectionPrimitive'
export { default as ModelPrimitive } from './primitive/ModelPrimitive' export { default as ModelPrimitive } from './primitive/ModelPrimitive'
export { default as PointPrimitive } from './primitive/PointPrimitive.js' export { default as PointPrimitive } from './primitive/PointPrimitive.js'
export { default as PolylinePrimitive } from './primitive/PolylinePrimitive.js' export { default as PolylinePrimitive } from './primitive/PolylinePrimitive.js'

+ 5
- 2
modules/overlay/model/Model.js 查看文件

this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._modelUrl = modelUrl this._modelUrl = modelUrl
this._rotateAmount = 0 this._rotateAmount = 0
this.type = Overlay.getOverlayType('model')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('model')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(


set rotateAmount(amount) { set rotateAmount(amount) {
this._rotateAmount = +amount this._rotateAmount = +amount
this._delegate.orientation = new Cesium.CallbackProperty(time => {
this._delegate.orientation = new Cesium.CallbackProperty(() => {
this._position.heading += this._rotateAmount this._position.heading += this._rotateAmount
if (this._position.heading >= 360 || this._position.heading <= -360) { if (this._position.heading >= 360 || this._position.heading <= -360) {
this._position.heading = 0 this._position.heading = 0

+ 4
- 1
modules/overlay/model/Tileset.js 查看文件

this._tileVisibleCallback = undefined this._tileVisibleCallback = undefined
this._properties = undefined this._properties = undefined
this._customShader = undefined this._customShader = undefined
this.type = Overlay.getOverlayType('tileset')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('tileset')
}

get readyPromise() { get readyPromise() {
return this._delegate.readyPromise return this._delegate.readyPromise
} }

+ 4
- 1
modules/overlay/plot/AttackArrow.js 查看文件

this.neckHeightFactor = 0.85 this.neckHeightFactor = 0.85
this.neckWidthFactor = 0.15 this.neckWidthFactor = 0.15
this.headTailFactor = 0.8 this.headTailFactor = 0.8
this.type = Overlay.getOverlayType('attack_arrow')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('attack_arrow')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.polygon.hierarchy = this._getHierarchy() this._delegate.polygon.hierarchy = this._getHierarchy()

+ 4
- 1
modules/overlay/plot/DoubleArrow.js 查看文件

this.headWidthFactor = 0.3 this.headWidthFactor = 0.3
this.neckHeightFactor = 0.85 this.neckHeightFactor = 0.85
this.neckWidthFactor = 0.15 this.neckWidthFactor = 0.15
this.type = Overlay.getOverlayType('double_arrow')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('double_arrow')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.polygon.hierarchy = this._getHierarchy() this._delegate.polygon.hierarchy = this._getHierarchy()

+ 4
- 1
modules/overlay/plot/FineArrow.js 查看文件

this.headWidthFactor = 0.25 this.headWidthFactor = 0.25
this.headAngle = Math.PI / 8.5 this.headAngle = Math.PI / 8.5
this.neckAngle = Math.PI / 13 this.neckAngle = Math.PI / 13
this.type = Overlay.getOverlayType('fine_arrow')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('fine_arrow')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.polygon.hierarchy = this._getHierarchy() this._delegate.polygon.hierarchy = this._getHierarchy()

+ 4
- 1
modules/overlay/plot/GatheringPlace.js 查看文件

this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate = new Cesium.Entity({ polygon: {} }) this._delegate = new Cesium.Entity({ polygon: {} })
this.t = 0.4 this.t = 0.4
this.type = Overlay.getOverlayType('gathering_place')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('gathering_place')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.polygon.hierarchy = this._getHierarchy() this._delegate.polygon.hierarchy = this._getHierarchy()

+ 4
- 1
modules/overlay/plot/TailedAttackArrow.js 查看文件

this.tailWidthFactor = 0.1 this.tailWidthFactor = 0.1
this.headTailFactor = 0.8 this.headTailFactor = 0.8
this.swallowTailFactor = 1 this.swallowTailFactor = 1
this.type = Overlay.getOverlayType('tailed_attack_arrow')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('tailed_attack_arrow')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.polygon.hierarchy = this._getHierarchy() this._delegate.polygon.hierarchy = this._getHierarchy()

+ 4
- 1
modules/overlay/primitive/BillboardPrimitive.js 查看文件

width: 0, width: 0,
height: 0 height: 0
} }
this.type = Overlay.getOverlayType('billboard_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('billboard_primitive')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 73
- 0
modules/overlay/primitive/BounceBillboardPrimitive.js 查看文件

/**
* @Author: Caven
* @Date: 2021-06-03 21:06:17
*/

import { Cesium } from '@dc-modules/namespace'
import State from '@dc-modules/state/State'
import Overlay from '../Overlay'
import BillboardPrimitive from './BillboardPrimitive'

const DEF_STYLE = {
maxOffsetY: 10,
offsetAmount: 0.1
}

class BounceBillboardPrimitive extends BillboardPrimitive {
constructor(position, icon) {
super(position, icon)
this._currentOffset = new Cesium.Cartesian2(0, 0)
this._isUp = true
this._state = State.INITIALIZED
}

get type() {
return Overlay.getOverlayType('bounce_billboard_primitive')
}

/**
*
* @private
*/
_addedHook() {
if (!this._delegate || !this._layer) {
return
}
this._delegate.layerId = this._layer?.layerId
this._delegate.overlayId = this._id
this._layer.delegate.add(this)
}

/**
*
* @private
*/
_removedHook() {
if (!this._layer) {
return
}
this._layer.delegate.remove(this)
}

/**
*
*/
update() {
if (!this._show) {
return
}
let maxOffsetY = this._style?.maxOffsetY || DEF_STYLE.maxOffsetY
let offsetAmount = this._style?.offsetAmount || DEF_STYLE.offsetAmount
if (this._currentOffset.y >= 0) {
this._isUp = true
} else if (this._currentOffset.y <= -maxOffsetY) {
this._isUp = false
}
this._currentOffset.y += offsetAmount * (this._isUp ? -1 : 1)
this._delegate.pixelOffset = this._currentOffset
}
}

Overlay.registerType('bounce_billboard_primitive')

export default BounceBillboardPrimitive

+ 73
- 0
modules/overlay/primitive/BounceLabelPrimitive.js 查看文件

/**
* @Author: Caven
* @Date: 2021-06-03 21:06:17
*/

import { Cesium } from '@dc-modules/namespace'
import State from '@dc-modules/state/State'
import Overlay from '../Overlay'
import LabelPrimitive from './LabelPrimitive'

const DEF_STYLE = {
maxOffsetY: 10,
offsetAmount: 0.1
}

class BounceLabelPrimitive extends LabelPrimitive {
constructor(position, text) {
super(position, text)
this._currentOffset = new Cesium.Cartesian2(0, 0)
this._isUp = true
this._state = State.INITIALIZED
}

get type() {
return Overlay.getOverlayType('bounce_label_primitive')
}

/**
*
* @private
*/
_addedHook() {
if (!this._delegate || !this._layer) {
return
}
this._delegate.layerId = this._layer?.layerId
this._delegate.overlayId = this._id
this._layer.delegate.add(this)
}

/**
*
* @private
*/
_removedHook() {
if (!this._layer) {
return
}
this._layer.delegate.remove(this)
}

/**
*
*/
update() {
if (!this._show) {
return
}
let maxOffsetY = this._style?.maxOffsetY || DEF_STYLE.maxOffsetY
let offsetAmount = this._style?.offsetAmount || DEF_STYLE.offsetAmount
if (this._currentOffset.y >= 0) {
this._isUp = true
} else if (this._currentOffset.y <= -maxOffsetY) {
this._isUp = false
}
this._currentOffset.y += offsetAmount * (this._isUp ? -1 : 1)
this._delegate.pixelOffset = this._currentOffset
}
}

Overlay.registerType('bounce_label_primitive')

export default BounceLabelPrimitive

+ 13
- 28
modules/overlay/primitive/DiffuseWallPrimitive.js 查看文件

const DEF_STYLE = { const DEF_STYLE = {
minRadius: 10, minRadius: 10,
minHeight: 30, minHeight: 30,
color: Cesium.Color.RED
color: Cesium.Color.RED,
slices: 128,
speed: 10
} }


class DiffuseWallPrimitive extends Overlay { class DiffuseWallPrimitive extends Overlay {
constructor(center, radius, height, slices, speed) {
constructor(center, radius, height) {
super() super()
this._center = Parse.parsePosition(center) this._center = Parse.parsePosition(center)
this._delegate = undefined this._delegate = undefined
this._height = height this._height = height
this._radius = radius this._radius = radius
this._slices = slices || 128
this._speed = speed || 10
this._currentHeight = height || 0 this._currentHeight = height || 0
this._currentRadius = 10 this._currentRadius = 10
this._style = { ...DEF_STYLE } this._style = { ...DEF_STYLE }
this.type = Overlay.getOverlayType('diffuse_wall_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('diffuse_wall_primitive')
}

set center(position) { set center(position) {
this._center = Parse.parsePosition(position) this._center = Parse.parsePosition(position)
return this return this
return this._height return this._height
} }


set slices(slices) {
this._slices = slices
return this
}

get slices() {
return this._slices
}

set speed(speed) {
this._speed = speed
return this
}

get speed() {
return this._speed
}

/** /**
* *
* @returns {*} * @returns {*}
let modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( let modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Transform.transformWGS84ToCartesian(this._center) Transform.transformWGS84ToCartesian(this._center)
) )
for (let i = 0; i < this._slices; i++) {
let angle = (i / this._slices) * Cesium.Math.TWO_PI
for (let i = 0; i < this._style.slices; i++) {
let angle = (i / this._style.slices) * Cesium.Math.TWO_PI
let x = Math.cos(angle) let x = Math.cos(angle)
let y = Math.sin(angle) let y = Math.sin(angle)
let point = new Cesium.Cartesian3( let point = new Cesium.Cartesian3(
*/ */
update(frameState) { update(frameState) {
this._delegate = this._delegate && this._delegate.destroy() this._delegate = this._delegate && this._delegate.destroy()
this._currentRadius += this._radius / this._speed / 20
this._currentHeight -= this._height / this._speed / 20
this._currentRadius += this._radius / this._style.speed / 20
this._currentHeight -= this._height / this._style.speed / 20
if ( if (
this._currentRadius > this._radius || this._currentRadius > this._radius ||
this._currentHeight < this._style.minHeight this._currentHeight < this._style.minHeight
this._currentRadius = this._style.minRadius this._currentRadius = this._style.minRadius
this._currentHeight = this._height this._currentHeight = this._height
} }
if (!this._slices || this._slices < 3) {
if (!this._style.slices || this._style.slices < 3) {
return false return false
} }
let positions = this._getPositions() let positions = this._getPositions()

+ 4
- 1
modules/overlay/primitive/ElecEllipsoidPrimitive.js 查看文件

geometry: {} geometry: {}
}) })
}) })
this.type = Overlay.getOverlayType('elec_ellipsoid_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('elec_ellipsoid_primitive')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.geometryInstances.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( this._delegate.geometryInstances.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(

+ 4
- 1
modules/overlay/primitive/FlowLinePrimitive.js 查看文件

geometry: {} geometry: {}
}) })
}) })
this.type = Overlay.getOverlayType('flow_line_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('flow_line_primitive')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({

+ 4
- 1
modules/overlay/primitive/LabelPrimitive.js 查看文件

position: undefined, position: undefined,
text: undefined text: undefined
} }
this.type = Overlay.getOverlayType('label_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('label_primitive')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 133
- 0
modules/overlay/primitive/ModelCollectionPrimitive.js 查看文件

/**
* @Author: Caven
* @Date: 2021-08-02 20:12:04
*/

import { Cesium } from '@dc-modules/namespace'
import State from '@dc-modules/state/State'
import Parse from '@dc-modules/parse/Parse'
import { Transform } from '@dc-modules/transform'
import Overlay from '../Overlay'

class ModelCollectionPrimitive extends Overlay {
constructor(positions, modelUrl) {
super()
this._positions = Parse.parsePositions(positions)
this._modelUrl = modelUrl
this._attrs = []
this._state = State.INITIALIZED
}

get type() {
return Overlay.getOverlayType('model_collection_primitive')
}

get readyPromise() {
return this._delegate.readyPromise
}

set attrs(attrs) {
this._attrs = attrs
return this
}

get attrs() {
return this._attrs
}

set positions(positions) {
this._positions = Parse.parsePositions(positions)
if (this._layer) {
this._resetDelegate()
this._layer.delegate.add(this._delegate)
}
return this
}

set modelUrl(modelUrl) {
this._modelUrl = modelUrl
if (this._layer) {
this._resetDelegate()
this._layer.delegate.add(this._delegate)
}
return this
}

get modelUrl() {
return this._modelUrl
}

_resetDelegate() {
this._delegate = this._delegate && this._delegate.destroy()
this._delegate = new Cesium.ModelInstanceCollection({
url: this._modelUrl,
instances: this._positions.map(item => {
let origin = Transform.transformWGS84ToCartesian(item)
let modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
origin,
new Cesium.HeadingPitchRoll(
Cesium.Math.toRadians(item.heading),
Cesium.Math.toRadians(item.pitch),
Cesium.Math.toRadians(item.roll)
)
)
this._style?.scale &&
Cesium.Matrix4.multiplyByUniformScale(
modelMatrix,
this._style?.scale,
modelMatrix
)
return {
modelMatrix
}
}),
...this._style
})
this._delegate.layerId = this._layer?.layerId
this._delegate.overlayId = this._id
}

_mountedHook() {
this._resetDelegate()
}

/**
*
* @param instanceId
* @returns {undefined}
*/
getModelInstance(instanceId) {
return this._delegate._instances[instanceId] || undefined
}

/**
*
* @param instanceId
* @returns {*|{}}
*/
getAttrByInstanceId(instanceId) {
return this._attrs[instanceId] || {}
}

/**
*
* @param style
* @returns {ModelCollectionPrimitive}
*/
setStyle(style) {
if (!style || Object.keys(style).length === 0) {
return this
}
delete style['instances'] && delete style['url']
this._style = style
if (this._layer) {
this._resetDelegate()
this._layer.delegate.add(this._delegate)
}
return this
}
}

Overlay.registerType('model_collection_primitive')

export default ModelCollectionPrimitive

+ 41
- 1
modules/overlay/primitive/ModelPrimitive.js 查看文件

this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._modelUrl = modelUrl this._modelUrl = modelUrl
this._delegate = Cesium.Model.fromGltf({ url: modelUrl }) this._delegate = Cesium.Model.fromGltf({ url: modelUrl })
this.type = Overlay.getOverlayType('model_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('model_primitive')
}

get readyPromise() {
return this._delegate.readyPromise
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
let origin = Transform.transformWGS84ToCartesian(this._position) let origin = Transform.transformWGS84ToCartesian(this._position)
this.position = this._position this.position = this._position
} }


/**
*
* @param name
*/
getMaterial(name) {
return this._delegate.getMaterial(name)
}

/**
*
* @param name
*/
getMesh(name) {
return this._delegate.getMesh(name)
}

/**
*
* @param name
* @returns {*}
*/
getNode(name) {
return this._delegate.getNode(name)
}

/**
*
* @returns {*}
*/
getNodes() {
return this._delegate._runtime.nodes
}

/** /**
* Sets style * Sets style
* @param style * @param style

+ 5
- 1
modules/overlay/primitive/PointPrimitive.js 查看文件

constructor(position) { constructor(position) {
super() super()
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this.type = Overlay.getOverlayType('point_primitive')
this._delegate = { this._delegate = {
position: undefined position: undefined
} }
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('point_primitive')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/primitive/PolylinePrimitive.js 查看文件

this._delegate = { this._delegate = {
positions: [] positions: []
} }
this.type = Overlay.getOverlayType('polyline_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('polyline_primitive')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.positions = Transform.transformWGS84ArrayToCartesianArray( this._delegate.positions = Transform.transformWGS84ArrayToCartesianArray(

+ 4
- 1
modules/overlay/primitive/ScanCirclePrimitive.js 查看文件

geometry: {} geometry: {}
}) })
}) })
this.type = Overlay.getOverlayType('scan_circle_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('scan_circle_primitive')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.geometryInstances.geometry = new Cesium.EllipseGeometry({ this._delegate.geometryInstances.geometry = new Cesium.EllipseGeometry({

+ 4
- 1
modules/overlay/primitive/TrailLinePrimitive.js 查看文件

geometry: {} geometry: {}
}) })
}) })
this.type = Overlay.getOverlayType('trail_line_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('trail_line_primitive')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({

+ 4
- 1
modules/overlay/primitive/VideoPrimitive.js 查看文件

}) })
}) })
this._video = video this._video = video
this.type = Overlay.getOverlayType('video_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('video_primitive')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions(

+ 4
- 1
modules/overlay/primitive/WaterPrimitive.js 查看文件

}), }),
asynchronous: true asynchronous: true
}) })
this.type = Overlay.getOverlayType('water_primitive')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('water_primitive')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions(

+ 4
- 1
modules/overlay/vector/Billboard.js 查看文件

this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._icon = icon this._icon = icon
this._size = [32, 32] this._size = [32, 32]
this.type = Overlay.getOverlayType('billboard')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('billboard')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Box.js 查看文件

} }
} }
}) })
this.type = Overlay.getOverlayType('box')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('box')
}

/** /**
* *
* @param position * @param position

+ 5
- 2
modules/overlay/vector/Circle.js 查看文件

this._radius = +radius || 0 this._radius = +radius || 0
this._rotateAmount = 0 this._rotateAmount = 0
this._stRotation = 0 this._stRotation = 0
this.type = Overlay.getOverlayType('circle')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('circle')
}

set center(center) { set center(center) {
this._center = Parse.parsePosition(center) this._center = Parse.parsePosition(center)
this._delegate.polygon.hierarchy = this._computeHierarchy() this._delegate.polygon.hierarchy = this._computeHierarchy()


set rotateAmount(amount) { set rotateAmount(amount) {
this._rotateAmount = +amount this._rotateAmount = +amount
this._delegate.polygon.stRotation = new Cesium.CallbackProperty(time => {
this._delegate.polygon.stRotation = new Cesium.CallbackProperty(() => {
this._stRotation += this._rotateAmount this._stRotation += this._rotateAmount
if (this._stRotation >= 360 || this._stRotation <= -360) { if (this._stRotation >= 360 || this._stRotation <= -360) {
this._stRotation = 0 this._stRotation = 0

+ 4
- 1
modules/overlay/vector/Corridor.js 查看文件

super() super()
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate = new Cesium.Entity({ corridor: {} }) this._delegate = new Cesium.Entity({ corridor: {} })
this.type = Overlay.getOverlayType('corridor')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('corridor')
}

set positions(positions) { set positions(positions) {
this._positions = Parse.parsePositions(positions) this._positions = Parse.parsePositions(positions)
this._delegate.corridor.positions = Transform.transformWGS84ArrayToCartesianArray( this._delegate.corridor.positions = Transform.transformWGS84ArrayToCartesianArray(

+ 4
- 1
modules/overlay/vector/Cylinder.js 查看文件

this._topRadius = +topRadius || 0 this._topRadius = +topRadius || 0
this._bottomRadius = +bottomRadius || 0 this._bottomRadius = +bottomRadius || 0
this._delegate = new Cesium.Entity({ cylinder: {} }) this._delegate = new Cesium.Entity({ cylinder: {} })
this.type = Overlay.getOverlayType('cylinder')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('cylinder')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Ellipse.js 查看文件

this._semiMajorAxis = +semiMajorAxis || 0 this._semiMajorAxis = +semiMajorAxis || 0
this._semiMinorAxis = +semiMinorAxis || 0 this._semiMinorAxis = +semiMinorAxis || 0
this._delegate = new Cesium.Entity({ ellipse: {} }) this._delegate = new Cesium.Entity({ ellipse: {} })
this.type = Overlay.getOverlayType('ellipse')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('ellipse')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Ellipsoid.js 查看文件

this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._radius = radius || { x: 10, y: 10, z: 10 } this._radius = radius || { x: 10, y: 10, z: 10 }
this._delegate = new Cesium.Entity({ ellipsoid: {} }) this._delegate = new Cesium.Entity({ ellipsoid: {} })
this.type = Overlay.getOverlayType('ellipsoid')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('ellipsoid')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Label.js 查看文件

this._delegate = new Cesium.Entity({ label: {} }) this._delegate = new Cesium.Entity({ label: {} })
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._text = text this._text = text
this.type = Overlay.getOverlayType('label')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('label')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Plane.js 查看文件

plane: new Cesium.Plane(this._normal, this._distance) plane: new Cesium.Plane(this._normal, this._distance)
} }
}) })
this.type = Overlay.getOverlayType('plane')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('plane')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 4
- 1
modules/overlay/vector/Point.js 查看文件

super() super()
this._delegate = new Cesium.Entity({ point: {} }) this._delegate = new Cesium.Entity({ point: {} })
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this.type = Overlay.getOverlayType('point')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


get type() {
return Overlay.getOverlayType('point')
}

set position(position) { set position(position) {
this._position = Parse.parsePosition(position) this._position = Parse.parsePosition(position)
this._delegate.position = Transform.transformWGS84ToCartesian( this._delegate.position = Transform.transformWGS84ToCartesian(

+ 0
- 0
modules/overlay/vector/Polygon.js 查看文件


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存