Added test mode and manual positioning
This commit is contained in:
@@ -9,38 +9,39 @@ namespace GeoSus.Client
|
||||
{
|
||||
#region Základní typy
|
||||
|
||||
public struct Position
|
||||
{
|
||||
[JsonProperty("lat")]
|
||||
public double Lat { get; set; }
|
||||
|
||||
[JsonProperty("lon")]
|
||||
public double Lon { get; set; }
|
||||
|
||||
public Position(double lat, double lon)
|
||||
public struct Position
|
||||
{
|
||||
Lat = lat;
|
||||
Lon = lon;
|
||||
}
|
||||
|
||||
// Haversine vzdálenost v metrech
|
||||
public double DistanceTo(Position other)
|
||||
{
|
||||
const double R = 6371000;
|
||||
var lat1 = Lat * Math.PI / 180;
|
||||
var lat2 = other.Lat * Math.PI / 180;
|
||||
var dLat = (other.Lat - Lat) * Math.PI / 180;
|
||||
var dLon = (other.Lon - Lon) * Math.PI / 180;
|
||||
|
||||
var a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
|
||||
Math.Cos(lat1) * Math.Cos(lat2) *
|
||||
Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
|
||||
var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
|
||||
|
||||
return R * c;
|
||||
}
|
||||
}
|
||||
[JsonProperty("lat")]
|
||||
public double Lat { get; set; }
|
||||
|
||||
[JsonProperty("lon")]
|
||||
public double Lon { get; set; }
|
||||
|
||||
public Position(double lat, double lon)
|
||||
{
|
||||
Lat = lat;
|
||||
Lon = lon;
|
||||
}
|
||||
|
||||
// Haversine vzdálenost v metrech
|
||||
public double DistanceTo(Position other)
|
||||
{
|
||||
const double R = 6371000;
|
||||
var lat1 = Lat * Math.PI / 180;
|
||||
var lat2 = other.Lat * Math.PI / 180;
|
||||
var dLat = (other.Lat - Lat) * Math.PI / 180;
|
||||
var dLon = (other.Lon - Lon) * Math.PI / 180;
|
||||
|
||||
var a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
|
||||
Math.Cos(lat1) * Math.Cos(lat2) *
|
||||
Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
|
||||
var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
|
||||
|
||||
return R * c;
|
||||
}
|
||||
public static bool operator ==(Position left, Position right) { if (left.Lat == right.Lat && left.Lon == right.Lon) { return true; } else { return false; } }
|
||||
public static bool operator !=(Position left, Position right) { return !(left == right); }
|
||||
}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum PlayerRole { Crew, Impostor }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user