/* * @Author: cbwu 504-wuchengbo@htsdfp.com * @Date: 2024-03-28 16:35:33 * @LastEditors: cbwu * @LastEditTime: 2024-04-12 15:43:49 * @Description: 封装的点几何类 */ import { Entity, Cartesian3, Color, PointGraphics, PositionProperty, LabelGraphics, Cartesian2, CallbackProperty, Property, } from 'cesium' type EntityOptions = { id?: string name?: string show?: boolean pixelSize?: number outlineColor?: Color color?: Color fillColor?: Color fill?: boolean width?: number outlineWidth?: number text?: string font?: string pixelOffset?: Cartesian2 } // 点 class PointEntity extends Entity { static ID: number = 0 public subId: number = 0 //用于作为其他几何体的控制点时标记节点号 options: EntityOptions = { id: 'Point' + String(PointEntity.ID), name: 'Point' + String(PointEntity.ID + 1), show: true, pixelSize: 8, color: Color.WHITE, outlineColor: Color.GREEN, outlineWidth: 0, } constructor(position: Cartesian3, options?: EntityOptions) { super({ position: position, }) this.options = { ...this.options, ...options } //点对象 this.point = new PointGraphics({ pixelSize: this.options.pixelSize, color: this.options.color, outlineColor: this.options.outlineColor, outlineWidth: this.options.outlineWidth, }) // 标注对象 this.label = new LabelGraphics({ text: this.options.text, font: this.options.font, pixelOffset: this.options.pixelOffset, }) PointEntity.ID++ } } export { PointEntity, type EntityOptions }