Version 4.12. Added MapControl.Images project, fixed assembly signing

This commit is contained in:
ClemensF 2018-12-09 17:14:32 +01:00
parent 3310f58912
commit ac26c57a81
22 changed files with 1015 additions and 40 deletions

View file

@ -0,0 +1,86 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2018 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
namespace MapControl.Images
{
public partial class GroundOverlayPanel
{
private async Task<List<ImageOverlay>> ReadGroundOverlaysFromFile(string docFile)
{
if (!Path.IsPathRooted(docFile))
{
docFile = Path.Combine(Directory.GetCurrentDirectory(), docFile);
}
var docUri = new Uri(docFile);
var imageOverlays = await Task.Run(() =>
{
var kmlDocument = new XmlDocument();
kmlDocument.Load(docUri.ToString());
return ReadGroundOverlays(kmlDocument).ToList();
});
foreach (var imageOverlay in imageOverlays)
{
imageOverlay.ImageSource = await ImageLoader.LoadImageAsync(new Uri(docUri, imageOverlay.ImagePath));
}
return imageOverlays;
}
private Task<List<ImageOverlay>> ReadGroundOverlaysFromArchive(string archiveFile)
{
return Task.Run(() =>
{
using (var archive = ZipFile.OpenRead(archiveFile))
{
var docEntry = archive.GetEntry("doc.kml")
?? archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml"));
if (docEntry == null)
{
throw new ArgumentException("No KML entry found in " + archiveFile);
}
var kmlDocument = new XmlDocument();
using (var docStream = docEntry.Open())
{
kmlDocument.Load(docStream);
}
var imageOverlays = ReadGroundOverlays(kmlDocument).ToList();
foreach (var imageOverlay in imageOverlays)
{
var imageEntry = archive.GetEntry(imageOverlay.ImagePath);
if (imageEntry != null)
{
using (var zipStream = imageEntry.Open())
using (var memoryStream = new MemoryStream())
{
zipStream.CopyTo(memoryStream);
memoryStream.Position = 0;
imageOverlay.ImageSource = ImageLoader.LoadImage(memoryStream);
}
}
}
return imageOverlays;
}
});
}
}
}

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{52042F63-563A-45BB-9A08-A8635AAAB84C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.Images</RootNamespace>
<AssemblyName>MapImages.WPF</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\GroundOverlayPanel.cs">
<Link>GroundOverlayPanel.cs</Link>
</Compile>
<Compile Include="..\Shared\WorldFile.cs">
<Link>WorldFile.cs</Link>
</Compile>
<Compile Include="..\Shared\WorldFileParameters.cs">
<Link>WorldFileParameters.cs</Link>
</Compile>
<Compile Include="..\Shared\ZoomLevelToOpacityConverter.cs">
<Link>ZoomLevelToOpacityConverter.cs</Link>
</Compile>
<Compile Include="GroundOverlayPanel.WPF.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\WPF\MapControl.WPF.csproj">
<Project>{a204a102-c745-4d65-aec8-7b96faedef2d}</Project>
<Name>MapControl.WPF</Name>
</ProjectReference>
<ProjectReference Include="..\..\MapProjections\WPF\MapProjections.WPF.csproj">
<Project>{426c21c0-5f14-491f-bcd1-6d2993510420}</Project>
<Name>MapProjections.WPF</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control Image Support (WPF)")]
[assembly: AssemblyDescription("Image Support Library for XAML Map Control")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2018 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("4.12.0")]
[assembly: AssemblyFileVersion("4.12.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]