IBatchTrafficSource Interface |
Namespace: Telogis.GeoBase.Traffic
The IBatchTrafficSource type exposes the following members.
Name | Description | |
---|---|---|
GetTraffic |
Get traffic information for one or more links.
|
The IBatchTrafficSource interface is implemented to provide bulk querying of traffic data. IBatchTrafficSource provides a function GetTraffic which may be called to fetch traffic information for one or more links (specified as an ITrafficRequest). The ITrafficRequest interface provides access to one or more ITrafficItem objects, each containing information for a single link. ITrafficItem.SetSpeed should be used to set the speed of each ITrafficItem as appropriate.
class MyTrafficSource : IBatchTrafficSource { public Dictionary<string, double> TMCToSpeed = new Dictionary<string, double>(); public void GetTraffic(ITrafficRequest request) { foreach (ITrafficItem item in request) { double speedMph; if (TMCToSpeed.TryGetValue(item.TMC, out speedMph)) { item.SetSpeed(speedMph, SpeedUnit.MilesPerHour); } } } }