Skip to content

Measure 测量工具类 ​

属性 ​

readonly id: string 唯一标识 ​

pointColor: MapColor 点颜色 ​

pointSize: number 点大小 ​

lineColor: MapColor 线颜色 ​

polygonColor: MapColor 面颜色 ​

lineWidth: number 线宽 ​

labelColor: MapColor 标签背景颜色 ​

labelFontColor: MapColor 标签文字颜色 ​

drawList: Record<string, BaseEntity<any>> 绘制的列表 ​

endIsShow: boolean 绘制结束是否显示 ​

方法 ​

measurePosition 测量点 ​

  • img 点图片
typescript
measurePosition(img?: string): Promise<Point3d[]>

measureDistance 测量距离 ​

  • type 类型 1直线距离 2地表距离 无值都显示
  • gridWidth 插值计算地表距离的间隔
typescript
measureDistance(type?: 1 | 2, gridWidth?: number): Promise<{
    points: Array<{
        position: Point3d;
        distance: number; //直线距离
        distanceSurface: number; //地表距离
    }>;
    total: {
        distance: number; //直线距离
        distanceSurface: number; //地表距离
    };
}>

measureAngle 角度测量 ​

  • 返回 两条线坐标和角度
typescript
measureAngle(): Promise<{
    lines: [Point3d, Point3d][];
    angle: number;
}>

measureArea 测量面积表面积 ​

  • type 类型 1面积 2表面积 无值都显示
  • gridWidth 插值计算表面积的间隔
  • AreaType 面积单位 (要用 导出的 AreaType 枚举)
typescript
measureArea(options?: {
    type?: 1 | 2;
    gridWidth?: number;
    AreaType: AreaType;
}): Promise<{
    area: number; //面积
    surfaceArea: number; //表面积
}>

measureSpace 空间测量 ​

  • 返回 height 高度 line 直线距离 horizontal 水平距离
typescript
measureSpace(): Promise<Record<'height' | 'line' | 'horizontal', number>>

clear 清除绘制的图形 ​

  • id 要清除的图形id (不传清除所有)
typescript
clear(id?: string): void

destroy 销毁绘制对象 ​

typescript
destroy(): boolean