Skip to main content
A newer version of this page is available. .

BingDetail.CompassDegrees Property

Returns the angle in degrees for which it is necessary to change the travel direction.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v21.1.dll

NuGet Packages: DevExpress.Win.Design, DevExpress.Win.Map

Declaration

public int CompassDegrees { get; }

Property Value

Type Description
Int32

A Int32 value representing an angle expressed in degrees.

Remarks

For more information, refer to the Bing Route Data topic in MSDN.

Example

This example demonstrates how to zoom a map to the calculated route.

To do this, handle the BingRouteDataProvider.RouteCalculated event. In the event handler, using the BingRouteResult.BoundingBox property, get the top-left corner (using the SearchBoundingBox.NorthLatitude and SearchBoundingBox.WestLongitude properties) and right-bottom corner (using the SearchBoundingBox.SouthLatitude and SearchBoundingBox.EastLongitude properties) of the required region. Then, using the MapControl.ZoomToRegion method, zoom the map to the required rectangle specified by the corners.

View Example

using DevExpress.XtraMap;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ZoomToFitOnRouteCalculated {
    public partial class Form1 : Form {
        InformationLayer Layer { get { return (InformationLayer)mapControl.Layers[1]; } }
        BingRouteDataProvider Provider { get { return (BingRouteDataProvider)Layer.DataProvider; } }
        public Form1() {
            InitializeComponent();
        }
        void OnRouteCalculated(object sender, BingRouteCalculatedEventArgs e) {
            SearchBoundingBox bBox = e.CalculationResult.RouteResults[0].BoundingBox;
            mapControl.ZoomToRegion(new GeoPoint(bBox.NorthLatitude, bBox.WestLongitude), new GeoPoint(bBox.SouthLatitude, bBox.EastLongitude), 0.4);
            splashScreenManager.CloseWaitForm();
        }
        private void Form1_Load(object sender, System.EventArgs e) {
            Provider.RouteCalculated += OnRouteCalculated;
            Provider.CalculateRoute(new List<RouteWaypoint> {
                new RouteWaypoint("New York", new GeoPoint(41.145556, -73.995)),
                new RouteWaypoint("Oklahoma", new GeoPoint(36.131389, -95.937222)),
                new RouteWaypoint("Las Vegas", new GeoPoint(36.175, -115.136389))
            });
            splashScreenManager.ShowWaitForm();
        }
    }
}
See Also