internal override void Process() { Thread roadLoadStatusThread = new Thread(UpdateStatus); roadLoadStatusThread.Start(); ConcurrencyUtils.SetText(mainForm.ResultLabel, "Идет пстроение улиц"); ConcurrencyUtils.SetAvailability(mainForm.AllDirectionButton, false); ConcurrencyUtils.SetAvailability(mainForm.ClearButton, false); ConcurrencyUtils.SetAvailability(mainForm.StreetViewsRequestButton, false); if (mainForm.GMapForm.Markers.Count > 1) { LoadedRoades = controller.GetAllRoadsOfArea( mainForm.GMapForm.Markers[0].Position.Lat, mainForm.GMapForm.Markers[0].Position.Lng, mainForm.GMapForm.Markers[1].Position.Lat, mainForm.GMapForm.Markers[1].Position.Lng); } else { LoadedRoades = controller.GetAllRoadsOfArea(mainForm.GMapForm.Markers[0].Position.Lat, mainForm.GMapForm.Markers[0].Position.Lng); } foreach (Road road in LoadedRoades.Values) { mainForm.GMapForm.MainMapRoute.AddRoad(road); int rowIndex = mainForm.FindRowByStreetName(mainForm.StreetsGridView, road.Name); if (rowIndex != -1) { ConcurrencyUtils.SetCellValue(mainForm.StreetsGridView, rowIndex, 1, "Нет"); } else { ConcurrencyUtils.AddRow(mainForm.StreetsGridView, new object[] { road.Name, road.IsStreetViewsDownloaded ? "Да" : "Нет", false }); } } isLoadComplete = true; }
protected override void UpdateStatus() { while (!isLoadComplete) { Thread.Sleep(1000); } ConcurrencyUtils.SetAvailability(mainForm.AllDirectionButton, true); ConcurrencyUtils.SetAvailability(mainForm.ClearButton, true); ConcurrencyUtils.SetAvailability(mainForm.StreetViewsRequestButton, true); ConcurrencyUtils.SetText(mainForm.ResultLabel, "Построение улиц завершено"); }
protected override void UpdateStatus() { while (downloader.Status < 100) { ConcurrencyUtils.SetText(mainForm.ResultLabel, "Идет загрузка панорамных изображений. Загружено " + downloader.Status + "%"); Thread.Sleep(1000); List <PolylineChunk> chunks = downloader.GetDownloadedChunks(); foreach (long overpassId in chunks.Select(ch => ch.OverpassId)) { mainForm.GMapForm.MainMapRoute.DeHighlightPolylineChunk(overpassId, true); } UpdateRoadsStatus(); } UpdateRoadsStatus(); ConcurrencyUtils.SetAvailability(mainForm.AllDirectionButton, true); ConcurrencyUtils.SetAvailability(mainForm.ClearButton, true); ConcurrencyUtils.SetAvailability(mainForm.StreetViewsRequestButton, true); ConcurrencyUtils.SetText(mainForm.ResultLabel, "Загрузка панорамных изображений завершена"); }
internal override void Process() { List <string> streets = new List <string>(); foreach (DataGridViewRow row in mainForm.StreetsGridView.Rows) { bool rowSelected = (bool)row.Cells[2].Value; if (rowSelected) { streets.Add((string)row.Cells[0].Value); } } if (streets.Count > 0) { ConcurrencyUtils.SetAvailability(mainForm.AllDirectionButton, false); ConcurrencyUtils.SetAvailability(mainForm.ClearButton, false); ConcurrencyUtils.SetAvailability(mainForm.StreetViewsRequestButton, false); GeographiData geoData = GeographiData.Instance; foreach (string roadName in streets) { Road road = geoData.Roads[roadName]; foreach (PolylineChunk chunk in road.PolylineChunks) { if (chunk.IsStreetViewsDownloaded) { mainForm.GMapForm.MainMapRoute.DeHighlightPolylineChunk(chunk.OverpassId, true); } } } downloader = controller.GetStreetViews(streets, "Data\\Chunks"); Thread roadLoadStatusThread = new Thread(UpdateStatus); roadLoadStatusThread.Start(); } else { ConcurrencyUtils.SetText(mainForm.ResultLabel, "Не выбрано ни одной улицы. Для загрузки панорам выберете хотябы одну улицу."); } }