XAML-Map-Control/MapControl/Shared/MapProjectionFactory.cs

59 lines
1.9 KiB
C#
Raw Normal View History

2022-01-19 16:43:00 +01:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2024-02-03 21:01:53 +01:00
// Copyright © 2024 Clemens Fischer
2022-01-19 16:43:00 +01:00
// Licensed under the Microsoft Public License (Ms-PL)
namespace MapControl
{
public class MapProjectionFactory
{
private static MapProjectionFactory instance;
public static MapProjectionFactory Instance
{
get => instance ?? (instance = new MapProjectionFactory());
set => instance = value;
}
2024-07-12 14:14:42 +02:00
public virtual MapProjection GetProjection(string crsId)
2022-01-19 16:43:00 +01:00
{
2024-07-12 14:14:42 +02:00
switch (crsId)
2022-01-19 16:43:00 +01:00
{
2024-07-12 14:14:42 +02:00
case WebMercatorProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new WebMercatorProjection();
2022-01-19 16:43:00 +01:00
2024-07-12 14:14:42 +02:00
case WorldMercatorProjection.DefaultCrsId:
return new WorldMercatorProjection();
case EquirectangularProjection.DefaultCrsId:
2024-08-03 23:42:09 +02:00
case "CRS:84":
case "EPSG:4087":
return new EquirectangularProjection(crsId);
2022-01-19 16:43:00 +01:00
2024-07-12 14:14:42 +02:00
case UpsNorthProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new UpsNorthProjection();
2024-07-12 14:14:42 +02:00
case UpsSouthProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new UpsSouthProjection();
2022-01-19 16:43:00 +01:00
case OrthographicProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new OrthographicProjection();
2022-01-19 16:43:00 +01:00
case AutoEquirectangularProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new AutoEquirectangularProjection();
2022-01-19 16:43:00 +01:00
case GnomonicProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new GnomonicProjection();
2022-01-19 16:43:00 +01:00
case StereographicProjection.DefaultCrsId:
2024-07-12 13:57:27 +02:00
return new StereographicProjection();
2022-01-19 16:43:00 +01:00
2024-07-12 13:57:27 +02:00
case AzimuthalEquidistantProjection.DefaultCrsId:
return new AzimuthalEquidistantProjection();
2022-01-22 20:32:17 +01:00
2024-07-12 14:14:42 +02:00
default:
return null;
}
}
2022-01-19 16:43:00 +01:00
}
}