Show/hide description box that is trailing satellite

Hey guys,

Lurker since January and finally I am posting my first question. It is very general.

Currently I have a couple satellites in orbit using a czml file. I am able to click on an icon button, which then shows/hides the path of the satellite. (Not the satellite, but an icon button located on the right side of the page) I want to show a description box trailing the satellite when the user wants to see the satellite orbit, and hide it when the user no longer wants to see the satellite orbit. Basically, user clicks on icon button, satellite orbit path and description box trailing satellite becomes visible. User clicks on icon button again (same one) to hide the satellite orbit path and the trailing description box.

I know that in cesium, (if you have infoBox set to true) you can just click on the entity and an info box (description) will show. However those are not the requirements I am supposed to fulfill (sadly).

I have attached a small snipet of my cesium directive code (using angular here) so you can get an idea of what is going on when a user clicks on an icon. The onclick button fires an event that contains the satellite id from the czml packet and then calls the function setSatelliteView.

function setSatelliteView(view :string){

// locates specific satellite in czml packet by its id and saves it in entity

var entity = viewerEntities.getById(view);

if (entity.path.show == false){

  //if show orbit path set to false, make true

  entity.path.show = new Cesium.ConstantProperty(true);

  //TODO

}

else if (entity.path.show == true){

  //if show orbit path set to true, make false

  entity.path.show = new Cesium.ConstantProperty(false);

  //TODO

}

}

I truly appreciate any help. I usually just try stuff out until something finally works, but I have a mid year demo next week and I’m stressed as heck! Any help will be greatly appreciated! :slight_smile:

Welcome to the Cesium forum Stephanie!

It sounds like you want to have an billboard/label entity following the satellite. I would give this entity a CallbackProperty for its position, and that can then get the satellite entity’s position, apply whatever offset, and return it. Alternatively, if it’s a label, it might not need a world coordinate offset at all, and you can instead use something like the eyeOffset or pixelOffset (see https://cesiumjs.org/Cesium/Build/Documentation/LabelGraphics.html?classFilter=LabelGr#pixelOffset).

Let me know if that helps!

Thanks Omar, this is exactly the explanation I was looking for. Cheers!