Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2498 | - | 1 | |
2 | namespace GMap.NET.MapProviders |
||
3 | { |
||
4 | using System; |
||
5 | using GMap.NET.Projections; |
||
6 | |||
7 | public abstract class CzechMapProviderBaseOld : GMapProvider |
||
8 | { |
||
9 | public CzechMapProviderBaseOld() |
||
10 | { |
||
11 | RefererUrl = "http://www.mapy.cz/"; |
||
12 | Area = new RectLatLng(51.2024819920053, 11.8401353319027, 7.22833716731277, 2.78312271922872); |
||
13 | } |
||
14 | |||
15 | #region GMapProvider Members |
||
16 | public override Guid Id |
||
17 | { |
||
18 | get |
||
19 | { |
||
20 | throw new NotImplementedException(); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | public override string Name |
||
25 | { |
||
26 | get |
||
27 | { |
||
28 | throw new NotImplementedException(); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | public override PureProjection Projection |
||
33 | { |
||
34 | get |
||
35 | { |
||
36 | return MapyCZProjection.Instance; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | GMapProvider[] overlays; |
||
41 | public override GMapProvider[] Overlays |
||
42 | { |
||
43 | get |
||
44 | { |
||
45 | if(overlays == null) |
||
46 | { |
||
47 | overlays = new GMapProvider[] { this }; |
||
48 | } |
||
49 | return overlays; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
54 | { |
||
55 | throw new NotImplementedException(); |
||
56 | } |
||
57 | #endregion |
||
58 | } |
||
59 | |||
60 | /// <summary> |
||
61 | /// CzechMap provider, http://www.mapy.cz/ |
||
62 | /// </summary> |
||
63 | public class CzechMapProviderOld : CzechMapProviderBaseOld |
||
64 | { |
||
65 | public static readonly CzechMapProviderOld Instance; |
||
66 | |||
67 | CzechMapProviderOld() |
||
68 | { |
||
69 | } |
||
70 | |||
71 | static CzechMapProviderOld() |
||
72 | { |
||
73 | Instance = new CzechMapProviderOld(); |
||
74 | } |
||
75 | |||
76 | #region GMapProvider Members |
||
77 | |||
78 | readonly Guid id = new Guid("6A1AF99A-84C6-4EF6-91A5-77B9D03257C2"); |
||
79 | public override Guid Id |
||
80 | { |
||
81 | get |
||
82 | { |
||
83 | return id; |
||
84 | } |
||
85 | } |
||
86 | |||
87 | readonly string name = "CzechOldMap"; |
||
88 | public override string Name |
||
89 | { |
||
90 | get |
||
91 | { |
||
92 | return name; |
||
93 | } |
||
94 | } |
||
95 | |||
96 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
97 | { |
||
98 | string url = MakeTileImageUrl(pos, zoom, LanguageStr); |
||
99 | |||
100 | return GetTileImageUsingHttp(url); |
||
101 | } |
||
102 | |||
103 | #endregion |
||
104 | |||
105 | string MakeTileImageUrl(GPoint pos, int zoom, string language) |
||
106 | { |
||
107 | // ['base','ophoto','turist','army2'] |
||
108 | // http://m1.mapserver.mapy.cz/base-n/3_8000000_8000000 |
||
109 | |||
110 | long xx = pos.X << (28 - zoom); |
||
111 | long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom); |
||
112 | |||
113 | return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy); |
||
114 | } |
||
115 | |||
116 | static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/base-n/{1}_{2:x7}_{3:x7}"; |
||
117 | } |
||
118 | } |