First commit.

master
Kowalski 2025-03-03 16:35:56 +01:00
commit 03fe0d2669
31 changed files with 2432 additions and 0 deletions

91
.gitignore vendored Normal file
View File

@ -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

20
MapDownloader.sln Normal file
View File

@ -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

View File

@ -0,0 +1,7 @@
Public Class DownloadException
Inherits Exception
Sub New()
MyBase.New("Chyba při stahování mapy.")
End Sub
End Class

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,35 @@
''' <summary>
''' Třída reprezentující část mapy o velikosti 256x256 pixelů
''' </summary>
''' <remarks></remarks>
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

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C7710240-E18E-4773-809F-3696D90711F6}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>MapDownloader.My.MyApplication</StartupObject>
<RootNamespace>MapDownloader</RootNamespace>
<AssemblyName>MapDownloader</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>MapDownloader.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>MapDownloader.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>On</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Core\DownloadException.vb" />
<Compile Include="Core\MapBlock.vb" />
<Compile Include="Mapa\clsMapa.vb" />
<Compile Include="Core\Mapy.cz\clsMapovePodklady.vb" />
<Compile Include="frmMain.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.vb">
<DependentUpon>frmMain.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMapa.Designer.vb">
<DependentUpon>frmMapa.vb</DependentUpon>
</Compile>
<Compile Include="frmMapa.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Core\Mapy.cz\clsPodklad.vb" />
<Compile Include="modulMapy.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmMapa.resx">
<DependentUpon>frmMapa.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Resources\down32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\download32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\left32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\minus32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\plus32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\right32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\up32x32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\page-copy-icon.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,187 @@
Imports System.Drawing.Imaging
Public Class clsMapa
Private Const minZoom = 1, maxZoom = 18
''' <summary>
''' Aktuální přiblížení
''' </summary>
''' <remarks></remarks>
Private aktZoom As Byte
Public ReadOnly Property GetAktZoom As Byte
Get
Return aktZoom
End Get
End Property
''' <summary>
''' Aktuální souřadnice X
''' </summary>
''' <remarks></remarks>
Private aktPosX As Integer
Public ReadOnly Property GetAktPosX As Integer
Get
Return aktPosX
End Get
End Property
''' <summary>
''' Aktuální souřadnice Y
''' </summary>
''' <remarks></remarks>
Private aktPosY As Integer
Private aktTypMapy As TYP_MAPY
Public ReadOnly Property GetAktPosY As Integer
Get
Return aktPosY
End Get
End Property
''' <summary>
''' Pole podkladů, které jsou aktuálně zobrazeny
''' </summary>
''' <remarks>2 dimenze</remarks>
Private aktualniZobrazeni(,) As clsPodklad
''' <summary>
''' Cache podkladů pro zobrazení mapy
''' </summary>
''' <remarks>Prevence znovunačítání podkladů z netu</remarks>
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

View File

@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
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
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.MapDownloader.frmMain
End Sub
End Class
End Namespace

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-16"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>frmMain</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -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
<Assembly: AssemblyTitle("MapDownloader")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MapDownloader")>
<Assembly: AssemblyCopyright("Copyright © 2012")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("61c7b100-b736-4fa4-b5ec-71a5d4d84aae")>
' 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:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,143 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
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

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="copy32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\page-copy-icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="down32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\down32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="download32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\download32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="left32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\left32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="minus32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\minus32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="plus32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\plus32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="right32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\right32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="up32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\up32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.MapDownloader.My.MySettings
Get
Return Global.MapDownloader.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

23
MapDownloader/app.config Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information"/>
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

352
MapDownloader/frmMain.Designer.vb generated Normal file
View File

@ -0,0 +1,352 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMain
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
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

120
MapDownloader/frmMain.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

515
MapDownloader/frmMain.vb Normal file
View File

@ -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

144
MapDownloader/frmMapa.Designer.vb generated Normal file
View File

@ -0,0 +1,144 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMapa
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
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

120
MapDownloader/frmMapa.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

60
MapDownloader/frmMapa.vb Normal file
View File

@ -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

View File

@ -0,0 +1,60 @@
Option Strict On
Imports System.Net
Imports System.IO
Module modulMapy
''' <summary>
''' Vytvoří název aplikace i s číslem verze.
''' </summary>
''' <remarks>Vhodné pro MsgBoxy.</remarks>
Public AplikaceVerze As String = String.Format("{0} {1}", My.Application.Info.Title, My.Application.Info.Version.ToString)
''' <summary>
''' Pole serverů odkud se berou mapy
''' </summary>
''' <remarks></remarks>
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
''' <summary>
''' Vrátí cestu k ..\Dokumenty\Powercare\{POJISTOVNA-KOD}\{ROK}\
''' </summary>
''' <returns></returns>
''' <remarks>Případně vytvoří složku Powercare atd.</remarks>
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