BingRouteIsochroneCalculatedEventArgs.CalculationResult Property
Returns the result of an isochrone calculation (isoline polygon points and origin waypoint coordinates).
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.1.dll
NuGet Package: DevExpress.Win.Map
Declaration
Property Value
Type | Description |
---|---|
RouteIsochroneCalculationResult | Contains the result of the isochrone calculation. |
Example
The following code plots a polygon that shows an area accessible from the specified point:
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