Should an Entity's children auto update?

We use czml exclusively and have been setting the parent id on our objects so that we can track what they are associated to. Since Cesium doesn’t currently support the ability to remove all children when a parent is removed, I watch the collection events and if the parent is removed, I loop its children and remove those as well. I’ve noticed though, if you remove a child, the _children property on the parent doesn’t seem to update. Is this intentional for some reason? Or is there a way that I can tell that thing to update its children list so that it remains up to date and accurate? I was intending on using that array to list associated, child entities in the infobox.

Also, since some of the other posts I’ve found have asked if children could be made more easily available, I’d like to see that added as well. If we have the ability to set the parent on an entity, why not expose the ability to see the parent/child relationships of the entities?

I know this is supposedly a private property that, maybe we shouldn’t be using in the first place but, it’s there and has been serving my needs until this instance. Also, people have asked for similar, at least here and here.

@david

I suggest that you try setting the parent of the child you remove to undefined. This should give you the functionality that you are looking for: when a child is removed, the _children property on the parent is updated to reflect this change. Let me know if this works!

If not, could you provide more information on how you are removing children? A code snipped might be helpful. More details on your use case and desired outcome would also help me address your questions!

-Sam

Maybe I’m misunderstanding something then. Because I was under the assumption that providing a packet similar to: { id: 'someid', delete: true } was deleting the child and I was under the assumption that, that parent child relationship was broken then. Now that I look back at czml documentation though, it seems as if delete just removes all data for that object but doesn’t necessarily delete the entity. Is that the issue?

@david

Yes, that is correct. delete removes all of the metadata yet does not remove the object itself. This is most likely the issue that you are facing.

-Sam

That… makes sense. Thanks Sam

1 Like

@david

You are welcome! Let me know if you have any other questions or concerns.

-Sam