-
Notifications
You must be signed in to change notification settings - Fork 1
/
BingMapsConnector.cs
32 lines (28 loc) · 1.11 KB
/
BingMapsConnector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Globalization;
namespace FSBingMapsConnect
{
public static class BingMapsConnector
{
public static string GetExecutionString(ConnectorParameters parameters)
{
string zoomString = "";
if (parameters.AlignZoom)
{
zoomString = $"lvl={20 - Math.Ceiling(parameters.Response.altitudeAboveGround / 1000)}";
}
else
{
zoomString = $"lvl={parameters.ZoomLevel}";
}
string mapString = "sty=";
switch (parameters.MapType)
{
case "Road": mapString += "r"; break;
default: mapString += "a"; break;
}
var gpsString = $"bingmaps:?cp={parameters.Response.latitude.ToString(CultureInfo.InvariantCulture.NumberFormat)}~{parameters.Response.longitude.ToString(CultureInfo.InvariantCulture.NumberFormat)}&{zoomString}&{mapString}&hdg={parameters.Response.heading.ToString(CultureInfo.InvariantCulture.NumberFormat)}&pit={parameters.Pitch}";
return gpsString;
}
}
}