API 参考
DMap3D SDK 提供了丰富的 API 接口,涵盖测量、分析、绘制等多个功能模块。
主要模块
测量工具 (DMap3D.measurement)
提供各种测量功能:
分析工具 (DMap3D.analysis)
提供各种空间分析功能:
绘制工具 (DMap3D.drawing)
提供各种绘制功能:
使用模式
所有工具都遵循统一的使用模式:
import DMap3D from 'dmap3d'
import * as Cesium from 'cesium'
// 1. 创建 Viewer
const viewer = new Cesium.Viewer('cesiumContainer')
// 2. 创建工具实例
const tool = new DMap3D.measurement.area(viewer, options)
// 3. 监听事件
tool.on('measureComplete', (result) => {
console.log('测量结果:', result)
})
// 4. 启动工具
tool.start()
// 5. 销毁工具
tool.destroy()
类型定义
DMap3D SDK 完全使用 TypeScript 编写,所有 API 都有完整的类型定义:
interface ITool {
start(): void
stop(): void
destroy(): void
on(event: string, callback: Function): void
off(event: string, callback: Function): void
}
浏览器支持
- Chrome >= 90
- Firefox >= 88
- Safari >= 14
- Edge >= 90