Version 4.10.0: Updated target framework versions. Cleanup of TypeConverters, ImageLoader, MBTileSource.

This commit is contained in:
ClemensF 2018-08-14 23:13:58 +02:00
parent f2a9dd9d0d
commit d859a9c4f9
7 changed files with 123 additions and 14 deletions

View file

@ -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();
}
}
}

View file

@ -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)

View file

@ -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();
}