public double DistanceToEuclid(Position2DViewModel other) { var x = other.Latitude - Latitude; var y = (other.Longitude - Longitude) * cosOfLatitude; return(deglen * Math.Sqrt(x * x + y * y)); }
public WildPokemonViewModel(WildPokemon pokemon, Settings settings) : base(pokemon.PokemonData, settings) { EncounterId = pokemon.EncounterId; LastModifiedTimestampMs = pokemon.LastModifiedTimestampMs; Position = new Position2DViewModel(pokemon.Latitude, pokemon.Longitude); SpawnpointId = pokemon.SpawnPointId; TimeTillHiddenMs = pokemon.TimeTillHiddenMs; }
public WildPokemonViewModel(PokemonData pokemon, FortData fort, Settings settings) : base(pokemon, settings) { EncounterId = fort.LureInfo.EncounterId; LastModifiedTimestampMs = fort.LastModifiedTimestampMs; Position = new Position2DViewModel(fort.Latitude, fort.Longitude); SpawnpointId = fort.LureInfo.FortId; TimeTillHiddenMs = fort.LureInfo.LureExpiresTimestampMs; }
public double DistanceTo(Position2DViewModel other) { var lat2 = ToRadians(other.Latitude); var dLat = ToRadians(other.Latitude - Latitude); var dLng = ToRadians(other.Longitude - Longitude); var h = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + cosOfLatitude * Math.Cos(lat2) * Math.Sin(dLng / 2) * Math.Sin(dLng / 2); var c = 2 * Math.Atan2(Math.Sqrt(h), Math.Sqrt(1 - h)); return(R * c); }
public MapPokemonViewModel(MapPokemon pokemon, SessionViewModel session, Settings settings, PlayerViewModel player, MapViewModel map) : base(pokemon.PokemonId, pokemon.EncounterId, settings) { this.session = session; this.player = player; this.map = map; EncounterId = pokemon.EncounterId; ExpirationTimestampMs = pokemon.ExpirationTimestampMs; SpawnPointId = pokemon.SpawnPointId; Position = new Position2DViewModel(pokemon.Latitude, pokemon.Longitude); }
public MapPokemonViewModel(FortData fort, SessionViewModel session, Settings settings, PlayerViewModel player, MapViewModel map) : base(fort.LureInfo.ActivePokemonId, fort.LureInfo.EncounterId, settings) { this.session = session; this.player = player; this.map = map; isPokemonFromLure = true; this.fort = fort; var lureInfo = fort.LureInfo; EncounterId = lureInfo.EncounterId; ExpirationTimestampMs = lureInfo.LureExpiresTimestampMs; SpawnPointId = lureInfo.FortId; Position = new Position2DViewModel(fort.Latitude, fort.Longitude); }
public bool Equals(Position2DViewModel other) { return(other != null && Latitude == other.Latitude && Longitude == other.Longitude); }
public bool IsInRange(Position2DViewModel other, double range) => DistanceToEuclid(other) <= range && DistanceTo(other) <= range;
public FortViewModel(FortData fort, SessionViewModel session) { Position = new Position2DViewModel(fort.Latitude, fort.Longitude); Id = fort.Id; this.session = session; }
bool CanExecuteMove(Position2DViewModel param) => true;
Task ExecuteMove(Position2DViewModel param) => MoveToAsync(param.To3D(Position.Altitute));