示例#1
0
 /// <summary>Trennt die Punkte aus dem angegebenen Text</summary>
 /// <param name="settings"></param>
 /// <param name="editor"></param>
 public void getPointsFromEditor(Settings settings, IScintillaGateway editor)
 {
     punkte.Clear();
     if (editor != null)
     {
         Int32 countLines = editor.GetLineCount();
         for (Int32 lc = 0; lc < countLines; lc++)
         {
             String cuLine = editor.GetLine(lc);
             // Auch Excel Splitbar machen ;-)
             cuLine = cuLine.Replace('\t', ' ');                         // Tab durch Leerzeichen ersetzten
             cuLine = cuLine.Replace(',', settings.Decimalseperator[0]); // , durch . ersetzten
             String[] split = ClassStringTools.GetFieldsManyDelimiters(cuLine, ' ', true);
             if (split != null)
             {
                 if (split.Length >= 4) // mind PNR R H E
                 {
                     ClassCADdyPunkt newPoint = new ClassCADdyPunkt();
                     {
                         newPoint.Punktnummer = ClassStringTools.trimToEmpty(split[settings.PointName_Column - 1]);
                         if (settings.PointName_ToUpper)
                         {
                             newPoint.Punktnummer = newPoint.Punktnummer.ToUpper();
                         }
                         if (!ClassStringTools.IsNullOrWhiteSpace(newPoint.Punktnummer))
                         {
                             Double temp = Double.NaN;
                             if (ClassConverters.StringToDouble(split[settings.Koord_RW_E_Column - 1], out temp))
                             {
                                 newPoint.Rechtswert = temp;
                                 if (ClassConverters.StringToDouble(split[settings.Koord_HW_N_Column - 1], out temp))
                                 {
                                     newPoint.Hochwert = temp;
                                     if (ClassConverters.StringToDouble(split[settings.Koord_Elev_Column - 1], out temp))
                                     {
                                         newPoint.Hoehe      = temp;
                                         newPoint.LineNumber = lc;
                                         if (split.Length >= 5)
                                         {   // code
                                             newPoint.Code = ClassStringTools.trimToEmpty(split[settings.Koord_Code_Column - 1]);
                                             if (split.Length >= 6)
                                             {   // code
                                                 newPoint.Bemerkung = ClassStringTools.trimToEmpty(split[settings.Koord_Descript_Column - 1]);
                                             }
                                         }
                                         punkte.Add(newPoint);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     hasPunkte = punkte.Count > 0;
 }
示例#2
0
        /// <summary>Trennt die Punkte aus dem Aktuellem Text</summary>
        /// <param name="settings"></param>
        public void getMeasuresFromCurrentCADdy(Settings settings)
        {
            IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());

            standpunkte.Clear();
            if (editor != null)
            {
                Int32 countLines = editor.GetLineCount();
                ClassCADdyStandpunkt cuStandpunkt = null;
                for (Int32 lc = 0; lc < countLines; lc++)
                {
                    String cuLine = editor.GetLine(lc);
                    // Auch Excel Splitbar machen ;-)
                    cuLine = cuLine.Replace('\t', ' ');                         // Tab durch Leerzeichen ersetzten
                    cuLine = cuLine.Replace(',', settings.Decimalseperator[0]); // , durch . ersetzten
                    String[] split = ClassStringTools.GetFieldsManyDelimiters(cuLine, ' ', true);
                    if (split != null)
                    {
                        if ((4 >= split.Length) && (split.Length >= 3)) // Standpunkt
                        {
                            if (split[0].StartsWith("-"))
                            {
                                if (cuStandpunkt != null)
                                {
                                    standpunkte.Add(cuStandpunkt);
                                }
                                cuStandpunkt             = new ClassCADdyStandpunkt();
                                cuStandpunkt.LineNumber  = lc;
                                cuStandpunkt.Punktnummer = ClassStringTools.trimToEmpty(split[settings.PointName_Column - 1]);
                                if (settings.PointName_ToUpper)
                                {
                                    cuStandpunkt.Punktnummer = cuStandpunkt.Punktnummer.ToUpper();
                                }
                                Double temp = Double.NaN;
                                if (ClassConverters.StringToDouble(split[settings.Messd_I_Column - 1], out temp))
                                {
                                    cuStandpunkt.I = temp;
                                    // code
                                    cuStandpunkt.Code = ClassStringTools.trimToEmpty(split[settings.Messd_STPKCode_Column - 1]);
                                    if (split.Length == 4)
                                    {   // code
                                        cuStandpunkt.Bemerkung = ClassStringTools.trimToEmpty(split[settings.Messd_STPKDescript_Column - 1]);
                                    }
                                }
                            }
                        }
                        if (split.Length >= 5) // = Zielpunkt
                        {
                            if (cuStandpunkt != null)
                            {
                                ClassCADdyZielung zielung = new ClassCADdyZielung();
                                {
                                    zielung.Zielpunkt = ClassStringTools.trimToEmpty(split[settings.PointName_Column - 1]);
                                    if (settings.PointName_ToUpper)
                                    {
                                        zielung.Zielpunkt = zielung.Zielpunkt.ToUpper();
                                    }
                                    if (!ClassStringTools.IsNullOrWhiteSpace(zielung.Zielpunkt))
                                    {
                                        Double temp = Double.NaN;
                                        if (ClassConverters.StringToDouble(split[settings.Messd_Hz_Column - 1], out temp))
                                        {
                                            zielung.Hz = temp;
                                            if (ClassConverters.StringToDouble(split[settings.Messd_S_Column - 1], out temp))
                                            {
                                                zielung.S = temp;
                                                if (ClassConverters.StringToDouble(split[settings.Messd_V_Column - 1], out temp))
                                                {
                                                    zielung.V = temp;
                                                    if (ClassConverters.StringToDouble(split[settings.Messd_D_Column - 1], out temp))
                                                    {
                                                        zielung.D = temp;
                                                        if (split.Length >= 6)
                                                        {   // code
                                                            zielung.Code = ClassStringTools.trimToEmpty(split[settings.Messd_Code_Column - 1]);
                                                            if (split.Length >= 7)
                                                            {   // Beschreibung
                                                                zielung.Bemerkung = ClassStringTools.trimToEmpty(split[settings.Messd_Descript_Column - 1]);
                                                            }
                                                        }
                                                    }
                                                    zielung.LineNumber = lc;
                                                    cuStandpunkt.Zielungen.Add(zielung);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                // den letzten nicht vergessen
                if (cuStandpunkt != null)
                {
                    standpunkte.Add(cuStandpunkt);
                }
            }
            hasMessdaten = standpunkte.Count > 0;
        }
示例#3
0
        /// <summary>Testet, um welche Datenstruktut es sich handeln könnte</summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static enWhatIAm check(Settings settings)
        {
            enWhatIAm         result = enWhatIAm.iDontKnown;
            IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());

            if (editor.GetLineCount() > 0)
            {
                String cuLine = editor.GetLine(0);
                cuLine = cuLine.Replace('\t', ' ');                         // Tab durch Leerzeichen ersetzten
                cuLine = cuLine.Replace(',', settings.Decimalseperator[0]); // , durch . ersetzten
                String[] split = ClassStringTools.GetFieldsManyDelimiters(cuLine, ' ', true);
                if (split != null)
                {
                    switch (split.Length)
                    {
                    case 3:
                        if (split[settings.PointName_Column - 1].StartsWith("-"))
                        {
                            result = enWhatIAm.CADdyMeasure;
                        }
                        break;

                    case 4:
                        if (split[settings.PointName_Column - 1].StartsWith("-"))
                        {
                            result = enWhatIAm.CADdyMeasure;
                        }
                        else if (split[settings.Koord_RW_E_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_RW_E_Column - 1]))
                        {
                            if (split[settings.Koord_HW_N_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_HW_N_Column - 1]))
                            {
                                if (split[settings.Koord_Elev_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_Elev_Column - 1]))
                                {
                                    // Koordinaten ohne Code
                                    result = enWhatIAm.CADdyCoord;
                                }
                            }
                        }
                        break;

                    case 5:
                        if (split[settings.Koord_RW_E_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_RW_E_Column - 1]))
                        {
                            if (split[settings.Koord_HW_N_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_HW_N_Column - 1]))
                            {
                                if (split[settings.Koord_Elev_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Koord_Elev_Column - 1]))
                                {
                                    if (!split[settings.Koord_Code_Column - 1].Contains(settings.Decimalseperator))
                                    {
                                        result = enWhatIAm.CADdyCoord;
                                    }
                                }
                            }
                        }
                        if (result == enWhatIAm.iDontKnown)
                        {
                            if (split[settings.Messd_Hz_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_Hz_Column - 1]))
                            {
                                if (split[settings.Messd_V_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_V_Column - 1]))
                                {
                                    if (split[settings.Messd_S_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_S_Column - 1]))
                                    {
                                        if (split[settings.Messd_D_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_D_Column]))
                                        {
                                            result = enWhatIAm.CADdyMeasure;
                                        }
                                    }
                                }
                            }
                        }
                        break;

                    case 6:
                        if (split[settings.Koord_RW_E_Column - 1].Contains(settings.Decimalseperator))
                        {
                            if (split[settings.Koord_HW_N_Column - 1].Contains(settings.Decimalseperator))
                            {
                                if (split[settings.Koord_Elev_Column - 1].Contains(settings.Decimalseperator))
                                {
                                    if (!split[settings.Koord_Code_Column - 1].Contains(settings.Decimalseperator))
                                    {
                                        result = enWhatIAm.CADdyCoord;
                                    }
                                }
                            }
                        }
                        if (result == enWhatIAm.iDontKnown)
                        {
                            if (split[settings.Messd_Hz_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_Hz_Column - 1]))
                            {
                                if (split[settings.Messd_V_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_V_Column - 1]))
                                {
                                    if (split[settings.Messd_S_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_S_Column - 1]))
                                    {
                                        if (split[settings.Messd_D_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_D_Column - 1]))
                                        {
                                            if (!split[settings.Messd_Code_Column - 1].Contains(settings.Decimalseperator))
                                            {
                                                result = enWhatIAm.CADdyMeasure;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;

                    case 7:
                        if (split[settings.Messd_Hz_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_Hz_Column - 1]))
                        {
                            if (split[settings.Messd_V_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_V_Column - 1]))
                            {
                                if (split[settings.Messd_S_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_S_Column - 1]))
                                {
                                    if (split[settings.Messd_D_Column - 1].Contains(settings.Decimalseperator) || ClassStringTools.IsNumeric(split[settings.Messd_D_Column - 1]))
                                    {
                                        if (!split[settings.Messd_Code_Column - 1].Contains(settings.Decimalseperator))
                                        {
                                            result = enWhatIAm.CADdyMeasure;
                                        }
                                    }
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            return(result);
        }