Skip to content

Commit a771172

Browse files
authored
Merge branch 'ArduPilot:master' into MyButton_add_DefaultValue_to_TextColorNotEnabled
2 parents 3de2cad + 2864d70 commit a771172

File tree

17 files changed

+38683
-38256
lines changed

17 files changed

+38683
-38256
lines changed

ExtLibs/Controls/HUD.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,7 @@ internal void doPaint()
31003100

31013101
var newfontsize = calcfontsize(message, font, fontsize + 10, (SolidBrush) brush, Width - 50 - 50);
31023102

3103-
var size = calcsize(message, newfontsize, (SolidBrush)Brushes.Red);
3103+
var size = calcsize(message, newfontsize, (SolidBrush) brush);
31043104

31053105
drawstring(message, font, newfontsize, (SolidBrush) brush, size.Width / -2,
31063106
halfheight / 3);
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace GMap.NET.Core.GMap.NET.Projections
6+
{
7+
public class NoProjection : PureProjection
8+
{
9+
public static PureProjection Instance { get; set; } = new NoProjection();
10+
11+
public override GSize TileSize => new GSize(256, 256);
12+
13+
public override double Axis => 6378137;
14+
15+
public override double Flattening => (1.0 / 298.257223563);
16+
17+
18+
public override GPoint FromLatLngToPixel(double lat, double lng, int zoom)
19+
20+
{
21+
GPoint ret = GPoint.Empty;
22+
23+
double x = (lng + 180) / 360;
24+
double y = (90 - lat) / 180;
25+
26+
GSize s = GetTileMatrixSizePixel(zoom);
27+
long mapSizeX = s.Width;
28+
long mapSizeY = s.Height;
29+
30+
ret.X = (long)Clip(x * mapSizeX + 0.5, 0, mapSizeX - 1);
31+
ret.Y = (long)Clip(y * mapSizeY + 0.5, 0, mapSizeY - 1);
32+
33+
return ret;
34+
}
35+
36+
public override PointLatLng FromPixelToLatLng(long x, long y, int zoom)
37+
{
38+
PointLatLng ret = PointLatLng.Empty;
39+
40+
GSize s = GetTileMatrixSizePixel(zoom);
41+
double mapSizeX = s.Width;
42+
double mapSizeY = s.Height;
43+
44+
double xx = (Clip(x, 0, mapSizeX - 1) / mapSizeX);
45+
double yy = (Clip(y, 0, mapSizeY - 1) / mapSizeY);
46+
47+
ret.Lat = 90 - 180 * yy;
48+
ret.Lng = 360 * xx - 180;
49+
50+
return ret;
51+
}
52+
53+
public override GSize GetTileMatrixMaxXY(int zoom)
54+
{
55+
long xy = (1 << zoom);
56+
return new GSize(xy - 1, xy - 1);
57+
}
58+
59+
public override GSize GetTileMatrixMinXY(int zoom)
60+
{
61+
return new GSize(0, 0);
62+
}
63+
}
64+
}

ExtLibs/Maps/GMapMarkerRect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public override void OnRender(IGraphics g)
7878
GPoint loc = new GPoint((int) (LocalPosition.X - (m2pixelwidth*wprad*2)), LocalPosition.Y);
7979
// MainMap.FromLatLngToLocal(wpradposition);
8080

81-
if (m2pixelheight > 0.001 && !double.IsInfinity(m2pixelheight))
81+
if (m2pixelheight > 0.001 && !double.IsInfinity(m2pixelheight) && m2pixelheight < Int32.MaxValue)
8282
{
8383
var rect = new System.Drawing.Rectangle(
8484
LocalPosition.X - Offset.X - (int) (Math.Abs(loc.X - LocalPosition.X) / 2),

ExtLibs/Maps/NoMap.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace MissionPlanner.Maps
7+
{
8+
using System;
9+
using GMap.NET.Projections;
10+
using System.Globalization;
11+
using GMap.NET.MapProviders;
12+
using GMap.NET;
13+
using System.Reflection;
14+
using GMap.NET.Core.GMap.NET.Projections;
15+
16+
/// <summary>
17+
/// Custom
18+
/// </summary>
19+
public class NoMap : GMapProvider
20+
{
21+
public static readonly NoMap Instance;
22+
23+
NoMap()
24+
{
25+
MaxZoom = 22;
26+
}
27+
28+
static NoMap()
29+
{
30+
Instance = new NoMap();
31+
32+
Type mytype = typeof (GMapProviders);
33+
FieldInfo field = mytype.GetField("DbHash", BindingFlags.Static | BindingFlags.NonPublic);
34+
Dictionary<int, GMapProvider> list = (Dictionary<int, GMapProvider>) field.GetValue(Instance);
35+
36+
list.Add(Instance.DbId, Instance);
37+
38+
39+
}
40+
41+
#region GMapProvider Members
42+
43+
readonly Guid id = new Guid("4574228D-B552-4CAF-89AE-F20BADBBDB2B");
44+
45+
public override Guid Id
46+
{
47+
get { return id; }
48+
}
49+
50+
readonly string name = "NoMap";
51+
52+
public override string Name
53+
{
54+
get { return name; }
55+
}
56+
57+
GMapProvider[] overlays;
58+
59+
public override GMapProvider[] Overlays
60+
{
61+
get
62+
{
63+
if (overlays == null)
64+
{
65+
overlays = new GMapProvider[] {this};
66+
}
67+
return overlays;
68+
}
69+
}
70+
71+
public override PureProjection Projection
72+
{
73+
get { return NoProjection.Instance; }
74+
}
75+
76+
public override PureImage GetTileImage(GPoint pos, int zoom)
77+
{
78+
return null;
79+
}
80+
81+
#endregion
82+
}
83+
}

0 commit comments

Comments
 (0)