You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GCSGUI/src/utils/map/geometry/pointEntity.ts

57 lines
1.4 KiB
TypeScript

/*
* @Author: cbwu 504-wuchengbo@htsdfp.com
* @Date: 2024-03-28 16:35:33
* @LastEditors: cbwu
* @LastEditTime: 2024-04-16 13:57:15
* @Description:
*/
import {
Entity,
Cartesian3,
Color,
PointGraphics,
LabelGraphics,
HeightReference,
} from 'cesium'
import { EntityOptions } from '@/types/entityoptions'
// 点
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,
// heightReference: HeightReference.NONE,
}
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,
disableDepthTestDistance: 50000,
// heightReference: this.options.heightReference,
})
// 标注对象
this.label = new LabelGraphics({
text: this.options.text,
font: this.options.font,
pixelOffset: this.options.pixelOffset,
})
PointEntity.ID++
}
}
export { PointEntity }