本文主要是介绍cesium创建图标/图片,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
创建预警标志
createWarnBill(uav, warnType) {this.$nextTick(() => {//避免重复加载const warnBillIndex = this.WarnBillList.findIndex(file => file.index === uav.warnId);if (warnBillIndex == -1) {warnIconDataSource = new Cesium.CustomDataSource('warnIconDataSource')this.WarnBillList.push({ dataSource: eqpDataSource, index: uav.warnId })window.cesiumViewer.dataSources.add(warnIconDataSource)warnIconDataSource.entities.add({position: Cesium.Cartesian3.fromDegrees(parseFloat(uav.longitude), parseFloat(uav.latitude), 1000.0),billboard: {id: `${uav.warnId}_${Math.random()}`,// 是否显示show: true,// 图像地址,URI或Canvas的属性image: `http://${window.location.host}/warn.png`,height: 32,width: 32,// 设置与相机的距离,在该距离处禁用深度测试disableDepthTestDistance: Number.POSITIVE_INFINITY,// 设置贴地heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,},label: {font: '900 16px MicroSoft YaHei',backgroundColor: Cesium.Color.fromCssColorString('#30415645'),showBackground: true,text: `${warnType}\n${uav.longitude} , ${uav.latitude}`,horizontalOrigin: Cesium.HorizontalOrigin.LEFT,verticalOrigin: Cesium.VerticalOrigin.BOTTOM,pixelOffset: new Cesium.Cartesian2(20, 27),disableDepthTestDistance: Number.POSITIVE_INFINITY,heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,},});}this.setMapCenter(uav)})},
这篇关于cesium创建图标/图片的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!