Skip to content
Prev Previous commit
Next Next commit
OxyAnnulus and OxyCircle: changed properties to have getter only and …
…beeing strictly immutable.
  • Loading branch information
ChrisCC6 committed Dec 8, 2022
commit aa9a3698a57b73783991071cd2d37873c9049464
36 changes: 19 additions & 17 deletions Source/OxyPlot/Rendering/OxyAnnulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,48 @@ namespace OxyPlot
/// </summary>
public struct OxyAnnulus : IOxyRegion, IEquatable<OxyAnnulus>, IFormattable
{
/// <summary>
/// The center point of the annulus.
/// </summary>
private readonly ScreenPoint center;

/// <summary>
/// The inner radius of the annulus
/// </summary>
private readonly double innerRadius;

/// <summary>
/// The outer radius of the annulus
/// </summary>
private readonly double outerRadius;

/// <summary>
/// Gets the center point of the annulus.
/// </summary>
/// <value>The center.</value>
public ScreenPoint Center { get; private set; }
public ScreenPoint Center => this.center;

/// <summary>
/// Gets the inner radius of the annulus
/// </summary>
public double InnerRadius { get; private set; }
public double InnerRadius => this.innerRadius;

/// <summary>
/// Gets the outer radius of the annulus
/// </summary>
public double OuterRadius { get; private set; }
public double OuterRadius => this.outerRadius;

/// <summary>
/// Gets the inner diameter of the annulus.
/// </summary>
/// <value>The inner diameter.</value>
public double InnerDiameter
{
get
{
return this.InnerRadius * 2;
}
}
public double InnerDiameter =>this.innerRadius * 2;

/// <summary>
/// Gets the outer diameter of the annulus.
/// </summary>
/// <value>The outer diameter.</value>
public double OuterDiameter
{
get
{
return this.OuterRadius * 2;
}
}
public double OuterDiameter => this.outerRadius * 2;

/// <summary>
/// Gets the inner top of the annulus.
Expand Down
26 changes: 15 additions & 11 deletions Source/OxyPlot/Rendering/OxyCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,33 @@ namespace OxyPlot
/// </summary>
public struct OxyCircle : IOxyRegion, IEquatable<OxyCircle>, IFormattable
{
/// <summary>
/// The center point of the circle.
/// </summary>
private readonly ScreenPoint center;

/// <summary>
/// The radius of the circle
/// </summary>
private readonly double radius;


/// <summary>
/// Gets the center point of the circle.
/// </summary>
/// <value>The center.</value>
public ScreenPoint Center { get; private set; }
public ScreenPoint Center => this.center;

/// <summary>
/// Gets the radius of the circle
/// </summary>
public double Radius { get; private set; }
public double Radius => this.radius;

/// <summary>
/// Gets the diameter of the circle.
/// </summary>
/// <value>The width.</value>
public double Diameter
{
get
{
return this.Radius * 2;
}
}
public double Diameter => this.radius * 2;

/// <summary>
/// Gets the top of the circle.
Expand Down Expand Up @@ -76,8 +80,8 @@ public OxyCircle(ScreenPoint center, double radius)
{
if (radius < 0)
throw new ArgumentOutOfRangeException(nameof(radius), "The radius should not be negative.");
this.Center = new ScreenPoint(center.X, center.Y);
this.Radius = radius;
this.center = new ScreenPoint(center.X, center.Y);
this.radius = radius;
}

/// <summary>
Expand Down