forked from nanoframework/nanoFramework.IoT.Device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocation.cs
87 lines (75 loc) · 2.8 KB
/
Location.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using UnitsNet;
namespace Iot.Device.Common.GnssDevice
{
/// <summary>
/// Represents a geographic position with latitude and longitude coordinates.
/// </summary>
public class Location
{
/// <summary>
/// Initializes a new instance of the <see cref="Location"/> class.
/// </summary>
public Location()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Location"/> class.
/// </summary>
/// <param name="latitude">The latitude.</param>
/// <param name="longitude">The longitude.</param>
public Location(double latitude, double longitude)
{
Latitude = latitude;
Longitude = longitude;
}
/// <summary>
/// Gets or sets the latitude of a geographic position.
/// </summary>
public double Latitude { get; set; }
/// <summary>
/// Gets or sets the longitude of a geographic position.
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// Gets or sets the altitude of the GNSS position.
/// </summary>
public double Altitude { get; set; }
/// <summary>
/// Gets or sets the speed of the GNSS position.
/// </summary>
public Speed Speed { get; set; }
/// <summary>
/// Gets or sets the course angle of the GNSS position.
/// </summary>
public Angle Course { get; set; }
/// <summary>
/// Gets or sets the horizontal accuracy(in meters) of the location.
/// </summary>
public double Accuracy { get; set; }
/// <summary>
/// Gets or sets the vertical accuracy (in meters) of the location.
/// </summary>
public double VerticalAccuracy { get; set; }
/// <summary>
/// Gets or sets the date and time of the GNSS position.
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// Converts latitude and longitude coordinates from decimal degrees format to a GeoPosition object.
/// </summary>
/// <param name="latitude">The latitude coordinate in decimal degrees.</param>
/// <param name="longitude">The longitude coordinate in decimal degrees.</param>
/// <returns>A GeoPosition object with the specified latitude and longitude coordinates.</returns>
public static Location FromDecimalDegrees(double latitude, double longitude)
{
return new Location()
{
Latitude = latitude,
Longitude = longitude
};
}
}
}