mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
Changed class Location to readonly struct
This commit is contained in:
parent
d7d7bba5f2
commit
6566167ff0
27 changed files with 194 additions and 307 deletions
|
|
@ -1,5 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
|
@ -37,6 +40,7 @@ namespace MapControl
|
|||
protected MapPolypoint()
|
||||
{
|
||||
Data = new PolypointGeometry();
|
||||
Location = new Location(0d, double.NaN);
|
||||
}
|
||||
|
||||
protected void DataCollectionPropertyChanged(IEnumerable oldValue, IEnumerable newValue)
|
||||
|
|
@ -58,5 +62,35 @@ namespace MapControl
|
|||
{
|
||||
UpdateData();
|
||||
}
|
||||
|
||||
protected double GetLongitudeOffset(IEnumerable<Location> locations)
|
||||
{
|
||||
if (!ParentMap.MapProjection.IsNormalCylindrical)
|
||||
{
|
||||
return 0d;
|
||||
}
|
||||
|
||||
Location location;
|
||||
|
||||
if (!double.IsNaN(Location.Longitude))
|
||||
{
|
||||
location = Location;
|
||||
}
|
||||
else if (locations != null && locations.Any())
|
||||
{
|
||||
location = locations.First();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0d;
|
||||
}
|
||||
|
||||
if (ParentMap.InsideViewBounds(ParentMap.LocationToView(location)))
|
||||
{
|
||||
return 0d;
|
||||
}
|
||||
|
||||
return ParentMap.NearestLongitude(location.Longitude) - location.Longitude;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue