Esempio n. 1
0
 private void импортToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFile        = new OpenFileDialog();
     OpenFile.Filter = "GSI | *.GSI; *.gsi";
     if (OpenFile.ShowDialog() == DialogResult.OK)
     {
         data   = new List <string>();
         result = new List <string>();
         data.AddRange(File.ReadAllLines(OpenFile.FileName));
         foreach (var item in data)
         {
             if (item.Contains("?"))
             {
                 continue;
             }
             result.Add(GET.PointName(item));
         }
         settingForm.dataGridView1.Rows.Clear();
         foreach (var item in result.GroupBy(x => x).Select(y => y.Key).ToList())
         {
             settingForm.dataGridView1.Rows.Add(item, "0.0");
         }
         start_btn.Enabled = true;
     }
 }
Esempio n. 2
0
        static private List <string> Recalculate(List <string> data, bool IsGSI_16)
        {
            int           count   = 1;
            List <string> result  = new List <string>();
            Station       station = new Station();

            foreach (var item in data)
            {
                if (item.Contains("41") && item.Contains("?..."))
                {
                    result.Add(item);
                    continue;
                }
                if (item.Contains("83..") && !item.Contains("571.08"))
                {
                    station.GroundHeight = GET.GroundHeight(item);
                    result.Add(CONVERT.ChangeValueInLine(GET.PointName(item), station.GroundHeight, IsGSI_16));
                }
                if (item.Contains("32...8"))
                {
                    if (count == 1)
                    {
                        result.Add(item.Replace(" 336.08", " 331.08"));
                        station.RearPointName     = GET.PointName(item);
                        station.RearPointDistance = GET.Distance(item);
                        station.RearLevelHeight   = GET.LevelHeight(item);
                        count++;
                        continue;
                    }
                    if (count == 2)
                    {
                        result.Add(item.Replace(" 335.08", " 332.08"));
                        station.FrontPointName     = GET.PointName(item);
                        station.FrontPointDistance = GET.Distance(item);
                        station.FrontLevelHeight   = GET.LevelHeight(item);
                        count = 1;
                        continue;
                    }
                }
                if (item.Contains("571.08") && item.Contains("83.."))
                {
                    station.AllMoveDistance             += station.RearPointDistance + station.FrontPointDistance;
                    station.ComulativeSholders          += station.RearPointDistance - station.FrontPointDistance;
                    station.GroundHeight                += station.RearLevelHeight - station.FrontLevelHeight;
                    station.StationDifference            = (int)GET.IntroductionError(7);
                    station.ComulativeStationDifference += station.StationDifference;
                    result.Add(CONVERT.ToStationStringBuilder(station, IsGSI_16, true));
                }
            }
            return(result);
        }
        public List <string> RecaculateStation(List <string> DataStationFromFile, List <string[]> HeightCorrect, Station station, bool IsGSI_16)
        {
            List <string> result = new List <string>();
            List <string> middle = new List <string>();
            int           row    = 1;
            int           correctRearValue;
            int           correctFrontValue;

            foreach (var item in DataStationFromFile)
            {
                if (item.Contains("41") && item.Contains("?..."))
                {
                    result.Add(item);
                    continue;
                }
                if (item.Contains("83..") && !item.Contains("571.08"))
                {
                    station.GroundHeight = GET.GroundHeight(item);
                    result.Add(item);
                }
                if (item.Contains("32...8"))
                {
                    if (row == 1)
                    {
                        station.RearPointName     = GET.PointName(item);
                        station.RearPointDistance = GET.Distance(item);
                        correctRearValue          = GET.CorrectValue(HeightCorrect, station.RearPointName);
                        station.StationHeight     = GetStationHeight(GET.LevelHeight(item), GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 1]));
                        var SpecialRearH = GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 3]);
                        station.RearLevelHeight = (GET.LevelHeight(item) + SpecialRearH) / 2 - correctRearValue + station.StationHeight;
                        station.MeasureSKO      = GET.SKO(item);

                        middle.Add(CONVERT.ToStationStringBuilder(station.RearPointName, station.RearPointDistance, "331.08", station.RearLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 2)
                    {
                        station.FrontPointName     = GET.PointName(item);
                        station.FrontPointDistance = GET.Distance(item);
                        station.MeasureSKO         = GET.SKO(item);
                        correctFrontValue          = GET.CorrectValue(HeightCorrect, station.FrontPointName);
                        int SpecialFrontH = GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 1]);
                        station.FrontLevelHeight = (GET.LevelHeight(item) + SpecialFrontH) / 2 - correctFrontValue + station.StationHeight;
                        middle.Add(CONVERT.ToStationStringBuilder(station.FrontPointName, station.FrontPointDistance, "332.08", station.FrontLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 3)
                    {
                        station.SpetialFrontPointDistance = GET.Distance(item);
                        station.MeasureSKO = GET.SKO(item);
                        station.SpetialFrontLevelHeight = station.FrontLevelHeight;
                        middle.Add(CONVERT.ToStationStringBuilder(station.FrontPointName, station.SpetialFrontPointDistance, "336.08", station.SpetialFrontLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 4)
                    {
                        station.SpetialRearPointDistance = GET.Distance(item);
                        station.MeasureSKO             = GET.SKO(item);
                        station.SpetialRearLevelHeight = station.RearLevelHeight;
                        station.StationHeight          = 0;
                        middle.Add(CONVERT.ToStationStringBuilder(station.RearPointName, station.SpetialRearPointDistance, "335.08", station.SpetialRearLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row = 1;
                        continue;
                    }
                }
                middle.Add(item);
            }
            station.GroundHeight += ((station.RearLevelHeight - station.FrontLevelHeight) + (station.SpetialRearLevelHeight - station.SpetialFrontLevelHeight)) / 2;

            foreach (var item in middle)
            {
                if (item.Contains("32...8"))
                {
                    if (row == 1)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.RearPointDistance, station.RearLevelHeight, "331.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 2)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.FrontPointDistance, station.FrontLevelHeight, "332.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 3)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.SpetialFrontPointDistance, station.SpetialFrontLevelHeight, "336.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 4)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.SpetialRearPointDistance, station.SpetialRearLevelHeight, "335.08", IsGSI_16));
                        row = 1;
                        continue;
                    }
                }
                if (item.Contains("571.08") && item.Contains("83..08"))
                {
                    result.Add(CONVERT.ToStationStringBuilder(item, station.GroundHeight, IsGSI_16));
                }
            }
            return(result);
        }
        public List <string> RecaculateStation(List <string> DataStationFromFile, List <string[]> HeightCorrect, Station station, double sigma, bool IsGSI_16)
        {
            List <string> result = new List <string>();
            List <string> middle = new List <string>();
            int           row    = 1;
            int           correctRearValue;
            int           correctFrontValue;

            foreach (var item in DataStationFromFile)
            {
                if (item.Contains("41") && item.Contains("?..."))
                {
                    result.Add(item);
                    continue;
                }
                if (item.Contains("83..") && !item.Contains("571.08"))
                {
                    station.GroundHeight = GET.GroundHeight(item);
                    result.Add(CONVERT.ChangeValueInLine(GET.PointName(item), station.GroundHeight, IsGSI_16));
                }
                if (item.Contains("32...8"))
                {
                    if (row == 1)
                    {
                        station.RearPointName     = GET.PointName(item);
                        station.RearPointDistance = GET.Distance(item);
                        correctRearValue          = GET.CorrectValue(HeightCorrect, station.RearPointName);
                        station.StationHeight     = GetStationHeight(GET.LevelHeight(item), GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 1]));
                        station.MeasureError      = (int)(GET.IntroductionError(sigma) * 100);
                        var SpecialRearH = GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 3]);
                        station.RearLevelHeight = (GET.LevelHeight(item) + SpecialRearH) / 2 - correctRearValue + station.StationHeight + station.MeasureError;
                        station.MeasureSKO      = (int)(GET.IntroductionError(0.1) * 100);
                        middle.Add(CONVERT.ToStationStringBuilder(station.RearPointName, station.RearPointDistance, "331.08", station.RearLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 2)
                    {
                        station.FrontPointName     = GET.PointName(item);
                        station.FrontPointDistance = GET.Distance(item);

                        correctFrontValue = GET.CorrectValue(HeightCorrect, station.FrontPointName);
                        int SpecialFrontH = GET.LevelHeight(DataStationFromFile[DataStationFromFile.IndexOf(item) + 1]);
                        station.MeasureError     = (int)(GET.IntroductionError(sigma) * 100);
                        station.FrontLevelHeight = (GET.LevelHeight(item) + SpecialFrontH) / 2 - correctFrontValue + station.MeasureError + station.StationHeight;
                        station.MeasureSKO       = (int)(GET.IntroductionError(0.1) * 100);
                        middle.Add(CONVERT.ToStationStringBuilder(station.FrontPointName, station.FrontPointDistance, "332.08", station.FrontLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 3)
                    {
                        station.SpetialFrontPointDistance = GET.Distance(item);
                        var rnd   = new Random();
                        int value = rnd.Next(-45, 45);
                        station.SpetialFrontLevelHeight = station.FrontLevelHeight + value;
                        station.MeasureSKO = (int)(GET.IntroductionError(0.1) * 100);
                        middle.Add(CONVERT.ToStationStringBuilder(station.FrontPointName, station.SpetialFrontPointDistance, "336.08", station.SpetialFrontLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 4)
                    {
                        station.SpetialRearPointDistance = GET.Distance(item);
                        var rnd   = new Random();
                        int value = rnd.Next(-45, 45);
                        station.SpetialRearLevelHeight = station.RearLevelHeight + value;
                        station.StationHeight          = 0;
                        station.MeasureSKO             = (int)(GET.IntroductionError(0.1) * 100);
                        middle.Add(CONVERT.ToStationStringBuilder(station.RearPointName, station.SpetialRearPointDistance, "335.08", station.SpetialRearLevelHeight, 3, station.MeasureSKO, IsGSI_16));
                        row = 1;
                        continue;
                    }
                }
                middle.Add(item);
            }

            int NewDistance  = ((station.RearPointDistance + station.FrontPointDistance + station.SpetialFrontPointDistance + station.SpetialRearPointDistance) / 2) + (int)(GET.IntroductionError(900) * 1000);
            int SholderError = (int)(GET.IntroductionError(900) * 1000);

            station.RearPointDistance         = NewDistance / 2 + SholderError;
            station.FrontPointDistance        = NewDistance / 2 - SholderError;
            station.SpetialFrontPointDistance = station.FrontPointDistance + (int)(GET.IntroductionError(3) * 50);
            station.SpetialRearPointDistance  = station.RearPointDistance + (int)(GET.IntroductionError(3) * 50);
            station.AllMoveDistance          += (station.RearPointDistance + station.FrontPointDistance + station.SpetialRearPointDistance + station.SpetialFrontPointDistance) / 2;
            station.ComulativeSholders       += ((station.RearPointDistance - station.FrontPointDistance) + (station.SpetialRearPointDistance - station.SpetialFrontPointDistance)) / 2;
            station.GroundHeight                += ((station.RearLevelHeight - station.FrontLevelHeight) + (station.SpetialRearLevelHeight - station.SpetialFrontLevelHeight)) / 2;
            station.StationDifference            = (int)GET.IntroductionError(7);
            station.ComulativeStationDifference += station.StationDifference;
            foreach (var item in middle)
            {
                if (item.Contains("32...8"))
                {
                    if (row == 1)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.RearPointDistance, station.RearLevelHeight, "331.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 2)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.FrontPointDistance, station.FrontLevelHeight, "332.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 3)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.SpetialFrontPointDistance, station.SpetialFrontLevelHeight, "336.08", IsGSI_16));
                        row++;
                        continue;
                    }
                    if (row == 4)
                    {
                        result.Add(CONVERT.ChangeValueInLine(item, station.SpetialRearPointDistance, station.SpetialRearLevelHeight, "335.08", IsGSI_16));
                        row = 1;
                        continue;
                    }
                }
                if (item.Contains("571.08") && item.Contains("83..08"))
                {
                    result.Add(CONVERT.ToStationStringBuilder(station, IsGSI_16));
                }
            }
            return(result);
        }