From 7fbdbf74b944a18c2cd20a7e871d408ed23683b4 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Mon, 7 Nov 2022 21:10:10 +0100 Subject: [PATCH] Fixed Heading rotation direction --- MapControl/Shared/MapBase.cs | 16 ++++++++-------- MapControl/Shared/ViewTransform.cs | 2 +- MapControl/Shared/ViewportChangedEventArgs.cs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/MapControl/Shared/MapBase.cs b/MapControl/Shared/MapBase.cs index b4aed4a5..10e5c56a 100644 --- a/MapControl/Shared/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -29,7 +29,7 @@ namespace MapControl /// /// The map control. Displays map content provided by one or more tile or image layers, - /// i.e. MapTileLayerBase or MapImageLayer instances. + /// such as MapTileLayerBase or MapImageLayer instances. /// The visible map area is defined by the Center and ZoomLevel properties. /// The map can be rotated by an angle that is given by the Heading property. /// MapBase can contain map overlay child elements like other MapPanels or MapItemsControls. @@ -178,7 +178,7 @@ namespace MapControl } /// - /// Gets or sets the map heading, i.e. a clockwise rotation angle in degrees. + /// Gets or sets the map heading, a counter-clockwise rotation angle in degrees. /// public double Heading { @@ -217,7 +217,7 @@ namespace MapControl /// /// Gets the scaling factor from projected map coordinates to view coordinates, - /// i.e. pixels per meter. + /// as pixels per meter. /// public double ViewScale => (double)GetValue(ViewScaleProperty); @@ -228,8 +228,8 @@ namespace MapControl public ViewTransform ViewTransform { get; } = new ViewTransform(); /// - /// Gets the map scale, i.e. the horizontal and vertical scaling factors from geographic - /// coordinates to view coordinates at the specified location, in pixels per meter. + /// Gets the map scale as the horizontal and vertical scaling factors from geographic + /// coordinates to view coordinates at the specified location, as pixels per meter. /// public Vector GetScale(Location location) { @@ -324,7 +324,7 @@ namespace MapControl if (rotation != 0d) { - var heading = (((Heading + rotation) % 360d) + 360d) % 360d; + var heading = (((Heading - rotation) % 360d) + 360d) % 360d; SetValueInternal(HeadingProperty, heading); SetValueInternal(TargetHeadingProperty, heading); @@ -737,7 +737,7 @@ namespace MapControl if (MapProjection.IsValid(mapCenter)) { - ViewTransform.SetTransform(mapCenter, viewCenter, viewScale, Heading); + ViewTransform.SetTransform(mapCenter, viewCenter, viewScale, -Heading); if (transformCenter != null) { @@ -770,7 +770,7 @@ namespace MapControl if (MapProjection.IsValid(mapCenter)) { - ViewTransform.SetTransform(mapCenter, viewCenter, viewScale, Heading); + ViewTransform.SetTransform(mapCenter, viewCenter, viewScale, -Heading); } } } diff --git a/MapControl/Shared/ViewTransform.cs b/MapControl/Shared/ViewTransform.cs index d4b0b63a..33be71e3 100644 --- a/MapControl/Shared/ViewTransform.cs +++ b/MapControl/Shared/ViewTransform.cs @@ -34,7 +34,7 @@ namespace MapControl /// /// Gets the scaling factor from projected map coordinates to view coordinates, - /// i.e. pixels per meter. + /// as pixels per meter. /// public double Scale { get; private set; } diff --git a/MapControl/Shared/ViewportChangedEventArgs.cs b/MapControl/Shared/ViewportChangedEventArgs.cs index 89403d56..6dd39ef2 100644 --- a/MapControl/Shared/ViewportChangedEventArgs.cs +++ b/MapControl/Shared/ViewportChangedEventArgs.cs @@ -15,8 +15,8 @@ namespace MapControl } /// - /// Indicates if the map projection has changed, i.e. if a MapTileLayer or MapImageLayer should - /// be updated immediately, or MapPath Data in projected map coordinates should be recalculated. + /// Indicates if the map projection has changed. Used to control when a MapTileLayer or MapImageLayer + /// should be updated immediately, or MapPath Data in projected map coordinates should be recalculated. /// public bool ProjectionChanged { get; }