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
   /// OpenSeaMapHybrid provider - http://openseamap.org
8
   /// </summary>
9
   public class OpenSeaMapHybridProvider : OpenStreetMapProviderBase
10
   {
11
      public static readonly OpenSeaMapHybridProvider Instance;
12
 
13
      OpenSeaMapHybridProvider()
14
      {
15
         RefererUrl = "http://openseamap.org/";
16
      }
17
 
18
      static OpenSeaMapHybridProvider()
19
      {
20
         Instance = new OpenSeaMapHybridProvider();
21
      }
22
 
23
      #region GMapProvider Members
24
 
25
      readonly Guid id = new Guid("FAACDE73-4B90-4AE6-BB4A-ADE4F3545592");
26
      public override Guid Id
27
      {
28
         get
29
         {
30
            return id;
31
         }
32
      }
33
 
34
      readonly string name = "OpenSeaMapHybrid";
35
      public override string Name
36
      {
37
         get
38
         {
39
            return name;
40
         }
41
      }
42
 
43
      GMapProvider[] overlays;
44
      public override GMapProvider[] Overlays
45
      {
46
         get
47
         {
48
            if(overlays == null)
49
            {
50
               overlays = new GMapProvider[] { OpenStreetMapProvider.Instance, this };
51
            }
52
            return overlays;
53
         }
54
      }
55
 
56
      public override PureImage GetTileImage(GPoint pos, int zoom)
57
      {
58
         string url = MakeTileImageUrl(pos, zoom, string.Empty);
59
 
60
         return GetTileImageUsingHttp(url);
61
      }
62
 
63
      #endregion
64
 
65
      string MakeTileImageUrl(GPoint pos, int zoom, string language)
66
      {
67
         return string.Format(UrlFormat, zoom, pos.X, pos.Y);
68
      }
69
 
70
      static readonly string UrlFormat = "http://tiles.openseamap.org/seamark/{0}/{1}/{2}.png";
71
   }
72
}