mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
|
// © 2019 Clemens Fischer
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace MapControl.Images
|
|
{
|
|
public partial class GroundOverlayPanel
|
|
{
|
|
private static Task<List<ImageOverlay>> ReadGroundOverlaysFromFileAsync(string docFile)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
docFile = Path.GetFullPath(docFile);
|
|
|
|
var kmlDocument = new XmlDocument();
|
|
kmlDocument.Load(docFile);
|
|
|
|
var imageOverlays = ReadGroundOverlays(kmlDocument).ToList();
|
|
var docDir = Path.GetDirectoryName(docFile);
|
|
|
|
foreach (var imageOverlay in imageOverlays)
|
|
{
|
|
imageOverlay.ImageSource = ImageLoader.LoadImage(Path.Combine(docDir, imageOverlay.ImagePath));
|
|
}
|
|
|
|
return imageOverlays;
|
|
});
|
|
}
|
|
}
|
|
}
|