@@ -17,22 +17,12 @@ public class Position : IPosition, IEqualityComparer<Position>, IEquatable<Posit
17
17
/// <summary>
18
18
/// Initializes a new instance of the <see cref="Position" /> class.
19
19
/// </summary>
20
- /// <param name="latitude">The latitude.</param>
21
- /// <param name="longitude">The longitude.</param>
20
+ /// <param name="latitude">The latitude, or Y coordinate .</param>
21
+ /// <param name="longitude">The longitude or X coordinate .</param>
22
22
/// <param name="altitude">The altitude in m(eter).</param>
23
23
public Position ( double latitude , double longitude , double ? altitude = null )
24
24
{
25
- // Yes I hate commented out code to, but this needs to go right now
26
- //if (Math.Abs(latitude) > 90)
27
- //{
28
- // throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be a proper lat (+/- double) value between -90 and 90.");
29
- //}
30
-
31
- //if (Math.Abs(longitude) > 180)
32
- //{
33
- // throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be a proper lon (+/- double) value between -180 and 180.");
34
- //}
35
-
25
+ // TODO Coordinate range validation should be performed only when CRS is supplied
36
26
Latitude = latitude ;
37
27
Longitude = longitude ;
38
28
Altitude = altitude ;
@@ -41,11 +31,12 @@ public Position(double latitude, double longitude, double? altitude = null)
41
31
/// <summary>
42
32
/// Initializes a new instance of the <see cref="Position" /> class.
43
33
/// </summary>
44
- /// <param name="latitude">The latitude, e.g. '38.889722'.</param>
45
- /// <param name="longitude">The longitude, e.g. '-77.008889'.</param>
34
+ /// <param name="latitude">The latitude, or Y coordinate e.g. '38.889722'.</param>
35
+ /// <param name="longitude">The longitude, or X coordinate e.g. '-77.008889'.</param>
46
36
/// <param name="altitude">The altitude in m(eters).</param>
47
37
public Position ( string latitude , string longitude , string altitude = null )
48
38
{
39
+ // TODO Coordinate range validation should be performed only when CRS is supplied
49
40
if ( string . IsNullOrEmpty ( latitude ) )
50
41
{
51
42
throw new ArgumentOutOfRangeException ( nameof ( latitude ) , "May not be empty." ) ;
@@ -56,14 +47,14 @@ public Position(string latitude, string longitude, string altitude = null)
56
47
throw new ArgumentOutOfRangeException ( nameof ( longitude ) , "May not be empty." ) ;
57
48
}
58
49
59
- if ( ! double . TryParse ( latitude , NumberStyles . Float , CultureInfo . InvariantCulture , out double lat ) || Math . Abs ( lat ) > 90 )
50
+ if ( ! double . TryParse ( latitude , NumberStyles . Float , CultureInfo . InvariantCulture , out double lat ) )
60
51
{
61
- throw new ArgumentOutOfRangeException ( nameof ( latitude ) , "Latitude must be a proper lat (+/- double) value between -90 and 90 ." ) ;
52
+ throw new ArgumentOutOfRangeException ( nameof ( altitude ) , "Latitude representation must be a numeric ." ) ;
62
53
}
63
54
64
- if ( ! double . TryParse ( longitude , NumberStyles . Float , CultureInfo . InvariantCulture , out double lon ) || Math . Abs ( lon ) > 180 )
55
+ if ( ! double . TryParse ( longitude , NumberStyles . Float , CultureInfo . InvariantCulture , out double lon ) )
65
56
{
66
- throw new ArgumentOutOfRangeException ( nameof ( longitude ) , "Longitude must be a proper lon (+/- double) value between -180 and 180 ." ) ;
57
+ throw new ArgumentOutOfRangeException ( nameof ( altitude ) , "Longitude representation must be a numeric ." ) ;
67
58
}
68
59
69
60
Latitude = lat ;
@@ -86,12 +77,12 @@ public Position(string latitude, string longitude, string altitude = null)
86
77
public double ? Altitude { get ; }
87
78
88
79
/// <summary>
89
- /// Gets the latitude.
80
+ /// Gets the latitude or Y coordinate
90
81
/// </summary>
91
82
public double Latitude { get ; }
92
83
93
84
/// <summary>
94
- /// Gets the longitude.
85
+ /// Gets the longitude or X coordinate
95
86
/// </summary>
96
87
public double Longitude { get ; }
97
88
0 commit comments