diff --git a/MapControl/Avalonia/MapGraticule.Avalonia.cs b/MapControl/Avalonia/MapGraticule.Avalonia.cs index aa07cef0..c8aeeb35 100644 --- a/MapControl/Avalonia/MapGraticule.Avalonia.cs +++ b/MapControl/Avalonia/MapGraticule.Avalonia.cs @@ -4,7 +4,6 @@ using Avalonia.Controls.Documents; using Avalonia.Media; using System.Collections.Generic; using System.Globalization; -using System.Linq; namespace MapControl { @@ -96,17 +95,9 @@ namespace MapControl } } - private static PathFigure CreatePolylineFigure(IEnumerable points) + private static PolyLineSegment CreatePolyLineSegment(IEnumerable points) { - var figure = new PathFigure - { - StartPoint = points.First(), - IsClosed = false, - IsFilled = false - }; - - figure.Segments.Add(new PolyLineSegment(points.Skip(1))); - return figure; + return new PolyLineSegment(points); } } } diff --git a/MapControl/Shared/GeoImage.cs b/MapControl/Shared/GeoImage.cs index ccf0fb62..66d95d6e 100644 --- a/MapControl/Shared/GeoImage.cs +++ b/MapControl/Shared/GeoImage.cs @@ -184,13 +184,13 @@ namespace MapControl throw new ArgumentException($"Insufficient number of parameters in world file {worldFilePath}."); } - return new Matrix( - parameters[0], // line 1: A or M11 - parameters[1], // line 2: D or M12 - parameters[2], // line 3: B or M21 - parameters[3], // line 4: E or M22 - parameters[4], // line 5: C or OffsetX - parameters[5]); // line 6: F or OffsetY + return new Matrix( // https://en.wikipedia.org/wiki/World_file + parameters[0], // line 1: A + parameters[1], // line 2: D + parameters[2], // line 3: B + parameters[3], // line 4: E + parameters[4], // line 5: C + parameters[5]); // line 6: F } private static MapProjection GetProjection(short[] geoKeyDirectory) diff --git a/MapControl/Shared/MapBase.cs b/MapControl/Shared/MapBase.cs index 13b16784..763e3f6d 100644 --- a/MapControl/Shared/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -375,8 +375,7 @@ namespace MapControl if (projection.IsNormalCylindrical) { - var maxLocation = projection.MapToLocation(0d, 180d * MapProjection.Wgs84MeterPerDegree); - maxLatitude = maxLocation.Latitude; + maxLatitude = projection.MapToLocation(0d, 180d * MapProjection.Wgs84MeterPerDegree).Latitude; Center = CoerceCenterProperty(Center); } diff --git a/MapControl/Shared/MapGraticule.cs b/MapControl/Shared/MapGraticule.cs index 1f4703d1..b5846031 100644 --- a/MapControl/Shared/MapGraticule.cs +++ b/MapControl/Shared/MapGraticule.cs @@ -40,6 +40,12 @@ namespace MapControl public static readonly DependencyProperty StrokeThicknessProperty = DependencyPropertyHelper.Register(nameof(StrokeThickness), 0.5); + private static readonly double[] lineDistances = [ + 1d/3600d, 1d/1800d, 1d/720d, 1d/360d, 1d/240d, 1d/120d, + 1d/60d, 1d/30d, 1d/12d, 1d/6d, 1d/4d, 1d/2d, + 1d, 2d, 5d, 10d, 15d, 30d]; + + /// /// Minimum graticule line distance in pixels. The default value is 150. /// @@ -75,32 +81,31 @@ namespace MapControl private List