mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Minor changes to MapPath
This commit is contained in:
parent
ee985aa777
commit
f5d5e1d620
|
|
@ -4,13 +4,10 @@
|
|||
|
||||
#if WINUI
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
#elif UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -30,7 +27,7 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Gets or sets a Location that is used as
|
||||
/// - either the origin point of a geometry specified in projected map coordinates (meters)
|
||||
/// - or as an optional value to constrain the view position of MapPaths with multiple
|
||||
/// - or as an optional anchor point to constrain the view position of MapPaths with multiple
|
||||
/// Locations (like MapPolyline or MapPolygon) to the visible map viewport, as done
|
||||
/// for elements where the MapPanel.Location property is set.
|
||||
/// </summary>
|
||||
|
|
@ -73,16 +70,7 @@ namespace MapControl
|
|||
{
|
||||
if (parentMap != null && Location != null && Data != null)
|
||||
{
|
||||
var matrix = parentMap.GetMapTransform(Location);
|
||||
|
||||
if (Data.Transform is MatrixTransform transform)
|
||||
{
|
||||
transform.Matrix = matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Transform = new MatrixTransform { Matrix = matrix };
|
||||
}
|
||||
SetMapTransform(parentMap.GetMapTransform(Location));
|
||||
}
|
||||
|
||||
MapPanel.SetLocation(this, Location);
|
||||
|
|
|
|||
|
|
@ -40,12 +40,23 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
data.Transform = new MatrixTransform();
|
||||
path.UpdateData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMapTransform(Matrix matrix)
|
||||
{
|
||||
if (Data.Transform is MatrixTransform transform && !transform.IsFrozen)
|
||||
{
|
||||
transform.Matrix = matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Transform = new MatrixTransform(matrix);
|
||||
}
|
||||
}
|
||||
|
||||
#region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon
|
||||
|
||||
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,19 @@ namespace MapControl
|
|||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
#region Methods used only by derived classes MapPolyline and MapPolygon
|
||||
private void SetMapTransform(Matrix matrix)
|
||||
{
|
||||
if (Data.Transform is MatrixTransform transform)
|
||||
{
|
||||
transform.Matrix = matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Transform = new MatrixTransform { Matrix = matrix };
|
||||
}
|
||||
}
|
||||
|
||||
#region Methods used only by derived classes MapPolyline and MapPolygon
|
||||
|
||||
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue