HERE Android SDK Developer's Guide

TrafficEvent

The class TrafficEvent is a member of com.here.android.mpa.mapping .

Class Summary

public final class TrafficEvent

extends java.lang.Object

Represents information about a traffic event.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in TrafficEvent
Nested Classes

public static abstract interface TrafficEvent.Listener

Event Listener interface for traffic event

public static final enumeration TrafficEvent.Severity

Indicates the serverity of the traffic events.

Field Summary

Table 2. Fields in TrafficEvent
Fields

public static final int DATA_UNAVAILABLE

Indicates it was not possible to obtain the requested data.

Method Summary

Table 3. Methods in TrafficEvent
Methods

public Date getActivationDate ()

To get date and time when this TrafficEvent will be or has been activated.

public GeoBoundingBox getAffectedArea ()

Return the bounding box affected by this TrafficEvent .

public int getAffectedLength ()

Return the length of this TrafficEvent .

public java.util.List <RoadElement> getAffectedRoadElements ()

Return affected RoadElements.

public List getAffectedStreets ()

The names of the streets that are affected by this TrafficEvent .

public void getAffectedStreets (Listener<String> listener)

Gets the names of the streets that are affected by this TrafficEvent asynchronously.

public int getDistanceTo (GeoCoordinate geoCoordinates)

Calculate distance to the TrafficEvent .

public int getEstimatedSpeedLimit ()

Return the estimated speed that applies on the road elements affected by the traffic event.

public String getEventText ()

Gets the text of the traffic event.

public String getFirstAffectedStreet ()

Gets the name of the first street affected by this TrafficEvent .

public void getFirstAffectedStreet (Listener<String> listener)

Gets the name of the first street affected by this TrafficEvent asynchronously.

public List getFromStreets ()

Gets the names of the streets of the intersection where the location of the traffic event starts.

public void getFromStreets (Listener<String> listener)

Gets the names of the streets of the intersection where the location of the traffic event starts (asynchronously).

public Image getIconOffRoute ()

Return the off-route icon associated to this TrafficEvent .

public Image getIconOnRoute ()

Return the on-route icon associated to this TrafficEvent .

public short getPenalty ()

Gets the penalty associated with this event where 100 is blocked and 0 is unblocked.

public Severity getSeverity ()

Gets the TrafficEvent.Severity of this event.

public String getShortText ()

Gets the short text (category) of this event.

public int getSpeedLimit ()

Return the speed that applies on the road elements affected by the traffic event.

public List getToStreets ()

Gets the names of the streets of the intersection where the location of the traffic event ends.

public void getToStreets (Listener<String> listener)

Gets the names of the streets of the intersection where the location of the traffic event ends (asynchronously).

public Date getUpdateDate ()

To get date and time when this TrafficEvent has been updated.

public boolean isActive ()

Check if this TrafficEvent is active.

public boolean isFlow ()

Check if this TrafficEvent is a flow event.

public boolean isIncident ()

Check if this TrafficEvent is an incident event.

public boolean isOnRoute (Route route)

Check if the given Route is affected by this TrafficEvent .

public boolean isReroutable ()

Check if this TrafficEvent is re-routable.

public boolean isVisible ()

Check if this TrafficEvent is visible.

public String toString ()

Class Details

Represents information about a traffic event. Traffic events are displayed on a client device by way of a TrafficEventObject object, which encapsulates its map coordinates.

Field Details

public static final int DATA_UNAVAILABLE

Indicates it was not possible to obtain the requested data.

Method Details

public Date getActivationDate ()

To get date and time when this TrafficEvent will be or has been activated.

Returns:

date and time.

public GeoBoundingBox getAffectedArea ()

Return the bounding box affected by this TrafficEvent .

Returns:

The GeoBoundingBox representing the area affected.

public int getAffectedLength ()

Return the length of this TrafficEvent .

Returns:

total length in meters.

public java.util.List <RoadElement> getAffectedRoadElements ()

Return affected RoadElements.

Returns:

array of RoadElement.

public List getAffectedStreets ()

The names of the streets that are affected by this TrafficEvent . The order of the street names does not have any significance.

Returns:

The List of street names affected by the traffic event. Can be null if not yet processed. Use getAffectedStreets(Listener) to avoid receiving null.

public void getAffectedStreets (Listener<String> listener)

