Minor improvements

This commit is contained in:
ClemensFischer 2022-12-13 22:12:49 +01:00
parent 91879054fa
commit 7cf4ed47a3
4 changed files with 9 additions and 9 deletions

View file

@ -179,10 +179,10 @@ namespace MapControl
{ {
if (geoKeyDirectory[i] == ProjectedCRSGeoKey && geoKeyDirectory[i + 1] == 0) if (geoKeyDirectory[i] == ProjectedCRSGeoKey && geoKeyDirectory[i + 1] == 0)
{ {
var crsId = $"EPSG:{geoKeyDirectory[i + 3]}"; int epsgCode = geoKeyDirectory[i + 3];
projection = MapProjection.Factory.GetProjection(crsId) ?? projection = MapProjection.Factory.GetProjection(epsgCode) ??
throw new ArgumentException($"Can not create projection {crsId} in {sourcePath}."); throw new ArgumentException($"Can not create projection EPSG:{epsgCode} in {sourcePath}.");
break; break;
} }

View file

@ -131,8 +131,8 @@ namespace MapControl
{ {
using (var archive = await Task.Run(() => ZipFile.OpenRead(archiveFilePath))) using (var archive = await Task.Run(() => ZipFile.OpenRead(archiveFilePath)))
{ {
var docEntry = await Task.Run(() => archive.GetEntry("doc.kml") var docEntry = await Task.Run(() => archive.GetEntry("doc.kml") ??
?? archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml"))); archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml")));
if (docEntry == null) if (docEntry == null)
{ {

View file

@ -142,8 +142,8 @@ namespace MapControl
foreach (var tileMatrix in currentMatrixes) foreach (var tileMatrix in currentMatrixes)
{ {
var layer = currentLayers.FirstOrDefault(l => l.WmtsTileMatrix == tileMatrix) var layer = currentLayers.FirstOrDefault(l => l.WmtsTileMatrix == tileMatrix) ??
?? new WmtsTileMatrixLayer(tileMatrix, tileMatrixSet.TileMatrixes.IndexOf(tileMatrix)); new WmtsTileMatrixLayer(tileMatrix, tileMatrixSet.TileMatrixes.IndexOf(tileMatrix));
if (layer.UpdateTiles(ParentMap.ViewTransform, ParentMap.RenderSize)) if (layer.UpdateTiles(ParentMap.ViewTransform, ParentMap.RenderSize))
{ {

View file

@ -72,8 +72,8 @@ namespace MapControl.Projections
} }
else else
{ {
var projection = coordinateSystem.Projection var projection = coordinateSystem.Projection ??
?? throw new ArgumentException("CoordinateSystem.Projection must not be null.", nameof(value)); throw new ArgumentException("CoordinateSystem.Projection must not be null.", nameof(value));
var centralMeridian = projection.GetParameter("central_meridian") ?? projection.GetParameter("longitude_of_origin"); var centralMeridian = projection.GetParameter("central_meridian") ?? projection.GetParameter("longitude_of_origin");
var centralParallel = projection.GetParameter("central_parallel") ?? projection.GetParameter("latitude_of_origin"); var centralParallel = projection.GetParameter("central_parallel") ?? projection.GetParameter("latitude_of_origin");