From aff729944400af117487f896dc2b7edb9386d2d5 Mon Sep 17 00:00:00 2001 From: xivk Date: Mon, 1 Feb 2016 22:27:20 +0000 Subject: [PATCH 01/33] Refactored to latest OsmSharp.Core. --- .../Data/SQLite/SQLiteConnection.cs | 4 +- .../OsmSharp.Android.UI.csproj | 8 +- .../Resources/Resource.designer.cs | 2 +- OsmSharp.Android.UI/packages.config | 2 +- OsmSharp.UI.Test/OsmSharp.UI.Test.csproj | 19 +-- OsmSharp.UI.Test/packages.config | 4 +- .../Data/SQLite/SQLiteConnectionBase.cs | 44 ++++++ OsmSharp.UI/Map/Layers/LayerMBTile.cs | 2 +- OsmSharp.UI/OsmSharp.UI.csproj | 9 +- OsmSharp.UI/packages.config | 2 +- .../MemoryMappedFiles/TempMemoryMappedFile.cs | 78 ---------- .../OsmSharp.WinForms.UI.csproj | 13 +- OsmSharp.WinForms.UI/packages.config | 2 +- .../OsmSharp.WindowsPhone.UI.csproj | 136 ------------------ OsmSharp.WindowsPhone.sln | 122 ---------------- .../Data/SQLite/SQLiteConnection.cs | 2 +- OsmSharp.iOS.UI/MapView.cs | 3 +- .../OsmSharp.iOS.UI.Classic.csproj | 14 +- OsmSharp.iOS.UI/packages.config | 2 +- 19 files changed, 91 insertions(+), 377 deletions(-) create mode 100644 OsmSharp.UI/Data/SQLite/SQLiteConnectionBase.cs delete mode 100644 OsmSharp.WinForms.UI/IO/MemoryMappedFiles/TempMemoryMappedFile.cs delete mode 100644 OsmSharp.WindowsPhone.UI/OsmSharp.WindowsPhone.UI.csproj delete mode 100644 OsmSharp.WindowsPhone.sln diff --git a/OsmSharp.Android.UI/Data/SQLite/SQLiteConnection.cs b/OsmSharp.Android.UI/Data/SQLite/SQLiteConnection.cs index 9120cfdc..d713bd5e 100644 --- a/OsmSharp.Android.UI/Data/SQLite/SQLiteConnection.cs +++ b/OsmSharp.Android.UI/Data/SQLite/SQLiteConnection.cs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with OsmSharp. If not, see . -using OsmSharp.Data.SQLite; +using OsmSharp.UI.Data.SQLite; using System.IO; using System.Reflection; @@ -25,7 +25,7 @@ namespace OsmSharp.Android.UI.Data.SQLite /// /// An Android-specific implementation of an SQLiteConnection. /// - public class SQLiteConnection : OsmSharp.Data.SQLite.SQLiteConnectionBase + public class SQLiteConnection : OsmSharp.UI.Data.SQLite.SQLiteConnectionBase { /// /// Holds the 'native' or platform-specific connection. diff --git a/OsmSharp.Android.UI/OsmSharp.Android.UI.csproj b/OsmSharp.Android.UI/OsmSharp.Android.UI.csproj index ca8accea..a5aa1794 100644 --- a/OsmSharp.Android.UI/OsmSharp.Android.UI.csproj +++ b/OsmSharp.Android.UI/OsmSharp.Android.UI.csproj @@ -38,12 +38,12 @@ ..\OutputAndroid\OsmSharp.Android.UI.XML - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\MonoAndroid\OsmSharp.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\MonoAndroid\OsmSharp.dll True - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\MonoAndroid\OsmSharp.Osm.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\MonoAndroid\OsmSharp.Osm.dll True diff --git a/OsmSharp.Android.UI/Resources/Resource.designer.cs b/OsmSharp.Android.UI/Resources/Resource.designer.cs index ded6de21..d633e591 100644 --- a/OsmSharp.Android.UI/Resources/Resource.designer.cs +++ b/OsmSharp.Android.UI/Resources/Resource.designer.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/OsmSharp.Android.UI/packages.config b/OsmSharp.Android.UI/packages.config index de5b7aeb..b98df203 100644 --- a/OsmSharp.Android.UI/packages.config +++ b/OsmSharp.Android.UI/packages.config @@ -1,7 +1,7 @@  - + \ No newline at end of file diff --git a/OsmSharp.UI.Test/OsmSharp.UI.Test.csproj b/OsmSharp.UI.Test/OsmSharp.UI.Test.csproj index 220f49ae..737d9e66 100644 --- a/OsmSharp.UI.Test/OsmSharp.UI.Test.csproj +++ b/OsmSharp.UI.Test/OsmSharp.UI.Test.csproj @@ -64,12 +64,16 @@ ..\packages\Antlr3.Runtime.PCL.3.5.0.3\lib\portable-win+net40+sl40+wp\Antlr3.Runtime.dll - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\net40\OsmSharp.dll + + ..\packages\NUnit.3.0.1\lib\net40\nunit.framework.dll True - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\net40\OsmSharp.Osm.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\net40\OsmSharp.dll + True + + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\net40\OsmSharp.Osm.dll True @@ -82,9 +86,6 @@ - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\packages\Zlib.Portable.1.9.2\lib\portable-net4+sl4+wp71+win8\Zlib.Portable.dll True @@ -139,5 +140,7 @@ --> - + + + \ No newline at end of file diff --git a/OsmSharp.UI.Test/packages.config b/OsmSharp.UI.Test/packages.config index 1fad1be4..c65cd619 100644 --- a/OsmSharp.UI.Test/packages.config +++ b/OsmSharp.UI.Test/packages.config @@ -1,8 +1,8 @@  - - + + \ No newline at end of file diff --git a/OsmSharp.UI/Data/SQLite/SQLiteConnectionBase.cs b/OsmSharp.UI/Data/SQLite/SQLiteConnectionBase.cs new file mode 100644 index 00000000..7b52e01e --- /dev/null +++ b/OsmSharp.UI/Data/SQLite/SQLiteConnectionBase.cs @@ -0,0 +1,44 @@ +// OsmSharp - OpenStreetMap (OSM) SDK +// Copyright (C) 2016 Abelshausen Ben +// +// This file is part of OsmSharp. +// +// OsmSharp is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// OsmSharp is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with OsmSharp. If not, see . + +using System; +using System.Collections.Generic; + +namespace OsmSharp.UI.Data.SQLite +{ + /// + /// A wrapper-class for all platform-specific SQLite connections. + /// + public abstract class SQLiteConnectionBase : IDisposable + { + /// + /// Creates an SQLLite command. + /// + public abstract List Query(string query, params object[] args) where T : new(); + + /// + /// Disposes of all resources associated with this connection. + /// + public abstract void Dispose(); + + /// + /// Closes this SQLite command. + /// + public abstract void Close(); + } +} \ No newline at end of file diff --git a/OsmSharp.UI/Map/Layers/LayerMBTile.cs b/OsmSharp.UI/Map/Layers/LayerMBTile.cs index a02a583d..81abf34f 100644 --- a/OsmSharp.UI/Map/Layers/LayerMBTile.cs +++ b/OsmSharp.UI/Map/Layers/LayerMBTile.cs @@ -23,7 +23,7 @@ using OsmSharp.UI.Renderer; using OsmSharp.Math.Geo; using OsmSharp.Osm.Tiles; -using OsmSharp.Data.SQLite; +using OsmSharp.UI.Data.SQLite; using OsmSharp.Collections.Cache; using OsmSharp.UI.Renderer.Primitives; using OsmSharp.Math.Geo.Projections; diff --git a/OsmSharp.UI/OsmSharp.UI.csproj b/OsmSharp.UI/OsmSharp.UI.csproj index e377ba39..1e77f455 100644 --- a/OsmSharp.UI/OsmSharp.UI.csproj +++ b/OsmSharp.UI/OsmSharp.UI.csproj @@ -71,6 +71,7 @@ + @@ -173,12 +174,12 @@ ..\packages\Antlr3.Runtime.PCL.3.5.0.3\lib\portable-win+net40+sl40+wp\Antlr3.Runtime.dll - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\portable-net40+sl4+win8+wp7\OsmSharp.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\portable-net403+sl50+win+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\OsmSharp.dll True - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\portable-net40+sl4+win8+wp7\OsmSharp.Osm.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\portable-net403+sl50+win+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\OsmSharp.Osm.dll True diff --git a/OsmSharp.UI/packages.config b/OsmSharp.UI/packages.config index 5ecdb832..d44b8835 100644 --- a/OsmSharp.UI/packages.config +++ b/OsmSharp.UI/packages.config @@ -1,7 +1,7 @@  - + \ No newline at end of file diff --git a/OsmSharp.WinForms.UI/IO/MemoryMappedFiles/TempMemoryMappedFile.cs b/OsmSharp.WinForms.UI/IO/MemoryMappedFiles/TempMemoryMappedFile.cs deleted file mode 100644 index df839f55..00000000 --- a/OsmSharp.WinForms.UI/IO/MemoryMappedFiles/TempMemoryMappedFile.cs +++ /dev/null @@ -1,78 +0,0 @@ -// OsmSharp - OpenStreetMap (OSM) SDK -// Copyright (C) 2015 Abelshausen Ben -// -// This file is part of OsmSharp. -// -// OsmSharp is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// OsmSharp is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with OsmSharp. If not, see . - -using OsmSharp.IO.MemoryMappedFiles; -using System.IO; - -namespace OsmSharp.WinForms.UI.IO.MemoryMappedFiles -{ - /// - /// A temporary memory mapped file. - /// - public class TempMemoryMappedFile : MemoryMappedStream - { - /// - /// Holds the temporary file info. - /// - private FileInfo _tempFile; - - /// - /// Holds the stream. - /// - private Stream _stream; - - /// - /// Creates a new temporary memory mapped file. - /// - public TempMemoryMappedFile() - : this(new FileInfo(Path.GetTempFileName())) - { - - } - - /// - /// Creates a new temporary memory mapped file. - /// - /// - public TempMemoryMappedFile(FileInfo tempFile) - : this(tempFile.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None), tempFile) - { - - } - - /// - /// Creates a new temporary memory mapped file. - /// - private TempMemoryMappedFile(Stream stream, FileInfo tempFile) - { - _tempFile = tempFile; - _stream = stream; - } - - /// - /// Disposes of all resources associated with this files. - /// - public override void Dispose() - { - base.Dispose(); - - _stream.Dispose(); - _tempFile.Delete(); - } - } -} \ No newline at end of file diff --git a/OsmSharp.WinForms.UI/OsmSharp.WinForms.UI.csproj b/OsmSharp.WinForms.UI/OsmSharp.WinForms.UI.csproj index 779868a6..378ff986 100644 --- a/OsmSharp.WinForms.UI/OsmSharp.WinForms.UI.csproj +++ b/OsmSharp.WinForms.UI/OsmSharp.WinForms.UI.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -7,7 +7,7 @@ Library OsmSharp.WinForms.UI OsmSharp.WinForms.UI - v4.0.3 + v4.5.2 @@ -65,12 +65,12 @@ false - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\net40\OsmSharp.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\net45\OsmSharp.dll True - - ..\packages\OsmSharp.Core.0.0.0.48-beta\lib\net40\OsmSharp.Osm.dll + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\net45\OsmSharp.Osm.dll True @@ -90,7 +90,6 @@ Properties\SharedAssemblyVersion.cs - diff --git a/OsmSharp.WinForms.UI/packages.config b/OsmSharp.WinForms.UI/packages.config index 71fc2b10..4baa4c9f 100644 --- a/OsmSharp.WinForms.UI/packages.config +++ b/OsmSharp.WinForms.UI/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/OsmSharp.WindowsPhone.UI/OsmSharp.WindowsPhone.UI.csproj b/OsmSharp.WindowsPhone.UI/OsmSharp.WindowsPhone.UI.csproj deleted file mode 100644 index 646aa455..00000000 --- a/OsmSharp.WindowsPhone.UI/OsmSharp.WindowsPhone.UI.csproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {5ED8F316-9B5A-46DB-BDB6-73269D361969} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - OsmSharp.WindowsPhone.UI - OsmSharp.WindowsPhone.UI - v8.0 - - - - - WindowsPhone - false - true - true - - - - - 4.0 - 11.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - ..\OutputWindowsPhone\ - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - ..\OutputWindowsPhone\OsmSharp.WindowsPhone.UI.XML - - - pdbonly - true - Bin\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - Bin\x86\Debug - true - full - false - - - - Bin\x86\Release - pdbonly - true - - - - Bin\ARM\Debug - true - full - false - - - - Bin\ARM\Release - pdbonly - true - - - - - - - {E20DC51A-431E-49F7-8018-53FE0DE80386} - OsmSharp.Osm - - - {2F4D2B40-D557-4640-96E1-693D598012A6} - OsmSharp.Routing - - - {1524C255-2EE5-4C0C-A64C-56CE39A062E3} - OsmSharp.UI - - - {077997FD-A61D-4DC0-B4B0-7429BF9824E8} - OsmSharp - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - \ No newline at end of file diff --git a/OsmSharp.WindowsPhone.sln b/OsmSharp.WindowsPhone.sln deleted file mode 100644 index 86799a15..00000000 --- a/OsmSharp.WindowsPhone.sln +++ /dev/null @@ -1,122 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{77A86923-AAE9-470C-A04B-9103A962388C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{00817571-839D-49D8-89BC-17652D1D992F}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WindowsPhone", "WindowsPhone", "{0E5D28A9-9626-4E4C-AC21-59A15ED79719}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp", "OsmSharp\OsmSharp.csproj", "{077997FD-A61D-4DC0-B4B0-7429BF9824E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.Osm", "OsmSharp.Osm\OsmSharp.Osm.csproj", "{E20DC51A-431E-49F7-8018-53FE0DE80386}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.Routing", "OsmSharp.Routing\OsmSharp.Routing.csproj", "{2F4D2B40-D557-4640-96E1-693D598012A6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.UI", "OsmSharp.UI\OsmSharp.UI.csproj", "{1524C255-2EE5-4C0C-A64C-56CE39A062E3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.WindowsPhone.UI", "OsmSharp.WindowsPhone.UI\OsmSharp.WindowsPhone.UI.csproj", "{5ED8F316-9B5A-46DB-BDB6-73269D361969}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Windows Phone = Debug|Windows Phone - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|Mixed Platforms = Release|Mixed Platforms - Release|Windows Phone = Release|Windows Phone - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|ARM.ActiveCfg = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Debug|x86.ActiveCfg = Debug|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|Any CPU.Build.0 = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|ARM.ActiveCfg = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|Windows Phone.ActiveCfg = Release|Any CPU - {077997FD-A61D-4DC0-B4B0-7429BF9824E8}.Release|x86.ActiveCfg = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|ARM.ActiveCfg = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Debug|x86.ActiveCfg = Debug|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|Any CPU.Build.0 = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|ARM.ActiveCfg = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|Windows Phone.ActiveCfg = Release|Any CPU - {E20DC51A-431E-49F7-8018-53FE0DE80386}.Release|x86.ActiveCfg = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|ARM.ActiveCfg = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Debug|x86.ActiveCfg = Debug|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|Any CPU.Build.0 = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|ARM.ActiveCfg = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|Windows Phone.ActiveCfg = Release|Any CPU - {2F4D2B40-D557-4640-96E1-693D598012A6}.Release|x86.ActiveCfg = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Debug|x86.ActiveCfg = Debug|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|Any CPU.Build.0 = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|ARM.ActiveCfg = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|Windows Phone.ActiveCfg = Release|Any CPU - {1524C255-2EE5-4C0C-A64C-56CE39A062E3}.Release|x86.ActiveCfg = Release|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|ARM.ActiveCfg = Debug|ARM - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|ARM.Build.0 = Debug|ARM - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|Windows Phone.ActiveCfg = Debug|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|x86.ActiveCfg = Debug|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Debug|x86.Build.0 = Debug|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|Any CPU.Build.0 = Release|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|ARM.ActiveCfg = Release|ARM - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|ARM.Build.0 = Release|ARM - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|Mixed Platforms.Build.0 = Release|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|Windows Phone.ActiveCfg = Release|Any CPU - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|x86.ActiveCfg = Release|x86 - {5ED8F316-9B5A-46DB-BDB6-73269D361969}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {077997FD-A61D-4DC0-B4B0-7429BF9824E8} = {77A86923-AAE9-470C-A04B-9103A962388C} - {E20DC51A-431E-49F7-8018-53FE0DE80386} = {77A86923-AAE9-470C-A04B-9103A962388C} - {2F4D2B40-D557-4640-96E1-693D598012A6} = {77A86923-AAE9-470C-A04B-9103A962388C} - {0E5D28A9-9626-4E4C-AC21-59A15ED79719} = {00817571-839D-49D8-89BC-17652D1D992F} - {1524C255-2EE5-4C0C-A64C-56CE39A062E3} = {00817571-839D-49D8-89BC-17652D1D992F} - {5ED8F316-9B5A-46DB-BDB6-73269D361969} = {0E5D28A9-9626-4E4C-AC21-59A15ED79719} - EndGlobalSection -EndGlobal diff --git a/OsmSharp.iOS.UI/Data/SQLite/SQLiteConnection.cs b/OsmSharp.iOS.UI/Data/SQLite/SQLiteConnection.cs index bed8c266..b509ed87 100644 --- a/OsmSharp.iOS.UI/Data/SQLite/SQLiteConnection.cs +++ b/OsmSharp.iOS.UI/Data/SQLite/SQLiteConnection.cs @@ -24,7 +24,7 @@ namespace OsmSharp.iOS.UI /// /// An iOS-specific implementation of an SQLiteConnection. /// - public class SQLiteConnection : OsmSharp.Data.SQLite.SQLiteConnectionBase + public class SQLiteConnection : OsmSharp.UI.Data.SQLite.SQLiteConnectionBase { /// /// Holds the 'native' or platform-specific connection. diff --git a/OsmSharp.iOS.UI/MapView.cs b/OsmSharp.iOS.UI/MapView.cs index 5b63bab2..0c2d04c3 100644 --- a/OsmSharp.iOS.UI/MapView.cs +++ b/OsmSharp.iOS.UI/MapView.cs @@ -34,10 +34,10 @@ using OsmSharp.Units.Angle; using System.Collections.ObjectModel; using OsmSharp.iOS.UI.Controls; -using CoreAnimation; #if __UNIFIED__ +using CoreAnimation; using CoreGraphics; using Foundation; using UIKit; @@ -46,6 +46,7 @@ using System.Drawing; using MonoTouch.Foundation; using MonoTouch.CoreGraphics; +using MonoTouch.CoreAnimation; // Type Mappings Unified to monotouch.dll using CGRect = global::System.Drawing.RectangleF; diff --git a/OsmSharp.iOS.UI/OsmSharp.iOS.UI.Classic.csproj b/OsmSharp.iOS.UI/OsmSharp.iOS.UI.Classic.csproj index e7d14762..9b90a84b 100644 --- a/OsmSharp.iOS.UI/OsmSharp.iOS.UI.Classic.csproj +++ b/OsmSharp.iOS.UI/OsmSharp.iOS.UI.Classic.csproj @@ -29,6 +29,14 @@ false + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\portable-net403+sl50+win+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\OsmSharp.dll + True + + + ..\packages\OsmSharp.Core.1.3.0-rc1-0119\lib\portable-net403+sl50+win+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\OsmSharp.Osm.dll + True + @@ -41,12 +49,6 @@ ..\packages\Zlib.Portable.1.9.2\lib\portable-net4+sl4+wp71+win8\Zlib.Portable.dll - - ..\packages\OsmSharp.Core.0.0.0.35-beta\lib\portable-net40+sl4+win8+wp7\OsmSharp.Osm.dll - - - ..\packages\OsmSharp.Core.0.0.0.35-beta\lib\portable-net40+sl4+win8+wp7\OsmSharp.dll - ..\packages\OsmSharp.Routing.0.0.0.17-beta\lib\portable-net40+sl4+win8+wp7\OsmSharp.Routing.dll diff --git a/OsmSharp.iOS.UI/packages.config b/OsmSharp.iOS.UI/packages.config index 1c92e561..61194fb5 100644 --- a/OsmSharp.iOS.UI/packages.config +++ b/OsmSharp.iOS.UI/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file From d9badd73cd4dadf29341c4f870dc6e6ecc1bb573 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Mon, 25 Apr 2016 12:34:09 +0300 Subject: [PATCH 02/33] Fix reading MapCSS with common rules (node{}, way{}, ...) --- .../Map/Styles/MapCSS/MapCSSInterpreter.cs | 27 +++++++------------ .../v0_2/Domain/DeclarationTextPosition.cs | 3 ++- .../Styles/MapCSS/v0_2/MapCSSDomainParser.cs | 3 +++ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/OsmSharp.UI/Map/Styles/MapCSS/MapCSSInterpreter.cs b/OsmSharp.UI/Map/Styles/MapCSS/MapCSSInterpreter.cs index ab41d498..564071af 100644 --- a/OsmSharp.UI/Map/Styles/MapCSS/MapCSSInterpreter.cs +++ b/OsmSharp.UI/Map/Styles/MapCSS/MapCSSInterpreter.cs @@ -136,19 +136,19 @@ private void PrepareForProcessing() switch (selector.Type) { case SelectorTypeEnum.Node: - _keysForNodes = null; + _keysForNodes.Add("*"); break; case SelectorTypeEnum.Way: - _keysForWays = null; + _keysForWays.Add("*"); break; case SelectorTypeEnum.Relation: - _keysForRelations = null; + _keysForRelations.Add("*"); break; case SelectorTypeEnum.Line: - _keysForLines = null; + _keysForLines.Add("*"); break; case SelectorTypeEnum.Area: - _keysForAreas = null; + _keysForAreas.Add("*"); break; } } @@ -299,12 +299,7 @@ public override void Translate(Scene2D scene, IProjection projection, ICompleteO { case CompleteOsmType.Node: if (!_mapCSSFile.HasNodeIdSelector && - osmGeo.Tags.Count == 0) - { // this node can never be selected, no tags and no id selectors. - break; - } - if (!_mapCSSFile.HasNodeIdSelector && - _keysForNodes != null && + !_keysForNodes.Contains("*") && !osmGeo.Tags.ContainsOneOfKeys(_keysForNodes)) { // no good keys present. break; @@ -312,13 +307,9 @@ public override void Translate(Scene2D scene, IProjection projection, ICompleteO this.TranslateNode(scene, projection, osmGeo as Node); break; case CompleteOsmType.Way: - var relevantWayTags = osmGeo.Tags; - if (_keysForWays != null) - { // filter the collection. - relevantWayTags = relevantWayTags.KeepKeysOf(_keysForWays); - } + var relevantWayTags = osmGeo.Tags.KeepKeysOf(_keysForWays); if (!_mapCSSFile.HasWayIdSelector && - _keysForWays != null && + !_keysForWays.Contains("*") && relevantWayTags.Count == 0) { // no good keys present. break; @@ -334,7 +325,7 @@ public override void Translate(Scene2D scene, IProjection projection, ICompleteO break; case CompleteOsmType.Relation: if (!_mapCSSFile.HasRelationIdSelector && - _keysForRelations != null && + !_keysForRelations.Contains("*") && !osmGeo.Tags.ContainsOneOfKeys(_keysForRelations)) { // no good keys present. break; diff --git a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Domain/DeclarationTextPosition.cs b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Domain/DeclarationTextPosition.cs index 5032ad5c..559e6e9c 100644 --- a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Domain/DeclarationTextPosition.cs +++ b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Domain/DeclarationTextPosition.cs @@ -28,6 +28,7 @@ public enum DeclarationTextPositionEnum public enum TextPositionEnum { Line, - Center + Center, + Offset } } diff --git a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/MapCSSDomainParser.cs b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/MapCSSDomainParser.cs index a729977b..4a513207 100644 --- a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/MapCSSDomainParser.cs +++ b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/MapCSSDomainParser.cs @@ -436,6 +436,9 @@ private static Rule ParseRule(CommonTree ruleTree) case "center": textPosition.Value = TextPositionEnum.Center; break; + case "offset": + textPosition.Value = TextPositionEnum.Offset; + break; default: throw new MapCSSDomainParserException(declarationTree, string.Format("{1} value {0} cannot be parsed!", valueString, qualifierString)); From 29ec115c35fea1a779bd938bea4e9cb01cb98e46 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Wed, 27 Apr 2016 12:08:33 +0300 Subject: [PATCH 03/33] Add fist version Wpf MapControl --- OsmSharp.UI.sln | 32 +- OsmSharp.UI/Map/Layers/LayerTile.cs | 8 +- .../MapCSS/v0_2/Eval/EvalInterpreter.cs | 201 +- OsmSharp.Wpf.UI.Sample/App.config | 6 + OsmSharp.Wpf.UI.Sample/App.xaml | 9 + OsmSharp.Wpf.UI.Sample/App.xaml.cs | 17 + OsmSharp.Wpf.UI.Sample/Data/color.mapcss | 8 + OsmSharp.Wpf.UI.Sample/Data/default.mapcss | 222 + .../Data/opencyclemap.mapcss | 149 + OsmSharp.Wpf.UI.Sample/Data/test.osm | 45470 ++++++++++++++++ OsmSharp.Wpf.UI.Sample/MainWindow.xaml | 15 + OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs | 70 + .../OsmSharp.Wpf.UI.Sample.csproj | 150 + .../Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 71 + .../Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + OsmSharp.Wpf.UI.Sample/packages.config | 7 + OsmSharp.Wpf.UI/Cache/OsmDataCacheDisk.cs | 276 + .../IO/Web/NativeHttpWebRequest.cs | 89 + .../IO/Web/NativeHttpWebResponse.cs | 61 + OsmSharp.Wpf.UI/Log/DebugTraceListener.cs | 26 + OsmSharp.Wpf.UI/MapControl.cs | 720 + OsmSharp.Wpf.UI/MapControlEventArgs.cs | 41 + OsmSharp.Wpf.UI/Native.cs | 48 + OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj | 97 + OsmSharp.Wpf.UI/Properties/AssemblyInfo.cs | 36 + OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs | 297 + .../Renderer/Images/NativeImage.cs | 128 + .../Renderer/Images/NativeImageCache.cs | 38 + OsmSharp.Wpf.UI/Renderer/RenderContext.cs | 49 + OsmSharp.Wpf.UI/Renderer/RenderExtensions.cs | 242 + OsmSharp.Wpf.UI/packages.config | 6 + 34 files changed, 48713 insertions(+), 85 deletions(-) create mode 100644 OsmSharp.Wpf.UI.Sample/App.config create mode 100644 OsmSharp.Wpf.UI.Sample/App.xaml create mode 100644 OsmSharp.Wpf.UI.Sample/App.xaml.cs create mode 100644 OsmSharp.Wpf.UI.Sample/Data/color.mapcss create mode 100644 OsmSharp.Wpf.UI.Sample/Data/default.mapcss create mode 100644 OsmSharp.Wpf.UI.Sample/Data/opencyclemap.mapcss create mode 100644 OsmSharp.Wpf.UI.Sample/Data/test.osm create mode 100644 OsmSharp.Wpf.UI.Sample/MainWindow.xaml create mode 100644 OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs create mode 100644 OsmSharp.Wpf.UI.Sample/OsmSharp.Wpf.UI.Sample.csproj create mode 100644 OsmSharp.Wpf.UI.Sample/Properties/AssemblyInfo.cs create mode 100644 OsmSharp.Wpf.UI.Sample/Properties/Resources.Designer.cs create mode 100644 OsmSharp.Wpf.UI.Sample/Properties/Resources.resx create mode 100644 OsmSharp.Wpf.UI.Sample/Properties/Settings.Designer.cs create mode 100644 OsmSharp.Wpf.UI.Sample/Properties/Settings.settings create mode 100644 OsmSharp.Wpf.UI.Sample/packages.config create mode 100644 OsmSharp.Wpf.UI/Cache/OsmDataCacheDisk.cs create mode 100644 OsmSharp.Wpf.UI/IO/Web/NativeHttpWebRequest.cs create mode 100644 OsmSharp.Wpf.UI/IO/Web/NativeHttpWebResponse.cs create mode 100644 OsmSharp.Wpf.UI/Log/DebugTraceListener.cs create mode 100644 OsmSharp.Wpf.UI/MapControl.cs create mode 100644 OsmSharp.Wpf.UI/MapControlEventArgs.cs create mode 100644 OsmSharp.Wpf.UI/Native.cs create mode 100644 OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj create mode 100644 OsmSharp.Wpf.UI/Properties/AssemblyInfo.cs create mode 100644 OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs create mode 100644 OsmSharp.Wpf.UI/Renderer/Images/NativeImage.cs create mode 100644 OsmSharp.Wpf.UI/Renderer/Images/NativeImageCache.cs create mode 100644 OsmSharp.Wpf.UI/Renderer/RenderContext.cs create mode 100644 OsmSharp.Wpf.UI/Renderer/RenderExtensions.cs create mode 100644 OsmSharp.Wpf.UI/packages.config diff --git a/OsmSharp.UI.sln b/OsmSharp.UI.sln index 866cc527..9af515dd 100644 --- a/OsmSharp.UI.sln +++ b/OsmSharp.UI.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.WinForms.UI", "OsmSharp.WinForms.UI\OsmSharp.WinForms.UI.csproj", "{1433D177-B342-463C-8128-8399720A35AF}" EndProject @@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.UI", "OsmSharp.UI\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.UI.Test", "OsmSharp.UI.Test\OsmSharp.UI.Test.csproj", "{0739A23C-1D40-477F-AE7C-38518B499567}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.Wpf.UI", "OsmSharp.Wpf.UI\OsmSharp.Wpf.UI.csproj", "{141C2CD0-6A13-43C2-9924-D2217E88AA88}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OsmSharp.Wpf.UI.Sample", "OsmSharp.Wpf.UI.Sample\OsmSharp.Wpf.UI.Sample.csproj", "{3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -53,6 +57,30 @@ Global {0739A23C-1D40-477F-AE7C-38518B499567}.Release|x64.Build.0 = Release|x64 {0739A23C-1D40-477F-AE7C-38518B499567}.Release|x86.ActiveCfg = Release|x86 {0739A23C-1D40-477F-AE7C-38518B499567}.Release|x86.Build.0 = Release|x86 + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|x64.ActiveCfg = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|x64.Build.0 = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|x86.ActiveCfg = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Debug|x86.Build.0 = Debug|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|Any CPU.Build.0 = Release|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|x64.ActiveCfg = Release|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|x64.Build.0 = Release|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|x86.ActiveCfg = Release|Any CPU + {141C2CD0-6A13-43C2-9924-D2217E88AA88}.Release|x86.Build.0 = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|x64.ActiveCfg = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|x64.Build.0 = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|x86.ActiveCfg = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Debug|x86.Build.0 = Debug|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|Any CPU.Build.0 = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|x64.ActiveCfg = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|x64.Build.0 = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|x86.ActiveCfg = Release|Any CPU + {3E2BD0D5-1EE6-4023-8880-78B451B6AEE1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/OsmSharp.UI/Map/Layers/LayerTile.cs b/OsmSharp.UI/Map/Layers/LayerTile.cs index 7c4c836f..acd73970 100644 --- a/OsmSharp.UI/Map/Layers/LayerTile.cs +++ b/OsmSharp.UI/Map/Layers/LayerTile.cs @@ -385,10 +385,10 @@ private void Response(HttpWebResponse myResp, Tile tile) protected internal override IEnumerable Get(float zoomFactor, View2D view) { var primitives = new List(); - if(_suspended) - { // just return an empty primitives list if suspended. - return primitives; - } + //if(_suspended) + //{ // just return an empty primitives list if suspended. + // return primitives; + //} try { // calculate the current zoom level. diff --git a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Eval/EvalInterpreter.cs b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Eval/EvalInterpreter.cs index 55bbba05..32804c4f 100644 --- a/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Eval/EvalInterpreter.cs +++ b/OsmSharp.UI/Map/Styles/MapCSS/v0_2/Eval/EvalInterpreter.cs @@ -12,6 +12,8 @@ namespace OsmSharp.UI.Map.Styles.MapCSS.v0_2.Eval /// public class EvalInterpreter { + #region instance + /// /// Creates a new eval interpreter. /// @@ -40,34 +42,67 @@ public static EvalInterpreter Instance } } - private const string TAG_TOKEN = "tag"; - - private const string PROP_TOKEN = "prop"; - - private const string COND_TOKEN = "cond"; + #endregion instance - private const string ANY_TOKEN = "any"; + #region atomar - private const string MAX_TOKEN = "max"; - - private const string MIN_TOKEN = "min"; + /// + /// Interpreters the given eval function. + /// + /// The string. + /// Eval function. + /// Tags. + public string InterpretString(string evalFunction, ITagsSource tags) + { + if (string.IsNullOrWhiteSpace(evalFunction)) { throw new ArgumentOutOfRangeException("evalFunction cannot be null"); } - /// - /// Interpreters the given eval function. - /// - /// The string. - /// Eval function. - /// Tags. - public string InterpretString(string evalFunction, ITagsSource tags){ - if (string.IsNullOrWhiteSpace(evalFunction)) { throw new ArgumentOutOfRangeException("evalFunction cannot be null"); } + // trim eval function. + evalFunction = evalFunction.Trim(); - // trim eval function. - evalFunction = evalFunction.Trim(); + // calculate the result. + return this.Interpreter(evalFunction, tags); + } + + /// + /// Interpreters the given eval function. + /// + /// + /// + /// + /// + public double InterpretDouble(string evalFunction, ITagsSource tags) + { + string result = this.InterpretString(evalFunction, tags); - // calculate the result. - return this.Interpreter (evalFunction, tags); - } + // parse to double. + double resultDouble = 0; + if (!double.TryParse(result, out resultDouble)) + { + OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, + string.Format("Cannot convert '{0}' to double.", result)); + } + return resultDouble; + } + /// + /// Interpreters the given eval function. + /// + /// + /// + /// + /// + public float InterpretFloat(string evalFunction, ITagsSource tags) + { + string result = this.InterpretString(evalFunction, tags); + // parse to float. + float resultFloat = 0; + if (!float.TryParse(result, out resultFloat)) + { + OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, + string.Format("Cannot convert '{0}' to float.", result)); + } + return resultFloat; + } /// /// Interpreters the given eval function. /// @@ -75,58 +110,44 @@ public string InterpretString(string evalFunction, ITagsSource tags){ /// /// /// - public double InterpretDouble(string evalFunction, ITagsSource tags) + public int InterpretInt(string evalFunction, ITagsSource tags) + { + string result = this.InterpretString(evalFunction, tags); + + // parse to double. + int resultInt = 0; + if (!int.TryParse(result, out resultInt)) + { + OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, + string.Format("Cannot convert '{0}' to int.", result)); + } + return resultInt; + } + /// + /// Returns the interpreted value of the boolstring according to the MapCSS eval boolean datatype rules. + /// + /// + /// + public bool InterpretBool(string evalFunction, ITagsSource tags) { - string result = this.InterpretString (evalFunction, tags); + string result = this.InterpretString(evalFunction, tags); + return !(result == null || result == "false" || result == string.Empty || result == "no"); + } + - // parse to double. - double resultDouble = 0; - if (!double.TryParse (result, out resultDouble)) { - OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, - string.Format ("Cannot convert '{0}' to double.", result)); - } - return resultDouble; - } + #endregion atomar + + private const string TAG_TOKEN = "tag"; + + private const string PROP_TOKEN = "prop"; - /// - /// Interpreters the given eval function. - /// - /// - /// - /// - /// - public float InterpretFloat(string evalFunction, ITagsSource tags) - { - string result = this.InterpretString (evalFunction, tags); + private const string COND_TOKEN = "cond"; - // parse to float. - float resultFloat = 0; - if (!float.TryParse (result, out resultFloat)) { - OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, - string.Format ("Cannot convert '{0}' to float.", result)); - } - return resultFloat; - } + private const string ANY_TOKEN = "any"; - /// - /// Interpreters the given eval function. - /// - /// - /// - /// - /// - public int InterpretInt(string evalFunction, ITagsSource tags) - { - string result = this.InterpretString (evalFunction, tags); + private const string MAX_TOKEN = "max"; - // parse to double. - int resultInt = 0; - if (!int.TryParse (result, out resultInt)) { - OsmSharp.Logging.Log.TraceEvent("EvalInterpreter", OsmSharp.Logging.TraceEventType.Error, - string.Format ("Cannot convert '{0}' to int.", result)); - } - return resultInt; - } + private const string MIN_TOKEN = "min"; /// /// Interpreters the given expression. @@ -157,7 +178,7 @@ private string Interpreter(string expression, ITagsSource tags) { // evaluate expression and decide on the next expression. string[] args = this.ParseFunction(expression); if (args.Length != 3) { throw new EvalInterpreterException("Invalid argument count: {0}", expression); } - if (this.ParseBool(this.Interpreter(args[0], tags))) + if (this.InterpretBool(this.Interpreter(args[0], tags))) { // evaluate and return the true-part. return this.Interpreter(args[1], tags); } @@ -182,12 +203,35 @@ private string Interpreter(string expression, ITagsSource tags) } else if (expression.StartsWith(MAX_TOKEN)) { // returns the maximum value of all arguments. + string[] args = this.ParseFunction(expression); + return null; } else if (expression.StartsWith(MIN_TOKEN)) { // returns the minimum value of all arguments. - + return null; } + //else if (expression.StartsWith(NUM_TOKEN)) + //{ // returns the minimum value of all arguments. + // return null; + //} + //else if (expression.StartsWith(STR_TOKEN)) + //{ // returns the minimum value of all arguments. + // return null; + //} + //else if (expression.StartsWith(BOOLEAN_TOKEN)) + //{ // returns the minimum value of all arguments. + // return null; + //} + //else if (expression.StartsWith(INT_TOKEN)) + //{ // returns the minimum value of all arguments. + // return null; + //} + + //metric + // sqrt + // concat + return null; throw new EvalInterpreterException("Failed to evaluate expression: {0}", expression); } @@ -238,25 +282,24 @@ private float EvaluateNumber(string number) } return result; } - /// - /// Returns true if the given string represents none. + /// Returns the interpreted value of the boolstring according to the MapCSS eval boolean datatype rules. /// - /// + /// /// - private bool IsNone(string noneString) + public bool InterpretBool(string boolean) { - return noneString == null || noneString == string.Empty; + return !(boolean == null || boolean == "false" || boolean == string.Empty || boolean == "no"); } /// - /// Returns the interpreted value of the boolstring according to the MapCSS eval boolean datatype rules. + /// Returns true if the given string represents none. /// - /// + /// /// - private bool ParseBool(string boolString) + private bool IsNone(string noneString) { - return !(boolString == null || boolString == "false" || boolString == string.Empty || boolString == "no"); + return string.IsNullOrEmpty(noneString); } /// diff --git a/OsmSharp.Wpf.UI.Sample/App.config b/OsmSharp.Wpf.UI.Sample/App.config new file mode 100644 index 00000000..88fa4027 --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OsmSharp.Wpf.UI.Sample/App.xaml b/OsmSharp.Wpf.UI.Sample/App.xaml new file mode 100644 index 00000000..8289127d --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/OsmSharp.Wpf.UI.Sample/App.xaml.cs b/OsmSharp.Wpf.UI.Sample/App.xaml.cs new file mode 100644 index 00000000..f40497dc --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace OsmSharp.Wpf.UI.Sample +{ + /// + /// Логика взаимодействия для App.xaml + /// + public partial class App : Application + { + } +} diff --git a/OsmSharp.Wpf.UI.Sample/Data/color.mapcss b/OsmSharp.Wpf.UI.Sample/Data/color.mapcss new file mode 100644 index 00000000..7e18919f --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/Data/color.mapcss @@ -0,0 +1,8 @@ +canvas{fill-color:#a0bc92} + +way { + color:#00FF00 +} +way[building]{ + color:#ffbb00; +} \ No newline at end of file diff --git a/OsmSharp.Wpf.UI.Sample/Data/default.mapcss b/OsmSharp.Wpf.UI.Sample/Data/default.mapcss new file mode 100644 index 00000000..c296674f --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/Data/default.mapcss @@ -0,0 +1,222 @@ +canvas{fill-color:#a0bc92} + + +/* ---------- DEFAULTS ---------- */ +way { + /* text: name; */text-position: line; text-halo-radius:2; + linecap: round; + + casing-opacity: eval("min(1,(num(any(tag('layer'),1))+5) / 6)"); + } + + + +/* ---------- ROADS ---------- */ +way|z16-[highway] /*[!lanes]*/ + {color:white; + + /*casing-width: 1; */ } + +way|z16-[highway=motorway], +way|z16-[highway=trunk], +{width:eval(metric(4*4));} + + +way|z16-[highway=primary] +{width:eval(metric(3*4));} + +way|z16-[highway=secondary], +way|z16-[highway=tertiary], +way|z16-[highway=residential], +way|z16-[highway=trunk_link], +way|z16-[highway=motorway_link], +way|z16-[highway=primary_link], +way|z16-[highway=secondary_link], +{width:eval(metric(2*4));} + +way|z16-[highway=service], +way|z16-[highway=track], +{width:eval(metric(1.5*4));} + +way|z16-[highway=footway], +way|z16-[highway=pedestrian], +way|z16-[highway=path], +way|z16-[highway=steps], +{width:eval(metric(1*4)); +} + + +way[highway][lanes]{width:eval(metric( num(tag("lanes")) * 4));} +way[width]{width:eval(metric(tag("width")));} + +way|z16-[highway=motorway], +way|z16-[highway=motorway_link], +way|z16-[highway=trunk], +way|z16-[highway=trunk_link], +way|z16-[highway=primary], +way|z16-[highway=primary_link], +way|z16-[highway=secondary], +way|z16-[highway=secondary_link], +way|z16-[highway=tertiary], +way|z16-[highway=tertiary_link], +way|z16-[highway=residential], +way|z16-[highway=service], + +{image: "styles/default/asphalt.png"; +z-index:5; +} + +area|z16-[amenity=parking], +{fill-image: "styles/default/asphalt.png"; +z-index:5; casing-width:1; +} + + +way|z16-[highway=footway], +way|z16-[highway=pedestrian], +{image: "styles/default/paving_stones6s.png"; +z-index:4;} + +way|z16-[highway=track], +{image: "styles/default/dirt.png"; +z-index:3;} + +way|z16-[highway=path], +{image: "styles/default/sand.png";z-index:2;} + + +way|z16-[layer<0], +{image: ""} + + +way|z16-[surface=asphalt] {image: "styles/defaurelt/asphalt.png"} + +way|z16-[surface=grass] {image: eval("styles/default/"+tag("surface")+".png")} +way|z16-[surface=sand] {image: eval("styles/default/"+tag("surface")+".png")} +way|z16-[surface=dirt] {image: eval("styles/default/"+tag("surface")+".png")} +way|z16-[surface=granite] {color:#655} +way|z16-[surface=paving_stones] {image: "styles/default/paving_stones6s.png"} +way|z16-[landuse=field] {fill-image: "styles/default/field.png"} + +way|z17-[barrier] + {casing-width:1; width: eval(metric(tag("width")))} + +way|z-16[highway=residential], +way|z-16[highway=tertiary], +way|z-16[highway=living_street] +{width: 3; color:#ffffff; z-index:10;casing-width: 1;} + +way|z15-16[highway=service][living_street!=yes], +way|z-16[highway=unclassified] + {width: 2.5; color:#ccc; z-index:9;casing-width: 1;} + + +way|z-16[highway=primary], +way|z-16[highway=motorway], +way|z-16[highway=trunk] + {width: 4; color: #ff0; z-index:11;casing-width: 1;} + +way|z-16[highway=primary_link], +way|z-16[highway=motorway_link], +way|z-16[highway=trunk_link] + {width: 3.5; color: #ff0; z-index:11;casing-width: 1;} + +way|z-16[highway=secondary] +{width: 4; color: orange; z-index:10;casing-width: 1;} + +way|z15-16[highway=track] +{width: 3; color:#252; z-index:8;casing-width: 1;} + +way|z15-16[living_street=yes] + {width: 2; z-index: 2;casing-width: 1;} + + +way|z15-16[highway=footway], +way|z15-16[highway=pedestrian], +way|z15-16[highway=path] +{width:eval(max(2, prop("width"))); color:#655; casing-dashes: 3,1; z-index:3;casing-width: 1;} + +way|z15-[highway=steps]{} +//{z-index:5; width:eval(max(2, prop("width"))); color:#655; casing-dashes: 1,0; linecap: butt;casing-width: 1;} +//TODo:{z-index:6; width:eval(max(2, prop("width"))); dashes: eval("1," + str( max(num(any(num(metric(tag("step:length")))/100, num(metric("0.3m"))))- 1, 1) ) ); color: black;casing-width: 1;} + + + +way[bridge=yes] {casing-width:eval(min(3, num(prop("width"))/2 ));casing-linecap:butt} + + +area[highway][area=yes] {fill-color: eval(any(prop("fill-color"),prop("color"))); fill-image: eval(any(prop("fill-image"), prop("image")));} + + +/* ---------- FORESTS ---------- */ +way[natural=forest], +way[natural=wood], +way[landuse=forest], +way[landuse=wood] + {fill-color: #020} + +/* ---------- WATER ---------- */ +way[waterway=riverbank], +way[landuse=reservoir], +way[natural=water] {fill-color: #009} + +way[waterway=river], +way[waterway=stream]{color: #009;width: eval(max(3, metric(tag("width")) ))} + + + + +/* ---------- BUILDINGS ---------- */ + +way|z16-[building] {fill-color: #522; +/*text: addr:housenumber;*/ +text-halo-radius:2; z-index:100; text-position: center; +opacity: 1; +fill-opacity: 1; +extrude: eval(zmetric("3m")*2); +extrude-face-color: #e2e2e2; +extrude-face-opacity: 1; +extrude-edge-width: 1; +extrude-edge-color: #404040; +} +way|z16-[barrier]{raise: eval(zmetric(tag("min_height")));extrude-face-opacity: 0.5} +way|z16-[barrier]{extrude: eval( zmetric(3) - num(prop("raise")) ); } +way|z16-[barrier][height]{extrude: eval( zmetric(tag("height")) - num(prop("raise")) ); } + + +way|z16-[building]{raise: eval( any( zmetric(tag("min_height")), zmetric ( num(tag("building:min_level")) * 3)));} + +way|z16-[building][building:levels]{extrude: eval( zmetric(num(tag("building:levels"))*3) - num(prop("raise")) );} +way|z16-[building][height]{extrude: eval( zmetric(tag("height")) - num(prop("raise")) );} + + + +/* ---------- INDUSTRY ---------- */ +way|z17-[power=line] {width: 1; color:#ccc} + + +way|z10-[landuse=industrial] {fill-color: #855} +way|z10-[landuse=military] {fill-color: pink} + +/* ---------- GARDENS&co ---------- */ +way|z13-[landuse=allotments] {fill-color: #452; opacity: 0.8} +way|z10-[landuse=field] {fill-color: #CCCC4E; opacity: 0.8} + +/* ---------- GRASS ---------- */ + +way|z16-[landuse=residential], +{fill-color: #cceecc; opacity: 0.8; fill-image: "styles/default/grass.png"; } +way|z16-[landuse=grass], +way|z16-[natural=grass] +{fill-color: #cceecc; opacity: 0.8; fill-image: "styles/default/grass.png"; z-index: 6} + + +/* ---------- AMENITIES ---------- */ +way|z15-[amenity=parking] {icon-image: "styles/default/parking.png"; } + +way[amenity=bench] {extrude: eval(zmetric("0.6m")); width:eval(metric("0.5m")); extrude-face-opacity:0;extrude-edge-color:black;color:brown;opacity:0.75} +//TODO:{offset:eval(metric("0.25m")); extrude-face-color:brown;extrude:eval(zmetric("1.2m"));extrude-face-opacity: 0.5} + +/* ---------- BORDERS ---------- */ +/*line[boundary=administrative] {width: 2; color: red; dashes:5,3; z-index:15} +area|z-17[boundary=administrative] {text: name; text-position:center}*/ diff --git a/OsmSharp.Wpf.UI.Sample/Data/opencyclemap.mapcss b/OsmSharp.Wpf.UI.Sample/Data/opencyclemap.mapcss new file mode 100644 index 00000000..25ba4dcc --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/Data/opencyclemap.mapcss @@ -0,0 +1,149 @@ +/* + + Stylesheet that mimicks, to a certain extent, opencyclemap + Andy Allan, June 2010 + + Based heavily on: + MapCSS demonstration stylesheet + Richard Fairhurst, October 2009 + +*/ + +canvas{fill-color:#a0bc92} + +/* This rule applies to all areas (closed ways). Note that rules are applied in the order + they appear in the file, so later rules may replace this one for some ways. + This is used as a debugger for finding unstyled areas; it's obviously oversimplistic since + it picks up closed-loop highways. */ + +way :area { color: gray; width: 1; fill-color: red; fill-opacity: 0.1; } + +/* A set of fairly standard rules. + We use z-index to make sure high-priority roads appear above minor ones. + The default z-index is 5. If an object matches multiple rules with the same + z-index then the rules are "merged" (but individual properties become one or the other) */ + +/*way[highway=motorway],way[highway=motorway_link], +way[highway=trunk],way[highway=trunk_link], +way[highway=primary],way[highway=primary_link], +way[highway=secondary],way[highway=secondary_link], +way[highway=tertiary],way[highway=tertiary_link], +way[highway=residential] { text: name; text-color: black; font-size: 7; text-position: line;}*/ +way[highway=motorway],way[highway=motorway_link] { z-index: 9; color: #bfbfcf; width: 7; casing-color: #506077; casing-width: 9; } +way[highway=trunk],way[highway=trunk_link] { z-index: 9; color: #c8d8c8; width: 7; casing-color: #477147; casing-width: 9; } +way[highway=primary],way[highway=primary_link] { z-index: 8; color: #d8c8c8; width: 7; casing-color: #8d4346; casing-width: 9; } +way[highway=secondary],way[highway=secondary_link] { z-index: 7; color: #eeeec9; width: 7; casing-color: #a37b48; casing-width: 9; } +way[highway=tertiary],way[highway=unclassified] { z-index: 6; color: #eeeec9; width: 5; casing-color: #999999; casing-width: 7; } +way[highway=residential] { z-index: 5; color: white; width: 5; casing-color: #999; casing-width: 7; } +way[highway=service] { color: white; width: 3; casing-color: #999; casing-width: 5; } + +/* Pedestrian precincts need to be treated carefully. Only closed-loops with an explicit +area=yes tag should be filled. The below doesn't yet work as intended. */ +way[highway=pedestrian] !:area { color: #ddddee; width: 5; casing-color: #555555; casing-width: 6; } +way[highway=pedestrian] :area { color: #555555; width: 1; fill-color: #ddddee; fill-opacity: 0.8; } + +way[highway=steps] { color: #be6c6c; width: 2; dashes: 4, 2; } +way[highway=footway] { color: #be6c6c; width: 2; dashes: 6, 3; } +way[highway=cycleway] { color: blue; width: 1.6; dashes: 5, 4; } +way[highway=bridleway] { z-index:9; color: #996644; width: 2; dashes: 4, 2, 2, 2; } +way[highway=track] { color: #996644; width: 2; dashes: 4, 2; } +way[highway=path] { color: lightgreen; width: 2; dashes: 2, 2; } + +way[waterway=river], way[waterway=canal] { color: blue; width: 2; text:name; text-color:blue; font-size:9; text-position: offset; text-offset: 7;} + +way[barrier] {color: #000000; width: 1} + +/* Fills can be solid colour or bitmap images */ + + +way[natural] :area { color: #ADD6A5; width: 1; fill-color: #ADD6A5; fill-opacity: 0.2; } +way[landuse] :area { color: #efefef; width: 1; fill-color: #f5f5f5; fill-opacity: 0.3; } +way[amenity],way[shop] :area { color: #ADCEB5; width: 1; fill-color: #ADCEB5; fill-opacity: 0.2; } +way[leisure],way[sport] :area { color: #8CD6B5; width: 1; fill-color: #8CD6B5; fill-opacity: 0.2; } +way[tourism] :area { color: #F7CECE; width: 1; fill-color: #F7CECE; fill-opacity: 0.2; } +way[historic],way[ruins] :area { color: #F7F7DE; width: 1; fill-color: #F7F7DE; fill-opacity: 0.2; } +way[military] :area { color: #D6D6D6; width: 1; fill-color: #D6D6D6; fill-opacity: 0.2; } +way[building] :area { color: #8d8d8d; width: 1; fill-color: #e0e0e0; fill-opacity: 0.2; } +way[natural=water], +way[waterway] :area { color: blue; width: 2; fill-color: blue; fill-opacity: 0.2; } +way[landuse=forest],way[natural=wood] :area { color: green; width: 2; fill-color: green; fill-opacity: 0.2; } +way[leisure=pitch],way[leisure=park] { color: #44ff44; width: 1; fill-color: #44ff44; fill-opacity: 0.2; } +way[amenity=parking] :area { color: gray; width: 1; fill-color: gray; fill-opacity: 0.2; } +way[public_transport=pay_scale_area] :area { color: gray; width: 1; fill-color: gray; fill-opacity: 0.1; } + +/* Addressing. Nodes with addresses *and* match POIs should have a poi icon, so we put addressing first */ + +node[addr:housenumber], +node[addr:housename] { icon-image: circle; icon-width: 4; color: #B0E0E6; casing-color:blue; casing-width: 1; } +way[addr:interpolation] { color: #B0E0E6; width: 3; dashes: 3,3;} + +/* POIs, too, can have bitmap icons - they can even be transparent */ + +node[amenity=pub] { icon-image: url('icons/pub.png'); text-offset: 15; font-family: DejaVu; text: name; font-size: 9; } +/*node[place] { icon-image: icons/place.png; text-offset: 17; font-family: DejaVu; text: name; font-size: 9; font-weight: bold; text-decoration: underline; } +node[railway=station] { icon-image: icons/station.png; text-offset: 13; font-family: DejaVu; text: name; font-size: 9; font-weight: bold; } +node[aeroway=aerodrome] { icon-image: icons/airport.png; text-offset: 13; font-family: DejaVu; text: name; font-size: 10; } +node[amenity=atm] { icon-image: icons/atm.png; } +node[amenity=bank] { icon-image: icons/bank.png; text-offset: 15; text: name; } +node[highway=bus_stop] { icon-image: icons/bus_stop.png; } +node[amenity=cafe] { icon-image: icons/cafe.png; text-offset: 15; text: name; } +node[shop=convenience] { icon-image: icons/convenience.png; text-offset:15; text:name; } +node[shop=supermarket] { icon-image: icons/supermarket.png; text-offset:15; text:name; } +node[amenity=fast_food] { icon-image: icons/fast_food.png; text-offset:15; text: name; } +node[amenity=fire_station] { icon-image: icons/fire_station.png; } +node[amenity=hospital] { icon-image: icons/hospital.png; } +node[tourism=hotel] { icon-image: icons/hotel.png; } +node[amenity=parking] { icon-image: icons/parking.png; } */ +node[amenity=bicycle_parking] { icon-image: url('icons/parking_cycle.png'); text-offset: 15; text: capacity; text-color: blue } +/* node[amenity=pharmacy] { icon-image: icons/pharmacy.png; } +node[amenity=pharmacy][dispensing=yes] { icon-image: icons/pharmacy_dispensing.png; } +node[amenity=police] { icon-image: icons/police.png; } +node[amenity=post_box] { icon-image: icons/post_box.png; } +node[amenity=recycling] { icon-image: icons/recycling.png; } +node[amenity=restaurant] { icon-image: icons/restaurant.png; } +node[amenity=school] { icon-image: icons/school.png; } +node[amenity=taxi] { icon-image: icons/taxi.png; } +node[amenity=telephone] { icon-image: icons/telephone.png; } +way node[barrier=gate], way node[highway=gate] { icon-image: icons/gate.png; } +way node[barrier=bollard] { icon-image: icons/bollard.png; } +node[barrier=cattle_grid] { icon-image: icons/cattle_grid.png; }*/ + +/* We can stack styles at different z-index (depth) */ + +way[railway=rail] + { z-index: 6; color: #444444; width: 5; } + { z-index: 7; color: white; width: 3; dashes: 12,12; } +way[railway=platform] { color:black; width: 2; } +way[railway=subway] + { z-index: 6; color: #444444; width: 5; } + { z-index: 7; color: white; width: 3; dashes: 8,8; } + +/* Bridge */ +way[bridge=yes], way[bridge=viaduct], way[bridge=suspension] + { z-index: 4; color: white; width: eval('_width+3'); } + { z-index: 3; color: black; width: eval('_width+6'); } + +/* Tunnel */ +way[tunnel=yes] + { z-index: 4; color: white; width: eval('_width+2'); } + { z-index: 3; color: black; width: eval('_width+6'); dashes: 4,4; } + +/* Oneway */ +way[oneway=yes] { z-index: 10; color: #6c70d5; width: 2; dashes: 10,30; /*line-style: arrows;*/ } + + +/* Change the road colour based on dynamically set "highlighted" tag (see earlier) */ + +way .highlighted { color: pink; } + +/* Descendant selectors provide an easy way to style relations: this example means "any way + which is part of a relation whose type=route". */ + +relation[type=route] way { z-index: 1; width: 17; color: yellow; opacity: 0.3; } +relation[type=route][route=bicycle][network=ncn] way { z-index: 1; width: 12; color: red; opacity: 0.3; } +relation[type=route][route=bicycle][network=rcn] way { z-index: 1; width: 12; color: cyan; opacity: 0.3; } +relation[type=route][route=bicycle][network=lcn] way { z-index: 1; width: 12; color: blue; opacity: 0.3; } +relation[type=route][route=bicycle][network=mtb] way { z-index: 1; width: 12; color: #48a448; opacity: 0.3; } + + + diff --git a/OsmSharp.Wpf.UI.Sample/Data/test.osm b/OsmSharp.Wpf.UI.Sample/Data/test.osm new file mode 100644 index 00000000..03c0f8df --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/Data/test.osm @@ -0,0 +1,45470 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml new file mode 100644 index 00000000..6d5f5163 --- /dev/null +++ b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml @@ -0,0 +1,15 @@ + + + public float Density => 1; - /// - /// Gets or sets the map bounding box. - /// - public GeoCoordinateBox MapBoundingBox { get; set; } - /// - /// Gets or sets the minimum zoom level. - /// - public float MapMinZoomLevel { get; set; } - /// - /// Gets or sets the maximum zoom level. - /// - public float MapMaxZoomLevel { get; set; } - void IMapView.Invalidate() { Refresh(); @@ -580,6 +609,11 @@ void IMapView.NotifyMapChange(double pixelsActualWidth, double pixelsActualHeigh #region dependency properties + public static readonly DependencyProperty MapBoundingBoxProperty; + + public static readonly DependencyProperty MapMinZoomLevelProperty; + public static readonly DependencyProperty MapMaxZoomLevelProperty; + public static readonly DependencyProperty MapCenterProperty; public static readonly DependencyProperty MapZoomProperty; public static readonly DependencyProperty MapTiltProperty; @@ -593,6 +627,25 @@ void IMapView.NotifyMapChange(double pixelsActualWidth, double pixelsActualHeigh static MapControl() { + MapBoundingBoxProperty = DependencyProperty.Register("MapBoundingBox", + typeof(GeoCoordinateBox), typeof(MapControl), new UIPropertyMetadata(null, (o, e) => + { + var mapControl = o as MapControl; + mapControl?.NotifyMapViewChanged(); + })); + MapMinZoomLevelProperty = DependencyProperty.Register("MapMinZoomLevel", + typeof(float), typeof(MapControl), new UIPropertyMetadata(0f, (o, e) => + { + var mapControl = o as MapControl; + mapControl?.NotifyMapViewChanged(); + })); + MapMaxZoomLevelProperty = DependencyProperty.Register("MapMaxZoomLevel", + typeof(float), typeof(MapControl), new UIPropertyMetadata(10000f, (o, e) => + { + var mapControl = o as MapControl; + mapControl?.NotifyMapViewChanged(); + })); + MapCenterProperty = DependencyProperty.Register("MapCenter", typeof(GeoCoordinate), typeof(MapControl), new UIPropertyMetadata(new GeoCoordinate(0, 0))); MapZoomProperty = DependencyProperty.Register("MapZoom", diff --git a/OsmSharp.Wpf.UI/MapControlCommands.cs b/OsmSharp.Wpf.UI/MapControlCommands.cs new file mode 100644 index 00000000..078e787c --- /dev/null +++ b/OsmSharp.Wpf.UI/MapControlCommands.cs @@ -0,0 +1,15 @@ +using System.Windows.Input; + +namespace OsmSharp.Wpf.UI +{ + /// + /// MapControl commands + /// + public static class MapControlCommands + { + public static RoutedUICommand ZoomIn = new RoutedUICommand("Приблизить", "ZoomIn", typeof(MapControl)); + public static RoutedUICommand ZoomOut = new RoutedUICommand("Отдалить", "ZoomOut", typeof(MapControl)); + + public static RoutedUICommand ShowFullMap = new RoutedUICommand("Вся карта", "ShowFullMap", typeof(MapControl)); + } +} \ No newline at end of file diff --git a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj index 1c999685..18c5fbc2 100644 --- a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj +++ b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj @@ -64,6 +64,7 @@ + From f56c1b52ee6fe2744ad2d429b0e4c7a0c3855e25 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Thu, 5 May 2016 19:14:16 +0300 Subject: [PATCH 10/33] Fix MapMaxZoomLevel --- OsmSharp.Wpf.UI/MapControl.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OsmSharp.Wpf.UI/MapControl.cs b/OsmSharp.Wpf.UI/MapControl.cs index cd8ff34c..5ab3d860 100644 --- a/OsmSharp.Wpf.UI/MapControl.cs +++ b/OsmSharp.Wpf.UI/MapControl.cs @@ -38,9 +38,6 @@ public MapControl() _mapSceneManager.RenderScene += OnRenderScene; _renderingScenes = new Stack(); - - MapMinZoomLevel = 0; - MapMaxZoomLevel = 10000; var zoomInBind = new CommandBinding(MapControlCommands.ZoomIn); zoomInBind.Executed += (sender, args) => ZoomIn(); @@ -640,7 +637,7 @@ static MapControl() mapControl?.NotifyMapViewChanged(); })); MapMaxZoomLevelProperty = DependencyProperty.Register("MapMaxZoomLevel", - typeof(float), typeof(MapControl), new UIPropertyMetadata(10000f, (o, e) => + typeof(float), typeof(MapControl), new UIPropertyMetadata(20f, (o, e) => { var mapControl = o as MapControl; mapControl?.NotifyMapViewChanged(); From 507052cfa48ccb832498aed72fff620f6ed408bf Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Sat, 7 May 2016 17:22:27 +0300 Subject: [PATCH 11/33] using MapControl MapBoundingBox --- OsmSharp.Wpf.UI.Sample/MainWindow.xaml | 6 ++ OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs | 7 +- OsmSharp.Wpf.UI/MapControl.cs | 109 ++++++++++++++++------ OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj | 7 +- 4 files changed, 93 insertions(+), 36 deletions(-) diff --git a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml index 3f401ca0..72895a62 100644 --- a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml +++ b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml @@ -12,5 +12,11 @@ public static class MapControlCommands { + public static RoutedUICommand NotifyMapViewChanged = new RoutedUICommand("Обновить", "Refresh", typeof(MapControl)); + public static RoutedUICommand ZoomIn = new RoutedUICommand("Приблизить", "ZoomIn", typeof(MapControl)); public static RoutedUICommand ZoomOut = new RoutedUICommand("Отдалить", "ZoomOut", typeof(MapControl)); diff --git a/OsmSharp.Wpf.UI/MapSceneManager.cs b/OsmSharp.Wpf.UI/MapSceneManager.cs index 88d6250f..65cdf841 100644 --- a/OsmSharp.Wpf.UI/MapSceneManager.cs +++ b/OsmSharp.Wpf.UI/MapSceneManager.cs @@ -36,6 +36,8 @@ public MapSceneManager(int historyCapacity = 5) _previewScene = null; _renderer = new MapRenderer(new DrawingRenderer2D()); + + IsReady = true; } #endregion constructors @@ -55,6 +57,8 @@ protected void OnRenderScene(MapRenderingScene scene) #region properties + public bool IsReady { get; private set; } + public Map Map { get; private set; } public Size SceneSize { get; private set; } @@ -181,6 +185,7 @@ public void Preview() } public void Preview(GeoCoordinate cener, double zoom, Degree tilt) { + IsReady = false; Map.Pause(); _previewScene = new MapRenderingScene(cener, zoom, tilt) { @@ -213,6 +218,8 @@ public void PreviewComplete() RenderingSceneAsync(newScene); } _previewScene = null; + + IsReady = true; } } From 825eacd8ada63432d58493f11d1663941b59416b Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Tue, 31 May 2016 15:32:54 +0300 Subject: [PATCH 14/33] Adding custom layers --- OsmSharp.Wpf.UI/MapControl.cs | 101 +++++++++++++++++++++++++++-- OsmSharp.Wpf.UI/MapSceneManager.cs | 2 +- 2 files changed, 97 insertions(+), 6 deletions(-) diff --git a/OsmSharp.Wpf.UI/MapControl.cs b/OsmSharp.Wpf.UI/MapControl.cs index 6d01d547..9b61108c 100644 --- a/OsmSharp.Wpf.UI/MapControl.cs +++ b/OsmSharp.Wpf.UI/MapControl.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; +using System.Linq; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; @@ -12,6 +14,7 @@ using OsmSharp.Math.Primitives; using OsmSharp.UI; using OsmSharp.UI.Map; +using OsmSharp.UI.Map.Layers; using OsmSharp.UI.Renderer; using OsmSharp.Units.Angle; using OsmSharp.Wpf.UI.Renderer; @@ -30,6 +33,9 @@ public class MapControl : FrameworkElement, IMapView, INotifyPropertyChanged private readonly Stack _renderingScenes; private readonly object _renderingScenesLock = new object(); + private readonly List> _customLayers; + private LayerPrimitives _canvas; + private Point? _draggingCoordinates; private bool _isReady; @@ -49,6 +55,9 @@ public MapControl() _isSuspendNotifyMapViewChanged = false; _isReady = true; + _customLayers = new List>(); + _canvas = new LayerPrimitives(new WebMercator()); + var notifyMapViewChanged = new CommandBinding(MapControlCommands.NotifyMapViewChanged); notifyMapViewChanged.Executed += (sender, args) => NotifyMapViewChanged(); notifyMapViewChanged.CanExecute += (sender, args) => args.CanExecute = true; @@ -342,6 +351,15 @@ public bool MapAllowTilt set { SetValue(MapAllowTiltProperty, value); OnPropertyChanged(); } } + public IEnumerable CustomLayers + { + get { return _customLayers.Select(l=>l.Item2); } + } + public LayerPrimitives Canvas + { + get { return _canvas; } + } + #endregion propreties #region utils @@ -480,7 +498,36 @@ private void RenderScene(DrawingContext context, Size renderSize, MapRenderingSc // } //} } - + + private void InitializeMap() + { + if (_mapSceneManager.Map != null) + { + foreach (var layer in _customLayers) + { + _mapSceneManager.Map.RemoveLayer(layer.Item2); + } + _mapSceneManager.Map.RemoveLayer(_canvas); + } + + _isSuspendNotifyMapViewChanged = false; + AdjustMapScene(); + _mapSceneManager.Initialize(Map, MapCenter, MapZoom, MapTilt, RenderSize); + if (_mapSceneManager.Map != null) + { + SuspendNotifyMapViewChanged(); + + foreach (var layer in _customLayers.OrderBy(l=>l.Item1)) + { + _mapSceneManager.Map.AddLayer(layer.Item2); + } + _canvas = new LayerPrimitives(_mapSceneManager.Map.Projection); + _mapSceneManager.Map.AddLayer(_canvas); + + ResumeNotifyMapViewChanged(); + } + } + #endregion utils #region overrides @@ -579,8 +626,7 @@ protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); - AdjustMapScene(); - _mapSceneManager.Initialize(Map, MapCenter, MapZoom, MapTilt, RenderSize); + InitializeMap(); } protected override Size MeasureOverride(Size availableSize) @@ -664,6 +710,52 @@ public void ShowFullMap() ResumeNotifyMapViewChanged(); } + public void AddLayer(Layer layer, int zIndex) + { + var index = 0; + for (var i = 0; i < _customLayers.Count-1; i++) + { + var fist = _customLayers[i]; + var second = _customLayers[i +1]; + if (zIndex >= fist.Item1 && zIndex < second.Item1) + { + index = i + 1; + } + } + _customLayers.Insert(index, new Tuple(zIndex, layer)); + var fistLayer = _customLayers.FirstOrDefault(); + if (fistLayer != null) + { + for (var i = 0; i < _mapSceneManager.Map.LayerCount; i++) + { + index++; + if (fistLayer.Item2 == _mapSceneManager.Map[i]) + { + break; + } + } + } + _mapSceneManager.Map.InsertLayer(index, layer); + } + public void RemoveLayer(Layer layer) + { + _mapSceneManager.Map.RemoveLayer(layer); + var item = _customLayers.FirstOrDefault(l => l.Item2 == layer); + if (item != null) + { + _customLayers.Remove(item); + } + } + + //public void GoTo(GeoCoordinate center, float zoom = float.NaN) + //{ + + //} + //public void GoTo(GeoCoordinateBox box) + //{ + + //} + #endregion methods #region IMapView implementation @@ -799,8 +891,7 @@ static MapControl() (o, e) => { var mapControl = o as MapControl; - mapControl?._mapSceneManager.Initialize(mapControl.Map, mapControl.MapCenter, mapControl.MapZoom, - mapControl.MapTilt, mapControl.RenderSize); + mapControl?.InitializeMap(); })); MapAllowPanProperty = DependencyProperty.Register("MapAllowPan", diff --git a/OsmSharp.Wpf.UI/MapSceneManager.cs b/OsmSharp.Wpf.UI/MapSceneManager.cs index 65cdf841..7de01c5a 100644 --- a/OsmSharp.Wpf.UI/MapSceneManager.cs +++ b/OsmSharp.Wpf.UI/MapSceneManager.cs @@ -115,10 +115,10 @@ public void Initialize(Map map, GeoCoordinate center, double zoom, Degree tilt, if (Map != null) { Map.MapChanged -= MapChanged; + //Map.RemoveLayer() } Map = map; Map.MapChanged += MapChanged; - Map = map; SceneSize = sceneSize; View(center, zoom, tilt); From 761c399e12d9cefb72efb147b6ff17977c04ef60 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Tue, 28 Jun 2016 21:00:44 +0300 Subject: [PATCH 15/33] Fix DrawIcon --- OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs | 137 +++++++++++++++++- OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs | 1 + 2 files changed, 134 insertions(+), 4 deletions(-) diff --git a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs index e618843d..7db17746 100644 --- a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs +++ b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs @@ -1,13 +1,20 @@ using System; +using System.Collections.Generic; using System.IO; using System.Threading; using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using OsmSharp.Geo.Features; using OsmSharp.Math.Geo; using OsmSharp.Math.Geo.Projections; using OsmSharp.Osm.Data.Memory; using OsmSharp.Osm.Xml.Streams; +using OsmSharp.UI; using OsmSharp.UI.Map.Layers; using OsmSharp.UI.Map.Styles.MapCSS; +using OsmSharp.UI.Renderer; +using OsmSharp.UI.Renderer.Primitives; using OsmSharp.Wpf.UI.Log; namespace OsmSharp.Wpf.UI.Sample @@ -41,10 +48,10 @@ private void button_Click(object sender, RoutedEventArgs e) var testLayer = new LayerOsm(MemoryDataSource.CreateFrom(source), mapCssInterpreter, new WebMercator()); - map.AddLayer(testLayer); + // map.AddLayer(testLayer); - // map.AddLayerTile(@"http://b.tile.openstreetmap.org/{z}/{x}/{y}.png"); + map.AddLayerTile(@"http://b.tile.openstreetmap.org/{z}/{x}/{y}.png"); // map.BackColor = SimpleColor.FromKnownColor(OsmSharp.UI.KnownColor.Black).Value; @@ -54,10 +61,132 @@ private void button_Click(object sender, RoutedEventArgs e) MapControl.MapZoom = 14; MapControl.Map = map; MapControl.MapCenter = testLayer.Envelope.Center; - // MapControl.MapCenter = new GeoCoordinate(51.2667, 4.7914); // wechel - + // MapControl.MapCenter = new GeoCoordinate(51.2667, 4.7914); // wechel + + var l = new MapLayerWrapper(new WebMercator()); + + //l.AddPoint(testLayer.Envelope.Center, 20, SimpleColor.FromKnownColor(OsmSharp.UI.KnownColor.Black).Value); + + MapControl.AddLayer(l, 100); + MapControl.ResumeNotifyMapViewChanged(); } } + + public class MapLayerWrapper : Layer + { + private readonly IProjection _projection; + + public MapLayerWrapper(IProjection projection) + { + _projection = projection; + + + } + + protected override IEnumerable Get(float zoomFactor, View2D view) + { + var result = new List(); + var viewBox = view.OuterBox; + var box = new GeoCoordinateBox(_projection.ToGeoCoordinates(viewBox.Min[0], viewBox.Min[1]), + _projection.ToGeoCoordinates(viewBox.Max[0], viewBox.Max[1])); + + + + var point = _projection.ToPixel(box.Center.Latitude, box.Center.Longitude); + var p = new Icon2D(point[0], point[1], Create("")); + result.Add(p); + + return result; + } + + public static byte[] Create(string key) + { + byte[] result = null; + Application.Current.Dispatcher.Invoke(() => + { + try + { + var drawingVisual = new DrawingVisual + { + Clip = new RectangleGeometry(new Rect(new Size(20, 20))), + CacheMode = new BitmapCache() + }; + var drawingContext = drawingVisual.RenderOpen(); + + //var canvas = (Canvas)Application.Current.FindResource(key); + //if (canvas != null) + //{ + // //drawingContext.DrawRectangle(new VisualBrush + // //{ + // // Visual = canvas, + + // //}, ); + + // var rectangle = new Rectangle(); + // rectangle.Width = 20; + // rectangle.Height = 30; + // rectangle.Fill = new SolidColorBrush(Colors.Brown); + + // VisualBrush vb = new VisualBrush(canvas) + // { + // }; + // GeometryDrawing gd = new GeometryDrawing(vb, new Pen(Brushes.Transparent, 0), new RectangleGeometry(new Rect(0, 0, 20, 30))); + // var img = new DrawingImage(gd); + // drawingContext.DrawDrawing(img.Drawing); + + //} + + drawingContext.DrawEllipse(Brushes.Red, new Pen(Brushes.Green, 2), new Point(10, 10), 10, 10); + + + // drawingContext.Pop(); + drawingContext.Close(); + + + + + //var rectangle = new Rectangle(); + //rectangle.Width = 20; + //rectangle.Height = 20; + //rectangle.Fill = new SolidColorBrush(Colors.Brown); + + var bitmap = new RenderTargetBitmap(25, 25, 96, 96, PixelFormats.Pbgra32); + bitmap.Render(drawingVisual); + + var encoder = new PngBitmapEncoder(); + var outputFrame = BitmapFrame.Create(bitmap); + encoder.Frames.Add(outputFrame); + + using (var stream = new MemoryStream()) + { + encoder.Save(stream); + result = stream.ToArray(); + } + try + { + using (var s = File.Create("E:\\test.png")) + { + s.Write(result, 0, result.Length); + } + + } + catch (Exception exc) + { + + throw; + } + } + catch (Exception) + { + + throw; + } + + }); + + return result; + } + } } diff --git a/OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs b/OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs index d425bc52..931e9292 100644 --- a/OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs +++ b/OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs @@ -200,6 +200,7 @@ protected override void DrawIcon(Target2DWrapper target, double x { var imageSource = new BitmapImage(); imageSource.BeginInit(); + imageSource.CacheOption = BitmapCacheOption.OnLoad; imageSource.StreamSource = stream; imageSource.EndInit(); From e1ddfc9a7bc171da6f2c86a160776daac116489c Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Wed, 29 Jun 2016 18:43:12 +0300 Subject: [PATCH 16/33] Add zoom to box --- .../Extensions/GeoCoordinateBoxExtensions.cs | 53 +++++++++++++++++++ OsmSharp.Wpf.UI/MapControl.cs | 21 +++++++- OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj | 1 + 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs diff --git a/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs new file mode 100644 index 00000000..cc8ea419 --- /dev/null +++ b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using OsmSharp.Math.Geo; + +namespace OsmSharp.Wpf.UI.Extensions +{ + public static class GeoCoordinateBoxExtensions + { + private static List> _zoomLevels = new List> + { + new Tuple(0, 360), + new Tuple(1, 180), + new Tuple(2, 90), + new Tuple(3, 45), + new Tuple(4, 22.5), + new Tuple(5, 11.25), + new Tuple(6, 5.625), + new Tuple(7, 2.813), + new Tuple(8, 1.406), + new Tuple(9, 0.703), + new Tuple(10, 0.352), + new Tuple(11, 0.176), + new Tuple(12, 0.088), + new Tuple(13, 0.044), + new Tuple(14, 0.022), + new Tuple(15, 0.011), + new Tuple(16, 0.005), + new Tuple(17, 0.003), + new Tuple(18, 0.001), + new Tuple(19, 0)// new Tuple(19, 0.0005) + }; + + public static float GetZoomLevel(this GeoCoordinateBox box) + { + var level = 0f; + var delta = System.Math.Max(box.DeltaLon, box.DeltaLat); + + for (int i = 0; i < _zoomLevels.Count - 1; i++) + { + var l1 = _zoomLevels[i]; + var l2 = _zoomLevels[i + 1]; + + if (delta <= l1.Item2 && delta >= l2.Item2) + { + var f = delta/(l2.Item1 - l1.Item1); + level = (float)(l2.Item2 + (l1.Item2 - l1.Item2)*f); + break; + } + } + return level; + } + } +} diff --git a/OsmSharp.Wpf.UI/MapControl.cs b/OsmSharp.Wpf.UI/MapControl.cs index 9b61108c..63b890b2 100644 --- a/OsmSharp.Wpf.UI/MapControl.cs +++ b/OsmSharp.Wpf.UI/MapControl.cs @@ -17,6 +17,7 @@ using OsmSharp.UI.Map.Layers; using OsmSharp.UI.Renderer; using OsmSharp.Units.Angle; +using OsmSharp.Wpf.UI.Extensions; using OsmSharp.Wpf.UI.Renderer; using TraceEventType = OsmSharp.Logging.TraceEventType; @@ -701,6 +702,24 @@ public void ZoomOut(float delta = 0.2f) { MapZoom -= delta; } + public void ZoomToCoordinate(GeoCoordinate coordinate) + { + SuspendNotifyMapViewChanged(); + + MapCenter = coordinate; + MapZoom = new GeoCoordinateBox(coordinate, coordinate).GetZoomLevel(); + + ResumeNotifyMapViewChanged(); + } + public void ZoomToBox(GeoCoordinateBox box) + { + SuspendNotifyMapViewChanged(); + + MapCenter = box.Center; + MapZoom = box.GetZoomLevel(); + + ResumeNotifyMapViewChanged(); + } public void ShowFullMap() { @@ -868,7 +887,7 @@ static MapControl() MapMinZoomLevelProperty = DependencyProperty.Register("MapMinZoomLevel", typeof(float), typeof(MapControl), new UIPropertyMetadata(0f, notifyMapViewChanged)); MapMaxZoomLevelProperty = DependencyProperty.Register("MapMaxZoomLevel", - typeof(float), typeof(MapControl), new UIPropertyMetadata(20f, notifyMapViewChanged)); + typeof(float), typeof(MapControl), new UIPropertyMetadata(19f, notifyMapViewChanged)); MapCenterProperty = DependencyProperty.Register("MapCenter", typeof(GeoCoordinate), typeof(MapControl), new UIPropertyMetadata(new GeoCoordinate(0, 0), notifyMapViewChanged)); diff --git a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj index 3b69d8b9..30fdbb97 100644 --- a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj +++ b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj @@ -64,6 +64,7 @@ + From 66dedca5799d9edf2f61a76ed642edf4143608b0 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Wed, 29 Jun 2016 18:49:45 +0300 Subject: [PATCH 17/33] Fix zoom to box --- OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs index cc8ea419..1a1feb94 100644 --- a/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs +++ b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs @@ -42,8 +42,8 @@ public static float GetZoomLevel(this GeoCoordinateBox box) if (delta <= l1.Item2 && delta >= l2.Item2) { - var f = delta/(l2.Item1 - l1.Item1); - level = (float)(l2.Item2 + (l1.Item2 - l1.Item2)*f); + var f = delta/(l2.Item2 - l1.Item2); + level = (float)(l2.Item1 + (l1.Item1 - l1.Item1)*f); break; } } From eca683f942d0fecdce4c60928a9e8ffc918fc919 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Wed, 29 Jun 2016 18:54:49 +0300 Subject: [PATCH 18/33] Add maxZoom to zoom to box --- OsmSharp.Wpf.UI/MapControl.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmSharp.Wpf.UI/MapControl.cs b/OsmSharp.Wpf.UI/MapControl.cs index 63b890b2..2b7aa3b2 100644 --- a/OsmSharp.Wpf.UI/MapControl.cs +++ b/OsmSharp.Wpf.UI/MapControl.cs @@ -9,6 +9,7 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Threading; +using OsmSharp.IO.Json; using OsmSharp.Math.Geo; using OsmSharp.Math.Geo.Projections; using OsmSharp.Math.Primitives; @@ -702,21 +703,21 @@ public void ZoomOut(float delta = 0.2f) { MapZoom -= delta; } - public void ZoomToCoordinate(GeoCoordinate coordinate) + public void ZoomToCoordinate(GeoCoordinate coordinate, float maxZoom = 19) { SuspendNotifyMapViewChanged(); MapCenter = coordinate; - MapZoom = new GeoCoordinateBox(coordinate, coordinate).GetZoomLevel(); + MapZoom = System.Math.Min(new GeoCoordinateBox(coordinate, coordinate).GetZoomLevel(), maxZoom); ResumeNotifyMapViewChanged(); } - public void ZoomToBox(GeoCoordinateBox box) + public void ZoomToBox(GeoCoordinateBox box, float maxZoom = 19) { SuspendNotifyMapViewChanged(); MapCenter = box.Center; - MapZoom = box.GetZoomLevel(); + MapZoom = System.Math.Min(box.GetZoomLevel(), maxZoom); ResumeNotifyMapViewChanged(); } From 7b27dcc08c6e89e1717f8906255799688b8eabf9 Mon Sep 17 00:00:00 2001 From: Evgeniy Shchurakovskiy Date: Fri, 1 Jul 2016 13:25:24 +0300 Subject: [PATCH 19/33] Add tool tip --- OsmSharp.UI/Map/Layers/Layer.cs | 25 +++ OsmSharp.UI/Renderer/Primitives/Icon2D.cs | 6 - OsmSharp.UI/Renderer/Primitives/Line2D.cs | 10 -- OsmSharp.UI/Renderer/Primitives/LineText2D.cs | 6 - OsmSharp.UI/Renderer/Primitives/Point2D.cs | 10 -- OsmSharp.UI/Renderer/Primitives/Polygon2D.cs | 10 -- .../Renderer/Primitives/Primitive2D.cs | 11 ++ OsmSharp.UI/Renderer/Primitives/Text2D.cs | 6 - OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs | 15 +- .../Extensions/GeoCoordinateBoxExtensions.cs | 5 + OsmSharp.Wpf.UI/MapControl.cs | 145 ++++++++++++++++-- OsmSharp.Wpf.UI/MapSceneManager.cs | 65 ++++++++ OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj | 9 ++ OsmSharp.Wpf.UI/Renderer/DrawingRenderer2D.cs | 1 + OsmSharp.Wpf.UI/Views/TextToolTipView.xaml | 15 ++ OsmSharp.Wpf.UI/Views/TextToolTipView.xaml.cs | 19 +++ 16 files changed, 287 insertions(+), 71 deletions(-) create mode 100644 OsmSharp.Wpf.UI/Views/TextToolTipView.xaml create mode 100644 OsmSharp.Wpf.UI/Views/TextToolTipView.xaml.cs diff --git a/OsmSharp.UI/Map/Layers/Layer.cs b/OsmSharp.UI/Map/Layers/Layer.cs index bebe441a..c4ded10e 100644 --- a/OsmSharp.UI/Map/Layers/Layer.cs +++ b/OsmSharp.UI/Map/Layers/Layer.cs @@ -156,6 +156,31 @@ public bool IsVisible /// public object Tag { get; set; } + /// + /// Returns all primitives from this layer that exist for the given zoom factor and inside the given view. + /// + /// + /// + /// + /// + public virtual IEnumerable Load(GeoCoordinateBox box, float zoomLevel, IProjection projection) + { + var topLeft = projection.ToPixel(box.TopLeft); + var bottomRight = projection.ToPixel(box.BottomRight); + var zoomFactor = projection.ToZoomFactor(zoomLevel); + var view = View2D.CreateFromBounds(topLeft[1], topLeft[0], bottomRight[1], bottomRight[0]); + + return Get((float)zoomFactor, view); + } + /// + /// Returns all primitives from this layer that exist for the given zoom factor and inside the given view. + /// + /// + public virtual IEnumerable Load(View2D view, float zoomFactor) + { + return Get(zoomFactor, view); + } + /// /// Pauses all activities in this layer. /// diff --git a/OsmSharp.UI/Renderer/Primitives/Icon2D.cs b/OsmSharp.UI/Renderer/Primitives/Icon2D.cs index 65830348..f8f13d21 100644 --- a/OsmSharp.UI/Renderer/Primitives/Icon2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Icon2D.cs @@ -76,12 +76,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.Icon2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag { get; set; } - /// /// Gets or sets the x. /// diff --git a/OsmSharp.UI/Renderer/Primitives/Line2D.cs b/OsmSharp.UI/Renderer/Primitives/Line2D.cs index 08f47008..b4ae4b0b 100644 --- a/OsmSharp.UI/Renderer/Primitives/Line2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Line2D.cs @@ -169,16 +169,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.Line2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag - { - get; - set; - } - /// /// Gets or sets the x. /// diff --git a/OsmSharp.UI/Renderer/Primitives/LineText2D.cs b/OsmSharp.UI/Renderer/Primitives/LineText2D.cs index 92160652..5311d0b6 100644 --- a/OsmSharp.UI/Renderer/Primitives/LineText2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/LineText2D.cs @@ -168,12 +168,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.LineText2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag { get; set; } - /// /// Gets or sets the text. /// diff --git a/OsmSharp.UI/Renderer/Primitives/Point2D.cs b/OsmSharp.UI/Renderer/Primitives/Point2D.cs index 3f6ca04c..5a30c20e 100644 --- a/OsmSharp.UI/Renderer/Primitives/Point2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Point2D.cs @@ -59,16 +59,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.Point2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag - { - get; - set; - } - /// /// Gets or sets the x. /// diff --git a/OsmSharp.UI/Renderer/Primitives/Polygon2D.cs b/OsmSharp.UI/Renderer/Primitives/Polygon2D.cs index c59137c8..d43e05aa 100644 --- a/OsmSharp.UI/Renderer/Primitives/Polygon2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Polygon2D.cs @@ -164,16 +164,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.Polygon2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag - { - get; - set; - } - /// /// Gets or sets the x. /// diff --git a/OsmSharp.UI/Renderer/Primitives/Primitive2D.cs b/OsmSharp.UI/Renderer/Primitives/Primitive2D.cs index 957e84ae..2a9f04ec 100644 --- a/OsmSharp.UI/Renderer/Primitives/Primitive2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Primitive2D.cs @@ -55,5 +55,16 @@ public abstract class Primitive2D /// Gets or sets the layer. /// public uint Layer { get; set; } + + /// + /// Gets or sets the tag. + /// + /// The tag. + public object Tag { get; set; } + /// + /// Gets or sets the tool tip. + /// + /// The tag. + public object ToolTip { get; set; } } } \ No newline at end of file diff --git a/OsmSharp.UI/Renderer/Primitives/Text2D.cs b/OsmSharp.UI/Renderer/Primitives/Text2D.cs index e37fa26c..542bfd9a 100644 --- a/OsmSharp.UI/Renderer/Primitives/Text2D.cs +++ b/OsmSharp.UI/Renderer/Primitives/Text2D.cs @@ -94,12 +94,6 @@ public override Primitive2DType Primitive2DType get { return Primitives.Primitive2DType.Text2D; } } - /// - /// Gets or sets the tag. - /// - /// The tag. - public object Tag { get; set; } - /// /// Gets/sets the color. /// diff --git a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs index 7db17746..00051d2c 100644 --- a/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs +++ b/OsmSharp.Wpf.UI.Sample/MainWindow.xaml.cs @@ -96,6 +96,7 @@ protected override IEnumerable Get(float zoomFactor, View2D view) var point = _projection.ToPixel(box.Center.Latitude, box.Center.Longitude); var p = new Icon2D(point[0], point[1], Create("")); + p.ToolTip = "Подсказка"; result.Add(p); return result; @@ -164,19 +165,7 @@ public static byte[] Create(string key) encoder.Save(stream); result = stream.ToArray(); } - try - { - using (var s = File.Create("E:\\test.png")) - { - s.Write(result, 0, result.Length); - } - - } - catch (Exception exc) - { - - throw; - } + } catch (Exception) { diff --git a/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs index 1a1feb94..e95fc008 100644 --- a/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs +++ b/OsmSharp.Wpf.UI/Extensions/GeoCoordinateBoxExtensions.cs @@ -49,5 +49,10 @@ public static float GetZoomLevel(this GeoCoordinateBox box) } return level; } + + public static GeoCoordinateBox ToBox(this GeoCoordinate coordinate) + { + return new GeoCoordinateBox(coordinate, coordinate).Resize(0.001); + } } } diff --git a/OsmSharp.Wpf.UI/MapControl.cs b/OsmSharp.Wpf.UI/MapControl.cs index 2b7aa3b2..bd1d37b6 100644 --- a/OsmSharp.Wpf.UI/MapControl.cs +++ b/OsmSharp.Wpf.UI/MapControl.cs @@ -4,8 +4,11 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Threading; +using System.Timers; using System.Windows; using System.Windows.Controls; +using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Threading; @@ -17,9 +20,11 @@ using OsmSharp.UI.Map; using OsmSharp.UI.Map.Layers; using OsmSharp.UI.Renderer; +using OsmSharp.UI.Renderer.Primitives; using OsmSharp.Units.Angle; using OsmSharp.Wpf.UI.Extensions; using OsmSharp.Wpf.UI.Renderer; +using OsmSharp.Wpf.UI.Views; using TraceEventType = OsmSharp.Logging.TraceEventType; namespace OsmSharp.Wpf.UI @@ -39,10 +44,16 @@ public class MapControl : FrameworkElement, IMapView, INotifyPropertyChanged private LayerPrimitives _canvas; private Point? _draggingCoordinates; + private Point? _toolTipCoordinates; private bool _isReady; private bool _isSuspendNotifyMapViewChanged; + private readonly Popup _toolTip; + private readonly DispatcherTimer _toolTipShowTimer; + private readonly DispatcherTimer _toolTipHideTimer; + private CancellationTokenSource _toolTipCancellationTokenSource; + #endregion fields #region constructors @@ -79,6 +90,19 @@ public MapControl() showFullMapBind.Executed += (sender, args) => ShowFullMap(); showFullMapBind.CanExecute += (sender, args) => args.CanExecute = true; CommandBindings.Add(showFullMapBind); + + _toolTip = new Popup + { + PlacementTarget = this, + Placement = PlacementMode.Relative, + AllowsTransparency = true + }; + _toolTip.MouseEnter += (sender, args) => { _toolTipHideTimer.Stop(); }; + + _toolTipShowTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(500)}; + _toolTipShowTimer.Tick += (sender, args) => ShowToolTip(); + _toolTipHideTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(500)}; + _toolTipHideTimer.Tick += (sender, args) => HideToolTip(); } #endregion constructors @@ -530,6 +554,74 @@ private void InitializeMap() } } + private void StartShowToolTip() + { + _toolTipShowTimer.Stop(); + _toolTipShowTimer.Start(); + } + private void StartHideToolTip() + { + _toolTipShowTimer.Stop(); + if (_toolTip.IsOpen && !_toolTipHideTimer.IsEnabled) + { + _toolTipHideTimer.Start(); + } + } + private async void StartToolTilSearch() + { + if (_toolTipCoordinates != null) + { + _toolTipCancellationTokenSource = new CancellationTokenSource(); + + var geo = _mapSceneManager.ToGeoCoordinates(_toolTipCoordinates.Value); + var obj = await _mapSceneManager.SearchPrimitiveAsync(geo, _toolTipCancellationTokenSource.Token); + if (obj != null && obj.ToolTip != null) + { + if (obj.ToolTip is UIElement) + { + _toolTip.Child = (UIElement)obj.ToolTip; + } + else + { + _toolTip.Child = new TextToolTipView { Text = obj.ToolTip.ToString() }; + } + + _toolTip.HorizontalOffset = _toolTipCoordinates.Value.X + 10; + _toolTip.VerticalOffset = _toolTipCoordinates.Value.Y + 10; + _toolTip.IsOpen = true; + } + } + } + private void StopToolTipSearch() + { + if (_toolTipCancellationTokenSource != null) + { + _toolTipCancellationTokenSource.Cancel(false); + _toolTipCancellationTokenSource = null; + } + } + private void StopToolTip() + { + _toolTipHideTimer.Stop(); + _toolTipShowTimer.Stop(); + + StopToolTipSearch(); + } + + private void ShowToolTip() + { + _toolTipShowTimer.Stop(); + StopToolTipSearch(); + StartToolTilSearch(); + } + + private void HideToolTip() + { + _toolTipCancellationTokenSource.Cancel(false); + _toolTipHideTimer.Stop(); + _toolTip.IsOpen = false; + } + #endregion utils #region overrides @@ -545,6 +637,8 @@ protected override void OnMouseDown(MouseButtonEventArgs e) _draggingCoordinates = e.GetPosition(this); _mapSceneManager.Preview(); } + + StartHideToolTip(); RaiseOnMapMouseDown(e); } protected override void OnMouseUp(MouseButtonEventArgs e) @@ -568,14 +662,24 @@ protected override void OnMouseMove(MouseEventArgs e) var currentCoordinates = e.GetPosition(this); if (MapAllowPan && e.LeftButton == MouseButtonState.Pressed && _draggingCoordinates != null) { - var delta = new[] { _draggingCoordinates.Value.X - currentCoordinates.X, - _draggingCoordinates.Value.Y - currentCoordinates.Y}; - var newCenter = new Point(RenderSize.Width / 2.0d + delta[0], RenderSize.Height / 2.0d + delta[1]); + var delta = new[] + { + _draggingCoordinates.Value.X - currentCoordinates.X, + _draggingCoordinates.Value.Y - currentCoordinates.Y + }; + var newCenter = new Point(RenderSize.Width/2.0d + delta[0], RenderSize.Height/2.0d + delta[1]); MapCenter = _mapSceneManager.ToGeoCoordinates(newCenter); AdjustMapScene(); _mapSceneManager.Preview(MapCenter, MapZoom, MapTilt); } + else + { + StartHideToolTip(); + _toolTipCoordinates = currentCoordinates; + StartShowToolTip(); + } + RaiseOnMapMouseMove(e); } @@ -593,6 +697,15 @@ protected override void OnMouseLeave(MouseEventArgs e) _draggingCoordinates = null; } + if (!_toolTip.IsMouseOver) + { + StartHideToolTip(); + } + else + { + StopToolTip(); + } + ResumeNotifyMapViewChanged(false); } @@ -612,6 +725,9 @@ protected override void OnMouseWheel(MouseWheelEventArgs e) ResumeNotifyMapViewChanged(); } + + StartHideToolTip(); + RaiseOnMapMouseWheel(e); } @@ -636,6 +752,9 @@ protected override Size MeasureOverride(Size availableSize) AdjustMapScene(); var newSize = base.MeasureOverride(availableSize); _mapSceneManager.SetSceneSize(availableSize); + + StartHideToolTip(); + return newSize; } protected override void OnRender(DrawingContext drawingContext) @@ -705,19 +824,25 @@ public void ZoomOut(float delta = 0.2f) } public void ZoomToCoordinate(GeoCoordinate coordinate, float maxZoom = 19) { - SuspendNotifyMapViewChanged(); - - MapCenter = coordinate; - MapZoom = System.Math.Min(new GeoCoordinateBox(coordinate, coordinate).GetZoomLevel(), maxZoom); - - ResumeNotifyMapViewChanged(); + ZoomToBox(coordinate.ToBox(), maxZoom); } public void ZoomToBox(GeoCoordinateBox box, float maxZoom = 19) { SuspendNotifyMapViewChanged(); + var currentView = _mapSceneManager.CreateView(); + var currentPerimeter = currentView.Width*2 + currentView.Height*2; + + var topLeft = _mapSceneManager.Map.Projection.ToPixel(box.TopLeft); + var bottomRight = _mapSceneManager.Map.Projection.ToPixel(box.BottomRight); + var newPerimeter = (bottomRight[0] - topLeft[0])*2 + (bottomRight[1] - topLeft[1])*2; + var perimeterFactor = newPerimeter/currentPerimeter; + MapCenter = box.Center; - MapZoom = System.Math.Min(box.GetZoomLevel(), maxZoom); + if (perimeterFactor > 3 || perimeterFactor < 1/3f) + { + MapZoom = System.Math.Min(box.GetZoomLevel(), maxZoom); + } ResumeNotifyMapViewChanged(); } diff --git a/OsmSharp.Wpf.UI/MapSceneManager.cs b/OsmSharp.Wpf.UI/MapSceneManager.cs index 7de01c5a..a4e37d1c 100644 --- a/OsmSharp.Wpf.UI/MapSceneManager.cs +++ b/OsmSharp.Wpf.UI/MapSceneManager.cs @@ -1,11 +1,17 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; using OsmSharp.Math.Geo; +using OsmSharp.UI; using OsmSharp.UI.Map; using OsmSharp.UI.Renderer; +using OsmSharp.UI.Renderer.Primitives; using OsmSharp.Units.Angle; using OsmSharp.Wpf.UI.Renderer; @@ -229,6 +235,65 @@ public void View(GeoCoordinate center, double zoom, Degree tilt) PreviewComplete(); } + public async Task SearchPrimitiveAsync(GeoCoordinate coordinate, CancellationToken cancellationToken) + { + return await Task.Run(() => + { + var scene = CurrentScene; + var zoomFactor = (float) Map.Projection.ToZoomFactor(scene.Zoom); + var view = CreateView(CurrentScene); + var point = ToPixels(coordinate, scene); + var backColor = SimpleColor.FromKnownColor(KnownColor.Transparent).Value; + var objs = new List(); + + for (int i = 0; i < Map.LayerCount; i++) + { + if (cancellationToken.IsCancellationRequested) + { + return null; + } + var layer = Map[i]; + if (layer.IsLayerVisibleFor((float) scene.Zoom)) + { + objs.AddRange(layer.Load(view, zoomFactor)); + } + } + objs.Reverse(); + + foreach (var obj in objs.Where(o => o.ToolTip != null)) + { + if (cancellationToken.IsCancellationRequested) + { + return null; + } + + var context = new RenderContext(SceneSize); + _renderer.SceneRenderer.Render(context, view, zoomFactor, new[] {obj}, backColor); + var image = context.BuildScene(); + image.Freeze(); + + int bytePerPixel = (image.Format.BitsPerPixel + 7)/8; + int stride = image.PixelWidth*bytePerPixel; + byte[] data = new byte[stride*image.PixelHeight]; + image.CopyPixels(data, stride, 0); + + //Pbgra32 + var pixel = new byte[bytePerPixel]; + var offset = stride*(int) point.Y + (int) point.X*bytePerPixel; + + for (int i = 0; i < bytePerPixel; i++) + { + pixel[i] = data[offset + i]; + } + if (pixel.Any(p => p != 0)) + { + return obj; + } + } + return null; + }, cancellationToken); + } + #endregion methods } } \ No newline at end of file diff --git a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj index 30fdbb97..9593cb73 100644 --- a/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj +++ b/OsmSharp.Wpf.UI/OsmSharp.Wpf.UI.csproj @@ -80,6 +80,9 @@ + + TextToolTipView.xaml + @@ -93,6 +96,12 @@ + + + Designer + MSBuild:Compile + +