import { onMounted, onUnmounted, ref, } from "vue";
import { Cartesian2, Cartesian3, Color, LabelStyle, VerticalOrigin, Viewer } from 'cesium';
import { DRAW_STATUS, PointGauger, } from "cesium-pocket/gauger";
import { ElButton, ElMessageBox } from 'element-plus'
import type { PointOptions } from "cesium-pocket/src/gauger/PointGauger.js";
import stickRedPng from '@/assets/images/stick_red.png'
const rootContainer: any = ref(null);
const viewer = ref<Viewer | null>(null)
let pointGauger: any = null
viewer.value = //你获取的viewer
const isBtn1Disabled = () => {
return pointGauger != null && status.value != DRAW_STATUS.STOPED
const isBtn2Disabled = () => {
return status.value != DRAW_STATUS.DRAWABLE && status.value != DRAW_STATUS.DELETABLE
const isBtn3Disabled = () => {
return status.value != DRAW_STATUS.DRAWABLE && status.value != DRAW_STATUS.EDITABLE
const isBtn4Disabled = () => {
return status.value != DRAW_STATUS.DRAWABLE && status.value != DRAW_STATUS.EDITABLE && status.value != DRAW_STATUS.DELETABLE
if (viewer.value && !viewer.value.isDestroyed()) {
let options: PointOptions = {
billboardCallbackFun: billboardCallbackFun,
delCallbackFun: delCallbackFun
pointGauger = new PointGauger(viewer.value as Viewer, options)
const billboardCallbackFun = (cartesian: Cartesian3) => {
const entity = (viewer.value as Viewer).entities.add({
// 设置经纬度位置 (经度, 纬度, 海拔高度)
font: '500 14px Helvetica',
pixelOffset: new Cartesian2(0, -120), //偏移量
backgroundColor: new Color(254, 0, 0, 0.7)
verticalOrigin: VerticalOrigin.BOTTOM,
const delCallbackFun = (): Promise<any> => {
return new Promise((resolve) => {
status.value = pointGauger.getStatus()
const drawPointEdit = () => {
pointGauger.setEditStatus()
status.value = pointGauger.getStatus()
const drawPointDelete = () => {
pointGauger.setDelStatus()
status.value = pointGauger.getStatus()
const drawPointRemove = () => {
status.value = pointGauger.getStatus()