-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
681 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,44 @@ | ||
namespace CyclingApp.Models | ||
namespace CyclingApp.Models; | ||
|
||
/// <summary> | ||
/// A cycling activity. | ||
/// </summary> | ||
public class Activity | ||
{ | ||
public class Activity | ||
{ | ||
public Guid Id { get; } | ||
/// <summary> | ||
/// Unique identifier of the activity. | ||
/// </summary> | ||
public Guid Id { get; } | ||
|
||
/// <summary> | ||
/// Creation time of the acitivity. | ||
/// </summary> | ||
public DateTime CreationTime { get; } | ||
/// <summary> | ||
/// Creation time of the activity. | ||
/// </summary> | ||
public DateTime CreationTime { get; } | ||
|
||
/// <summary> | ||
/// Duration of the acitivity. | ||
/// </summary> | ||
public TimeSpan Duration { get; } | ||
/// <summary> | ||
/// Duration of the activity. | ||
/// </summary> | ||
public TimeSpan Duration { get; } | ||
|
||
/// <summary> | ||
/// Route of the activity. | ||
/// </summary> | ||
public ReadOnlyRoute Route { get; } | ||
/// <summary> | ||
/// Route of the activity. | ||
/// </summary> | ||
public ReadOnlyRoute Route { get; } | ||
|
||
/// <summary> | ||
/// Average speed during the activity in kilometers per hour. | ||
/// </summary> | ||
public double AvgSpeed { get; } | ||
/// <summary> | ||
/// Average speed during the activity in kilometers per hour. | ||
/// </summary> | ||
public double AvgSpeed { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of <see cref="Activity"/> class. | ||
/// </summary> | ||
public Activity(Guid id, DateTime creationTime, TimeSpan duration, ReadOnlyRoute route) | ||
{ | ||
Id = id; | ||
CreationTime = creationTime; | ||
Duration = duration; | ||
Route = route; | ||
} | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="Activity"/> class. | ||
/// </summary> | ||
public Activity(Guid id, DateTime creationTime, TimeSpan duration, ReadOnlyRoute route) | ||
{ | ||
Id = id; | ||
CreationTime = creationTime; | ||
Duration = duration; | ||
Route = route; | ||
AvgSpeed = route.CalculateAvgSpeed(Duration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,78 @@ | ||
namespace CyclingApp.Models | ||
namespace CyclingApp.Models; | ||
|
||
/// <summary> | ||
/// Position and altitude on earth. | ||
/// </summary> | ||
public class GeoLocation | ||
{ | ||
/// <summary> | ||
/// Position and altitude on earth. | ||
/// Longitude in decimal degrees. | ||
/// </summary> | ||
public class GeoLocation | ||
{ | ||
/// <summary> | ||
/// Longitude in decimal degrees. | ||
/// </summary> | ||
public double Longitude { get; } | ||
public double Longitude { get; } | ||
|
||
/// <summary> | ||
/// Latitude in decimal degrees. | ||
/// </summary> | ||
public double Latitude { get; } | ||
/// <summary> | ||
/// Latitude in decimal degrees. | ||
/// </summary> | ||
public double Latitude { get; } | ||
|
||
/// <summary> | ||
/// Accuracy of the <see cref="Latitude"/> and <see cref="Longitude"/> properties, expressed in meters. | ||
/// </summary> | ||
public double Accuracy { get; } | ||
/// <summary> | ||
/// Accuracy of the <see cref="Latitude"/> and <see cref="Longitude"/> properties, expressed in meters. | ||
/// </summary> | ||
public double Accuracy { get; } | ||
|
||
/// <summary> | ||
/// Altitude in meters, relative to nominal sea level. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the location source cannot provide the data. | ||
/// </value> | ||
public double? Altitude { get; } | ||
/// <summary> | ||
/// Altitude in meters, relative to nominal sea level. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the location source cannot provide the data. | ||
/// </value> | ||
public double? Altitude { get; } | ||
|
||
/// <summary> | ||
/// Accuracy of the altitude expressed in meters. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? AltitudeAccuracy { get; } | ||
/// <summary> | ||
/// Accuracy of the altitude expressed in meters. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? AltitudeAccuracy { get; } | ||
|
||
/// <summary> | ||
/// Direction towards which the device is facing. This value, specified in degrees, indicates how far off from | ||
/// heading true north the device is. 0 degrees represents true north, and the direction is determined clockwise | ||
/// (which means that east is 90 degrees and west is 270 degrees). If speed is 0, <see cref="Heading"/> is | ||
/// <see cref="double.NaN"/>. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? Heading { get; } | ||
/// <summary> | ||
/// Direction towards which the device is facing. This value, specified in degrees, indicates how far off from | ||
/// heading true north the device is. 0 degrees represents true north, and the direction is determined clockwise | ||
/// (which means that east is 90 degrees and west is 270 degrees). If speed is 0, <see cref="Heading"/> is | ||
/// <see cref="double.NaN"/>. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? Heading { get; } | ||
|
||
/// <summary> | ||
/// Velocity of the device in meters per second. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? Speed { get; } | ||
/// <summary> | ||
/// Velocity of the device in meters per second. | ||
/// </summary> | ||
/// <value> | ||
/// Can be <see langword="null"/> if the original data source cannot provide the data. | ||
/// </value> | ||
public double? Speed { get; } | ||
|
||
/// <summary> | ||
/// Time at which the location was retrieved. | ||
/// </summary> | ||
public DateTime Timestamp { get; } | ||
/// <summary> | ||
/// Time at which the location was retrieved. | ||
/// </summary> | ||
public DateTime Timestamp { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of <see cref="GeoLocation"/> class. | ||
/// </summary> | ||
public GeoLocation(DateTime timestamp, double longitude, double latitude, double accuracy, | ||
double? altitude, double? altitudeAccuracy, double? heading, double? speed) | ||
{ | ||
Timestamp = timestamp; | ||
Longitude = longitude; | ||
Latitude = latitude; | ||
Accuracy = accuracy; | ||
Altitude = altitude; | ||
AltitudeAccuracy = altitudeAccuracy; | ||
Heading = heading; | ||
Speed = speed; | ||
} | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="GeoLocation"/> class. | ||
/// </summary> | ||
public GeoLocation(DateTime timestamp, double longitude, double latitude, double accuracy, | ||
double? altitude, double? altitudeAccuracy, double? heading, double? speed) | ||
{ | ||
Timestamp = timestamp; | ||
Longitude = longitude; | ||
Latitude = latitude; | ||
Accuracy = accuracy; | ||
Altitude = altitude; | ||
AltitudeAccuracy = altitudeAccuracy; | ||
Heading = heading; | ||
Speed = speed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace CyclingApp.Models | ||
{ | ||
/// <summary> | ||
/// A read-only route. | ||
/// </summary> | ||
/// <param name="waypoints">The waypoints of the route.</param> | ||
public class ReadOnlyRoute(IList<GeoLocation> waypoints) : RouteBase(waypoints) | ||
{ } | ||
} | ||
namespace CyclingApp.Models; | ||
|
||
/// <summary> | ||
/// A read-only route. | ||
/// </summary> | ||
/// <param name="waypoints">The waypoints of the route.</param> | ||
public class ReadOnlyRoute(IList<GeoLocation> waypoints) : RouteBase(waypoints) | ||
{ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
namespace CyclingApp.Models | ||
namespace CyclingApp.Models; | ||
|
||
/// <summary> | ||
/// An editable route. | ||
/// </summary> | ||
public class Route() : RouteBase([]) | ||
{ | ||
/// <summary> | ||
/// An editable route. | ||
/// Add a waypoint to the route. | ||
/// </summary> | ||
public class Route() : RouteBase([]) | ||
/// <param name="waypoint">The waypoint to add.</param> | ||
public new void AddWaypoint(GeoLocation waypoint) | ||
{ | ||
/// <summary> | ||
/// Add a waypoint to the route. | ||
/// </summary> | ||
/// <param name="waypoint">The waypoint to add.</param> | ||
public new void AddWaypoint(GeoLocation waypoint) | ||
{ | ||
base.AddWaypoint(waypoint); | ||
} | ||
base.AddWaypoint(waypoint); | ||
} | ||
|
||
/// <summary> | ||
/// Remove waypoint from the route. | ||
/// </summary> | ||
/// <param name="waypoint">The waypoint to remove.</param> | ||
public new void RemoveWaypoint(GeoLocation waypoint) | ||
{ | ||
base.RemoveWaypoint(waypoint); | ||
} | ||
/// <summary> | ||
/// Remove waypoint from the route. | ||
/// </summary> | ||
/// <param name="waypoint">The waypoint to remove.</param> | ||
public new void RemoveWaypoint(GeoLocation waypoint) | ||
{ | ||
base.RemoveWaypoint(waypoint); | ||
} | ||
} |
Oops, something went wrong.