diff --git a/MapControl/Shared/MapBase.cs b/MapControl/Shared/MapBase.cs index c452e6ba..15a11c96 100644 --- a/MapControl/Shared/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -33,6 +33,8 @@ namespace MapControl { private const double MaximumZoomLevel = 22d; + public static TimeSpan TileFadeDuration { get; set; } = TimeSpan.FromSeconds(0.1); + public static readonly DependencyProperty MapLayerProperty = DependencyProperty.Register( nameof(MapLayer), typeof(UIElement), typeof(MapBase), new PropertyMetadata(null, (o, e) => ((MapBase)o).MapLayerPropertyChanged((UIElement)e.OldValue, (UIElement)e.NewValue))); @@ -61,10 +63,6 @@ namespace MapControl nameof(AnimationEasingFunction), typeof(EasingFunctionBase), typeof(MapBase), new PropertyMetadata(new QuadraticEase { EasingMode = EasingMode.EaseOut })); - public static readonly DependencyProperty TileFadeDurationProperty = DependencyProperty.Register( - nameof(TileFadeDuration), typeof(TimeSpan), typeof(MapBase), - new PropertyMetadata(Tile.FadeDuration, (o, e) => Tile.FadeDuration = (TimeSpan)e.NewValue)); - private PointAnimation centerAnimation; private DoubleAnimation zoomLevelAnimation; private DoubleAnimation headingAnimation; @@ -213,16 +211,6 @@ namespace MapControl set { SetValue(AnimationEasingFunctionProperty, value); } } - /// - /// Gets or sets the Duration of the Tile Opacity animation. - /// The default value is 0.2 seconds. - /// - public TimeSpan TileFadeDuration - { - get { return (TimeSpan)GetValue(TileFadeDurationProperty); } - set { SetValue(TileFadeDurationProperty, value); } - } - /// /// Gets the scaling factor from cartesian map coordinates to view coordinates, /// i.e. pixels per meter, as a read-only dependency property. diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 722f2a28..0a103e44 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -23,8 +23,8 @@ using System.Windows.Threading; namespace MapControl { /// - /// Map image layer. Fills the viewport with a single map image, e.g. provided by a Web Map Service. - /// The image must be provided by the abstract GetImageAsync method. + /// Displays a single map image, e.g. from a Web Map Service (WMS). + /// The image must be provided by the abstract GetImageAsync() method. /// public abstract class MapImageLayer : MapPanel, IMapLayer { @@ -335,13 +335,13 @@ namespace MapControl topImage.BeginAnimation(OpacityProperty, new DoubleAnimation { To = 1d, - Duration = Tile.FadeDuration + Duration = MapBase.TileFadeDuration }); bottomImage.BeginAnimation(OpacityProperty, new DoubleAnimation { To = 0d, - BeginTime = Tile.FadeDuration, + BeginTime = MapBase.TileFadeDuration, Duration = TimeSpan.Zero }); } diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index e471c041..71c02da3 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -17,7 +17,7 @@ using System.Windows.Media; namespace MapControl { /// - /// Fills the viewport with map tiles from a TileSource. + /// Displays web mercator map tiles. /// public class MapTileLayer : MapTileLayerBase { diff --git a/MapControl/Shared/Tile.cs b/MapControl/Shared/Tile.cs index 834c0a67..17928694 100644 --- a/MapControl/Shared/Tile.cs +++ b/MapControl/Shared/Tile.cs @@ -19,8 +19,6 @@ namespace MapControl { public partial class Tile { - public static TimeSpan FadeDuration { get; set; } = TimeSpan.FromSeconds(0.15); - public readonly int ZoomLevel; public readonly int X; public readonly int Y; @@ -46,7 +44,14 @@ namespace MapControl private void FadeIn() { - Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { From = 0d, To = 1d, Duration = FadeDuration, FillBehavior = FillBehavior.Stop }); + Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation + { + From = 0d, + To = 1d, + Duration = MapBase.TileFadeDuration, + FillBehavior = FillBehavior.Stop + }); + Image.Opacity = 1d; } } diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs index 1ca3c1d1..dbd3e863 100644 --- a/MapControl/Shared/WmtsTileLayer.cs +++ b/MapControl/Shared/WmtsTileLayer.cs @@ -15,6 +15,9 @@ using System.Windows; namespace MapControl { + /// + /// Displays map tiles from a Web Map Tile Service (WMTS). + /// public class WmtsTileLayer : MapTileLayerBase { public static readonly DependencyProperty CapabilitiesUriProperty = DependencyProperty.Register( @@ -37,12 +40,18 @@ namespace MapControl Loaded += OnLoaded; } + /// + /// The Uri of a XML file or web response that contains the service capabilities. + /// public Uri CapabilitiesUri { get { return (Uri)GetValue(CapabilitiesUriProperty); } set { SetValue(CapabilitiesUriProperty, value); } } + /// + /// The ows:Identifier of the Layer that should be displayed. If not set, the first Layer is displayed. + /// public string LayerIdentifier { get { return (string)GetValue(LayerIdentifierProperty); } diff --git a/MapControl/UWP/Tile.UWP.cs b/MapControl/UWP/Tile.UWP.cs index 30740773..43921b9f 100644 --- a/MapControl/UWP/Tile.UWP.cs +++ b/MapControl/UWP/Tile.UWP.cs @@ -16,7 +16,7 @@ namespace MapControl { Pending = false; - if (fadeIn && FadeDuration > TimeSpan.Zero) + if (fadeIn && MapBase.TileFadeDuration > TimeSpan.Zero) { if (image is BitmapImage bitmap && bitmap.UriSource != null) { diff --git a/MapControl/WPF/Tile.WPF.cs b/MapControl/WPF/Tile.WPF.cs index c35f88f0..1e4f43c5 100644 --- a/MapControl/WPF/Tile.WPF.cs +++ b/MapControl/WPF/Tile.WPF.cs @@ -15,7 +15,7 @@ namespace MapControl { Pending = false; - if (fadeIn && FadeDuration > TimeSpan.Zero) + if (fadeIn && MapBase.TileFadeDuration > TimeSpan.Zero) { if (image is BitmapSource bitmap && !bitmap.IsFrozen && bitmap.IsDownloading) {