Compare commits

...

4 commits

Author SHA1 Message Date
ClemensFischer 16d477a31d Update MapScale.cs 2025-11-15 00:38:02 +01:00
ClemensFischer 2ec8b1b987 Simplified new expressions 2025-11-15 00:33:32 +01:00
ClemensFischer ae0ebc6fdb MapTileLayer/WmtsTileMatrixLayer MeasureOverride 2025-11-15 00:19:12 +01:00
ClemensFischer c594727711 Removed partial declarations 2025-11-14 23:59:24 +01:00
20 changed files with 29 additions and 34 deletions

View file

@ -12,7 +12,7 @@ namespace MapControl
public class ImageTile(int zoomLevel, int x, int y, int columnCount)
: Tile(zoomLevel, x, y, columnCount)
{
public Image Image { get; } = new Image { Stretch = Stretch.Fill };
public Image Image { get; } = new() { Stretch = Stretch.Fill };
public override async Task LoadImageAsync(Func<Task<IImage>> loadImageFunc)
{

View file

@ -26,7 +26,7 @@ using Avalonia.Media;
namespace MapControl
{
public partial class GroundOverlay : MapPanel
public class GroundOverlay : MapPanel
{
private class ImageOverlay
{
@ -39,7 +39,7 @@ namespace MapControl
public string ImagePath { get; }
public Image Image { get; } = new Image { Stretch = Stretch.Fill };
public Image Image { get; } = new() { Stretch = Stretch.Fill };
public async Task LoadImage(Uri docUri)
{

View file

@ -23,7 +23,7 @@ namespace MapControl.Caching
/// IDistributedCache implementation that creates a single file per cache entry.
/// The cache expiration time is stored in the file's CreationTime property.
/// </summary>
public sealed partial class ImageFileCache : IDistributedCache, IDisposable
public sealed class ImageFileCache : IDistributedCache, IDisposable
{
private readonly MemoryDistributedCache memoryCache;
private readonly DirectoryInfo rootDirectory;

View file

@ -3,7 +3,7 @@ using System.Linq;
namespace MapControl
{
public partial class ImageTileList : List<ImageTile>
public class ImageTileList : List<ImageTile>
{
/// <summary>
/// Adds existing ImageTile from the source collection or newly created ImageTile to fill the specified tile matrix.

View file

@ -13,7 +13,7 @@ namespace MapControl
#else
[System.ComponentModel.TypeConverter(typeof(LocationCollectionConverter))]
#endif
public partial class LocationCollection : List<Location>
public class LocationCollection : List<Location>
{
public LocationCollection()
{

View file

@ -174,7 +174,7 @@ namespace MapControl
/// Gets the ViewTransform instance that is used to transform between projected
/// map coordinates and view coordinates.
/// </summary>
public ViewTransform ViewTransform { get; } = new ViewTransform();
public ViewTransform ViewTransform { get; } = new();
/// <summary>
/// Gets the map scale as horizontal and vertical scaling factors from meters to

View file

@ -16,7 +16,7 @@ namespace MapControl
/// Such elements are arranged at a distance of BorderWidth/2 from the edges of the
/// MapBorderPanel in direction of their original azimuth from the map center.
/// </summary>
public partial class MapBorderPanel : MapPanel
public class MapBorderPanel : MapPanel
{
public static readonly DependencyProperty BorderWidthProperty =
DependencyPropertyHelper.Register<MapBorderPanel, double>(nameof(BorderWidth));

View file

@ -17,7 +17,7 @@ namespace MapControl
/// for the Polygons property if collection changes of the property itself and its
/// elements are both supposed to trigger UI updates.
/// </summary>
public partial class MapMultiPolygon : MapPolypoint
public class MapMultiPolygon : MapPolypoint
{
public static readonly DependencyProperty PolygonsProperty =
DependencyPropertyHelper.Register<MapMultiPolygon, IEnumerable<IEnumerable<Location>>>(nameof(Polygons), null,

View file

@ -16,7 +16,7 @@ namespace MapControl
/// <summary>
/// A MapPanel with a collection of GroundOverlay or GeoImage children.
/// </summary>
public partial class MapOverlaysPanel : MapPanel
public class MapOverlaysPanel : MapPanel
{
public static readonly DependencyProperty SourcePathsProperty =
DependencyPropertyHelper.Register<MapOverlaysPanel, IEnumerable<string>>(nameof(SourcePaths), null,

View file

@ -1,5 +1,4 @@
using System.Linq;
#if WPF
#if WPF
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@ -177,7 +176,7 @@ namespace MapControl
{
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
foreach (var element in Children.Cast<FrameworkElement>())
foreach (FrameworkElement element in Children)
{
element.Measure(availableSize);
}
@ -189,7 +188,7 @@ namespace MapControl
{
if (parentMap != null)
{
foreach (var element in Children.Cast<FrameworkElement>())
foreach (FrameworkElement element in Children)
{
ArrangeChildElement(element, finalSize);
}

View file

@ -12,7 +12,7 @@ namespace MapControl
/// <summary>
/// A polygon defined by a collection of Locations.
/// </summary>
public partial class MapPolygon : MapPolypoint
public class MapPolygon : MapPolypoint
{
public static readonly DependencyProperty LocationsProperty =
DependencyPropertyHelper.Register<MapPolygon, IEnumerable<Location>>(nameof(Locations), null,

View file

@ -12,7 +12,7 @@ namespace MapControl
/// <summary>
/// A polyline defined by a collection of Locations.
/// </summary>
public partial class MapPolyline : MapPolypoint
public class MapPolyline : MapPolypoint
{
public static readonly DependencyProperty LocationsProperty =
DependencyPropertyHelper.Register<MapPolyline, IEnumerable<Location>>(nameof(Locations), null,

View file

@ -35,7 +35,7 @@ namespace MapControl
/// <summary>
/// Draws a map scale overlay.
/// </summary>
public partial class MapScale : MapPanel
public class MapScale : MapPanel
{
public static readonly DependencyProperty PaddingProperty =
DependencyPropertyHelper.Register<MapScale, Thickness>(nameof(Padding), new Thickness(4));
@ -55,9 +55,9 @@ namespace MapControl
set => SetValue(StrokeThicknessProperty, value);
}
private readonly Polyline line = new Polyline();
private readonly Polyline line = new();
private readonly TextBlock label = new TextBlock
private readonly TextBlock label = new()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center

View file

@ -22,7 +22,7 @@ namespace MapControl
/// <summary>
/// Displays a Web Mercator tile pyramid.
/// </summary>
public partial class MapTileLayer : TilePyramidLayer
public class MapTileLayer : TilePyramidLayer
{
private const int TileSize = 256;
@ -89,8 +89,6 @@ namespace MapControl
protected override Size MeasureOverride(Size availableSize)
{
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
foreach (var tile in Tiles)
{
tile.Image.Measure(availableSize);

View file

@ -18,7 +18,7 @@ using ConverterCulture = System.Globalization.CultureInfo;
namespace MapControl
{
public partial class LocationConverter : TypeConverter, IValueConverter
public class LocationConverter : TypeConverter, IValueConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
@ -41,7 +41,7 @@ namespace MapControl
}
}
public partial class LocationCollectionConverter : TypeConverter, IValueConverter
public class LocationCollectionConverter : TypeConverter, IValueConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
@ -64,7 +64,7 @@ namespace MapControl
}
}
public partial class BoundingBoxConverter : TypeConverter, IValueConverter
public class BoundingBoxConverter : TypeConverter, IValueConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
@ -87,7 +87,7 @@ namespace MapControl
}
}
public partial class TileSourceConverter : TypeConverter, IValueConverter
public class TileSourceConverter : TypeConverter, IValueConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
@ -110,7 +110,7 @@ namespace MapControl
}
}
public partial class MapProjectionConverter : TypeConverter, IValueConverter
public class MapProjectionConverter : TypeConverter, IValueConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{

View file

@ -25,7 +25,7 @@ namespace MapControl
/// <summary>
/// Displays a single map image from a Web Map Service (WMS).
/// </summary>
public partial class WmsImageLayer : MapImageLayer
public class WmsImageLayer : MapImageLayer
{
private static ILogger logger;
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger(typeof(WmsImageLayer));

View file

@ -20,7 +20,7 @@ namespace MapControl
/// <summary>
/// Displays map tiles from a Web Map Tile Service (WMTS).
/// </summary>
public partial class WmtsTileLayer : TilePyramidLayer
public class WmtsTileLayer : TilePyramidLayer
{
private static ILogger logger;
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger(typeof(WmtsTileLayer));

View file

@ -19,7 +19,7 @@ using Avalonia.Media;
namespace MapControl
{
public partial class WmtsTileMatrixLayer : Panel
public class WmtsTileMatrixLayer : Panel
{
// zoomLevel is index of tileMatrix in a WmtsTileMatrixSet.TileMatrixes list.
//
@ -101,8 +101,6 @@ namespace MapControl
protected override Size MeasureOverride(Size availableSize)
{
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
foreach (var tile in Tiles)
{
tile.Image.Measure(availableSize);

View file

@ -11,7 +11,7 @@ namespace MapControl
public class ImageTile(int zoomLevel, int x, int y, int columnCount)
: Tile(zoomLevel, x, y, columnCount)
{
public Image Image { get; } = new Image { Stretch = Stretch.Fill };
public Image Image { get; } = new() { Stretch = Stretch.Fill };
public override async Task LoadImageAsync(Func<Task<ImageSource>> loadImageFunc)
{

View file

@ -21,7 +21,7 @@ namespace MapControl
public class ImageTile(int zoomLevel, int x, int y, int columnCount)
: Tile(zoomLevel, x, y, columnCount)
{
public Image Image { get; } = new Image { Stretch = Stretch.Fill };
public Image Image { get; } = new() { Stretch = Stretch.Fill };
public override async Task LoadImageAsync(Func<Task<ImageSource>> loadImageFunc)
{