and I would like to set a attribute description for my billboard, but the billboard looses this attribute
Are you sure it loses the attribute, or is the problem that it doesn’t get set? What is your code for setting and getting this attribute (it’s not in your code example above)? Also, do you mean property, or just get/set a given value on the entity?
whereas the datasource is an extension of the Cesium.CustomDataSource and has a billboardCollecion for the handling of the billboards (according to @Gabby_Getz )
addBillboard(myBillboard) {
if (typeof this.mybillboardCollection === 'undefined') {
this.mybillboardCollection = new BillboardCollection();
if (this._primitives) {
this._primitives.add(this.mybillboardCollection);
}
else
{
this.addPrimitives(this.mybillboardCollection);
}
}
if (this.mybillboardCollection.length < this.numberBillboards)
{
this.mybillboardCollection.add(myBillboard);
// this.setBillboardTextureAtlasDimension(myBillboard.imagewidth, myBillboard.imageheight);
}
else
{
this.mybillboardCollection = new BillboardCollection();
this.mybillboardCollection.add(myBillboard);
this._primitives.add(this.mybillboardCollection);
}
}
numberBillboards depends on the hardware/gl_textureSize
I know that the billboards have no attribute/property description, but I thought that a private attribute “description” will remain.
In the clicHandler I receive the primitive but I have no access to an attribute description.
Hmm, I think your problem is that “description” isn’t a property of a Billboard. Are you describing something that used to work but now didn’t, or something else?
For properties like this we usually use an Entity’s property API (get/set), however with primitives, I guess you can sorta hack one in there, so just before you actually add it, create it as a referenced object before adding it, so instead of just;
this.mybillboardCollection.add(myBillboard);
add in;
let b = this.mybillboardCollection.add(myBillboard);
if ( myBillboard.description ) {
b.description = myBillboard.description;
}
… or add in here the equivalent property API (ie. b.addProperty(…) )
my description should work - but didn’t. But your trick/hack with
let b = this.mybillboardCollection.add(myBillboard);
if ( myBillboard.description ) {
b.description = myBillboard.description;
}
works - great !!
Now I have one more question - with this description I would like to open the “Standard-” InfoBox.
Can I open the infoBox programmatically in the setInputAction ?
I thought, that the object (with all his attribute/properties) given to the add function will preserve, but that doesn’t work - so to use the object which is the return value would do the trick !
The thing is that “description” (when you pass this into the add() function) isn’t part of the schema. If you look at BillboardCollection - Cesium Documentation you’ll see the parameters it recognizes. Anything else, like “description”, is just a dynamic property you specify, so these should be handled through the Property API, depending on your need for serialising, etc.
Hi, is it possible to add some functions to the billboard? because when you click on the billboard it takes you to the location, can i add some features?