javascript - Add billboardCollection to an entity in Cesium -


i need create billboardcollection in cesium js , put inside entity.

i created 2 billboards , tryed add billboardcolletion , use when created entity, label showing... none of billboards appear.

this code far:

var pos = cesium.cartesian3.fromdegrees(-75.1641667, 39.9522222); var pinbuilder = new cesium.pinbuilder();  var pointbillboard = {     image: pinbuilder.fromcolor(cesium.color.salmon, 48),     verticalorigin: cesium.verticalorigin.bottom };  var linebillboard = {     color: cesium.color.white,     image: "img/white.png",     pixeloffset: new cesium.cartesian2(0, 0),     position: pos };  var billboards = scene.primitives.add(new cesium.billboardcollection());  billboards.add(pointbillboard); billboards.add(linebillboard);  this.entity = mapa.getviewer.entities.add({     position: cesium.cartesian3.fromdegrees(-75.1641667, 39.9522222),     billboard: billboards,     label: {         text: ' ponto',         verticalorigin: cesium.verticalorigin.top,         horizontalorigin: cesium.horizontalorigin.right,         font: '11px helvetica',         fillcolor: cesium.color.white,         outlinewidth: 1,         style: cesium.labelstyle.fill     } }); 

is there way insert billboardcollection inside entity?

thanks lot!

no, sorry, you're mixing 2 different layers of api here. billboardcollection part of graphics primitive layer, , entities built on top of don't include primitives directly in manner.

i notice you're calling scene.primitives.add on billboardcollection, it's in scene. pin isn't showing because forgot add position: pos pointbillboard definition. billboards in collection can exist separately entities in scene.

each entity in scene allowed 1 billboard, not collection. under hood, many entities pool billboards single collection. collection separate collection constructed in own code.

in docs, note entity.billboard takes billboardgraphics description of how single billboard's definition changes on time. not take actual primitive billboard or billboardcollection.

typically, if have "thousands" of billboards, can use 1 entity per billboard. if have lot more that, may have give high-level entities , construct own billboardcollection directly, you've done here.


Comments