Skip to main content
All docs
V23.2

BingRouteIsochroneDataProvider.IsochroneCalculated Event

Occurs after an isochrone is calculated.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.2.dll

NuGet Package: DevExpress.Win.Map

Declaration

public event BingRouteIsochroneCalculatedEventHandler IsochroneCalculated

Event Data

The IsochroneCalculated event's data class is BingRouteIsochroneCalculatedEventArgs. The following properties provide information specific to this event:

Property Description
CalculationResult Returns the result of an isochrone calculation (isoline polygon points and origin waypoint coordinates).
Cancelled Gets a value indicating whether an asynchronous operation has been canceled. Inherited from AsyncCompletedEventArgs.
Error Gets a value indicating which error occurred during an asynchronous operation. Inherited from AsyncCompletedEventArgs.
UserState Gets the unique identifier for the asynchronous task. Inherited from AsyncCompletedEventArgs.

The event data class exposes the following methods:

Method Description
RaiseExceptionIfNecessary() Raises a user-supplied exception if an asynchronous operation failed. Inherited from AsyncCompletedEventArgs.

Remarks

The following code plots a polygon that shows an area accessible from the specified point:

Isochrone map

using DevExpress.XtraMap;
using System;
using System.Drawing;
using System.Windows.Forms;

    private void Form1_Load(object sender, EventArgs e) {
        ImageLayer imageLayer = new ImageLayer();
        mapControl1.Layers.Add(imageLayer);
        BingMapDataProvider provider = new BingMapDataProvider();
        provider.BingKey = "Insert your Bing key.";
        provider.Kind = BingMapKind.RoadLight;
        imageLayer.DataProvider = provider;       

        InformationLayer infoLayer = new InformationLayer();
        mapControl1.Layers.Add(infoLayer);

        BingRouteIsochroneDataProvider isochroneDataProvider = new BingRouteIsochroneDataProvider();
        isochroneDataProvider.BingKey = "Insert your Bing Maps key.";
        GeoPoint origin = new GeoPoint(36.1532403246368, -86.7701703811725);
        mapControl1.CenterPoint = origin;
        isochroneDataProvider.CalculateIsochroneByDistance(new RouteWaypoint("", origin), 10);
        isochroneDataProvider.GenerateLayerItems = false;
        isochroneDataProvider.IsochroneCalculated += IsochroneCalculated;
        infoLayer.DataProvider = isochroneDataProvider;

    }

    private void IsochroneCalculated(object sender, BingRouteIsochroneCalculatedEventArgs e) {
        foreach (var polygon in e.CalculationResult.IsochroneResult.Polygons) {
            MapPolyline item = new MapPolyline();
            foreach (var points in polygon.Coordinates)
                item.Points.Add(points);
            item.StrokeWidth = 4;
            item.Stroke = Color.Red;

            VectorItemsLayer vectorLayer = new VectorItemsLayer();
            mapControl1.Layers.Add(vectorLayer);
            MapItemStorage storage = new MapItemStorage();
            vectorLayer.Data = storage;
            storage.Items.Add(item);
        }
        mapControl1.ZoomToFitLayerItems();
    }
See Also