mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Simplify BoundingBox
This commit is contained in:
parent
8bb2555533
commit
142e86da31
|
|
@ -57,19 +57,16 @@ namespace MapControl
|
|||
public virtual double Width
|
||||
{
|
||||
get => East - West;
|
||||
protected set { }
|
||||
}
|
||||
|
||||
public virtual double Height
|
||||
{
|
||||
get => North - South;
|
||||
protected set { }
|
||||
}
|
||||
|
||||
public virtual Location Center
|
||||
{
|
||||
get => new Location((South + North) / 2d, (West + East) / 2d);
|
||||
protected set { }
|
||||
}
|
||||
|
||||
public static BoundingBox Parse(string boundingBox)
|
||||
|
|
|
|||
|
|
@ -8,15 +8,19 @@ namespace MapControl
|
|||
{
|
||||
public class CenteredBoundingBox : BoundingBox
|
||||
{
|
||||
public CenteredBoundingBox(Location center, double width, double height)
|
||||
private readonly Location center;
|
||||
private readonly double width;
|
||||
private readonly double height;
|
||||
|
||||
public CenteredBoundingBox(Location c, double w, double h)
|
||||
{
|
||||
Center = center;
|
||||
Width = Math.Max(width, 0d);
|
||||
Height = Math.Max(height, 0d);
|
||||
center = c;
|
||||
width = Math.Max(w, 0d);
|
||||
height = Math.Max(h, 0d);
|
||||
}
|
||||
|
||||
public override double Width { get; protected set; }
|
||||
public override double Height { get; protected set; }
|
||||
public override Location Center { get; protected set; }
|
||||
public override Location Center => center;
|
||||
public override double Width => width;
|
||||
public override double Height => height;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue