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 ArcGISMapPlateCarreeProviderBase : GMapProvider |
||
8 | { |
||
9 | public ArcGISMapPlateCarreeProviderBase() |
||
10 | { |
||
11 | Copyright = string.Format("©{0} ESRI - Map data ©{0} ArcGIS", DateTime.Today.Year); |
||
12 | } |
||
13 | |||
14 | #region GMapProvider Members |
||
15 | public override Guid Id |
||
16 | { |
||
17 | get |
||
18 | { |
||
19 | throw new NotImplementedException(); |
||
20 | } |
||
21 | } |
||
22 | |||
23 | public override string Name |
||
24 | { |
||
25 | get |
||
26 | { |
||
27 | throw new NotImplementedException(); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | public override PureProjection Projection |
||
32 | { |
||
33 | get |
||
34 | { |
||
35 | return PlateCarreeProjection.Instance; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | GMapProvider[] overlays; |
||
40 | public override GMapProvider[] Overlays |
||
41 | { |
||
42 | get |
||
43 | { |
||
44 | if(overlays == null) |
||
45 | { |
||
46 | overlays = new GMapProvider[] { this }; |
||
47 | } |
||
48 | return overlays; |
||
49 | } |
||
50 | } |
||
51 | |||
52 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
53 | { |
||
54 | throw new NotImplementedException(); |
||
55 | } |
||
56 | #endregion |
||
57 | } |
||
58 | |||
59 | public abstract class ArcGISMapMercatorProviderBase : GMapProvider |
||
60 | { |
||
61 | public ArcGISMapMercatorProviderBase() |
||
62 | { |
||
63 | MaxZoom = null; |
||
64 | Copyright = string.Format("©{0} ESRI - Map data ©{0} ArcGIS", DateTime.Today.Year); |
||
65 | } |
||
66 | |||
67 | #region GMapProvider Members |
||
68 | public override Guid Id |
||
69 | { |
||
70 | get |
||
71 | { |
||
72 | throw new NotImplementedException(); |
||
73 | } |
||
74 | } |
||
75 | |||
76 | public override string Name |
||
77 | { |
||
78 | get |
||
79 | { |
||
80 | throw new NotImplementedException(); |
||
81 | } |
||
82 | } |
||
83 | |||
84 | public override PureProjection Projection |
||
85 | { |
||
86 | get |
||
87 | { |
||
88 | return MercatorProjection.Instance; |
||
89 | } |
||
90 | } |
||
91 | |||
92 | GMapProvider[] overlays; |
||
93 | public override GMapProvider[] Overlays |
||
94 | { |
||
95 | get |
||
96 | { |
||
97 | if(overlays == null) |
||
98 | { |
||
99 | overlays = new GMapProvider[] { this }; |
||
100 | } |
||
101 | return overlays; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
106 | { |
||
107 | throw new NotImplementedException(); |
||
108 | } |
||
109 | #endregion |
||
110 | } |
||
111 | |||
112 | /// <summary> |
||
113 | /// ArcGIS_StreetMap_World_2D_Map provider, http://server.arcgisonline.com |
||
114 | /// </summary> |
||
115 | public class ArcGIS_StreetMap_World_2D_MapProvider : ArcGISMapPlateCarreeProviderBase |
||
116 | { |
||
117 | public static readonly ArcGIS_StreetMap_World_2D_MapProvider Instance; |
||
118 | |||
119 | ArcGIS_StreetMap_World_2D_MapProvider() |
||
120 | { |
||
121 | } |
||
122 | |||
123 | static ArcGIS_StreetMap_World_2D_MapProvider() |
||
124 | { |
||
125 | Instance = new ArcGIS_StreetMap_World_2D_MapProvider(); |
||
126 | } |
||
127 | |||
128 | #region GMapProvider Members |
||
129 | |||
130 | readonly Guid id = new Guid("00BF56D4-4B48-4939-9B11-575BBBE4A718"); |
||
131 | public override Guid Id |
||
132 | { |
||
133 | get |
||
134 | { |
||
135 | return id; |
||
136 | } |
||
137 | } |
||
138 | |||
139 | readonly string name = "ArcGIS_StreetMap_World_2D_Map"; |
||
140 | public override string Name |
||
141 | { |
||
142 | get |
||
143 | { |
||
144 | return name; |
||
145 | } |
||
146 | } |
||
147 | |||
148 | public override PureImage GetTileImage(GPoint pos, int zoom) |
||
149 | { |
||
150 | string url = MakeTileImageUrl(pos, zoom, LanguageStr); |
||
151 | |||
152 | return GetTileImageUsingHttp(url); |
||
153 | } |
||
154 | |||
155 | #endregion |
||
156 | |||
157 | string MakeTileImageUrl(GPoint pos, int zoom, string language) |
||
158 | { |
||
159 | // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/0/0/0.jpg |
||
160 | |||
161 | return string.Format(UrlFormat, zoom, pos.Y, pos.X); |
||
162 | } |
||
163 | |||
164 | static readonly string UrlFormat = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/{0}/{1}/{2}"; |
||
165 | } |
||
166 | } |