MapPanel longitude coercion

This commit is contained in:
ClemensFischer 2024-08-29 21:35:58 +02:00
parent 94c3faf805
commit 4b0a0d29fd
9 changed files with 110 additions and 189 deletions

View file

@ -17,7 +17,7 @@ namespace MapControl
#endif
public class BoundingBox
{
public BoundingBox()
protected BoundingBox()
{
}
@ -34,15 +34,27 @@ namespace MapControl
{
}
public double South { get; }
public double North { get; }
public double West { get; }
public double East { get; }
public double South { get; private set; }
public double North { get; private set; }
public double West { get; private set; }
public double East { get; private set; }
public virtual double Width => East - West;
public virtual double Height => North - South;
public virtual Location Center => new Location((South + North) / 2d, (West + East) / 2d);
public virtual Location Center
{
get => new Location((South + North) / 2d, (West + East) / 2d);
set
{
var latOffset = value.Latitude - (South + North) / 2d;
var lonOffset = value.Longitude - (West + East) / 2d;
South += latOffset;
North += latOffset;
West += lonOffset;
East += lonOffset;
}
}
/// <summary>
/// Creates a BoundingBox instance from a string containing a comma-separated sequence of four floating point numbers.