Class DynamicEntity

java.lang.Object
com.esri.arcgisruntime.realtime.DynamicEntity
All Implemented Interfaces:
GeoElement

public final class DynamicEntity extends Object implements GeoElement
A GeoElement that represents a real-world object received from a DynamicEntityDataSource.

Dynamic entities are updated with data coming from a stream. These updates are referred to as observations and are represented by the DynamicEntityObservation class. An observation is a static snapshot of the state of a dynamic entity at a given time. This snapshot includes the associated dynamic entity's location (geometry) as well as all its attributes. For example, an observation for a moving aircraft may include updates to attributes like speed, altitude, and heading in addition to its updated location. While observations remain static, a dynamic entity changes because it's essentially a pointer to the most recent observation.

The properties of a DynamicEntity, such as its attributes and geometry, are updated when new observations are received from the server. You should not cache the getGeometry() or getAttributes() collection properties as they are completely replaced when a new observation is received for the associated DynamicEntity.

Since:
200.1.0
See Also:
  • Property Details

  • Method Details

    • entityIdProperty

      public ReadOnlyLongProperty entityIdProperty()
      A unique identifier for the DynamicEntity.

      The entityId property uniquely identifies a DynamicEntity.

      Returns:
      the entityId property
      Since:
      200.1.0
      See Also:
    • getEntityId

      public long getEntityId()
      Gets the value of the entityId property.
      Property description:
      A unique identifier for the DynamicEntity.

      The entityId property uniquely identifies a DynamicEntity.

      Returns:
      the value of the entityId property
      Since:
      200.1.0
      See Also:
    • latestObservation

      public DynamicEntityObservation latestObservation()
      Gets the latest DynamicEntityObservation associated with this dynamic entity.

      The observation returned by this method represents a snapshot of the state of this dynamic entity at the time the observation was received. This method may return null if the dynamic entity has been purged from the local data cache.

      Returns:
      the latest observation associated with this dynamic entity, or null if none
      Since:
      200.1.0
      See Also:
    • getObservations

      public List<DynamicEntityObservation> getObservations(int maximumObservations)
      Gets the collection of DynamicEntityObservation objects associated with this dynamic entity.

      Use this method to get a collection of DynamicEntityObservation objects associated with this dynamic entity. Observations are associated with a dynamic entity through a shared track ID. For ArcGISStreamService data sources, the track ID field is defined by the ArcGISStreamServiceInfo.trackIdFieldProperty() property.

      The returned observations are sorted from the most recent to the oldest.

      This method may return an empty collection if the dynamic entity has been purged from the local data cache.

      Parameters:
      maximumObservations - the maximum number of observations to return, including the latest
      Returns:
      an unmodifiable list of observations of a DynamicEntity
      Since:
      200.1.0
      See Also:
    • addDynamicEntityChangedListener

      public void addDynamicEntityChangedListener(DynamicEntity.DynamicEntityChangedListener listener)
      Registers the given DynamicEntityChangedListener to be called when an update is received from the DynamicEntity.

      Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

      Parameters:
      listener - the listener to register
      Throws:
      NullPointerException - if the DynamicEntityChangedListener is null
      Since:
      200.1.0
      See Also:
    • removeDynamicEntityChangedListener

      public boolean removeDynamicEntityChangedListener(DynamicEntity.DynamicEntityChangedListener listener)
      Unregisters the given DynamicEntityChangedListener that was previously added using addDynamicEntityChangedListener(DynamicEntityChangedListener).
      Parameters:
      listener - the listener to unregister
      Returns:
      true if the listener was successfully removed; false otherwise
      Since:
      200.1.0
    • getAttributes

      public Map<String,Object> getAttributes()
      Gets the attributes. After a DynamicEntity.DynamicEntityChangedEvent happens you must call this property to get a new map of attributes to see the updated values.
      Specified by:
      getAttributes in interface GeoElement
      Returns:
      the attributes
      Since:
      200.1.0
    • getGeometry

      public Geometry getGeometry()
      Description copied from interface: GeoElement
      Gets the geometry which defines the shape and location of the GeoElement.
      Specified by:
      getGeometry in interface GeoElement
      Returns:
      the geometry defines the shape and location of the GeoElement, or null if none
    • setGeometry

      public void setGeometry(Geometry geometry)
      Description copied from interface: GeoElement
      Sets the geometry defines the shape and location of the GeoElement.
      Specified by:
      setGeometry in interface GeoElement
      Parameters:
      geometry - the geometry defines the shape and location of the GeoElement