mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
throw ArgumentException when projection could not be created
This commit is contained in:
parent
8e835e5475
commit
85cf0483ec
|
|
@ -166,7 +166,7 @@ namespace MapControl
|
|||
var epsgCode = geoKeyDirectory[i + 3];
|
||||
|
||||
mapProjection = MapProjectionFactory.Instance.GetProjection($"EPSG:{epsgCode}") ??
|
||||
throw new ArgumentException($"Can not create projection EPSG:{epsgCode}.");
|
||||
throw new ArgumentException($"Can not create MapProjection \"EPSG:{epsgCode}\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Copyright © 2024 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
|
|
@ -25,7 +26,7 @@ namespace MapControl.UiTools
|
|||
{
|
||||
#if WPF
|
||||
[ContentProperty(nameof(Projection))]
|
||||
#elif UWP || WINUI
|
||||
#elif UWP || WINUI
|
||||
[ContentProperty(Name = nameof(Projection))]
|
||||
#endif
|
||||
public class MapProjectionItem
|
||||
|
|
@ -101,7 +102,8 @@ namespace MapControl.UiTools
|
|||
if (selectedProjection != projection)
|
||||
{
|
||||
selectedProjection = projection;
|
||||
Map.MapProjection = MapProjectionFactory.Instance.GetProjection(selectedProjection);
|
||||
Map.MapProjection = MapProjectionFactory.Instance.GetProjection(selectedProjection) ??
|
||||
throw new ArgumentException($"Can not create MapProjection \"{selectedProjection}\".");
|
||||
}
|
||||
|
||||
UpdateCheckedStates();
|
||||
|
|
|
|||
Loading…
Reference in a new issue