@@ -19,18 +19,18 @@ namespace PolylineAlgorithm;
19
19
[ DebuggerDisplay ( "{ToString()}" ) ]
20
20
public readonly struct Coordinate : IEquatable < Coordinate > {
21
21
/// <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 .
23
23
/// </summary>
24
24
public Coordinate ( ) {
25
25
Latitude = default ;
26
26
Longitude = default ;
27
27
}
28
28
29
29
/// <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.
31
31
/// </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>
34
34
public Coordinate ( double latitude , double longitude ) {
35
35
Latitude = latitude ;
36
36
Longitude = longitude ;
@@ -47,19 +47,29 @@ public Coordinate(double latitude, double longitude) {
47
47
public readonly double Longitude { get ; }
48
48
49
49
/// <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 .
51
51
/// </summary>
52
52
public bool IsDefault
53
53
=> Latitude == default
54
54
&& Longitude == default ;
55
55
56
56
/// <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.
58
58
/// </summary>
59
59
public bool IsValid
60
60
=> ICoordinateValidator . Default . Latitude . IsInRange ( Latitude )
61
61
&& ICoordinateValidator . Default . Longitude . IsInRange ( Longitude ) ;
62
62
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
+
63
73
#region Overrides
64
74
65
75
/// <inheritdoc />
@@ -75,10 +85,10 @@ public override int GetHashCode() {
75
85
}
76
86
77
87
/// <summary>
78
- /// Returns the formatted string respresentation of this instance.
88
+ /// Returns the formatted string representation of this instance.
79
89
/// </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>
82
92
[ ExcludeFromCodeCoverage ]
83
93
public override string ToString ( ) {
84
94
return $ "{{ { nameof ( Latitude ) } : { Latitude . ToString ( "G" , CultureInfo . InvariantCulture ) } , { nameof ( Longitude ) } : { Longitude . ToString ( "G" , CultureInfo . InvariantCulture ) } }}";
@@ -99,19 +109,18 @@ public bool Equals(Coordinate other) {
99
109
#region Equality operators
100
110
101
111
/// <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.
103
113
/// </summary>
104
114
/// <param name="left">The first object to compare.</param>
105
115
/// <param name="right">The second object to compare.</param>
106
116
/// <returns><see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise, <see langword="false"/>.</returns>
107
-
108
117
[ ExcludeFromCodeCoverage ]
109
118
public static bool operator == ( Coordinate left , Coordinate right ) {
110
119
return left . Equals ( right ) ;
111
120
}
112
121
113
122
/// <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.
115
124
/// </summary>
116
125
/// <param name="left">The first object to compare.</param>
117
126
/// <param name="right">The second object to compare.</param>
0 commit comments