forked from ArduPilot/MissionPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatkart_Topo2.cs
97 lines (74 loc) · 2.42 KB
/
Statkart_Topo2.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MissionPlanner.Maps
{
using System;
using GMap.NET.Projections;
using System.Globalization;
using GMap.NET.MapProviders;
using GMap.NET;
using System.Reflection;
/// <summary>
/// EarthBuilder Custom
/// </summary>
public class Statkart_Topo2 : GMapProvider
{
public static readonly Statkart_Topo2 Instance;
Statkart_Topo2()
{
}
static Statkart_Topo2()
{
Instance = new Statkart_Topo2();
Type mytype = typeof (GMapProviders);
FieldInfo field = mytype.GetField("DbHash", BindingFlags.Static | BindingFlags.NonPublic);
Dictionary<int, GMapProvider> list = (Dictionary<int, GMapProvider>) field.GetValue(Instance);
list.Add(Instance.DbId, Instance);
}
#region GMapProvider Members
readonly Guid id = new Guid("24855c2f-7f75-4074-a30b-ac3ce3287237");
public override Guid Id
{
get { return id; }
}
readonly string name = "Statkart_Topo2";
public override string Name
{
get { return name; }
}
GMapProvider[] overlays;
public override GMapProvider[] Overlays
{
get
{
if (overlays == null)
{
overlays = new GMapProvider[] {this};
}
return overlays;
}
}
public override PureProjection Projection
{
get { return MercatorProjection.Instance; }
}
public override PureImage GetTileImage(GPoint pos, int zoom)
{
string url = MakeTileImageUrl(pos, zoom, LanguageStr);
return GetTileImageUsingHttp(url);
}
#endregion
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
string ret;
this.RefererUrl = "http://www.norgeskart.no/";
ret = string.Format(CultureInfo.InvariantCulture, CustomURL, zoom, pos.X, pos.Y);
return ret;
}
//http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom=%1&x=%2&y=%3
public static string CustomURL =
"http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom={0}&x={1}&y={2}";
}
}