mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Version 4.12. Added MapControl.Images project, fixed assembly signing
This commit is contained in:
parent
3310f58912
commit
ac26c57a81
22 changed files with 1015 additions and 40 deletions
92
MapImages/UWP/GroundOverlayPanel.UWP.cs
Normal file
92
MapImages/UWP/GroundOverlayPanel.UWP.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// 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;
|
||||
using Windows.Storage;
|
||||
|
||||
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(async () =>
|
||||
{
|
||||
var file = await StorageFile.GetFileFromPathAsync(docFile);
|
||||
var kmlDocument = new XmlDocument();
|
||||
|
||||
using (var stream = await file.OpenReadAsync())
|
||||
{
|
||||
kmlDocument.Load(stream.AsStreamForRead());
|
||||
}
|
||||
|
||||
return ReadGroundOverlays(kmlDocument).ToList();
|
||||
});
|
||||
|
||||
foreach (var imageOverlay in imageOverlays)
|
||||
{
|
||||
imageOverlay.ImageSource = await ImageLoader.LoadImageAsync(new Uri(docUri, imageOverlay.ImagePath));
|
||||
}
|
||||
|
||||
return imageOverlays;
|
||||
}
|
||||
|
||||
private async Task<List<ImageOverlay>> ReadGroundOverlaysFromArchive(string archiveFile)
|
||||
{
|
||||
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 imageOverlays = await Task.Run(() =>
|
||||
{
|
||||
var kmlDocument = new XmlDocument();
|
||||
|
||||
using (var docStream = docEntry.Open())
|
||||
{
|
||||
kmlDocument.Load(docStream);
|
||||
}
|
||||
|
||||
return 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())
|
||||
{
|
||||
await zipStream.CopyToAsync(memoryStream);
|
||||
memoryStream.Position = 0;
|
||||
imageOverlay.ImageSource = await ImageLoader.LoadImageAsync(memoryStream.AsRandomAccessStream());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return imageOverlays;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
96
MapImages/UWP/MapImages.UWP.csproj
Normal file
96
MapImages/UWP/MapImages.UWP.csproj
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" 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>{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MapControl.Images</RootNamespace>
|
||||
<AssemblyName>MapImages.UWP</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.10586.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<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.UWP.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\MapImages.UWP.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.2.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
|
||||
<Project>{9545f73c-9c35-4cf6-baae-19a0baebd344}</Project>
|
||||
<Name>MapControl.UWP</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MapProjections\UWP\MapProjections.UWP.csproj">
|
||||
<Project>{9ee69591-5edc-45e3-893e-2f9a4b82d538}</Project>
|
||||
<Name>MapProjections.UWP</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\MapControl.snk">
|
||||
<Link>MapControl.snk</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
14
MapImages/UWP/Properties/AssemblyInfo.cs
Normal file
14
MapImages/UWP/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("XAML Map Control Image Support (UWP)")]
|
||||
[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)]
|
||||
33
MapImages/UWP/Properties/MapImages.UWP.rd.xml
Normal file
33
MapImages/UWP/Properties/MapImages.UWP.rd.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains Runtime Directives, specifications about types your application accesses
|
||||
through reflection and other dynamic code patterns. Runtime Directives are used to control the
|
||||
.NET Native optimizer and ensure that it does not remove code accessed by your library. If your
|
||||
library does not do any reflection, then you generally do not need to edit this file. However,
|
||||
if your library reflects over types, especially types passed to it or derived from its types,
|
||||
then you should write Runtime Directives.
|
||||
|
||||
The most common use of reflection in libraries is to discover information about types passed
|
||||
to the library. Runtime Directives have three ways to express requirements on types passed to
|
||||
your library.
|
||||
|
||||
1. Parameter, GenericParameter, TypeParameter, TypeEnumerableParameter
|
||||
Use these directives to reflect over types passed as a parameter.
|
||||
|
||||
2. SubTypes
|
||||
Use a SubTypes directive to reflect over types derived from another type.
|
||||
|
||||
3. AttributeImplies
|
||||
Use an AttributeImplies directive to indicate that your library needs to reflect over
|
||||
types or methods decorated with an attribute.
|
||||
|
||||
For more information on writing Runtime Directives for libraries, please visit
|
||||
https://go.microsoft.com/fwlink/?LinkID=391919
|
||||
-->
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Library Name="MapImages.UWP">
|
||||
|
||||
<!-- add directives for your library here -->
|
||||
|
||||
</Library>
|
||||
</Directives>
|
||||
Loading…
Add table
Add a link
Reference in a new issue