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

This commit is contained in:
ClemensF 2018-08-14 23:23:43 +02:00
parent 147b56260d
commit c8773cd551
7 changed files with 18 additions and 119 deletions

View file

@ -23,20 +23,6 @@ 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
@ -132,54 +118,10 @@ namespace ViewModel
{
Description = "© [SevenCs GmbH](http://www.sevencs.com)",
ServiceUri = new Uri("http://chartserver4.sevencs.com:8080"),
Layers = "ENC"
Layers = "ENC",
MaxBoundingBoxWidth = 360
}
},
{
"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";
@ -208,23 +150,17 @@ 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",
"ECDIS DAY_BRIGHT",
"ECDIS DAY_WHITEBACK",
"ECDIS DAY_BLACKBACK",
"ECDIS DUSK",
"ECDIS NIGHT",
"SevenCs ChartServer"
};
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).
@ -237,15 +173,6 @@ 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,11 +1,9 @@
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
{
@ -15,40 +13,11 @@ 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,9 +11,8 @@ 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();
}