Entity Types

The Common Entity Library defines two standard entity types that should cover most situations. These include AgPointEntity (used for modeling a point in space such as an aircraft or building) and AgPolylineEntity (used for modeling a region of space such as a country border or cloud coverage). While entity objects perform no processing themselves, they act as the primary container for all information known about a particular piece of real-time data.

Both AgPointEntity and AgPolylineEntity implement a variety of interfaces. They share in common IAgEntity (the primary interface for all entity objects), IPersist (the standard Microsoft persistence interface), IAgPersistSafeArray (for persisting an entity into an array of bytes), IAgEntityMerge (for merging the contents of one entity into another), and IAgEntityTimeToLive (for setting expiration parameters if an entity has not been updated within a certain amount of time). The primary interface for each is IAgPointEntity and IAgPolylineEntity, respectively.

Entity objects publish an OnEntityChanged event that clients can listen to for notification of when an entity is updated. To increase performance and prevent a multitude of events from being executed you must manually call the CommitUpdate method on an entity once you are done modifying it. For example, suppose you had an AgPointEntity named PointEntity and you wanted to set the DisplayName of an entity to “Alpha1” and its time to live to 2 minutes; you would use the following code:

using AGI.Entity;
PointEntity.DisplayName = "Alpha1";
PointEntity.DesiredTimeToLive = 120;
PointEntity.CommitUpdate(AgEEntityUpdate.eEntityUpdate);

This would cause any clients subscribed to PointEntity to receive notification that the entity had been updated. They only get one notification for both changes rather than the entity automatically sending two updates when the properties are modified. The AgEEntityUpdate enum can also specify that only position or graphics has changed to allow for optimizations on the subscriber's end. eEntityUpdate is a catch-all value meaning that a variety of things about the Entity have changed.

STK Programming Interface 11.0.1