[英]Add a Label to the Polygon in Cesium
如何在指定位置向實體(例如多邊形)添加標簽:
這是我嘗試執行的操作:(entity.polygon = true)
static addLabel(entity) {
entity.myLabel = new Cesium.LabelGraphics({
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
label : {
text : 'Philadelphia',
font : '24px Helvetica',
fillColor : Cesium.Color.SKYBLUE,
outlineColor : Cesium.Color.BLACK,
outlineWidth : 2,
}
})
}
沒有錯誤,但不會顯示在地圖上。
“標簽”是實體的對象,因此請嘗試以下操作:
entity.label= new Cesium.LabelGraphics({
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Philadelphia',
font : '24px Helvetica',
fillColor : Cesium.Color.SKYBLUE,
outlineColor : Cesium.Color.BLACK,
outlineWidth : 2,
})
隱藏它
enity.label.show = FALSE;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.