Gets the names of the streets that are affected by this TrafficEvent asynchronously. The order of the street names does not have any significance.

Parameters:

  • listener

    The that receives the result callback.

public int getDistanceTo (GeoCoordinate geoCoordinates)

Calculate distance to the TrafficEvent .

Parameters:

  • geoCoordinates

    coordinates

Returns:

distance in meters.

public int getEstimatedSpeedLimit ()

Return the estimated speed that applies on the road elements affected by the traffic event. Speed in this context refers to how fast traffic is moving.

If it is not possible to obtain an estimated speed DATA_UNAVAILABLE will be returned. It is possible a trusted speed may be available instead, this can be checked by way of getSpeedLimit().

Returns:

speed limit in km/h or DATA_UNAVAILABLE if no estimated speed is available.

public String getEventText ()

Gets the text of the traffic event.

Returns:

The String containing traffic event information

public String getFirstAffectedStreet ()

Gets the name of the first street affected by this TrafficEvent .

Returns:

the street name. Can be null if not yet processed. Use getFirstAffectedStreet(Listener) to avoid receiving null.

public void getFirstAffectedStreet (Listener<String> listener)

Gets the name of the first street affected by this TrafficEvent asynchronously.

Parameters:

  • listener

    The that receives the result callback.

public List getFromStreets ()

Gets the names of the streets of the intersection where the location of the traffic event starts.

Returns:

A list of streets. Can be null if not yet processed. When null the caller should try again later or use getFromStreets(Listener).

public void getFromStreets (Listener<String> listener)

Gets the names of the streets of the intersection where the location of the traffic event starts (asynchronously).

Parameters:

  • listener

    The that receives the result callback.

public Image getIconOffRoute ()

Return the off-route icon associated to this TrafficEvent . Can be null if there is no icon.

Returns:

traffic event icon.

public Image getIconOnRoute ()

Return the on-route icon associated to this TrafficEvent . Can be null if there is no icon.

Returns:

traffic event icon.

public short getPenalty ()

Gets the penalty associated with this event where 100 is blocked and 0 is unblocked.

Returns:

The penalty associated with this event.

public Severity getSeverity ()

Gets the TrafficEvent.Severity of this event.

Returns:

The Severity of this event.

public String getShortText ()

Gets the short text (category) of this event.

Returns:

The default possible return values are "CLOSURE", "ROADWORKS", "ACCIDENT", "CONGESTION", "OTHER", "FLOW". The text is NOT localized.

public int getSpeedLimit ()

Return the speed that applies on the road elements affected by the traffic event. Speed in this context refers to how fast traffic is moving. This value is expected to be accurate, because it reflects field probes.

If it is not possible to obtain a trusted speed DATA_UNAVAILABLE will be returned. It is possible an estimated speed may be available instead, this can be checked by way of getEstimatedSpeedLimit().

Returns:

speed limit in km/h or DATA_UNAVAILABLE if no trusted speed is available.

public List getToStreets ()

Gets the names of the streets of the intersection where the location of the traffic event ends.

Returns:

A list of streets. Can be null if not yet processed. When null the caller should try again later or use getToStreets(TrafficEvent.Listener).

public void getToStreets (Listener<String> listener)

Gets the names of the streets of the intersection where the location of the traffic event ends (asynchronously).

Parameters:

  • listener

    The that receives the result callback.

public Date getUpdateDate ()

To get date and time when this TrafficEvent has been updated.

Returns:

date and time.

public boolean isActive ()

Check if this TrafficEvent is active.

Returns:

true if this TrafficEvent is active, false otherwise

public boolean isFlow ()

Check if this TrafficEvent is a flow event.

Returns:

true if this TrafficEvent is a flow event, false otherwise.

public boolean isIncident ()

Check if this TrafficEvent is an incident event.

Returns:

true if this TrafficEvent is an incident event, false otherwise.

public boolean isOnRoute (Route route)

Check if the given Route is affected by this TrafficEvent .

Parameters:

  • route

    Route to be checked.

Returns:

true if affected, otherwise false.

public boolean isReroutable ()

Check if this TrafficEvent is re-routable.

Returns:

true if this TrafficEvent is re-routable, false otherwise.

public boolean isVisible ()

Check if this TrafficEvent is visible.

Returns:

true if this TrafficEvent is visible, false otherwise

public String toString ()

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.