Hello,
I’m trying to set up my Cesium application to download all entities present as a KMZ file via exportKml
. It seems that when points are converted from Cesium entities to KML entities, the pixelSize
of the point determines how big the icon is when viewed in Google Earth. As such, I currently have the code set up to create a copy of all entities in the Viewer, editing all points to be larger, and then using that to save.
It looks like this:
const v = Cesium.Viewer;
const entitiesToSave = Cesium.clone(v.entities);
for (const ent of entitiesToSave.values) {
ent.model = undefined; // Removing any models present
if (ent.point) {
ent.point.pixelSize = new Cesium.ConstantProperty(20.0); // To increase size of point icon in KMZ
}
}
exportKml({
entities: entitiesToSave,
kmz: true,
}).then((result): void => {
... saving
However, after making this edit, I find that the entities present in the cesium viewer are also edited (as in, their points are enlarged), even though I made a clone of the entities instead of editing them directly. I’m guessing that cloning the entities present in the simulation only makes a cloned copy of references to the entities rather than copies of the entities themselves.
Is there a way to make a copy of an entity or an entity collection (such as those present in the cesium viewer) such that they can be edited without editing the original entities they were copied from?