cesium-plot-js/README.md

82 lines
2.5 KiB
Markdown
Raw Normal View History

2024-01-30 08:10:25 +00:00
# CesiumDraw
2024-02-23 09:38:40 +00:00
2024-03-06 03:24:05 +00:00
cesium 绘制插件
2024-02-25 03:22:45 +00:00
2024-03-06 03:24:05 +00:00
![image](https://github.com/ethan-zf/CesiumDraw/assets/19545189/75b93c62-dd10-4c92-825c-c4ab01b454a7)
2024-02-25 03:22:45 +00:00
2024-03-05 12:03:28 +00:00
在线示例:[demo](https://ethan-zf.github.io/CesiumDraw/examples/index.html)
2024-02-23 09:45:40 +00:00
2024-03-05 12:03:28 +00:00
### 类
| 类名 | 类型 | 描述 |
| ---------------------- | --------- | ---------------- |
| Polygon | 'polygon' | 多边形 |
| Reactangle | 'polygon' | 矩形 |
| Triangle | 'polygon' | 三角形 |
| Circle | 'polygon' | 圆形 |
| StraightArrow | 'line' | 细直箭头 |
| CurvedArrow | 'line' | 曲线箭头 |
| FineArrow | 'polygon' | 直箭头 |
| AttackArrow | 'polygon' | 进攻方向箭头 |
| SwallowtailAttackArrow | 'polygon' | 燕尾进攻方向箭头 |
| SquadCombat | 'polygon' | 分队战斗方向 |
| SwallowtailSquadCombat | 'polygon' | 燕尾分队战斗方向 |
| AssaultDirection | 'polygon' | 突击方向 |
| DoubleArrow | 'polygon' | 双箭头 |
| FreehandLine | 'line' | 自由线 |
| FreehandPolygon | 'polygon' | 自由面 |
| Curve | 'line' | 曲线 |
| Ellipse | 'polygon' | 椭圆 |
| Lune | 'polygon' | 半月面 |
2024-03-06 03:24:05 +00:00
```
const geometry = new CesiumPlot.Polygon(Cesium, viewer);
```
2024-03-05 12:03:28 +00:00
2024-03-06 03:24:05 +00:00
### 类的实例方法
2024-03-05 12:03:28 +00:00
2024-03-06 03:24:05 +00:00
| 方法名 | 参数 | 描述 |
| ------ | ------------------------------------------------------- | -------- |
| hide | | 隐藏 |
| show | | 显示 |
| remove | | 删除 |
| on | (event: EventType, listener: (eventData?: any) => void) | 绑定事件 |
| off | (event: EventType) | 解绑事件 |
2024-03-05 12:03:28 +00:00
### 事件
- 'drawStart'
绘制开始
2024-03-06 03:24:05 +00:00
```
geometry.on('drawStart', () => {
console.log('draw start');
});
```
2024-03-05 12:03:28 +00:00
- 'drawUpdate'
2024-03-06 03:24:05 +00:00
绘制过程中点位更新,回调事件返回更新的 Cartesian3 点位
```
geometry.on('drawUpdate', () => {
console.log('draw start');
});
```
2024-03-05 12:03:28 +00:00
- 'drawEnd'
2024-03-06 03:24:05 +00:00
绘制结束,回调事件返回图形的关键点位
2024-03-05 12:03:28 +00:00
- 'editStart'
编辑开始
- 'editEnd'
2024-03-06 03:24:05 +00:00
编辑结束,回调事件返回图形的关键点位