mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 23:45:05 +00:00
Location now immutable
This commit is contained in:
parent
52d990a89c
commit
dc9932a0cf
5 changed files with 18 additions and 32 deletions
|
|
@ -10,7 +10,9 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// A geographic location with latitude and longitude values in degrees.
|
||||
/// </summary>
|
||||
#if !UWP
|
||||
#if WINUI || UWP
|
||||
[Windows.Foundation.Metadata.CreateFromString(MethodName = "MapControl.Location.Parse")]
|
||||
#else
|
||||
[System.ComponentModel.TypeConverter(typeof(LocationConverter))]
|
||||
#endif
|
||||
public class Location : IEquatable<Location>
|
||||
|
|
@ -21,19 +23,12 @@ namespace MapControl
|
|||
|
||||
public Location(double latitude, double longitude)
|
||||
{
|
||||
Latitude = latitude;
|
||||
Latitude = Math.Min(Math.Max(latitude, -90d), 90d);
|
||||
Longitude = longitude;
|
||||
}
|
||||
|
||||
private double latitude;
|
||||
|
||||
public double Latitude
|
||||
{
|
||||
get => latitude;
|
||||
set => latitude = Math.Min(Math.Max(value, -90d), 90d);
|
||||
}
|
||||
|
||||
public double Longitude { get; set; }
|
||||
public double Latitude { get; }
|
||||
public double Longitude { get; }
|
||||
|
||||
public bool Equals(Location location)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue