Skip to content

Commit

Permalink
GMap.NET.Core: CzechMapProviderBaseOld
Browse files Browse the repository at this point in the history
  • Loading branch information
radioman committed Jun 12, 2016
1 parent 8f791c6 commit c839b7c
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Demo.WindowsForms/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
3 changes: 3 additions & 0 deletions Demo.WindowsPresentation/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
14 changes: 7 additions & 7 deletions GMap.NET.Core/GMap.NET.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GMap.NET</RootNamespace>
<AssemblyName>GMap.NET.Core</AssemblyName>
<AssemblyName>GMap.NET.Core</AssemblyName>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>sn.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -110,7 +110,7 @@
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkVersion)' == 'v2.0' ">
<PropertyGroup Condition=" '$(TargetFrameworkVersion)' == 'v2.0' ">
<TargetFrameworkVersionNumber>2.0</TargetFrameworkVersionNumber>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.0' ">
Expand Down Expand Up @@ -229,11 +229,11 @@
<Compile Include="GMap.NET.MapProviders\Etc\CloudMadeMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\SwedenMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\WikiMapiaMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechHistoryMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechHybridMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechSatelliteMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechTuristMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\CzechOld\CzechHistoryMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\CzechOld\CzechHybridMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\CzechOld\CzechSatelliteMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\CzechOld\CzechTuristMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\CzechOld\CzechMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\TurkeyMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\MapBenderWMSProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\SpainMapProvider.cs" />
Expand Down
2 changes: 1 addition & 1 deletion GMap.NET.Core/GMap.NET.Internals/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ void AddLoadTask(LoadTask t)

Debug.WriteLine(ctid + ": started");
do
{
{
if (tileLoadQueue4.Count == 0)
{
Debug.WriteLine(ctid + ": ready");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

namespace GMap.NET.MapProviders
{
using System;

/// <summary>
/// CzechHistoryMap provider, http://www.mapy.cz/
/// </summary>
public class CzechHistoryMapProviderOld : CzechMapProviderBaseOld
{
public static readonly CzechHistoryMapProviderOld Instance;

CzechHistoryMapProviderOld()
{
}

static CzechHistoryMapProviderOld()
{
Instance = new CzechHistoryMapProviderOld();
}

#region GMapProvider Members

readonly Guid id = new Guid("C666AAF4-9D27-418F-97CB-7F0D8CC44544");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechHistoryMap";
public override string Name
{
get
{
return name;
}
}

GMapProvider[] overlays;
public override GMapProvider[] Overlays
{
get
{
if(overlays == null)
{
overlays = new GMapProvider[] { this, CzechHybridMapProviderOld.Instance };
}
return overlays;
}
}

public override PureImage GetTileImage(GPoint pos, int zoom)
{
string url = MakeTileImageUrl(pos, zoom, LanguageStr);

return GetTileImageUsingHttp(url);
}

#endregion

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://m4.mapserver.mapy.cz/army2/9_7d00000_8080000

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/army2/{1}_{2:x7}_{3:x7}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

namespace GMap.NET.MapProviders
{
using System;

/// <summary>
/// CzechHybridMap provider, http://www.mapy.cz/
/// </summary>
public class CzechHybridMapProviderOld : CzechMapProviderBaseOld
{
public static readonly CzechHybridMapProviderOld Instance;

CzechHybridMapProviderOld()
{
}

static CzechHybridMapProviderOld()
{
Instance = new CzechHybridMapProviderOld();
}

#region GMapProvider Members

readonly Guid id = new Guid("F785D98E-DD1D-46FD-8BC1-1AAB69604980");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechHybridMap";
public override string Name
{
get
{
return name;
}
}

GMapProvider[] overlays;
public override GMapProvider[] Overlays
{
get
{
if(overlays == null)
{
overlays = new GMapProvider[] { CzechSatelliteMapProviderOld.Instance, this };
}
return overlays;
}
}

public override PureImage GetTileImage(GPoint pos, int zoom)
{
string url = MakeTileImageUrl(pos, zoom, LanguageStr);

return GetTileImageUsingHttp(url);
}

#endregion

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://m2.mapserver.mapy.cz/hybrid/9_7d00000_7b80000

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/hybrid/{1}_{2:x7}_{3:x7}";
}
}
118 changes: 118 additions & 0 deletions GMap.NET.Core/GMap.NET.MapProviders/CzechOld/CzechMapProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@

namespace GMap.NET.MapProviders
{
using System;
using GMap.NET.Projections;

public abstract class CzechMapProviderBaseOld : GMapProvider
{
public CzechMapProviderBaseOld()
{
RefererUrl = "http://www.mapy.cz/";
Area = new RectLatLng(51.2024819920053, 11.8401353319027, 7.22833716731277, 2.78312271922872);
}

#region GMapProvider Members
public override Guid Id
{
get
{
throw new NotImplementedException();
}
}

public override string Name
{
get
{
throw new NotImplementedException();
}
}

public override PureProjection Projection
{
get
{
return MapyCZProjection.Instance;
}
}

GMapProvider[] overlays;
public override GMapProvider[] Overlays
{
get
{
if(overlays == null)
{
overlays = new GMapProvider[] { this };
}
return overlays;
}
}

public override PureImage GetTileImage(GPoint pos, int zoom)
{
throw new NotImplementedException();
}
#endregion
}

/// <summary>
/// CzechMap provider, http://www.mapy.cz/
/// </summary>
public class CzechMapProviderOld : CzechMapProviderBaseOld
{
public static readonly CzechMapProviderOld Instance;

CzechMapProviderOld()
{
}

static CzechMapProviderOld()
{
Instance = new CzechMapProviderOld();
}

#region GMapProvider Members

readonly Guid id = new Guid("6A1AF99A-84C6-4EF6-91A5-77B9D03257C2");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechMap";
public override string Name
{
get
{
return name;
}
}

public override PureImage GetTileImage(GPoint pos, int zoom)
{
string url = MakeTileImageUrl(pos, zoom, LanguageStr);

return GetTileImageUsingHttp(url);
}

#endregion

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// ['base','ophoto','turist','army2']
// http://m1.mapserver.mapy.cz/base-n/3_8000000_8000000

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/base-n/{1}_{2:x7}_{3:x7}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

namespace GMap.NET.MapProviders
{
using System;

/// <summary>
/// CzechSatelliteMap provider, http://www.mapy.cz/
/// </summary>
public class CzechSatelliteMapProviderOld : CzechMapProviderBaseOld
{
public static readonly CzechSatelliteMapProviderOld Instance;

CzechSatelliteMapProviderOld()
{
}

static CzechSatelliteMapProviderOld()
{
Instance = new CzechSatelliteMapProviderOld();
}

#region GMapProvider Members

readonly Guid id = new Guid("7846D655-5F9C-4042-8652-60B6BF629C3C");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechSatelliteMap";
public override string Name
{
get
{
return name;
}
}

public override PureImage GetTileImage(GPoint pos, int zoom)
{
string url = MakeTileImageUrl(pos, zoom, LanguageStr);

return GetTileImageUsingHttp(url);
}

#endregion

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
//http://m3.mapserver.mapy.cz/ophoto/9_7a80000_7a80000

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/ophoto/{1}_{2:x7}_{3:x7}";
}
}
Loading

0 comments on commit c839b7c

Please sign in to comment.