Пример #1
0
        /// <summary>
        /// Retrieves all stations that are located within the box defined by the two corners
        /// </summary>
        /// <param name="cornerOneLatitude">-90.0 to 90.0</param>
        /// <param name="cornerOneLongitude">-180.0 to 180.0</param>
        /// <param name="cornerTwoLatitude">-90.0 to 90.0</param>
        /// <param name="cornerTwoLongitude">-180.0 to 180.0</param>
        /// <returns>Empty list if no stations are found in the area defined</returns>
        public async Task <List <StationInfoDto> > GetStationsInBoxAsync(double cornerOneLatitude, double cornerOneLongitude,
                                                                         double cornerTwoLatitude, double cornerTwoLongitude)
        {
            GeographicValidator.ValidateLatitude(cornerOneLatitude);
            GeographicValidator.ValidateLongitude(cornerOneLongitude);
            GeographicValidator.ValidateLatitude(cornerTwoLatitude);
            GeographicValidator.ValidateLongitude(cornerTwoLongitude);

            return(await _stationDataAccessor.GetStationsInBoxAsync(cornerOneLatitude, cornerOneLongitude,
                                                                    cornerTwoLatitude, cornerTwoLongitude).ConfigureAwait(false));
        }
Пример #2
0
        /// <summary>
        /// Retrieves all stations that are located within the circle defined by the latitude and longitude
        /// for the center and distance defining the radius to search.
        /// </summary>
        /// <param name="latitude">-90.0 to 90.0</param>
        /// <param name="longitude">-180.0 to 180.0</param>
        /// <param name="distance">Statute miles</param>
        /// <returns>Empty list if no stations are found in the area defined</returns>
        public async Task <List <StationInfoDto> > GetStationsNearAsync(double latitude, double longitude,
                                                                        int distance)
        {
            GeographicValidator.ValidateLatitude(latitude);
            GeographicValidator.ValidateLongitude(longitude);
            if (distance < 1)
            {
                throw new ArgumentException("Distance must be a value greater than 0", nameof(distance));
            }

            return(await _stationDataAccessor.GetStationsNearAsync(latitude, longitude, distance)
                   .ConfigureAwait(false));
        }
Пример #3
0
        /// <summary>
        /// Retrieves all TAFs disseminated over the last number of hours
        /// within the box defined by the Latitude and Longitude coordinates
        /// </summary>
        /// <param name="maxLongitude"></param>
        /// <param name="minLongitude"></param>
        /// <param name="maxLatitude"></param>
        /// <param name="minLatitude"></param>
        /// <param name="hoursBeforeNow"></param>
        /// <returns></returns>
        public async Task <List <ForecastDto> > GetForecastsInBoxAsync(int maxLongitude,
                                                                       int minLongitude,
                                                                       int maxLatitude,
                                                                       int minLatitude,
                                                                       int hoursBeforeNow = 4)
        {
            GeographicValidator.ValidateLatitude(minLatitude);
            GeographicValidator.ValidateLatitude(maxLatitude);
            GeographicValidator.ValidateLongitude(minLongitude);
            GeographicValidator.ValidateLongitude(maxLongitude);

            return(await _tafAccessor.GetForecastsInBoxAsync(maxLongitude, minLongitude,
                                                             maxLatitude, minLatitude, hoursBeforeNow).ConfigureAwait(false));
        }
Пример #4
0
        /// <summary>
        /// Retrieves all TAFs disseminated over the last number of hours
        /// within the box defined by the Latitude and Longitude coordinates
        /// </summary>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        /// <param name="radial"></param>
        /// <param name="hoursBeforeNow"></param>
        /// <returns></returns>
        public async Task <List <ForecastDto> > GetForecastsInRadialAsync(int longitude,
                                                                          int latitude,
                                                                          int radial,
                                                                          int hoursBeforeNow = 4)
        {
            if (radial <= 0)
            {
                throw new ArgumentOutOfRangeException($"'{nameof(radial)}' must be greater than 0 but less than 500");
            }
            GeographicValidator.ValidateLatitude(latitude);
            GeographicValidator.ValidateLongitude(longitude);

            return(await _tafAccessor.GetForecastsInRadialAsync(longitude, latitude,
                                                                radial, hoursBeforeNow).ConfigureAwait(false));
        }