let that = this;
let dataSource = new Cesium.CustomDataSource('importantHasStationCollapse');
dataSourcesArr.push({
name:'importantHasStationCollapse',
data:dataSource,
})
viewer.dataSources.add(dataSource);
dataSource.show = false;
let hiddenData=that.$refs.hiddenTroubleArea.allHiddenPoint;
for(let i=0;i<hiddenData.importantHasStationCollapse.length;i++) {
let entity = hiddenData.importantHasStationCollapse[i];
let lng=entity.longitudeDegree;
let lat=entity.latitudeDegree;
let x=1;
let pixelSize = 30;
let outLineOpacity = 0.2;
let outLineFlog = true;
let pixelSizeFlog = true;
let flog=true;
dataSource.entities.add({
position: Cesium.Cartesian3.fromDegrees(lng, lat, 6000),//标签的位置
point : {
show : true, // default
color :new Cesium.CallbackProperty(function () {
if(flog){
x=x-0.03;
if(x<=0){
flog=false;
}
}else{
x=x+0.03;
if(x>=1){
flog=true;
}
}
return Cesium.Color.YELLOW.withAlpha(x);
},false),
pixelSize : new Cesium.CallbackProperty((time, result) => {
return pixelSizeFlog ? (pixelSize += 2,
pixelSize >= 30 && (pixelSizeFlog = false)) : (pixelSize = 10,
pixelSizeFlog = true),
pixelSize
}, false),
outlineColor: new Cesium.CallbackProperty(() => {
return outLineFlog ? (outLineOpacity -= .035,
outLineOpacity <= 0 && (outLineFlog = false)) : (outLineOpacity = .7,
outLineFlog = true),
Cesium.Color.RED.withAlpha(outLineOpacity)
}, false),
outlineWidth :30,
scaleByDistance: new Cesium.NearFarScalar(1200, 1, 5200, 0.4),
},
billboard:{
image: require('@/assets/bigScreen/geologic/崩塌_重要_绑定监测站.png'),
width: 48,
height: 46,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
// scale: 0.3,
},
type: 'text'//自定义属性
});
}
cesium给点添加动态扩展源
最新推荐文章于 2024-07-02 17:17:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)