sharee.bike-App/TINKLib/Model/Map/MapSpan.cs

31 lines
693 B
C#
Raw Normal View History

2022-01-22 18:16:10 +01:00
using System;
namespace TINK.Model.Map
{
2022-09-06 16:08:19 +02:00
/// <summary> Holds the displayed map area. </summary>
public class MapSpan : IMapSpan
{
internal MapSpan(IPosition center, double radius)
{
if (!GetIsValid(center, radius))
throw new ArgumentNullException();
2022-01-22 18:16:10 +01:00
2022-09-06 16:08:19 +02:00
Center = center;
Radius = radius;
}
2022-01-22 18:16:10 +01:00
2022-09-06 16:08:19 +02:00
/// <summary> Center of map displayed area.</summary>
public IPosition Center { get; }
2022-01-22 18:16:10 +01:00
2022-09-06 16:08:19 +02:00
/// <summary> Radius of displayed map area. </summary>
public double Radius { get; }
2022-01-22 18:16:10 +01:00
2022-09-06 16:08:19 +02:00
public bool IsValid => GetIsValid(Center, Radius);
2022-01-22 18:16:10 +01:00
2022-09-06 16:08:19 +02:00
public static bool GetIsValid(IPosition center, double radius)
=> center != null
&& center.IsValid
&& !double.IsNaN(radius);
}
2022-01-22 18:16:10 +01:00
}