mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
Updated azimuthal projections
This commit is contained in:
parent
d5ee7bbfc0
commit
1bf4cab071
6 changed files with 93 additions and 39 deletions
|
|
@ -6,7 +6,7 @@ namespace MapControl
|
|||
{
|
||||
public virtual MapProjection GetProjection(string crsId)
|
||||
{
|
||||
MapProjection projection = crsId switch
|
||||
var projection = crsId switch
|
||||
{
|
||||
WebMercatorProjection.DefaultCrsId => new WebMercatorProjection(),
|
||||
WorldMercatorProjection.DefaultCrsId => new WorldMercatorProjection(),
|
||||
|
|
@ -26,17 +26,27 @@ namespace MapControl
|
|||
return projection ?? throw new NotSupportedException($"MapProjection \"{crsId}\" is not supported.");
|
||||
}
|
||||
|
||||
public MapProjection GetProjectionFromEpsgCode(string crsId) =>
|
||||
crsId.StartsWith("EPSG:") && int.TryParse(crsId.Substring(5), out int epsgCode) ? GetProjection(epsgCode) : null;
|
||||
|
||||
public virtual MapProjection GetProjection(int epsgCode) => epsgCode switch
|
||||
public virtual MapProjection GetProjection(int epsgCode)
|
||||
{
|
||||
var code when code >= Etrs89UtmProjection.FirstZoneEpsgCode && code <= Etrs89UtmProjection.LastZoneEpsgCode => new Etrs89UtmProjection(epsgCode % 100),
|
||||
var code when code >= Nad27UtmProjection.FirstZoneEpsgCode && code <= Nad27UtmProjection.LastZoneEpsgCode => new Nad27UtmProjection(epsgCode % 100),
|
||||
var code when code >= Nad83UtmProjection.FirstZoneEpsgCode && code <= Nad83UtmProjection.LastZoneEpsgCode => new Nad83UtmProjection(epsgCode % 100),
|
||||
var code when code >= Wgs84UtmProjection.FirstZoneNorthEpsgCode && code <= Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(epsgCode % 100, Hemisphere.North),
|
||||
var code when code >= Wgs84UtmProjection.FirstZoneSouthEpsgCode && code <= Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(epsgCode % 100, Hemisphere.South),
|
||||
_ => null
|
||||
};
|
||||
return epsgCode switch
|
||||
{
|
||||
var c when c is >= Etrs89UtmProjection.FirstZoneEpsgCode
|
||||
and <= Etrs89UtmProjection.LastZoneEpsgCode => new Etrs89UtmProjection(c % 100),
|
||||
var c when c is >= Nad27UtmProjection.FirstZoneEpsgCode
|
||||
and <= Nad27UtmProjection.LastZoneEpsgCode => new Nad27UtmProjection(c % 100),
|
||||
var c when c is >= Nad83UtmProjection.FirstZoneEpsgCode
|
||||
and <= Nad83UtmProjection.LastZoneEpsgCode => new Nad83UtmProjection(c % 100),
|
||||
var c when c is >= Wgs84UtmProjection.FirstZoneNorthEpsgCode
|
||||
and <= Wgs84UtmProjection.LastZoneNorthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.North),
|
||||
var c when c is >= Wgs84UtmProjection.FirstZoneSouthEpsgCode
|
||||
and <= Wgs84UtmProjection.LastZoneSouthEpsgCode => new Wgs84UtmProjection(c % 100, Hemisphere.South),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
protected MapProjection GetProjectionFromEpsgCode(string crsId)
|
||||
{
|
||||
return crsId.StartsWith("EPSG:") && int.TryParse(crsId.Substring(5), out int epsgCode) ? GetProjection(epsgCode) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue