diff --git a/MapControl/Shared/AzimuthalProjection.cs b/MapControl/Shared/AzimuthalProjection.cs
index a5e40a41..2297b3f6 100644
--- a/MapControl/Shared/AzimuthalProjection.cs
+++ b/MapControl/Shared/AzimuthalProjection.cs
@@ -20,15 +20,9 @@ namespace MapControl
{
var center = MapToLocation(mapRect.Center);
- if (center == null)
- {
- return null;
- }
-
- var width = mapRect.Width / Wgs84MeterPerDegree;
- var height = mapRect.Height / Wgs84MeterPerDegree;
-
- return new CenteredBoundingBox(center, width, height);
+ return center != null
+ ? new CenteredBoundingBox(center, mapRect.Width / Wgs84MeterPerDegree, mapRect.Height / Wgs84MeterPerDegree)
+ : null;
}
///
diff --git a/MapControl/Shared/MapProjection.cs b/MapControl/Shared/MapProjection.cs
index 1c4d4296..160ba111 100644
--- a/MapControl/Shared/MapProjection.cs
+++ b/MapControl/Shared/MapProjection.cs
@@ -72,6 +72,8 @@ namespace MapControl
///
public virtual MapRect BoundingBoxToMapRect(BoundingBox boundingBox)
{
+ MapRect mapRect = null;
+
if (!double.IsNaN(boundingBox.South) && !double.IsNaN(boundingBox.West) &&
!double.IsNaN(boundingBox.North) && !double.IsNaN(boundingBox.East))
{
@@ -80,7 +82,7 @@ namespace MapControl
if (p1.HasValue && p2.HasValue)
{
- return new MapRect(p1.Value, p2.Value);
+ mapRect = new MapRect(p1.Value, p2.Value);
}
}
else if (boundingBox.Center != null)
@@ -94,11 +96,11 @@ namespace MapControl
var x = center.Value.X - width / 2d;
var y = center.Value.Y - height / 2d;
- return new MapRect(x, y, x + width, y + height);
+ mapRect = new MapRect(x, y, x + width, y + height);
}
}
- return null;
+ return mapRect;
}
///