Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2498 | - | 1 | |
2 | namespace GMap.NET.MapProviders |
||
3 | { |
||
4 | using System; |
||
5 | |||
6 | /// <summary> |
||
7 | /// CzechHybridMap provider, http://www.mapy.cz/ |
||
8 | /// </summary> |
||
9 | public class CzechHybridMapProviderOld : CzechMapProviderBaseOld |
||
10 | { |
||
11 | public static readonly CzechHybridMapProviderOld Instance; |
||
12 | |||
13 | CzechHybridMapProviderOld() |
||
14 | { |
||
15 | } |
||
16 | |||
17 | static CzechHybridMapProviderOld() |
||
18 | { |
||
19 | Instance = new CzechHybridMapProviderOld(); |
||
20 | } |
||
21 | |||
22 | #region GMapProvider Members |
||
23 | |||
24 | readonly Guid id = new Guid("F785D98E-DD1D-46FD-8BC1-1AAB69604980"); |
||
25 | public override Guid Id |
||
26 | { |
||
27 | get |
||
28 | { |
||
29 | return id; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | readonly string name = "CzechHybridOldMap"; |
||
34 | public override string Name |
||
35 | { |
||
36 | get |
||
37 | { |
||
38 | return name; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | GMapProvider[] overlays; |
||
43 | public override GMapProvider[] Overlays |
||
44 | { |
||
45 | get |
||
46 | { |
||
47 | if(overlays == null) |
||
48 | { |
||
49 | overlays = new GMapProvider[] { CzechSatelliteMapProviderOld.Instance, this }; |
||
50 | } |
||
51 | return overlays; |
||
52 | } |
||
53 | } |
||
54 | |||
55 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
56 | { |
||
57 | string url = MakeTileImageUrl(pos, zoom, LanguageStr); |
||
58 | |||
59 | return GetTileImageUsingHttp(url); |
||
60 | } |
||
61 | |||
62 | #endregion |
||
63 | |||
64 | string MakeTileImageUrl(GPoint pos, int zoom, string language) |
||
65 | { |
||
66 | // http://m2.mapserver.mapy.cz/hybrid/9_7d00000_7b80000 |
||
67 | |||
68 | long xx = pos.X << (28 - zoom); |
||
69 | long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom); |
||
70 | |||
71 | return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy); |
||
72 | } |
||
73 | |||
74 | static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/hybrid/{1}_{2:x7}_{3:x7}"; |
||
75 | } |
||
76 | } |