Skip to content

Commit 8e829ab

Browse files
committed
Updated Coordinate struct documantation
1 parent 3173193 commit 8e829ab

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

src/PolylineAlgorithm/Coordinate.cs

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace PolylineAlgorithm;
1111
using System.Diagnostics.CodeAnalysis;
1212
using System.Globalization;
1313
using System.Runtime.InteropServices;
14-
1514
/// <summary>
1615
/// Represents a latitude and longitude coordinate pair.
1716
/// </summary>
@@ -22,43 +21,45 @@ namespace PolylineAlgorithm;
2221
internal static long Size { get; } = Marshal.SizeOf<Coordinate>();
2322

2423
/// <summary>
25-
/// Creates a new <see cref="Coordinate"/> structure with <see cref="Latitude"/> and <see cref="Longitude"/> set to their default values.
24+
/// Initializes a new instance of the <see cref="Coordinate"/> struct with default values for <see cref="Latitude"/> and <see cref="Longitude"/>.
2625
/// </summary>
2726
public Coordinate() {
2827
Latitude = default;
2928
Longitude = default;
3029
}
3130

3231
/// <summary>
33-
/// Creates a new <see cref="Coordinate"/> structure with specified latitude and longitude values.
32+
/// Initializes a new instance of the <see cref="Coordinate"/> struct with specified latitude and longitude values.
3433
/// </summary>
35-
/// <param name="latitude">The latitude value.</param>
36-
/// <param name="longitude">The longitude value.</param>
34+
/// <param name="latitude">The latitude value, in degrees.</param>
35+
/// <param name="longitude">The longitude value, in degrees.</param>
3736
public Coordinate(double latitude, double longitude) {
3837
Latitude = latitude;
3938
Longitude = longitude;
4039
}
4140

4241
/// <summary>
43-
/// Gets the latitude value as a double.
42+
/// Gets the latitude value of the coordinate, in degrees.
4443
/// </summary>
4544
public double Latitude { get; }
4645

4746
/// <summary>
48-
/// Gets the longitude value as a double.
47+
/// Gets the longitude value of the coordinate, in degrees.
4948
/// </summary>
5049
public double Longitude { get; }
5150

5251
/// <summary>
53-
/// Gets a value indicating whether both the <see cref="Latitude"/> and <see cref="Longitude"/> values are equal to their default values.
52+
/// Determines whether the coordinate is the default value (both <see cref="Latitude"/> and <see cref="Longitude"/> are 0).
5453
/// </summary>
54+
/// <returns><see langword="true"/> if the coordinate is the default value; otherwise, <see langword="false"/>.</returns>
5555
public bool IsDefault()
5656
=> Latitude == default
5757
&& Longitude == default;
5858

5959
/// <summary>
60-
/// Gets a value indicating whether both the <see cref="Latitude"/> and <see cref="Longitude"/> values are within the valid range.
60+
/// Determines whether the coordinate is valid by checking if both <see cref="Latitude"/> and <see cref="Longitude"/> are within their respective valid ranges.
6161
/// </summary>
62+
/// <returns><see langword="true"/> if the coordinate is valid; otherwise, <see langword="false"/>.</returns>
6263
public bool IsValid()
6364
=> ICoordinateValidator.Default.Latitude.IsInRange(Latitude)
6465
&& ICoordinateValidator.Default.Longitude.IsInRange(Longitude);
@@ -74,10 +75,9 @@ public bool IsValid()
7475
public override int GetHashCode() => HashCode.Combine(Latitude, Longitude);
7576

7677
/// <summary>
77-
/// Returns the formatted string representation of this instance.
78+
/// Returns a string representation of the coordinate in the format: { Latitude: [double], Longitude: [double] }.
7879
/// </summary>
79-
/// <returns>The formatted string representation of this instance.</returns>
80-
/// <remarks>The format is: { Latitude: [double], Longitude: [double] }</remarks>
80+
/// <returns>A string representation of the coordinate.</returns>
8181
[ExcludeFromCodeCoverage]
8282
public override string ToString() {
8383
return $"{{ {nameof(Latitude)}: {Latitude.ToString("G", CultureInfo.InvariantCulture)}, {nameof(Longitude)}: {Longitude.ToString("G", CultureInfo.InvariantCulture)} }}";
@@ -87,7 +87,11 @@ public override string ToString() {
8787

8888
#region IEquatable<Coordinate> implementation
8989

90-
/// <inheritdoc />
90+
/// <summary>
91+
/// Determines whether the current coordinate is equal to another coordinate.
92+
/// </summary>
93+
/// <param name="other">The coordinate to compare with the current coordinate.</param>
94+
/// <returns><see langword="true"/> if the coordinates are equal; otherwise, <see langword="false"/>.</returns>
9195
public bool Equals(Coordinate other) {
9296
return Latitude == other.Latitude &&
9397
Longitude == other.Longitude;
@@ -98,22 +102,22 @@ public bool Equals(Coordinate other) {
98102
#region Equality operators
99103

100104
/// <summary>
101-
/// Indicates whether the values of two specified <see cref="Coordinate"/> objects are equal.
105+
/// Determines whether two <see cref="Coordinate"/> instances are equal.
102106
/// </summary>
103-
/// <param name="left">The first object to compare.</param>
104-
/// <param name="right">The second object to compare.</param>
105-
/// <returns><see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise, <see langword="false"/>.</returns>
107+
/// <param name="left">The first coordinate to compare.</param>
108+
/// <param name="right">The second coordinate to compare.</param>
109+
/// <returns><see langword="true"/> if the coordinates are equal; otherwise, <see langword="false"/>.</returns>
106110
[ExcludeFromCodeCoverage]
107111
public static bool operator ==(Coordinate left, Coordinate right) => left.Equals(right);
108112

109113
/// <summary>
110-
/// Indicates whether the values of two specified <see cref="Coordinate"/> objects are not equal.
114+
/// Determines whether two <see cref="Coordinate"/> instances are not equal.
111115
/// </summary>
112-
/// <param name="left">The first object to compare.</param>
113-
/// <param name="right">The second object to compare.</param>
114-
/// <returns><see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are not equal; otherwise, <see langword="false"/>.</returns>
116+
/// <param name="left">The first coordinate to compare.</param>
117+
/// <param name="right">The second coordinate to compare.</param>
118+
/// <returns><see langword="true"/> if the coordinates are not equal; otherwise, <see langword="false"/>.</returns>
115119
[ExcludeFromCodeCoverage]
116120
public static bool operator !=(Coordinate left, Coordinate right) => !(left == right);
117121

118122
#endregion
119-
}
123+
}

0 commit comments

Comments
 (0)