From 142e86da31365936c72bfeac8017472ec3d6f7b5 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Wed, 7 Dec 2022 22:29:08 +0100 Subject: [PATCH] Simplify BoundingBox --- MapControl/Shared/BoundingBox.cs | 3 --- MapControl/Shared/CenteredBoundingBox.cs | 18 +++++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/MapControl/Shared/BoundingBox.cs b/MapControl/Shared/BoundingBox.cs index 73325094..0e56ab0b 100644 --- a/MapControl/Shared/BoundingBox.cs +++ b/MapControl/Shared/BoundingBox.cs @@ -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) diff --git a/MapControl/Shared/CenteredBoundingBox.cs b/MapControl/Shared/CenteredBoundingBox.cs index 35704f4e..fee06d30 100644 --- a/MapControl/Shared/CenteredBoundingBox.cs +++ b/MapControl/Shared/CenteredBoundingBox.cs @@ -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; } }