mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.10.0: Updated target framework versions. Cleanup of TypeConverters, ImageLoader, MBTileSource.
This commit is contained in:
parent
f2a9dd9d0d
commit
d859a9c4f9
|
|
@ -34,7 +34,7 @@ namespace MapControl
|
|||
{
|
||||
imageSource = await LoadLocalImageAsync(uri);
|
||||
}
|
||||
else if (uri.Scheme == "http")
|
||||
else if (uri.Scheme == "http" || uri.Scheme == "https")
|
||||
{
|
||||
imageSource = await LoadHttpImageAsync(uri);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MapControl
|
|||
{
|
||||
SourceName = "OpenStreetMap",
|
||||
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png" },
|
||||
TileSource = new TileSource { UriFormat = "https://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png" },
|
||||
MaxZoomLevel = 19
|
||||
};
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ namespace MapControl
|
|||
|
||||
if (equivalentTile != null)
|
||||
{
|
||||
tile.SetImage(equivalentTile.Image.Source, false); // do not animate to avoid flicker when crossing 180° longitude
|
||||
tile.SetImage(equivalentTile.Image.Source, false); // no fade-in animation
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { To = 1d, Duration = FadeDuration });
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { From = 0d, To = 1d, Duration = FadeDuration, FillBehavior = FillBehavior.Stop });
|
||||
Image.Opacity = 1d;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -46,7 +47,8 @@ namespace MapControl
|
|||
bitmapImage.ImageOpened -= BitmapImageOpened;
|
||||
bitmapImage.ImageFailed -= BitmapImageFailed;
|
||||
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { To = 1d, Duration = FadeDuration });
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { From = 0d, To = 1d, Duration = FadeDuration, FillBehavior = FillBehavior.Stop });
|
||||
Image.Opacity = 1d;
|
||||
}
|
||||
|
||||
private void BitmapImageFailed(object sender, ExceptionRoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(1d, FadeDuration));
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(0d, 1d, FadeDuration, FillBehavior.Stop));
|
||||
Image.Opacity = 1d;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -46,7 +47,8 @@ namespace MapControl
|
|||
bitmapSource.DownloadCompleted -= BitmapDownloadCompleted;
|
||||
bitmapSource.DownloadFailed -= BitmapDownloadFailed;
|
||||
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(1d, FadeDuration));
|
||||
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(0d, 1d, FadeDuration, FillBehavior.Stop));
|
||||
Image.Opacity = 1d;
|
||||
}
|
||||
|
||||
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,20 @@ namespace ViewModel
|
|||
"OpenStreetMap",
|
||||
MapTileLayer.OpenStreetMapTileLayer
|
||||
},
|
||||
{
|
||||
"OpenStreetMap Files",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "OpenStreetMap Files",
|
||||
Description = "© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)",
|
||||
#if WINDOWS_UWP
|
||||
TileSource = new TileSource { UriFormat = @"C:\Users\Clemens\AppData\Local\Packages\XamlMapControl.UniversalApp_2kan67jdewwkc\TempState\OpenStreetMap\{z}\{x}\{y}.png" },
|
||||
#else
|
||||
TileSource = new TileSource { UriFormat = @"C:\ProgramData\MapControl\TileCache\OpenStreetMap\{z}\{x}\{y}.png" },
|
||||
#endif
|
||||
MaxZoomLevel = 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"OpenStreetMap German",
|
||||
new MapTileLayer
|
||||
|
|
@ -118,10 +132,54 @@ namespace ViewModel
|
|||
{
|
||||
Description = "© [SevenCs GmbH](http://www.sevencs.com)",
|
||||
ServiceUri = new Uri("http://chartserver4.sevencs.com:8080"),
|
||||
Layers = "ENC",
|
||||
MaxBoundingBoxWidth = 360
|
||||
Layers = "ENC"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECDIS DAY_BRIGHT",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "ECDIS WMS DAY_BRIGHT",
|
||||
ServiceUri = new Uri("http://as113121:8080/ECDIS?LAYERS=ENC&LIGHTS=TRUE&COLOR=0&DETAILS=2")
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECDIS DAY_WHITEBACK",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "ECDIS WMS DAY_WHITEBACK",
|
||||
ServiceUri = new Uri("http://as113121:8080/ECDIS?LAYERS=ENC&LIGHTS=TRUE&COLOR=1&DETAILS=2")
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECDIS DAY_BLACKBACK",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "ECDIS WMS DAY_BLACKBACK",
|
||||
ServiceUri = new Uri("http://as113121:8080/ECDIS?LAYERS=ENC&LIGHTS=TRUE&COLOR=2&DETAILS=2"),
|
||||
MapForeground = new SolidColorBrush(Colors.White)
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECDIS DUSK",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "ECDIS WMS DUSK",
|
||||
ServiceUri = new Uri("http://as113121:8080/ECDIS?LAYERS=ENC&LIGHTS=TRUE&COLOR=3&DETAILS=2"),
|
||||
MapForeground = new SolidColorBrush(Colors.Gray),
|
||||
MapBackground = new SolidColorBrush(Colors.Black)
|
||||
}
|
||||
},
|
||||
{
|
||||
"ECDIS NIGHT",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "ECDIS WMS NIGHT",
|
||||
ServiceUri = new Uri("http://as113121:8080/ECDIS?LAYERS=ENC&LIGHTS=TRUE&COLOR=4&DETAILS=2"),
|
||||
MapForeground = new SolidColorBrush(Colors.Gray),
|
||||
MapBackground = new SolidColorBrush(Colors.Black)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
private string currentMapLayerName = "OpenStreetMap";
|
||||
|
|
@ -150,17 +208,23 @@ namespace ViewModel
|
|||
public List<string> MapLayerNames { get; } = new List<string>
|
||||
{
|
||||
"OpenStreetMap",
|
||||
"OpenStreetMap Files",
|
||||
"OpenStreetMap German",
|
||||
"Stamen Terrain",
|
||||
"Stamen Toner Light",
|
||||
"OpenStreetMap WMS",
|
||||
"OpenStreetMap TOPO WMS",
|
||||
"SevenCs ChartServer"
|
||||
"SevenCs ChartServer",
|
||||
"ECDIS DAY_BRIGHT",
|
||||
"ECDIS DAY_WHITEBACK",
|
||||
"ECDIS DAY_BLACKBACK",
|
||||
"ECDIS DUSK",
|
||||
"ECDIS NIGHT",
|
||||
};
|
||||
|
||||
public MapLayers()
|
||||
{
|
||||
//BingMapsTileLayer.ApiKey = "...";
|
||||
BingMapsTileLayer.ApiKey = "";
|
||||
|
||||
// Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
// (see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
|
|
@ -173,6 +237,15 @@ namespace ViewModel
|
|||
MapLayerNames.Add("Bing Maps Aerial");
|
||||
MapLayerNames.Add("Bing Maps Aerial with Labels");
|
||||
}
|
||||
|
||||
//var t = new System.Windows.Threading.DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
|
||||
//t.Tick += async (s, e) =>
|
||||
//{
|
||||
// var layers = await ((WmsImageLayer)mapLayers["OpenStreetMap WMS"]).GetLayerNamesAsync();
|
||||
// System.Diagnostics.Debug.WriteLine(string.Join(", ", layers));
|
||||
// t.Stop();
|
||||
//};
|
||||
//t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
using MapControl;
|
||||
using MapControl.Caching;
|
||||
using ViewModel;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace UniversalApp
|
||||
{
|
||||
|
|
@ -13,11 +15,40 @@ namespace UniversalApp
|
|||
|
||||
public MainPage()
|
||||
{
|
||||
//TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
|
||||
InitializeComponent();
|
||||
DataContext = ViewModel;
|
||||
|
||||
for (var x = -180d; x < 180d; x += 15d)
|
||||
{
|
||||
var location = new Location(0d, x);
|
||||
|
||||
var locations = new LocationCollection
|
||||
{
|
||||
new Location(0, x - 5),
|
||||
new Location(5, x),
|
||||
new Location(0, x + 5),
|
||||
new Location(-5, x)
|
||||
};
|
||||
|
||||
map.Children.Add(new MapPolygon
|
||||
{
|
||||
Fill = new SolidColorBrush(Colors.Red) { Opacity = 0.25 },
|
||||
Stroke = new SolidColorBrush(Colors.Red),
|
||||
StrokeThickness = 2,
|
||||
StrokeLineJoin = PenLineJoin.Round,
|
||||
Locations = locations,
|
||||
Location = location,
|
||||
});
|
||||
|
||||
map.Children.Add(new Pushpin
|
||||
{
|
||||
Content = x,
|
||||
Location = location,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ namespace WpfApplication
|
|||
{
|
||||
public MainWindow()
|
||||
{
|
||||
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = null;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue