mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
MapPanel longitude coercion
This commit is contained in:
parent
94c3faf805
commit
4b0a0d29fd
9 changed files with 110 additions and 189 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue