Skip to content

Commit b54819f

Browse files
author
Petr Sramek
committed
imprved documentation for coordinate structure with helkpo of Copilot
1 parent 7b58f47 commit b54819f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/PolylineAlgorithm/Coordinate.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ namespace PolylineAlgorithm;
1919
[DebuggerDisplay("{ToString()}")]
2020
public readonly struct Coordinate : IEquatable<Coordinate> {
2121
/// <summary>
22-
/// Creates a new <see cref="Coordinate"/> structure that contains <see cref="Latitude" /> and <see cref="Longitude" /> set to <see langword="default"/> value.
22+
/// Creates a new <see cref="Coordinate"/> structure with <see cref="Latitude"/> and <see cref="Longitude"/> set to their default values.
2323
/// </summary>
2424
public Coordinate() {
2525
Latitude = default;
2626
Longitude = default;
2727
}
2828

2929
/// <summary>
30-
/// Creates a new <see cref="Coordinate"/> structure that contains <see cref="Latitude" /> and <see cref="Longitude" /> set to specified values.
30+
/// Creates a new <see cref="Coordinate"/> structure with specified latitude and longitude values.
3131
/// </summary>
32-
/// <param name="latitude">A latitude value.</param>
33-
/// <param name="longitude">A latitude value.</param>
32+
/// <param name="latitude">The latitude value.</param>
33+
/// <param name="longitude">The longitude value.</param>
3434
public Coordinate(double latitude, double longitude) {
3535
Latitude = latitude;
3636
Longitude = longitude;
@@ -47,19 +47,29 @@ public Coordinate(double latitude, double longitude) {
4747
public readonly double Longitude { get; }
4848

4949
/// <summary>
50-
/// Gets a value that indicates whether both, the <see cref="Latitude" /> and <see cref="Longitude"/> values, are equal to <see langword="default" />.
50+
/// Gets a value indicating whether both the <see cref="Latitude"/> and <see cref="Longitude"/> values are equal to their default values.
5151
/// </summary>
5252
public bool IsDefault
5353
=> Latitude == default
5454
&& Longitude == default;
5555

5656
/// <summary>
57-
/// Gets a value that indicates whether both, the <see cref="Latitude" /> and <see cref="Longitude"/> values, are in the valid range.
57+
/// Gets a value indicating whether both the <see cref="Latitude"/> and <see cref="Longitude"/> values are within the valid range.
5858
/// </summary>
5959
public bool IsValid
6060
=> ICoordinateValidator.Default.Latitude.IsInRange(Latitude)
6161
&& ICoordinateValidator.Default.Longitude.IsInRange(Longitude);
6262

63+
/// <summary>
64+
/// Deconstructs this instance into its latitude and longitude components.
65+
/// </summary>
66+
/// <param name="latitude">The latitude component.</param>
67+
/// <param name="longitude">The longitude component.</param>
68+
public void Deconstruct(out double latitude, out double longitude) {
69+
latitude = Latitude;
70+
longitude = Longitude;
71+
}
72+
6373
#region Overrides
6474

6575
/// <inheritdoc />
@@ -75,10 +85,10 @@ public override int GetHashCode() {
7585
}
7686

7787
/// <summary>
78-
/// Returns the formatted string respresentation of this instance.
88+
/// Returns the formatted string representation of this instance.
7989
/// </summary>
80-
/// <returns>The formatted string respresentation of this instance.</returns>
81-
/// <remarks>{ Latitude: [double], Longitude: [double] }</remarks>
90+
/// <returns>The formatted string representation of this instance.</returns>
91+
/// <remarks>The format is: { Latitude: [double], Longitude: [double] }</remarks>
8292
[ExcludeFromCodeCoverage]
8393
public override string ToString() {
8494
return $"{{ {nameof(Latitude)}: {Latitude.ToString("G", CultureInfo.InvariantCulture)}, {nameof(Longitude)}: {Longitude.ToString("G", CultureInfo.InvariantCulture)} }}";
@@ -99,19 +109,18 @@ public bool Equals(Coordinate other) {
99109
#region Equality operators
100110

101111
/// <summary>
102-
/// Indicates whether the values of two specified <see cref="Coordinate" /> objects are equal.
112+
/// Indicates whether the values of two specified <see cref="Coordinate"/> objects are equal.
103113
/// </summary>
104114
/// <param name="left">The first object to compare.</param>
105115
/// <param name="right">The second object to compare.</param>
106116
/// <returns><see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise, <see langword="false"/>.</returns>
107-
108117
[ExcludeFromCodeCoverage]
109118
public static bool operator ==(Coordinate left, Coordinate right) {
110119
return left.Equals(right);
111120
}
112121

113122
/// <summary>
114-
/// Indicates whether the values of two specified <see cref="CoordinateRange" /> objects are not equal.
123+
/// Indicates whether the values of two specified <see cref="Coordinate"/> objects are not equal.
115124
/// </summary>
116125
/// <param name="left">The first object to compare.</param>
117126
/// <param name="right">The second object to compare.</param>

0 commit comments

Comments
 (0)