Update comments

This commit is contained in:
ClemensFischer 2022-11-30 22:18:45 +01:00
parent 9db1987ee5
commit 754e185c5d
20 changed files with 83 additions and 48 deletions

View file

@ -112,20 +112,26 @@ namespace MapControl
private bool UpdateChildLayers(WmtsTileMatrixSet tileMatrixSet)
{
var maxScale = 1.001 * ParentMap.ViewTransform.Scale; // avoid rounding issues
// Multiply scale by 1.001 to avoid rounding issues.
//
var maxScale = 1.001 * ParentMap.ViewTransform.Scale;
// show all WmtsTileMatrix layers with Scale <= maxScale, at least the first layer
// Show all WmtsTileMatrix layers with Scale <= maxScale, at least the first layer.
//
var currentMatrixes = tileMatrixSet.TileMatrixes
.Where((matrix, i) => i == 0 || matrix.Scale <= maxScale)
.ToList();
if (!IsBaseMapLayer) // show only the last layer
if (!IsBaseMapLayer)
{
// Show only the last layer.
//
currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - 1).ToList();
}
else if (currentMatrixes.Count > MaxBackgroundLevels + 1)
{
// Show not more than MaxBackgroundLevels + 1 layers.
//
currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - MaxBackgroundLevels - 1).ToList();
}