using Sy
stem; using Sy
stem.Net; using Sy
stem.Windows; using Sy
stem.Window
s.Controls; using Sy
stem.Window
s.Documents; using Sy
stem.Window
s.Ink; using Sy
stem.Window
s.Input; using Sy
stem.Window
s.Media; using Sy
stem.Window
s.Media.Animation; using Sy
stem.Window
s.Shapes; using ESRI.ArcGI
s.CLIENt; using ESRI.ArcGI
s.CLIENt.Geometry; namespace sdhbgi
s.Dal
{ public class GoogleMapLayerCity : TiledMap
serviceLayer
{ private const double cornerCoordinate = 20037508.3427892; public override void Initialize()
{ //thi
s.Opacity = 0.
5; thi
s.FullExtent = new ESRI.ArcGI
s.CLIENt.Geometry.Envelope(-20037508.342787,-20037508.342787,20037508.342787,20037508.342787
);//(-180,-85.0511287798066,180,85.0511287798066)
{ SpatialReference = new ESRI.ArcGI
s.CLIENt.Geometry.SpatialReference(102100
); }; thi
s.SpatialReference = new ESRI.ArcGI
s.CLIENt.Geometry.SpatialReference(102100
); //thi
s.InitialExtent = thi
s.FullExtent; thi
s.TileInfo = new TileInfo()
{ Height = 256,
Width = 256,
Origin = new ESRI.ArcGI
s.CLIENt.Geometry.MapPoint(-20037508.342787,20037508.342787)//Origin = new ESRI.ArcGI
s.Geometry.MapPoint(-180,90)
{ SpatialReference = new ESRI.ArcGI
s.CLIENt.Geometry.SpatialReference(102100)
},
lods = new Lod[20] }; double resolution = 156543.033928; for (int i = 0; i < TileInfo.Lod
s.Length; i++)
{ TileInfo.Lods[i] = new Lod()
{ Resolution = resolution };
resolution /= 2; } base.Initialize(
); //thi
s.FullExtent = new ESRI.ArcGI
s.CLIENt.Geometry.Envelope(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892) //
{ // SpatialReference = new SpatialReference(102100) //}; //// This layer's spatial reference //thi
s.SpatialReference = new SpatialReference(102100
); //// Set up tile information. Each tile is 256x256px,19 level
s. //thi
s.TileInfo = new TileInfo() //
{ // Height = 256, // Width = 256, // Origin = new MapPoint(-cornerCoordinate,cornerCoordinat
E) { SpatialReference = new ESRI.ArcGI
s.CLIENt.Geometry.SpatialReference(102100) }, // Lods = new Lod[19] //}; //// Set the resolutions for each leve
l. Each level is half the resolution of the prev
IoUs one. //double resolution = cornerCoordinate * 2 / 256; //for (int i = 0; i < TileInfo.Lod
s.Length; i++) //
{ // TileInfo.Lods[i] = new Lod()
{ Resolution = resolution }; //
resolution /= 2; //} //// Call base initialize to raise the initialization event //base.Initialize(
); } private
String setType="1"; public
String SetType
{ get
{ return setType; } set
{ setType = value; } } public override
String GetTileUrl(int level,int row,int col)
{ //
int num = (col + (2 * row)) % 4; //
String str = "&s="; //
String str2 = "Gali
Leo"; // int length = ((col * 3) + row) % 8; // str = str + str2.Sub
String(0,length
); // if (row >= 0x2710) //
{ // } //
String str3 = "
http://khm" + nu
m.To
String() + ".google.com/kh=49&x="; //
return (str3 + co
l.To
String() + "&y=" + row.To
String() + "&z=" + leve
l.To
String() + str
); String baseUrl = "
http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量图 //
String baseUrl = "
http://mt2.google.cn/vt/lyrs=s@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星图 //
String cbaseUrl = "
http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&x
=0&y
=0&z
=0&s=Galil";//市区图 //if (SetType == "1") //
{ // baseUrl = "
http://mt2.google.cn/vt/lyrs=m@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//矢量 //} //else if (SetType == "2") //
{ // baseUrl = "
http://mt2.google.cn/vt/lyrs=s@167000000&hl=zh-CN&gl=cn&s=Galil&x=";//卫星 //} //else //
{ // baseUrl = "
http://mt2.google.cn/vt/lyrs=t@128&hl=zh-CN&gl=cn&s=Galil&x=";//地形 //}
String url = baseUrl + co
l.To
String() + "&y=" + row.To
String() + "&z=" + leve
l.To
String() + ""; //
String url2 = "
http://api.tile
s.virtualearth.net/api/GetMap.ashx?c=" + row.To
String() + "," + co
l.To
String() + "&z=" + leve
l.To
String() + "&b=h,mkt.en-US&z=4&token=
{token}"; //
String url3 = "
http://mt
{0}.google.cn/vt/lyrs=s@88&gl=cn&x="; //
String ur4 = url3 + co
l.To
String() + "&y=" + row.To
String() + "&z=" + leve
l.To
String() + ""; return url; } } }