XAML-Map-Control/MapControl/Shared/CenteredBoundingBox.cs

39 lines
938 B
C#
Raw Normal View History

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2018 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
2018-12-20 21:55:12 +01:00
using System;
namespace MapControl
{
public class CenteredBoundingBox : BoundingBox
{
private readonly double width;
private readonly double height;
public CenteredBoundingBox(Location center, double width, double height)
{
2018-12-04 00:38:54 +01:00
Center = center;
2018-12-20 21:55:12 +01:00
this.width = Math.Max(width, 0d);
this.height = Math.Max(height, 0d);
}
2018-12-04 00:38:54 +01:00
public Location Center { get; private set; }
public override double Width
{
get { return width; }
}
public override double Height
{
get { return height; }
}
public override BoundingBox Clone()
{
2018-12-04 00:38:54 +01:00
return new CenteredBoundingBox(Center, Width, Height);
}
}
}