/*
|
* @Author: shuishen 1109946754@qq.com
|
* @Date: 2023-03-24 17:24:45
|
* @LastEditors: shuishen 1109946754@qq.com
|
* @LastEditTime: 2023-03-29 20:29:27
|
* @FilePath: \srs-police-affairs\src\utils\plot\draw\DrawBillboard.js
|
* @Description:
|
*
|
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
|
*/
|
/**
|
* @Author: Caven
|
* @Date: 2020-08-29 20:29:59
|
*/
|
import { PlotEventType } from '@/utils/event/index.js'
|
|
import Draw from './Draw'
|
|
const IMG_CIRCLE_RED = '/images/circle_red.png'
|
|
class DrawPoint extends Draw {
|
constructor(style) {
|
super()
|
this._position = global.DC.Namespace.Cesium.Cartesian3.UNIT_Z
|
this._style = {
|
image: style.billboardImage ?? IMG_CIRCLE_RED,
|
...style
|
}
|
}
|
|
/**
|
*
|
* @private
|
*/
|
_mountedHook () {
|
this.curDrawTool.tooltipMess = '单击选择点位'
|
this._delegate = new global.DC.Namespace.Cesium.Entity({
|
position: new global.DC.Namespace.Cesium.CallbackProperty(() => {
|
return this._position
|
}, false),
|
billboard: {
|
...this._style,
|
}
|
})
|
this._layer.entities.add(this._delegate)
|
}
|
|
/**
|
*
|
* @private
|
*/
|
_stopdHook () {
|
let billboard = new global.DC.Billboard(
|
global.DC.Transform.transformCartesianToWGS84(this._position),
|
this._style.image
|
).setStyle(this._style)
|
this._options.onDrawStop && this._options.onDrawStop(billboard)
|
}
|
|
/**
|
*
|
* @param position
|
* @private
|
*/
|
_onDrawAnchor (position) {
|
this._position = position
|
this.curDrawTool.fire(PlotEventType.DRAW_STOP)
|
}
|
|
/**
|
*
|
* @param position
|
* @private
|
*/
|
_onAnchorMoving (position) {
|
this._position = position
|
}
|
}
|
|
export default DrawPoint
|