From 03fe0d2669fbbc82c26978f3b61f9fa87cbbe8fb Mon Sep 17 00:00:00 2001 From: Kowalski Date: Mon, 3 Mar 2025 16:35:56 +0100 Subject: [PATCH] First commit. --- .gitignore | 91 ++++ MapDownloader.sln | 20 + MapDownloader/Core/DownloadException.vb | 7 + MapDownloader/Core/MapBlock.vb | 9 + .../Core/Mapy.cz/clsMapovePodklady.vb | 62 +++ MapDownloader/Core/Mapy.cz/clsPodklad.vb | 35 ++ MapDownloader/MapDownloader.vbproj | 176 ++++++ MapDownloader/Mapa/clsMapa.vb | 187 +++++++ .../My Project/Application.Designer.vb | 38 ++ MapDownloader/My Project/Application.myapp | 10 + MapDownloader/My Project/AssemblyInfo.vb | 35 ++ .../My Project/Resources.Designer.vb | 143 +++++ MapDownloader/My Project/Resources.resx | 145 +++++ MapDownloader/My Project/Settings.Designer.vb | 73 +++ MapDownloader/My Project/Settings.settings | 7 + MapDownloader/Resources/down32x32.png | Bin 0 -> 1460 bytes MapDownloader/Resources/download32x32.png | Bin 0 -> 1475 bytes MapDownloader/Resources/left32x32.png | Bin 0 -> 1479 bytes MapDownloader/Resources/minus32x32.png | Bin 0 -> 723 bytes MapDownloader/Resources/page-copy-icon.png | Bin 0 -> 1051 bytes MapDownloader/Resources/plus32x32.png | Bin 0 -> 1657 bytes MapDownloader/Resources/right32x32.png | Bin 0 -> 1497 bytes MapDownloader/Resources/up32x32.png | Bin 0 -> 1537 bytes MapDownloader/app.config | 23 + MapDownloader/frmMain.Designer.vb | 352 ++++++++++++ MapDownloader/frmMain.resx | 120 ++++ MapDownloader/frmMain.vb | 515 ++++++++++++++++++ MapDownloader/frmMapa.Designer.vb | 144 +++++ MapDownloader/frmMapa.resx | 120 ++++ MapDownloader/frmMapa.vb | 60 ++ MapDownloader/modulMapy.vb | 60 ++ 31 files changed, 2432 insertions(+) create mode 100644 .gitignore create mode 100644 MapDownloader.sln create mode 100644 MapDownloader/Core/DownloadException.vb create mode 100644 MapDownloader/Core/MapBlock.vb create mode 100644 MapDownloader/Core/Mapy.cz/clsMapovePodklady.vb create mode 100644 MapDownloader/Core/Mapy.cz/clsPodklad.vb create mode 100644 MapDownloader/MapDownloader.vbproj create mode 100644 MapDownloader/Mapa/clsMapa.vb create mode 100644 MapDownloader/My Project/Application.Designer.vb create mode 100644 MapDownloader/My Project/Application.myapp create mode 100644 MapDownloader/My Project/AssemblyInfo.vb create mode 100644 MapDownloader/My Project/Resources.Designer.vb create mode 100644 MapDownloader/My Project/Resources.resx create mode 100644 MapDownloader/My Project/Settings.Designer.vb create mode 100644 MapDownloader/My Project/Settings.settings create mode 100644 MapDownloader/Resources/down32x32.png create mode 100644 MapDownloader/Resources/download32x32.png create mode 100644 MapDownloader/Resources/left32x32.png create mode 100644 MapDownloader/Resources/minus32x32.png create mode 100644 MapDownloader/Resources/page-copy-icon.png create mode 100644 MapDownloader/Resources/plus32x32.png create mode 100644 MapDownloader/Resources/right32x32.png create mode 100644 MapDownloader/Resources/up32x32.png create mode 100644 MapDownloader/app.config create mode 100644 MapDownloader/frmMain.Designer.vb create mode 100644 MapDownloader/frmMain.resx create mode 100644 MapDownloader/frmMain.vb create mode 100644 MapDownloader/frmMapa.Designer.vb create mode 100644 MapDownloader/frmMapa.resx create mode 100644 MapDownloader/frmMapa.vb create mode 100644 MapDownloader/modulMapy.vb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e3d94b --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +*.suo +*.user + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbml +powercaredb.designer.db +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + + +# ZAZA +distribuce \ No newline at end of file diff --git a/MapDownloader.sln b/MapDownloader.sln new file mode 100644 index 0000000..e8787f8 --- /dev/null +++ b/MapDownloader.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MapDownloader", "MapDownloader\MapDownloader.vbproj", "{C7710240-E18E-4773-809F-3696D90711F6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7710240-E18E-4773-809F-3696D90711F6}.Debug|x86.ActiveCfg = Debug|x86 + {C7710240-E18E-4773-809F-3696D90711F6}.Debug|x86.Build.0 = Debug|x86 + {C7710240-E18E-4773-809F-3696D90711F6}.Release|x86.ActiveCfg = Release|x86 + {C7710240-E18E-4773-809F-3696D90711F6}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/MapDownloader/Core/DownloadException.vb b/MapDownloader/Core/DownloadException.vb new file mode 100644 index 0000000..c9ed05a --- /dev/null +++ b/MapDownloader/Core/DownloadException.vb @@ -0,0 +1,7 @@ +Public Class DownloadException + Inherits Exception + + Sub New() + MyBase.New("Chyba při stahování mapy.") + End Sub +End Class \ No newline at end of file diff --git a/MapDownloader/Core/MapBlock.vb b/MapDownloader/Core/MapBlock.vb new file mode 100644 index 0000000..3537a68 --- /dev/null +++ b/MapDownloader/Core/MapBlock.vb @@ -0,0 +1,9 @@ +Public Class MapBlock + Public imagePosX As Integer + Public imagePosY As Integer + + 'x blocku mapy: + Public mapPosX As Integer + 'y bloku mapy: + Public mapPosY As Integer +End Class diff --git a/MapDownloader/Core/Mapy.cz/clsMapovePodklady.vb b/MapDownloader/Core/Mapy.cz/clsMapovePodklady.vb new file mode 100644 index 0000000..75a9bdb --- /dev/null +++ b/MapDownloader/Core/Mapy.cz/clsMapovePodklady.vb @@ -0,0 +1,62 @@ +Imports System.IO +Imports System.Net + +Public Class clsMapovePodklady + + 'Private mapoveServery() As String = {"m1.mapserver.mapy.cz", "m2.mapserver.mapy.cz", "m3.mapserver.mapy.cz", "m4.mapserver.mapy.cz"} + Private mapoveServery() As String = {"mapserver.mapy.cz"} + 'https://mapserver.mapy.cz/base-m/17-70940-43966 + + Public Function LoadMapImage(ByVal typMapy As TYP_MAPY, ByVal posX As Integer, ByVal posY As Integer, ByVal zoom As Byte) As clsPodklad + Dim apiKey As String = "Vjmja5cYKiiXB_GZH5uRbneNBq9AzEDt_UCmRa3Hg80" + Dim tileSize = 256 + Dim mapset = "basic" + 'Dim vzorUrl = "https://api.mapy.cz/v1/maptiles/basic/256/17/70940/43966?apikey=Vjmja5cYKiiXB_GZH5uRbneNBq9AzEDt_UCmRa3Hg80" + + Dim urlFormat As String = "https://api.mapy.cz/v1/maptiles/{0}/{1}/{2}/{3}/{4}?apikey={5}" + Dim url = String.Format(urlFormat, mapset, tileSize, zoom, posX, posY, apiKey) + 'Select Case typMapy + ' Case TYP_MAPY.OBECNA + ' url = String.Format("https://{0}/{1}/{2}-{3}-{4}", VyberMapServer(), "base-m", zoom, posX, posY) + ' Case TYP_MAPY.LETECKA + ' url = String.Format("https://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "ophoto", zoom, posX, posY) + ' Case TYP_MAPY.ZIMNI + ' url = String.Format("https://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "turist_winter", zoom, posX, posY) + ' Case TYP_MAPY.TURISTICKA + ' url = String.Format("https://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "turist", zoom, posX, posY) + 'End Select + + Using wc As New Net.WebClient() + Dim img As Image = Nothing + Dim velikost As Long + Try + img = Image.FromStream(wc.OpenRead(url)) + velikost = Convert.ToInt64(wc.ResponseHeaders("Content-Length")) + Catch ex As Exception + Throw New DownloadException() + End Try + + 'Dim data = New Object() {img, velikost} + Dim myPodklad As New clsPodklad(posX, posY, zoom, typMapy, velikost, img) + Debug.WriteLine("Stažen " + myPodklad.ToString) + + Return myPodklad + End Using + End Function + +#Region "Privátní metody" + Private Function VyberMapServer() As String + Dim pocetServeru As Integer = mapoveServery.Count + Dim generator As Random = New Random() + Return CStr(mapoveServery.GetValue(generator.Next(0, pocetServeru - 1))) + End Function +#End Region + +End Class + +Public Enum TYP_MAPY + OBECNA + LETECKA + ZIMNI + TURISTICKA +End Enum diff --git a/MapDownloader/Core/Mapy.cz/clsPodklad.vb b/MapDownloader/Core/Mapy.cz/clsPodklad.vb new file mode 100644 index 0000000..ea32c0b --- /dev/null +++ b/MapDownloader/Core/Mapy.cz/clsPodklad.vb @@ -0,0 +1,35 @@ +''' +''' Třída reprezentující část mapy o velikosti 256x256 pixelů +''' +''' +Public Class clsPodklad + + Public x As Integer + + Public y As Integer + + Public zoom As Byte + + Public typ As TYP_MAPY + + Public velikost As Long + + Private mapa As Image + + Sub New(ByVal x As Integer, ByVal y As Integer, ByVal zoom As Byte, ByVal typ As TYP_MAPY, ByVal velikost As Long, ByVal mapa As Image) + Me.x = x + Me.y = y + Me.zoom = zoom + Me.typ = typ + Me.velikost = velikost + Me.mapa = mapa + End Sub + + Public Overrides Function ToString() As String + Return String.Format("Mapový podklad - ({0};{1}) zoom={2}; typ={3}; velikost={4}", Me.x, Me.y, Me.zoom, Me.typ, Me.velikost) + End Function + + Public Function GetMapa() As Image + Return Me.mapa + End Function +End Class diff --git a/MapDownloader/MapDownloader.vbproj b/MapDownloader/MapDownloader.vbproj new file mode 100644 index 0000000..cc7b14c --- /dev/null +++ b/MapDownloader/MapDownloader.vbproj @@ -0,0 +1,176 @@ + + + + Debug + x86 + + + 2.0 + {C7710240-E18E-4773-809F-3696D90711F6} + WinExe + MapDownloader.My.MyApplication + MapDownloader + MapDownloader + 512 + WindowsForms + v4.8 + + + + + x86 + true + full + true + true + bin\Debug\ + MapDownloader.xml + + + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 + false + + + x86 + pdbonly + false + true + true + bin\Release\ + MapDownloader.xml + + + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 + false + + + On + + + Binary + + + On + + + On + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + frmMain.vb + Form + + + frmMapa.vb + + + Form + + + + + + True + Application.myapp + True + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + frmMain.vb + + + frmMapa.vb + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MapDownloader/Mapa/clsMapa.vb b/MapDownloader/Mapa/clsMapa.vb new file mode 100644 index 0000000..ebb9a35 --- /dev/null +++ b/MapDownloader/Mapa/clsMapa.vb @@ -0,0 +1,187 @@ +Imports System.Drawing.Imaging + +Public Class clsMapa + Private Const minZoom = 1, maxZoom = 18 + + ''' + ''' Aktuální přiblížení + ''' + ''' + Private aktZoom As Byte + + Public ReadOnly Property GetAktZoom As Byte + Get + Return aktZoom + End Get + End Property + + ''' + ''' Aktuální souřadnice X + ''' + ''' + Private aktPosX As Integer + + Public ReadOnly Property GetAktPosX As Integer + Get + Return aktPosX + End Get + End Property + + ''' + ''' Aktuální souřadnice Y + ''' + ''' + Private aktPosY As Integer + + Private aktTypMapy As TYP_MAPY + + Public ReadOnly Property GetAktPosY As Integer + Get + Return aktPosY + End Get + End Property + + ''' + ''' Pole podkladů, které jsou aktuálně zobrazeny + ''' + ''' 2 dimenze + Private aktualniZobrazeni(,) As clsPodklad + + ''' + ''' Cache podkladů pro zobrazení mapy + ''' + ''' Prevence znovunačítání podkladů z netu + Private cachePodkladu As List(Of clsPodklad) + + Private mapovePodklady As clsMapovePodklady + + Sub New(ByVal sirka As Integer, ByVal vyska As Integer) + Me.cachePodkladu = New List(Of clsPodklad) + Me.aktZoom = 18 'max + Me.aktPosX = 141917 'hrádek + Me.aktPosY = 87910 'hrádek + Me.aktTypMapy = TYP_MAPY.OBECNA + + Me.mapovePodklady = New clsMapovePodklady + + SetRozmerMapy(sirka, vyska) + End Sub + + Private Sub NactiAktualniZobrazeni() + For indexX = 0 To Me.aktualniZobrazeni.GetUpperBound(0) + For indexY = 0 To Me.aktualniZobrazeni.GetUpperBound(1) + Me.aktualniZobrazeni(indexX, indexY) = ZiskejPodklad(Me.aktPosX + indexX, Me.aktPosY + indexY) + Next + Next + End Sub + + Private Function ZiskejPodklad(ByVal x As Integer, ByVal y As Integer) As clsPodklad + Dim myPodklad As clsPodklad + + 'najdi v cache nejdříve: + myPodklad = (From p In Me.cachePodkladu Where p.x = x And p.y = y And p.zoom = Me.aktZoom And p.typ = Me.aktTypMapy).FirstOrDefault + + 'nenašel, tak stáhni a ulož: + If myPodklad Is Nothing Then + myPodklad = Me.mapovePodklady.LoadMapImage(Me.aktTypMapy, x, y, Me.aktZoom) + Me.cachePodkladu.Add(myPodklad) + End If + + Return myPodklad + End Function + + Public Function GetMapa(ByVal sirka As Integer, ByVal vyska As Integer) As Image + Dim xBloku = aktualniZobrazeni.GetUpperBound(0) + Dim yBloku = aktualniZobrazeni.GetUpperBound(1) + + Dim mapa As New Bitmap((xBloku + 1) * 256, (yBloku + 1) * 256, PixelFormat.Format16bppRgb565) + Dim g As Graphics = Graphics.FromImage(mapa) + + For indexX = 0 To xBloku + For indexY = 0 To yBloku + g.DrawImage(aktualniZobrazeni(indexX, indexY).GetMapa, New Point(indexX * 256, indexY * 256)) + Next + Next + + Return mapa + End Function + +#Region "Kontrol" + Public Sub SetRozmerMapy(ByVal sirka As Integer, ByVal vyska As Integer) + Dim sirkaPodklady As Integer = CInt(Math.Ceiling(sirka / 265)) + Dim vyskaPodklady As Integer = CInt(Math.Ceiling(vyska / 265)) + + ReDim Me.aktualniZobrazeni(sirkaPodklady - 1, vyskaPodklady - 1) + NactiAktualniZobrazeni() + End Sub + + Public Sub PosunNahoru() + Me.aktPosY -= coordinateOffSet + NactiAktualniZobrazeni() + End Sub + + Public Sub PosunDolu() + Me.aktPosY += coordinateOffSet + NactiAktualniZobrazeni() + End Sub + + Public Sub PosunDoleva() + Me.aktPosX -= coordinateOffSet + NactiAktualniZobrazeni() + End Sub + + Public Sub PosunDoprava() + Me.aktPosX += coordinateOffSet + NactiAktualniZobrazeni() + End Sub + + Public Sub Priblizit() + If Me.aktZoom = maxZoom Then Exit Sub + Me.aktZoom = CByte(Me.aktZoom + 1) + + Me.aktPosX = CInt(Math.Round(PrumerujX() * 2)) + Me.aktPosY = CInt(Math.Round(PrumerujY() * 2)) + + NactiAktualniZobrazeni() + End Sub + + Public Sub Oddalit() + If Me.aktZoom = minZoom Then Exit Sub + Me.aktZoom = CByte(Me.aktZoom - 1) + + Me.aktPosX = CInt(Math.Round(PrumerujX() / 2)) + Me.aktPosY = CInt(Math.Round(PrumerujY() / 2)) + + NactiAktualniZobrazeni() + End Sub + + +#End Region + +#Region "Pomocné metody" + Private Function PrumerujX() As Decimal + Dim d As Decimal = 0 + + Dim blockX As Integer = Me.aktualniZobrazeni.GetUpperBound(0) + + For indexX = 0 To blockX + d += Me.aktualniZobrazeni(indexX, 0).x + Next + + Return d / (blockX + 1) + End Function + + Private Function PrumerujY() As Decimal + Dim d As Decimal = 0 + + Dim blockY As Integer = Me.aktualniZobrazeni.GetUpperBound(1) + + For indexY = 0 To blockY + d += Me.aktualniZobrazeni(0, indexY).y + Next + + Return d / (blockY + 1) + End Function +#End Region + +End Class diff --git a/MapDownloader/My Project/Application.Designer.vb b/MapDownloader/My Project/Application.Designer.vb new file mode 100644 index 0000000..82cffc5 --- /dev/null +++ b/MapDownloader/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.MapDownloader.frmMain + End Sub + End Class +End Namespace diff --git a/MapDownloader/My Project/Application.myapp b/MapDownloader/My Project/Application.myapp new file mode 100644 index 0000000..5907301 --- /dev/null +++ b/MapDownloader/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + frmMain + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/MapDownloader/My Project/AssemblyInfo.vb b/MapDownloader/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..41d5286 --- /dev/null +++ b/MapDownloader/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/MapDownloader/My Project/Resources.Designer.vb b/MapDownloader/My Project/Resources.Designer.vb new file mode 100644 index 0000000..2c00cda --- /dev/null +++ b/MapDownloader/My Project/Resources.Designer.vb @@ -0,0 +1,143 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MapDownloader.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property copy32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("copy32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property down32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("down32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property download32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("download32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property left32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("left32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property minus32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("minus32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property plus32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("plus32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property right32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("right32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + + ''' + ''' Looks up a localized resource of type System.Drawing.Bitmap. + ''' + Friend ReadOnly Property up32x32() As System.Drawing.Bitmap + Get + Dim obj As Object = ResourceManager.GetObject("up32x32", resourceCulture) + Return CType(obj,System.Drawing.Bitmap) + End Get + End Property + End Module +End Namespace diff --git a/MapDownloader/My Project/Resources.resx b/MapDownloader/My Project/Resources.resx new file mode 100644 index 0000000..f7f5432 --- /dev/null +++ b/MapDownloader/My Project/Resources.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\page-copy-icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\down32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\download32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\left32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\minus32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\plus32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\right32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\up32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/MapDownloader/My Project/Settings.Designer.vb b/MapDownloader/My Project/Settings.Designer.vb new file mode 100644 index 0000000..da30437 --- /dev/null +++ b/MapDownloader/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.MapDownloader.My.MySettings + Get + Return Global.MapDownloader.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/MapDownloader/My Project/Settings.settings b/MapDownloader/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/MapDownloader/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/MapDownloader/Resources/down32x32.png b/MapDownloader/Resources/down32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..e7df9d02c3f7651082f418386a608d859697734d GIT binary patch literal 1460 zcmV;l1xxygP)3$g6vxloXKS(3Qc62i7%GL7Z9s&<6x$SuAp`-x5Q?OPM2P}Hr4opuf(Am+#Mp>@ zXrv*yBpN8Pm;!}_w9r~2D3v8xfuRhYc31{FZ-38o-wc~lW`>L!Z*u2$x$m6c`=9^0 z^Bx8N@u2<}0Chi}ql!FFwAJoC?`v-F#=n@cf0%ba@H4g+<~m{3ywNSDsZXvL?=jN? zFmvT@8i&4Yfe$Du!6l{%^$q8YEEmtcx5#g#1;9IJ3yoX#wQoF^#BLMTe9~xi?0Ahy zCU#N)gQkCs0#N$uCFOnPycZB7e)QP^4&NYv@ZBmL=SaNGnRi{dQ*hG z!R{MQ&7gpynfPR_m8Kc$=|R`fNxM52`2V_Y#P9#3tIzOpsFhVs)1?fVCrPm zK;RiD8su&+A3wN!Mdbwb0f70dwpWQ7`=x`qjtTDTEAk^IVi*Q)iweRJ02){7zRNMW zVS<6l48s7YosT6pA3O*h4j1I)mw?-*On!5||L6k%BVKsBUntaby2zV1Ff+pu%Zro7 z#4N`F%W??8S|Dgh3xtAu3K)3zhOUE-iFHl0CaPdT-5JB4%!Afn0=G(r6&BTPSQPr3 z2b@LIr|~ScuXyArRGhVvay$8< zC({9J84X2{WpvV%)k_3{3$)(%SdA3=VMX6K@{?yWE z8~$|&1^!pFbMw9!Tv7_0UA z<%_GOVB7jfo&yh6!sFjD!snlrTR0jOaKr(K7to+_BU%91dRiPnmK97cTGC$&o`&|8 z#zSb*sZ#K`kureb@n@s+PfnRpS&-2$A5|bFh?$X;fW~v5^eX{SvGxi&UdAb*0=H%y(gm=<_P3?i-qDFYcqenpL$k4#As;mEGd zW>+9ETe^Cp{!#Ih`YsUid>cniDy^PaKG#ZaLn9I;*f@Zu>G3SXE%k7`anI*+ z=(pDs#ZC%<&mG0%@qBc~!sX+J4xIpYyI^$$&v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PGd4=mE%33Vhh+@OpN6`ReiYjjY4% zfvMJg7n-&>7l(8`UiN*p#?>xC+~&cikJQi zMPsl?P1`iR2@SRwh(hh5Ykq8Evg6z7?mAhbH>rmm`0|F`H}gL8-kTwC&VzUW9)Jhn z0sL10rPWn(XMUdk%YfR-3JESOI58Z6k85jB8s+k{%KG|kty)zn_fv35MEOih2(zXn z&YF@3$RCaB!RhI;Ka*MVPfl()0B;r-(}JdLP(hHt6bkUQR07Hox`T@xgwKND0c011 zV%fm>I0VvZbKa4{;YWd7?mYu|9gpXc?!mQ0f;l&jj#ywvl(OJ9j2ns|gn&N8<-@0-xd5~(g)>U1daZY1cG_uKLD7) zv6Mg}5%{5L@a^yrs=K?;zzo&#-`$A`h;44NOou5YZ2e1IqoYksO+oPF#HlAQH%MP5 zd_E9DAuw<|{qz(XxX1VXeP}eB&@xMks#{8=QV_#Ts5rlF1H3>VboAfMWWI zK4kt&SpGIZ0U^|%R`b~JfcyIKAa1d1hY;1{zT*dfFMjK=@~002ovPDHLk FV1l_AQ2YP@ literal 0 HcmV?d00001 diff --git a/MapDownloader/Resources/page-copy-icon.png b/MapDownloader/Resources/page-copy-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a9dcae59224aaf967416044dd4326e26fc578051 GIT binary patch literal 1051 zcmV+$1mydPP)eTuc2^r>E5h z&jy`fVhmUWfrKAHlAydK57?Q9@U!VKY{*Il`+y5-@4oxvZLeI1m-!P0cs@K1CKJ;N z0EnUl`#0qPJKF_w9hERT?S*Z*RvwAkyKf!tw#xNJAUHq@0(cRi@7F{q0@?t(H>|}7 zbb)lE8s>cgaJhZ35hFo4apKxh@+{-Twrg{UgCUB}xv7 z=Y+Mf2j*LBS$KBZFu=Rt(+IFM2T3>%6k1n9afU^+BTQsiXg`vNUtNX)K00QW1>g=L zNqo-~=V-H|C=<+=o`5CE9KKE#_YD(s;p-{ZdOa$DFV5NU$>pT9DS4pn`5C~@KLY7` zmF7L%H#*;FCaMbH+xT2e04pH@rT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pgVy%m(dAbTr|W{ zSV92cDR!9Fr6_b!=dqI7VMUle`8hga>P##e3#4a`#WWZ$FaWHDXc`O$j26@g87er1 zg%Sn0)^ZsSFi{M_)vLa5CVy^p{ho>t}hr zKE2rVEbz6rFovZ z(#y9zidTPB#%(Pwyy1(8U8xgh(6_c91`<|`4p8+DV67*~Ok9G98itmpvzn*9>q9)k z*Y}?*Q*O3qLa*c0iL>b1&%Om3l=a-pF>$tYbigyv2@TF4yT!0naJBK!$=g{oF@Q-= z(sxTMfe%VX??=T0__k~~{}Z&<)m7q2_1Zww_XD@PW?}%@PtocCec9JNL{$sJoj;$rQ{g)T zm|67x6Im8vQhUSi)t7540{>M!VStgi?mECft(=oiZpErB00000NkvXXu0mjfN@BPo literal 0 HcmV?d00001 diff --git a/MapDownloader/Resources/up32x32.png b/MapDownloader/Resources/up32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..fead6a1c134afa8c4df23c18bcb3c5e5deccbfb2 GIT binary patch literal 1537 zcmV+c2LAbpP)H8Vv^Z zA8CjWY%w5&@~Vx25Je?e!lOuqV(AMisajLod+pAyznQ&ODk!yHagtwVbGI|!&-~{5 zn^_M2=f?GQ;Ham!i#Zv?DhY_j+1l3JbDz9G?km8^xo>Y>{`}PS0o{TyCDvTf1gqvgDBQ7YjlG z1Garw)fm)C#-&nkTfYJ%O)uKBa#?QP(B#2Aes64Uhti|9`!4VHKGSai3E8WbWltKr zbLPxP*~)3N><$E;gJY+z!-d-4SJsp*-4Sts!4qCei;o|0W_iKfDBx}z)5U{Lo)C?+$ULDFkP0JKjTp!v72qH#W~RBw_HExpQXl-5Pi3T0O?_JP%)8 z@LRv#B6AVqaGwEU(igzaF3d| ze{y!#g2bVTJqLwN$a>56gGJ3~^>7CK+73`%A3SE6WY)Fv)#kqfh)$ccA~9*m2bmMb zvxzy52M$v!@B;RnE#6fP_`hjV2op>~fS4wG=5b7Ia|l}7$+~NYUMcQ1fGc&@D2GF- znle4dDM~U3f(W800xt--zXIE11`!@kSI@*zm{0&>05J^qOd+c4e0qp*IrT?hJAF?8 z=P-|qgT5P=H9pflAPy*iC`t@Kpg{o;gl2$-)t!Mb024OAFm%v$9Sl8$3vfX7wT_?A zo|z3_tZ)BE04-(4TgfRYMTsdRKtgdzmRT=K5(A;xurm?f0?W>T4L}$`m$-!>PDKO_ zqrRmRt~C2f8!I>D|1E%;JoWMDnApmZ>En0-MR6MtzyUHw7X-@!g$Qqhh`l8848YKB zVLcRrU?2z`9UXAJr4@d@*~&68Few!baCqwuuibSAKQ_<(I*n~%%1+rvU1qGmu*1dt|3*i=^6``{1P0QD*3%nEsyreM@ z3gJS4tCd@O9GbnljFf~4yylJ~c`t7U0W-k7z|0s1Kp#-^1<`z1gm9#6n{}hAobS!t zy#i2^Ci7ZMG+DH23y6dR1wX~`j$qqBn}OvPLL&yy`5^>2xchyx`I}N9asWefcx^x| z$uHal4g^qXRVa2AXrrqSpl|&CAOtJ}4(us0n~v{@AVBhTUW<<-`KvdAh5(wXVklT0 z4t5dImHW^)KA#_aXxIb$cbSb9??e#b!N+)Q&>*s8)dp}H95^)vG)-lhpa6a*j)5iD zfdB^&eQq|CzY$pgH9np!rT|zxU8|R6iTzLa-yaCrSwIgQt~g@W?|(gV03$qJ-jHN6 zyI>6{2H>fPCX_^W7|}*=JqkgqAb=UEzIeuTtFm}><6`SxbN32hVQ~r97J}0^&Q@pr z(tH!|06YcpKH&JS5W1hEVq+lvi7BUCE_KSTMLCfH=xQ1B3%R- + + + + + + + + + + + + + + + + + + + + + + diff --git a/MapDownloader/frmMain.Designer.vb b/MapDownloader/frmMain.Designer.vb new file mode 100644 index 0000000..34b3b4b --- /dev/null +++ b/MapDownloader/frmMain.Designer.vb @@ -0,0 +1,352 @@ + _ +Partial Class frmMain + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.btnReload = New System.Windows.Forms.Button() + Me.picMapa = New System.Windows.Forms.PictureBox() + Me.btnNahoru = New System.Windows.Forms.Button() + Me.btnDolu = New System.Windows.Forms.Button() + Me.btnDoleva = New System.Windows.Forms.Button() + Me.btnDoprava = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.txtServer = New System.Windows.Forms.TextBox() + Me.txtZoom = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.txtX = New System.Windows.Forms.TextBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.txtY = New System.Windows.Forms.TextBox() + Me.Label4 = New System.Windows.Forms.Label() + Me.btnMerge = New System.Windows.Forms.Button() + Me.rtbInfo = New System.Windows.Forms.RichTextBox() + Me.picProgress = New System.Windows.Forms.PictureBox() + Me.txtRychlost = New System.Windows.Forms.TextBox() + Me.Label5 = New System.Windows.Forms.Label() + Me.nudVlakna = New System.Windows.Forms.NumericUpDown() + Me.Label8 = New System.Windows.Forms.Label() + Me.txtBlokuY = New System.Windows.Forms.TextBox() + Me.Label6 = New System.Windows.Forms.Label() + Me.txtBlokuX = New System.Windows.Forms.TextBox() + Me.Label7 = New System.Windows.Forms.Label() + Me.btnClearCache = New System.Windows.Forms.Button() + CType(Me.picMapa, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.picProgress, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudVlakna, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'btnReload + ' + Me.btnReload.Location = New System.Drawing.Point(513, 120) + Me.btnReload.Name = "btnReload" + Me.btnReload.Size = New System.Drawing.Size(113, 27) + Me.btnReload.TabIndex = 0 + Me.btnReload.Text = "Reload" + Me.btnReload.UseVisualStyleBackColor = True + ' + 'picMapa + ' + Me.picMapa.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.picMapa.Location = New System.Drawing.Point(12, 12) + Me.picMapa.Name = "picMapa" + Me.picMapa.Size = New System.Drawing.Size(256, 256) + Me.picMapa.TabIndex = 1 + Me.picMapa.TabStop = False + ' + 'btnNahoru + ' + Me.btnNahoru.Image = Global.MapDownloader.My.Resources.Resources.up32x32 + Me.btnNahoru.Location = New System.Drawing.Point(313, 12) + Me.btnNahoru.Name = "btnNahoru" + Me.btnNahoru.Size = New System.Drawing.Size(36, 36) + Me.btnNahoru.TabIndex = 3 + Me.btnNahoru.UseVisualStyleBackColor = True + ' + 'btnDolu + ' + Me.btnDolu.Image = Global.MapDownloader.My.Resources.Resources.down32x32 + Me.btnDolu.Location = New System.Drawing.Point(313, 68) + Me.btnDolu.Name = "btnDolu" + Me.btnDolu.Size = New System.Drawing.Size(36, 36) + Me.btnDolu.TabIndex = 4 + Me.btnDolu.UseVisualStyleBackColor = True + ' + 'btnDoleva + ' + Me.btnDoleva.Image = Global.MapDownloader.My.Resources.Resources.left32x32 + Me.btnDoleva.Location = New System.Drawing.Point(274, 42) + Me.btnDoleva.Name = "btnDoleva" + Me.btnDoleva.Size = New System.Drawing.Size(36, 36) + Me.btnDoleva.TabIndex = 5 + Me.btnDoleva.UseVisualStyleBackColor = True + ' + 'btnDoprava + ' + Me.btnDoprava.Image = Global.MapDownloader.My.Resources.Resources.right32x32 + Me.btnDoprava.Location = New System.Drawing.Point(355, 42) + Me.btnDoprava.Name = "btnDoprava" + Me.btnDoprava.Size = New System.Drawing.Size(36, 36) + Me.btnDoprava.TabIndex = 6 + Me.btnDoprava.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(411, 25) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(41, 13) + Me.Label1.TabIndex = 7 + Me.Label1.Text = "Server:" + ' + 'txtServer + ' + Me.txtServer.Location = New System.Drawing.Point(513, 16) + Me.txtServer.Name = "txtServer" + Me.txtServer.ReadOnly = True + Me.txtServer.Size = New System.Drawing.Size(211, 20) + Me.txtServer.TabIndex = 8 + ' + 'txtZoom + ' + Me.txtZoom.Location = New System.Drawing.Point(513, 42) + Me.txtZoom.Name = "txtZoom" + Me.txtZoom.Size = New System.Drawing.Size(211, 20) + Me.txtZoom.TabIndex = 10 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(411, 51) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(37, 13) + Me.Label2.TabIndex = 9 + Me.Label2.Text = "Zoom:" + ' + 'txtX + ' + Me.txtX.Location = New System.Drawing.Point(513, 68) + Me.txtX.Name = "txtX" + Me.txtX.Size = New System.Drawing.Size(211, 20) + Me.txtX.TabIndex = 12 + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(411, 77) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(45, 13) + Me.Label3.TabIndex = 11 + Me.Label3.Text = "x coord:" + ' + 'txtY + ' + Me.txtY.Location = New System.Drawing.Point(513, 94) + Me.txtY.Name = "txtY" + Me.txtY.Size = New System.Drawing.Size(211, 20) + Me.txtY.TabIndex = 14 + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(411, 103) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(45, 13) + Me.Label4.TabIndex = 13 + Me.Label4.Text = "y coord:" + ' + 'btnMerge + ' + Me.btnMerge.Location = New System.Drawing.Point(513, 381) + Me.btnMerge.Name = "btnMerge" + Me.btnMerge.Size = New System.Drawing.Size(75, 23) + Me.btnMerge.TabIndex = 15 + Me.btnMerge.Text = "Stahuj" + Me.btnMerge.UseVisualStyleBackColor = True + ' + 'rtbInfo + ' + Me.rtbInfo.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rtbInfo.Location = New System.Drawing.Point(730, 12) + Me.rtbInfo.Name = "rtbInfo" + Me.rtbInfo.Size = New System.Drawing.Size(246, 523) + Me.rtbInfo.TabIndex = 20 + Me.rtbInfo.Text = "" + ' + 'picProgress + ' + Me.picProgress.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.picProgress.Location = New System.Drawing.Point(12, 274) + Me.picProgress.Name = "picProgress" + Me.picProgress.Size = New System.Drawing.Size(256, 256) + Me.picProgress.TabIndex = 21 + Me.picProgress.TabStop = False + ' + 'txtRychlost + ' + Me.txtRychlost.Location = New System.Drawing.Point(513, 345) + Me.txtRychlost.Name = "txtRychlost" + Me.txtRychlost.ReadOnly = True + Me.txtRychlost.Size = New System.Drawing.Size(100, 20) + Me.txtRychlost.TabIndex = 22 + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(412, 348) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(102, 13) + Me.Label5.TabIndex = 23 + Me.Label5.Text = "Rychlost stahování:" + ' + 'nudVlakna + ' + Me.nudVlakna.Location = New System.Drawing.Point(513, 319) + Me.nudVlakna.Maximum = New Decimal(New Integer() {1000, 0, 0, 0}) + Me.nudVlakna.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudVlakna.Name = "nudVlakna" + Me.nudVlakna.Size = New System.Drawing.Size(73, 20) + Me.nudVlakna.TabIndex = 24 + Me.nudVlakna.Value = New Decimal(New Integer() {10, 0, 0, 0}) + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(412, 321) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(43, 13) + Me.Label8.TabIndex = 25 + Me.Label8.Text = "Vláken:" + ' + 'txtBlokuY + ' + Me.txtBlokuY.Location = New System.Drawing.Point(513, 293) + Me.txtBlokuY.Name = "txtBlokuY" + Me.txtBlokuY.Size = New System.Drawing.Size(100, 20) + Me.txtBlokuY.TabIndex = 29 + Me.txtBlokuY.Text = "20" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(412, 296) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(44, 13) + Me.Label6.TabIndex = 28 + Me.Label6.Text = "y bloků:" + ' + 'txtBlokuX + ' + Me.txtBlokuX.Location = New System.Drawing.Point(513, 267) + Me.txtBlokuX.Name = "txtBlokuX" + Me.txtBlokuX.Size = New System.Drawing.Size(100, 20) + Me.txtBlokuX.TabIndex = 27 + Me.txtBlokuX.Text = "20" + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(412, 270) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(44, 13) + Me.Label7.TabIndex = 26 + Me.Label7.Text = "x bloků:" + ' + 'btnClearCache + ' + Me.btnClearCache.Location = New System.Drawing.Point(513, 153) + Me.btnClearCache.Name = "btnClearCache" + Me.btnClearCache.Size = New System.Drawing.Size(113, 27) + Me.btnClearCache.TabIndex = 30 + Me.btnClearCache.Text = "Clear cache" + Me.btnClearCache.UseVisualStyleBackColor = True + ' + 'frmMain + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(978, 536) + Me.Controls.Add(Me.btnClearCache) + Me.Controls.Add(Me.txtBlokuY) + Me.Controls.Add(Me.Label6) + Me.Controls.Add(Me.txtBlokuX) + Me.Controls.Add(Me.Label7) + Me.Controls.Add(Me.Label8) + Me.Controls.Add(Me.nudVlakna) + Me.Controls.Add(Me.Label5) + Me.Controls.Add(Me.txtRychlost) + Me.Controls.Add(Me.picProgress) + Me.Controls.Add(Me.rtbInfo) + Me.Controls.Add(Me.btnMerge) + Me.Controls.Add(Me.txtY) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.txtX) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.txtZoom) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.txtServer) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.btnNahoru) + Me.Controls.Add(Me.btnDoprava) + Me.Controls.Add(Me.btnDoleva) + Me.Controls.Add(Me.btnDolu) + Me.Controls.Add(Me.picMapa) + Me.Controls.Add(Me.btnReload) + Me.MaximizeBox = False + Me.Name = "frmMain" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Map Downloader" + CType(Me.picMapa, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.picProgress, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudVlakna, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents btnReload As System.Windows.Forms.Button + Friend WithEvents picMapa As System.Windows.Forms.PictureBox + Friend WithEvents btnNahoru As System.Windows.Forms.Button + Friend WithEvents btnDolu As System.Windows.Forms.Button + Friend WithEvents btnDoleva As System.Windows.Forms.Button + Friend WithEvents btnDoprava As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents txtServer As System.Windows.Forms.TextBox + Friend WithEvents txtZoom As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents txtX As System.Windows.Forms.TextBox + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents txtY As System.Windows.Forms.TextBox + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents btnMerge As System.Windows.Forms.Button + Friend WithEvents rtbInfo As System.Windows.Forms.RichTextBox + Friend WithEvents picProgress As System.Windows.Forms.PictureBox + Friend WithEvents txtRychlost As System.Windows.Forms.TextBox + Friend WithEvents Label5 As System.Windows.Forms.Label + Friend WithEvents nudVlakna As System.Windows.Forms.NumericUpDown + Friend WithEvents Label8 As System.Windows.Forms.Label + Friend WithEvents txtBlokuY As System.Windows.Forms.TextBox + Friend WithEvents Label6 As System.Windows.Forms.Label + Friend WithEvents txtBlokuX As System.Windows.Forms.TextBox + Friend WithEvents Label7 As System.Windows.Forms.Label + Friend WithEvents btnClearCache As System.Windows.Forms.Button + +End Class diff --git a/MapDownloader/frmMain.resx b/MapDownloader/frmMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MapDownloader/frmMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MapDownloader/frmMain.vb b/MapDownloader/frmMain.vb new file mode 100644 index 0000000..e28fe95 --- /dev/null +++ b/MapDownloader/frmMain.vb @@ -0,0 +1,515 @@ +Option Strict On + +Imports System.Net +Imports System.IO +Imports System.Drawing.Imaging +Imports System.Threading + +Public Class frmMain + 'http://m1.mapserver.mapy.cz/base-n/16_7f6f000_8073000 + '16_7f6f000_8073000 + + Private mapServer As String = "m1.mapserver.mapy.cz" + Private typMapy As TYP_MAPY = TYP_MAPY.OBECNA + + Private zoom As Integer = 17 '16 + '141917 'hrádek + ' Me.aktPosY = 87910 'hrádek + Private aktPosX As Integer = 70944 '&H7F14000 + Private aktPosY As Integer = 43964 '&H83C5000 + 'http://m1.mapserver.mapy.cz/base-m/18-141876-87924 + 'http://m2.mapserver.mapy.cz/base-m/18-141864-87917 + 'https://mapserver.mapy.cz/base-m/18-141949-87957 + 'https://mapserver.mapy.cz/base-m/18-141985-87985 + 'https://mapserver.mapy.cz/base-m/17-71001-44000 'chrastava + 'https://mapserver.mapy.cz/base-m/17-70990-44005 'andělská hora + 'https://mapserver.mapy.cz/base-m/17-70976-43988 'bílý kostel + + 'Mapa - Zoom=17, X=71012, Y=43987 Nová Ves + 'Mapa - Zoom=17, X=70998, Y=43983 Vítkov + Private oknoMapa As frmMapa + +#Region "Loading" + Dim myCache As String = "cache" + + Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing + + End Sub + Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load + Control.CheckForIllegalCrossThreadCalls = True + + If (Not Directory.Exists(myCache)) Then + Directory.CreateDirectory(myCache) + End If + + End Sub + + Private Sub Form1_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown + oknoMapa = New frmMapa + oknoMapa.Show(Me) + + Application.DoEvents() + LoadMap(0, 0) + End Sub +#End Region + + Private Sub LoadMap(ByVal xOffset As Integer, ByVal yOffSet As Integer) + aktPosX += xOffset + aktPosY += yOffSet + + Dim apiKey As String = "Vjmja5cYKiiXB_GZH5uRbneNBq9AzEDt_UCmRa3Hg80" + Dim tileSize = 256 + Dim mapset = "basic" + Dim urlFormat As String = "https://api.mapy.cz/v1/maptiles/{0}/{1}/{2}/{3}/{4}?apikey={5}" + Dim url = String.Format(urlFormat, mapset, tileSize, zoom, aktPosX, aktPosY, apiKey) + + 'Select Case typMapy + ' Case TYP_MAPY.OBECNA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "base-m", zoom, aktPosX, aktPosY) + ' Case TYP_MAPY.LETECKA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "ophoto", zoom, aktPosX, aktPosY) + ' Case TYP_MAPY.ZIMNI + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "turist_winter", zoom, aktPosX, aktPosY) + ' Case TYP_MAPY.TURISTICKA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "turist", zoom, aktPosX, aktPosY) + 'End Select + DownloadImageFromURL(url) + + txtServer.Text = Me.mapServer + txtZoom.Text = Me.zoom.ToString + txtX.Text = String.Format("{0}", Me.aktPosX) + txtY.Text = String.Format("{0}", Me.aktPosY) + End Sub + + Private Sub LoadMapOffset(ByVal xOffset As Integer, ByVal yOffSet As Integer) + Dim url As String = "" + Select Case typMapy + Case TYP_MAPY.OBECNA + url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "base-m", zoom, aktPosX + xOffset, aktPosY + yOffSet) + Case TYP_MAPY.LETECKA + url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "ophoto", zoom, aktPosX + xOffset, aktPosY + yOffSet) + Case TYP_MAPY.ZIMNI + url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "turist_winter", zoom, aktPosX + xOffset, aktPosY + yOffSet) + Case TYP_MAPY.TURISTICKA + url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", mapServer, "turist", zoom, aktPosX + xOffset, aktPosY + yOffSet) + End Select + DownloadImageFromURL(url) + + txtServer.Text = Me.mapServer + txtZoom.Text = Me.zoom.ToString + txtX.Text = String.Format("0x{0:X}", Me.aktPosX) + txtY.Text = String.Format("0x{0:X}", Me.aktPosY) + End Sub + + Private Function LoadMapOffsetImage(ByVal posX As Integer, ByVal posY As Integer) As Object() + Dim apiKey As String = "Vjmja5cYKiiXB_GZH5uRbneNBq9AzEDt_UCmRa3Hg80" + Dim tileSize = 256 + Dim mapset = "basic" + Dim urlFormat As String = "https://api.mapy.cz/v1/maptiles/{0}/{1}/{2}/{3}/{4}?apikey={5}" + Dim url = String.Format(urlFormat, mapset, tileSize, zoom, posX, posY, apiKey) + 'Select Case typMapy + ' Case TYP_MAPY.OBECNA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "base-m", zoom, posX, posY) + ' Case TYP_MAPY.LETECKA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "ophoto", zoom, posX, posY) + ' Case TYP_MAPY.ZIMNI + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "turist_winter", zoom, posX, posY) + ' Case TYP_MAPY.TURISTICKA + ' url = String.Format("http://{0}/{1}/{2}_{3:X}_{4:X}", VyberMapServer(), "turist", zoom, posX, posY) + 'End Select + + Using wc As New Net.WebClient() + Dim img As Image = Nothing + Dim velikost As Int64 + Try + img = Image.FromStream(wc.OpenRead(url)) + velikost = Convert.ToInt64(wc.ResponseHeaders("Content-Length")) + Catch ex As Exception + Throw New DownloadException() + End Try + + Dim data = New Object() {img, velikost} + + Return data + End Using + End Function + + Private Sub DownloadImageFromURL(ByVal url As String) + Using wc As New Net.WebClient() + Dim img As Image = Nothing + Try + img = Image.FromStream(wc.OpenRead(url)) + Catch ex As WebException + ChyboveHlaseni(ex.Message) + End Try + picMapa.Image = img + Application.DoEvents() + End Using + End Sub + +#Region "Merging" + Private Sub btnMerge_Click(sender As System.Object, e As System.EventArgs) Handles btnMerge.Click + btnMerge.Enabled = False + + Me.xBlocks = CInt(txtBlokuX.Text) + Me.yBlocks = CInt(txtBlokuY.Text) + + 'progress mapa: + Dim progressMapa = New Bitmap(256, 256) + picProgress.Image = progressMapa + + Dim r As New Thread(New ThreadStart(AddressOf MereniRychlosti)) + r.Start() + + Dim t As New Thread(New ThreadStart(AddressOf MergeThreading)) + t.Start() + + btnMerge.Enabled = True + End Sub + + Dim threadCount As Integer = 10 + Private vlakna As Thread() + Private blocks As Queue(Of MapBlock) + Private g As Graphics + Private xBlocks As Integer + Private yBlocks As Integer + + Private Sub MergeThreading() + Dim sw As Stopwatch + sw = Stopwatch.StartNew + + 'tlačítko: + Me.Invoke(DelegateTlacitkoMergeEnabled, False) + + 'mapa: + Dim bm As New Bitmap(256 * xBlocks, 256 * yBlocks, PixelFormat.Format16bppRgb565) + g = Graphics.FromImage(bm) + + 'bloky do fronty: + blocks = New Queue(Of MapBlock) + + 'na střed (virtuálně) + Dim stredX As Integer = Me.aktPosX + Me.xBlocks \ 2 + Dim stredY As Integer = Me.aktPosY + Me.yBlocks \ 2 + + Dim imagePosX As Integer + Dim imagePosY As Integer = 0 + For y As Integer = stredY - Me.yBlocks To stredY + Me.yBlocks + imagePosX = 0 + For x As Integer = stredX - Me.xBlocks To stredX + Me.xBlocks + Dim b As New MapBlock + b.imagePosX = imagePosX + b.imagePosY = imagePosY + b.mapPosX = x + b.mapPosY = y + blocks.Enqueue(b) + imagePosX += 1 + Next + imagePosY += 1 + Next + + threadCount = CInt(nudVlakna.Value) + ReDim vlakna(threadCount) + + For i As Integer = 0 To (threadCount) + Dim t As New Thread(New ThreadStart(AddressOf ZpracujBlock)) + vlakna(i) = t + t.Name = i.ToString + t.Start() + Next + + For Each t In vlakna + t.Join() + Next + + Dim fs As New FileStream(Path.Combine(PathToSlozkaMapy, "mapa.png"), FileMode.Create, FileAccess.Write) + Dim bs = New BufferedStream(fs, 4096) + bm.Save(bs, ImageFormat.Png) + bs.Close() + fs.Close() + bs.Dispose() + fs.Dispose() + bs = Nothing + fs = Nothing + + g.Dispose() + g = Nothing + + bm.Dispose() + bm = Nothing + + sw.Stop() + Me.Invoke(DelegateKonzole, "Hotovo " + TimeToString(sw.Elapsed)) + + 'tlačítko: + Me.Invoke(DelegateTlacitkoMergeEnabled, True) + End Sub + + Private Sub ZpracujBlock() + Dim myBlock As MapBlock + + Dim loadedImage As Image = Nothing + Dim velikostObrazku As Long + Dim xBlockProgress As Single + Dim yBlockProgress As Single + Dim rect As RectangleF + + Dim myFile As String + Dim myPath As String + + Dim data As Object() + Dim fs As FileStream + Dim bs As BufferedStream + + 'barva vybarveného čtverečku: + Dim barva As Brush + + While True + 'If loadedImage IsNot Nothing Then + ' loadedImage.Dispose() + ' loadedImage = Nothing + 'End If + + SyncLock blocks + If blocks.Count = 0 Then Exit Sub + myBlock = blocks.Dequeue() + End SyncLock + + 'progress mapa: + xBlockProgress = CSng(256 / (xBlocks * 2)) + yBlockProgress = CSng(256 / (yBlocks * 2)) + rect = New RectangleF(myBlock.imagePosX * xBlockProgress, myBlock.imagePosY * yBlockProgress, xBlockProgress, yBlockProgress) + + 'progressMapa načítání bloku: + Me.Invoke(DelegateProgressMapa, rect, Brushes.Yellow) + + Try + 'najdi v souborové cachi: + myFile = String.Format("{0}_{1}-{2}.png", zoom, myBlock.mapPosX, myBlock.mapPosY) + myPath = Path.Combine(Application.StartupPath, Path.Combine(myCache, myFile)) + If File.Exists(myPath) Then + Dim b As Bitmap = New Bitmap(256, 256) + Dim g As Graphics = Graphics.FromImage(b) + fs = New FileStream(myPath, FileMode.Open, FileAccess.Read) + g.DrawImage(Image.FromStream(fs), 0, 0, 256, 256) + g.Dispose() + loadedImage = CType(b, Image) + velikostObrazku = CLng(loadedImage.Size.Height * loadedImage.Size.Width * 16 / 8) + barva = Brushes.Green + fs.Close() + fs.Dispose() + fs = Nothing + Else + 'jinak na netu: + data = LoadMapOffsetImage(myBlock.mapPosX, myBlock.mapPosY) + loadedImage = CType(data(0), Image) + velikostObrazku = CLng(data(1)) + + 'savuj obrázek do cache: + fs = New FileStream(myPath, FileMode.Create, FileAccess.Write) + bs = New BufferedStream(fs, 4096) + loadedImage.Save(bs, ImageFormat.Png) + bs.Close() + fs.Close() + + barva = Brushes.Blue + End If + Catch ex As DownloadException + Me.Invoke(DelegateProgressMapa, rect, Brushes.Red) + SyncLock blocks + blocks.Enqueue(myBlock) + End SyncLock + Continue While + End Try + + SyncLock velikostMap + velikostMap.Add(velikostObrazku) + End SyncLock + + SyncLock g + With myBlock + g.DrawImage(loadedImage, 256 * .imagePosX, 256 * .imagePosY) + End With + End SyncLock + 'loadedImage.Dispose() + 'loadedImage = Nothing + + 'náhled stažené mapy: + Me.Invoke(DelegateMapa, loadedImage) + 'loadedImage.Dispose() + + 'progressMapa načtení bloku: + Me.Invoke(DelegateProgressMapa, rect, barva) + + 'Dim msg As String = String.Format("Vlákno {2}: Blok - {0}; {1}", myBlock.mapPosX, myBlock.mapPosY, Thread.CurrentThread.Name) + 'Me.Invoke(DelegateKonzole, msg) + End While + End Sub + + +#Region "Delegate GUI" + Private DelegateTlacitkoMergeEnabled As CallBackDelegate = AddressOf TlacitkoMergeEnabled + Private Sub TlacitkoMergeEnabled(ByVal enabled As Object) + btnMerge.Enabled = CBool(enabled) + End Sub + + Private DelegateKonzole As CallBackDelegate = AddressOf Konzole + Private Sub Konzole(ByVal msg As Object) + rtbInfo.AppendText(CStr(msg) + vbCrLf) + rtbInfo.ScrollToCaret() + 'Application.DoEvents() + End Sub + + Private DelegateMapa As CallBackDelegate = AddressOf Mapa + Private Sub Mapa(ByVal img As Object) + Dim b As Bitmap = New Bitmap(256, 256) + Dim g As Graphics = Graphics.FromImage(b) + g.DrawImage(CType(img, Image), 0, 0, 256, 256) + picMapa.Image = b + g.Dispose() + g = Nothing + 'picMapa.Refresh() + End Sub + + Private DelegateProgressMapa As CallBackDelegate2 = AddressOf ProgressMapa + Private Sub ProgressMapa(ByVal rect As Object, ByVal color As Object) + 'Dim image As Image = CType(picProgress.Image.Clone(), Drawing.Image) + Dim gProgress = Graphics.FromImage(picProgress.Image) + gProgress.FillRectangle(CType(color, Brush), CType(rect, RectangleF)) + picProgress.Image = picProgress.Image + gProgress.Dispose() + gProgress = Nothing + 'picProgress.Refresh() + End Sub + + Private DelegateRychlost As CallBackDelegate = AddressOf Rychlost + Private Sub Rychlost(ByVal msg As Object) + txtRychlost.Text = CStr(msg) + End Sub +#End Region + +#End Region + +#Region "Navigace" + Private Sub btnReload_Click(sender As System.Object, e As System.EventArgs) Handles btnReload.Click + 'nastav proměnné: + zoom = CInt(txtZoom.Text) + aktPosX = CInt(txtX.Text) + aktPosY = CInt(txtY.Text) + LoadMap(0, 0) + End Sub + + Private Sub btnDoleva_Click(sender As System.Object, e As System.EventArgs) Handles btnDoleva.Click + LoadMap(-1 * coordinateOffSet, 0) + NactiMapuDoOkna(-1, 0) + 'LoadMap(-4096, 0) + End Sub + + Private Sub btnDolu_Click(sender As System.Object, e As System.EventArgs) Handles btnDolu.Click + LoadMap(0, coordinateOffSet) + NactiMapuDoOkna(0, 1) + 'LoadMap(0, -4096) + End Sub + + Private Sub btnDoprava_Click(sender As System.Object, e As System.EventArgs) Handles btnDoprava.Click + LoadMap(coordinateOffSet, 0) + NactiMapuDoOkna(1, 0) + 'LoadMap(4096, 0) + End Sub + + Private Sub btnNahoru_Click(sender As System.Object, e As System.EventArgs) Handles btnNahoru.Click + LoadMap(0, -1 * coordinateOffSet) + NactiMapuDoOkna(0, -1) + 'LoadMap(0, 4096) + End Sub + + Private Sub NactiMapuDoOkna(ByVal posunPoX As Integer, posunPoY As Integer) + Me.aktPosX += coordinateOffSet * posunPoX + Me.aktPosY += coordinateOffSet * posunPoY + + 'mapa: + Dim bm As New Bitmap(256 * 3, 256 * 3, PixelFormat.Format16bppRgb565) + Dim myGraphics = Graphics.FromImage(bm) + + + 'Dim imagePosX As Integer + 'Dim imagePosY As Integer = 0 + 'For y As Integer = Me.aktPosY - Me.yBlocks To Me.aktPosY + Me.yBlocks + ' imagePosX = 0 + ' For x As Integer = Me.aktPosX - Me.xBlocks To Me.aktPosX + Me.xBlocks + ' Dim b As New MapBlock + ' b.imagePosX = imagePosX + ' b.imagePosY = imagePosY + ' b.mapPosX = x + ' b.mapPosY = y + ' blocks.Enqueue(b) + ' imagePosX += 1 + ' Next + ' imagePosY += 1 + 'Next + + Dim loadedImage As Image = Nothing + Dim imagePosX As Integer + Dim imagePosY As Integer = 0 + For y As Integer = Me.aktPosY - 1 To Me.aktPosY + 1 + imagePosX = 0 + For x As Integer = Me.aktPosX - 1 To Me.aktPosX + 1 + Try + Dim data = LoadMapOffsetImage(x, y) + loadedImage = CType(data(0), Image) + myGraphics.DrawImage(loadedImage, 256 * imagePosX, 256 * imagePosY) + Catch ex As DownloadException + Dim rect As New RectangleF(imagePosX * 256, imagePosY * 256, 256, 256) + myGraphics.FillRectangle(Brushes.Red, CType(rect, RectangleF)) + End Try + imagePosX += 1 + Next + imagePosY += 1 + Next + + 'oknoMapa.showMap(bm) + End Sub +#End Region + +#Region "Rychlost stahování" + Private velikostMap As List(Of Long) + + Private Sub MereniRychlosti() + velikostMap = New List(Of Long) + + Do + Thread.Sleep(2000) + Dim celkem As Long + SyncLock velikostMap + celkem = velikostMap.Sum() + velikostMap.Clear() + End SyncLock + + Dim rychlost As Decimal = CDec(celkem / 1024 / 2) + Dim text As String = String.Format("{0:n2} kB/s", rychlost) + + Me.Invoke(DelegateRychlost, text) + Loop + End Sub +#End Region + + Private Function TimeToString(ByVal cas As TimeSpan) As String + If cas.Milliseconds <= 0 Then Return "0s" + + If cas.Hours >= 24 Then Return cas.ToString + + Dim myString As New List(Of String) + If cas.Hours > 0 Then myString.Add(CStr(cas.Hours) + "h") + If cas.Minutes > 0 Then myString.Add(CStr(cas.Minutes) + "min") + If cas.Seconds > 0 Then myString.Add(CStr(cas.Seconds) + "s") + If cas.Milliseconds > 0 Then myString.Add(CStr(cas.Milliseconds) + "ms") + + Return String.Join(" ", myString.ToArray) + End Function + + Private Sub btnClearCache_Click(sender As System.Object, e As System.EventArgs) Handles btnClearCache.Click + For Each deleteFile In Directory.GetFiles(myCache, "*.*", SearchOption.TopDirectoryOnly) + File.Delete(deleteFile) + Next + End Sub +End Class diff --git a/MapDownloader/frmMapa.Designer.vb b/MapDownloader/frmMapa.Designer.vb new file mode 100644 index 0000000..0da5c05 --- /dev/null +++ b/MapDownloader/frmMapa.Designer.vb @@ -0,0 +1,144 @@ + _ +Partial Class frmMapa + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.btnCopy = New System.Windows.Forms.Button() + Me.btnOddalit = New System.Windows.Forms.Button() + Me.btnPriblizit = New System.Windows.Forms.Button() + Me.btnNahoru = New System.Windows.Forms.Button() + Me.btnDoprava = New System.Windows.Forms.Button() + Me.btnDoleva = New System.Windows.Forms.Button() + Me.btnDolu = New System.Windows.Forms.Button() + Me.picMapa = New System.Windows.Forms.PictureBox() + CType(Me.picMapa, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'btnCopy + ' + Me.btnCopy.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnCopy.Image = Global.MapDownloader.My.Resources.Resources.copy32x32 + Me.btnCopy.Location = New System.Drawing.Point(586, 172) + Me.btnCopy.Name = "btnCopy" + Me.btnCopy.Size = New System.Drawing.Size(40, 40) + Me.btnCopy.TabIndex = 13 + Me.btnCopy.UseVisualStyleBackColor = True + ' + 'btnOddalit + ' + Me.btnOddalit.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnOddalit.Image = Global.MapDownloader.My.Resources.Resources.minus32x32 + Me.btnOddalit.Location = New System.Drawing.Point(632, 126) + Me.btnOddalit.Name = "btnOddalit" + Me.btnOddalit.Size = New System.Drawing.Size(40, 40) + Me.btnOddalit.TabIndex = 12 + Me.btnOddalit.UseVisualStyleBackColor = True + ' + 'btnPriblizit + ' + Me.btnPriblizit.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnPriblizit.Image = Global.MapDownloader.My.Resources.Resources.plus32x32 + Me.btnPriblizit.Location = New System.Drawing.Point(586, 126) + Me.btnPriblizit.Name = "btnPriblizit" + Me.btnPriblizit.Size = New System.Drawing.Size(40, 40) + Me.btnPriblizit.TabIndex = 11 + Me.btnPriblizit.UseVisualStyleBackColor = True + ' + 'btnNahoru + ' + Me.btnNahoru.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnNahoru.Image = Global.MapDownloader.My.Resources.Resources.up32x32 + Me.btnNahoru.Location = New System.Drawing.Point(607, 0) + Me.btnNahoru.Name = "btnNahoru" + Me.btnNahoru.Size = New System.Drawing.Size(40, 40) + Me.btnNahoru.TabIndex = 7 + Me.btnNahoru.UseVisualStyleBackColor = True + ' + 'btnDoprava + ' + Me.btnDoprava.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDoprava.Image = Global.MapDownloader.My.Resources.Resources.right32x32 + Me.btnDoprava.Location = New System.Drawing.Point(644, 40) + Me.btnDoprava.Name = "btnDoprava" + Me.btnDoprava.Size = New System.Drawing.Size(40, 40) + Me.btnDoprava.TabIndex = 10 + Me.btnDoprava.UseVisualStyleBackColor = True + ' + 'btnDoleva + ' + Me.btnDoleva.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDoleva.Image = Global.MapDownloader.My.Resources.Resources.left32x32 + Me.btnDoleva.Location = New System.Drawing.Point(568, 40) + Me.btnDoleva.Name = "btnDoleva" + Me.btnDoleva.Size = New System.Drawing.Size(40, 40) + Me.btnDoleva.TabIndex = 9 + Me.btnDoleva.UseVisualStyleBackColor = True + ' + 'btnDolu + ' + Me.btnDolu.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDolu.Image = Global.MapDownloader.My.Resources.Resources.down32x32 + Me.btnDolu.Location = New System.Drawing.Point(607, 80) + Me.btnDolu.Name = "btnDolu" + Me.btnDolu.Size = New System.Drawing.Size(40, 40) + Me.btnDolu.TabIndex = 8 + Me.btnDolu.UseVisualStyleBackColor = True + ' + 'picMapa + ' + Me.picMapa.Dock = System.Windows.Forms.DockStyle.Fill + Me.picMapa.Location = New System.Drawing.Point(0, 0) + Me.picMapa.Name = "picMapa" + Me.picMapa.Size = New System.Drawing.Size(684, 466) + Me.picMapa.TabIndex = 2 + Me.picMapa.TabStop = False + ' + 'frmMapa + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(684, 466) + Me.Controls.Add(Me.btnCopy) + Me.Controls.Add(Me.btnOddalit) + Me.Controls.Add(Me.btnPriblizit) + Me.Controls.Add(Me.btnNahoru) + Me.Controls.Add(Me.btnDoprava) + Me.Controls.Add(Me.btnDoleva) + Me.Controls.Add(Me.btnDolu) + Me.Controls.Add(Me.picMapa) + Me.DoubleBuffered = True + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow + Me.Name = "frmMapa" + Me.Text = "Mapa" + CType(Me.picMapa, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents picMapa As System.Windows.Forms.PictureBox + Friend WithEvents btnNahoru As System.Windows.Forms.Button + Friend WithEvents btnDoprava As System.Windows.Forms.Button + Friend WithEvents btnDoleva As System.Windows.Forms.Button + Friend WithEvents btnDolu As System.Windows.Forms.Button + Friend WithEvents btnPriblizit As System.Windows.Forms.Button + Friend WithEvents btnOddalit As System.Windows.Forms.Button + Friend WithEvents btnCopy As System.Windows.Forms.Button +End Class diff --git a/MapDownloader/frmMapa.resx b/MapDownloader/frmMapa.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MapDownloader/frmMapa.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MapDownloader/frmMapa.vb b/MapDownloader/frmMapa.vb new file mode 100644 index 0000000..bf17922 --- /dev/null +++ b/MapDownloader/frmMapa.vb @@ -0,0 +1,60 @@ +Public Class frmMapa + + Private mapa As clsMapa + + Sub New() + InitializeComponent() + + Me.mapa = New clsMapa(picMapa.Width, picMapa.Height) + RefreshMap() + End Sub + + Private Sub RefreshMap() + Me.picMapa.Image = Me.mapa.GetMapa(picMapa.Width, picMapa.Height) + Me.Text = String.Format("Mapa - Zoom={0}, X={1}, Y={2}", mapa.GetAktZoom, mapa.GetAktPosX, mapa.GetAktPosY) + End Sub + + Private Sub frmMapa_ResizeEnd(sender As Object, e As System.EventArgs) Handles Me.ResizeEnd + Me.mapa.SetRozmerMapy(picMapa.Width, picMapa.Height) + RefreshMap() + End Sub + +#Region "Tlačítka" + Private Sub btnNahoru_Click(sender As System.Object, e As System.EventArgs) Handles btnNahoru.Click + Me.mapa.PosunNahoru() + RefreshMap() + End Sub + + Private Sub btnDolu_Click(sender As System.Object, e As System.EventArgs) Handles btnDolu.Click + Me.mapa.PosunDolu() + RefreshMap() + End Sub + + Private Sub btnDoleva_Click(sender As System.Object, e As System.EventArgs) Handles btnDoleva.Click + Me.mapa.PosunDoleva() + RefreshMap() + End Sub + + Private Sub btnDoprava_Click(sender As System.Object, e As System.EventArgs) Handles btnDoprava.Click + Me.mapa.PosunDoprava() + RefreshMap() + End Sub + + Private Sub btnPriblizit_Click(sender As System.Object, e As System.EventArgs) Handles btnPriblizit.Click + Me.mapa.Priblizit() + RefreshMap() + End Sub + + Private Sub btnOddalit_Click(sender As System.Object, e As System.EventArgs) Handles btnOddalit.Click + Me.mapa.Oddalit() + RefreshMap() + End Sub + + Private Sub btnCopy_Click(sender As System.Object, e As System.EventArgs) Handles btnCopy.Click + My.Computer.Clipboard.SetText(String.Format("Mapa - Zoom={0}, X={1}, Y={2}", mapa.GetAktZoom, mapa.GetAktPosX, mapa.GetAktPosY)) + End Sub +#End Region + + + +End Class \ No newline at end of file diff --git a/MapDownloader/modulMapy.vb b/MapDownloader/modulMapy.vb new file mode 100644 index 0000000..9e270fe --- /dev/null +++ b/MapDownloader/modulMapy.vb @@ -0,0 +1,60 @@ +Option Strict On +Imports System.Net +Imports System.IO + +Module modulMapy + + + + ''' + ''' Vytvoří název aplikace i s číslem verze. + ''' + ''' Vhodné pro MsgBoxy. + Public AplikaceVerze As String = String.Format("{0} {1}", My.Application.Info.Title, My.Application.Info.Version.ToString) + + ''' + ''' Pole serverů odkud se berou mapy + ''' + ''' + Public mapoveServery() As String = {"m1.mapserver.mapy.cz", "m2.mapserver.mapy.cz", "m3.mapserver.mapy.cz", "m4.mapserver.mapy.cz"} + + Public Const coordinateOffSet As Integer = 1 + + Public Function VyberMapServer() As String + Dim pocetServeru As Integer = mapoveServery.Count + Dim generator As Random = New Random() + Return CStr(mapoveServery.GetValue(generator.Next(0, pocetServeru - 1))) + End Function + + Public Delegate Sub CallBackDelegate(ByVal p1 As Object) + Public Delegate Sub CallBackDelegate2(ByVal p1 As Object, ByVal p2 As Object) + + + + Public Sub ChyboveHlaseni(ByVal zprava As String) + MsgBox(zprava, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, AplikaceVerze) + End Sub + Public Sub InformacniHlaseni(ByVal zprava As String) + MsgBox(zprava, MsgBoxStyle.Information Or MsgBoxStyle.OkOnly, AplikaceVerze) + End Sub + Public Sub VystrazneHlaseni(ByVal zprava As String) + MsgBox(zprava, MsgBoxStyle.Exclamation Or MsgBoxStyle.OkOnly, AplikaceVerze) + End Sub + Public Function DotazovaciHlaseni(ByVal zprava As String) As MsgBoxResult + Return MsgBox(zprava, MsgBoxStyle.YesNo Or MsgBoxStyle.Question, AplikaceVerze) + End Function + + ''' + ''' Vrátí cestu k ..\Dokumenty\Powercare\{POJISTOVNA-KOD}\{ROK}\ + ''' + ''' + ''' Případně vytvoří složku Powercare atd. + Public Function PathToSlozkaMapy() As String + Return VytvorSlozkuPokudNeexistuje(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Mapy")) + End Function + + Private Function VytvorSlozkuPokudNeexistuje(ByVal path As String) As String + If Not Directory.Exists(path) Then Directory.CreateDirectory(path) + Return path + End Function +End Module