Exemple #1
0
        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;
        }
Exemple #2
0
        private void UpdateRoadsStatus()
        {
            List <Road> downloadedRoads = downloader.GetDownloadedRoads();

            foreach (Road road in downloadedRoads)
            {
                int rowIndex = mainForm.FindRowByStreetName(mainForm.StreetsGridView, road.Name);
                if (rowIndex != -1)
                {
                    ConcurrencyUtils.SetCellValue(mainForm.StreetsGridView, rowIndex, 1, "Да");
                    ConcurrencyUtils.SetCellValue(mainForm.StreetsGridView, rowIndex, 2, false);
                    rowIndex = mainForm.FindRowByStreetName(mainForm.StreetsBypassView, road.Name);
                    if (rowIndex != -1)
                    {
                        ConcurrencyUtils.SetCellValue(mainForm.StreetsBypassView, rowIndex, 1, "Нет");
                    }
                    else
                    {
                        ConcurrencyUtils.AddRow(mainForm.StreetsBypassView, new object[] { road.Name, road.IsSignDetected ? "Да" : "Нет", false });
                    }
                    mainForm.GMapForm.MiniMapRoute.AddRoad(road);
                }
            }
            mainForm.GMapForm.RefreshGMapMini();
        }
Exemple #3
0
 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, "Построение улиц завершено");
 }
Exemple #4
0
 protected override void UpdateStatus()
 {
     while (processor.Status < 100)
     {
         UpdateMiniMap();
         UpdateRoadsStatus();
         UpdateStreetViewBox();
         Thread.Sleep(500);
     }
     UpdateMiniMap();
     UpdateRoadsStatus();
     UpdateStreetViewBox();
     ConcurrencyUtils.SetAvailability(mainForm.DetectSignsInViewsButton, true);
 }
Exemple #5
0
        private void UpdateRoadsStatus()
        {
            List <string> processedRoads = processor.GetProcessedRoadsNames();

            foreach (string roadName in processedRoads)
            {
                int rowIndex = mainForm.FindRowByStreetName(mainForm.StreetsBypassView, roadName);
                if (rowIndex != -1)
                {
                    ConcurrencyUtils.SetCellValue(mainForm.StreetsBypassView, rowIndex, 1, "Да");
                    ConcurrencyUtils.SetCellValue(mainForm.StreetsBypassView, rowIndex, 2, false);
                }
            }
        }
Exemple #6
0
        private void UpdateStreetViewBox()
        {
            List <SignDetectionResult> results = processor.GetBypassResults();

            foreach (SignDetectionResult result in results)
            {
                foreach (var detectorsResult in result.DetectorsResult)
                {
                    foreach (Sign sign in detectorsResult.Value)
                    {
                        ConcurrencyUtils.AddRow(mainForm.SignsGridView, new object[] { sign.ClassName, sign.DetectorName });
                        mainForm.SignsRowIndexDictionary.Add(mainForm.SignsGridView.RowCount, sign);
                    }
                }

                ConcurrencyUtils.SetImage(mainForm.StreetViewBox, result.Image);
                Thread.Sleep(1000);
            }
        }
Exemple #7
0
        internal override void Process()
        {
            List <string> streets = new List <string>();

            foreach (DataGridViewRow row in mainForm.StreetsBypassView.Rows)
            {
                bool rowSelected = (bool)row.Cells[2].Value;
                if (rowSelected)
                {
                    streets.Add((string)row.Cells[0].Value);
                }
            }

            if (streets.Count > 0)
            {
                ConcurrencyUtils.SetAvailability(mainForm.DetectSignsInViewsButton, false);

                GeographiData geoData = GeographiData.Instance;
                foreach (string roadName in streets)
                {
                    Road road = geoData.Roads[roadName];
                    foreach (PolylineChunk chunk in road.PolylineChunks)
                    {
                        if (chunk.IsSignDetected)
                        {
                            mainForm.GMapForm.MiniMapRoute.DeHighlightPolylineChunk(chunk.OverpassId, true);
                        }
                    }

                    List <string> selectedDetectorsNames = mainForm.GetCheckedDetectorsNamesList();
                    if (selectedDetectorsNames.Count > 0)
                    {
                        processor = controller.StartDetection(streets, selectedDetectorsNames);
                        Thread byPassStatusThread = new Thread(UpdateStatus);
                        byPassStatusThread.Start();
                    }
                    else
                    {
                        ConcurrencyUtils.SetAvailability(mainForm.DetectSignsInViewsButton, true);
                    }
                }
            }
        }
Exemple #8
0
 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, "Загрузка панорамных изображений завершена");
 }
Exemple #9
0
        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, "Не выбрано ни одной улицы. Для загрузки панорам выберете хотябы одну улицу.");
            }
        }