Exemplo n.º 1
0
    private void UpdateNearestObjectLocation(float latitude, float longitude)
    {
        _nearestMapPoint = _map.all_points[0];
        var   currentLocation  = new Location(latitude, longitude);
        float shortestDistance = LocationUtils.Hoversine(currentLocation, _nearestMapPoint.coords);

        foreach (var point in _map.all_points)
        {
            var tmpDist = LocationUtils.Hoversine(currentLocation, point.coords);
            if (tmpDist > shortestDistance)
            {
                continue;
            }
            shortestDistance = tmpDist;
            _nearestMapPoint = point;
        }
    }