Subversion Repositories Projects

Rev

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
   /// YahooHybridMap provider
8
   /// </summary>
9
   public class YahooHybridMapProvider : YahooMapProviderBase
10
   {
11
      public static readonly YahooHybridMapProvider Instance;
12
 
13
      YahooHybridMapProvider()
14
      {
15
      }
16
 
17
      static YahooHybridMapProvider()
18
      {
19
         Instance = new YahooHybridMapProvider();
20
      }
21
 
22
      public string Version = "4.3";
23
 
24
      #region GMapProvider Members
25
 
26
      readonly Guid id = new Guid("A084E0DB-F9A6-45C1-BC2F-791E1F4E958E");
27
      public override Guid Id
28
      {
29
         get
30
         {
31
            return id;
32
         }
33
      }
34
 
35
      readonly string name = "YahooHybridMap";
36
      public override string Name
37
      {
38
         get
39
         {
40
            return name;
41
         }
42
      }
43
 
44
      GMapProvider[] overlays;
45
      public override GMapProvider[] Overlays
46
      {
47
         get
48
         {
49
            if(overlays == null)
50
            {
51
               overlays = new GMapProvider[] { YahooSatelliteMapProvider.Instance, this };
52
            }
53
            return overlays;
54
         }
55
      }
56
 
57
      public override PureImage GetTileImage(GPoint pos, int zoom)
58
      {
59
         string url = MakeTileImageUrl(pos, zoom, LanguageStr);
60
 
61
         return GetTileImageUsingHttp(url);
62
      }
63
 
64
      #endregion
65
 
66
      string MakeTileImageUrl(GPoint pos, int zoom, string language)
67
      {
68
         // http://maps1.yimg.com/hx/tl?b=1&v=4.3&t=h&.intl=en&x=14&y=5&z=7&r=1
69
 
70
         return string.Format(UrlFormat, ((GetServerNum(pos, 2)) + 1), Version, language, pos.X, (((1 << zoom) >> 1) - 1 - pos.Y), (zoom + 1));
71
      }
72
 
73
      static readonly string UrlFormat = "http://maps{0}.yimg.com/hx/tl?v={1}&t=h&.intl={2}&x={3}&y={4}&z={5}&r=1";
74
   }
75
}