/// <summary> /// получить ограничения скоростей с заданного региона /// </summary> /// <param name="region">информация о регионе</param> /// <param name="geocoder">геокодер для получения координат</param> /// <param name="checkStop">функция проверки отмены</param> /// <param name="act">действие при изменении процента выполнения</param> /// <param name="current_region">номер текущего региона (передавать в act)</param> /// <param name="total_regions">всего регионов (передавать в act)</param> /// <returns></returns> public List <ManualLimits> GetLimits(RegionInfo region, IGeocoderProvider geocoder, Func <bool> checkStop = null, Action <int, int, string, int, int> act = null, int current_region = -1, int total_regions = -1) { List <BaseLimit> bases = getBasesLimits(region); List <ManualLimits> res = new List <ManualLimits>(); int counter = 0; foreach (BaseLimit lim in bases) { try { if (checkStop.Invoke()) { return(res); } if (act != null) { act.Invoke(current_region, total_regions, region.Name, counter, bases.Count); } Diapason <double> speeds = new Diapason <double>(0, lim.MaxSpeed); ManualLimits limit = new ManualLimits(null, new List <Diapason <double> >() { speeds }); limit.Name = lim.Name; limit.Position = geocoder.GetCoordinate(lim.Name); res.Add(limit); counter++; } catch (Exception ex) { continue; } } return(res); }
public FormLoadFromNASA(PointLatLng selectedPoint) { InitializeComponent(); Result = null; DialogResult = DialogResult.None; geocoder = new Arcgis(Vars.Options.CacheFolder + "\\arcgis"); comboBoxSpeedHeight.Items.AddRange(NasaWindSpeedHeight.WS10M.GetItems().ToArray()); comboBoxSpeedHeight.SelectedItem = NasaWindSpeedHeight.WS10M.Description(); point = selectedPoint; if (point.IsEmpty) //если точка пустая, то надо попробовать взять из последних { point = Vars.Options.LoadNasaLastPoint; } if (!point.IsEmpty) { spoint = new RP5MeteostationInfo(); spoint.Position = point; labelPointCoordinates.Text = $"Широта: {point.Lat:0.000} Долгота: {point.Lng:0.000}"; loadAddressAsync(point); buttonDownload.Enabled = true; dateTimePickerFromDate.Enabled = true; dateTimePickerToDate.Enabled = true; } }