mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Add IsBaseMapLayer property
This commit is contained in:
parent
681da9b625
commit
c17092cd38
|
|
@ -211,7 +211,7 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
var minZoomLevel = LoadBackgroundTiles
|
||||
var minZoomLevel = IsBaseMapLayer
|
||||
? Math.Max(TileMatrix.ZoomLevel - MaxBackgroundLevels, MinZoomLevel)
|
||||
: maxZoomLevel;
|
||||
|
||||
|
|
|
|||
|
|
@ -176,9 +176,14 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
protected bool LoadBackgroundTiles
|
||||
protected bool IsBaseMapLayer
|
||||
{
|
||||
get { return this == parentMap?.MapLayer; }
|
||||
get
|
||||
{
|
||||
return parentMap != null
|
||||
&& parentMap.Children.Count > 0
|
||||
&& parentMap.Children[0] == this;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnViewportChanged(object sender, ViewportChangedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -120,15 +120,15 @@ namespace MapControl
|
|||
var layersChanged = false;
|
||||
var maxScale = 1.001 * ParentMap.ViewTransform.Scale; // avoid rounding issues
|
||||
|
||||
// show all TileMatrix 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 (!LoadBackgroundTiles)
|
||||
if (!IsBaseMapLayer) // show only the last layer
|
||||
{
|
||||
currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - 1).ToList(); // last element only
|
||||
currentMatrixes = currentMatrixes.Skip(currentMatrixes.Count - 1).ToList();
|
||||
}
|
||||
else if (currentMatrixes.Count > MaxBackgroundLevels + 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Version>6.1.0</Version>
|
||||
<Authors>Clemens Fischer</Authors>
|
||||
|
|
|
|||
Loading…
Reference in a new issue