private string create_DATyz(List <Messpunkt> vMP)
        {
            string           Text = String.Empty;
            NumberFormatInfo nfi  = new NumberFormatInfo();

            nfi.NumberDecimalDigits = _config.GetAppSettingInt("decimals");

            for (int i = 0; i < vMP.Count; i++)
            {
                Messpunkt objMP = vMP[i];

                string Zeile = objMP.NR.PadLeft(9);

                Zeile += objMP.Hochwert.ToString("N", nfi).PadLeft(13);
                Zeile.Replace(",", ".");

                if (objMP.Höhe.HasValue)
                {
                    Zeile += objMP.Höhe.Value.ToString("N", nfi).PadLeft(13);
                }

                Zeile += objMP.Rechtswert.ToString("N", nfi).PadLeft(13);
                Zeile.Replace(",", ".");

                Zeile  = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }
Exemple #2
0
        private string create_DATyz(List <Messpunkt> vMP)
        {
            string Text = String.Empty;

            for (int i = 0; i < vMP.Count; i++)
            {
                Messpunkt objMP = vMP[i];
                string    Format;
                switch (objMP.PrecisionX)
                {
                case 1:
                    Format = "0.0";
                    break;

                case 2:
                    Format = Global.Format2;
                    break;

                case 3:
                    Format = Global.Format3;
                    break;

                case 4:
                    Format = Global.Format4;
                    break;

                case 5:
                    Format = Global.Format5;
                    break;

                default:
                    Format = Global.Format0;
                    break;
                }

                string Zeile = objMP.NR.PadLeft(9);

                Zeile += objMP.Hochwert.ToString(Format).PadLeft(13);
                Zeile.Replace(",", ".");

                if (objMP.Höhe.HasValue)
                {
                    Zeile += objMP.Höhe.Value.ToString(Format).PadLeft(13);
                }

                Zeile += objMP.Rechtswert.ToString(Format).PadLeft(13);
                Zeile.Replace(",", ".");

                Zeile  = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }
        //Methoden
        public void create_vMP()
        {
            char[]   seperator = { '\r', '\n' };
            string[] arText    = m_GSI_Text.Split(seperator, StringSplitOptions.RemoveEmptyEntries);

            foreach (string Zeile in arText)
            {
                GsiZeile objGsiZeile = new GsiZeile(Zeile);

                if (objGsiZeile.Nr != null && objGsiZeile.X != null && objGsiZeile.Y != null)
                {
                    Messpunkt objMP = new Messpunkt(objGsiZeile.Nr, objGsiZeile.X.Value, objGsiZeile.Y.Value, objGsiZeile.Z, objGsiZeile.zH, objGsiZeile.AddKonstante,
                                                    objGsiZeile.Code, objGsiZeile.Datum, objGsiZeile.Precision, objGsiZeile.Precision, objGsiZeile.Precision);
                    m_vMP.Add(objMP);
                }
            }
        }
        private string create_DAT(List <Messpunkt> lsMP)
        {
            string           Text = String.Empty;
            NumberFormatInfo nfi  = new NumberFormatInfo();

            nfi.NumberDecimalDigits = _config.GetAppSettingInt("decimals");

            for (int i = 0; i < lsMP.Count; i++)
            {
                Messpunkt MP = lsMP[i];

                string Zeile = MP.NR.PadLeft(9);

                Zeile += MP.Rechtswert.ToString("F", nfi).PadLeft(13);
                Zeile += MP.Hochwert.ToString("F", nfi).PadLeft(13);

                if (MP.Höhe.HasValue)
                {
                    Zeile += MP.Höhe.Value.ToString("F", nfi).PadLeft(11);
                }

                //Code
                if (MP.Code != null)
                {
                    Zeile += MP.Code.PadLeft(13);
                }
                else
                {
                    Zeile += String.Empty.PadLeft(13);
                }

                //Datum
                if (MP.Datum != null)
                {
                    Zeile += MP.Datum.Value.ToString("dd.MM.yyy").PadLeft(13);
                }

                Zeile  = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }
        private string create_CSV(List <Messpunkt> vMP)
        {
            string           Text = String.Empty;
            NumberFormatInfo nfi  = new NumberFormatInfo();

            nfi.NumberDecimalDigits = _config.GetAppSettingInt("decimals");

            for (int i = 0; i < vMP.Count; i++)
            {
                Messpunkt objMP = vMP[i];

                string Zeile = objMP.NR;
                m_Table.Rows.Add(objMP.NR);

                Zeile += ";";

                Zeile += objMP.Rechtswert.ToString("N", nfi) + ";";
                Zeile.Replace(",", ".");

                Zeile += objMP.Hochwert.ToString("N", nfi) + ";";
                Zeile.Replace(",", ".");

                if (objMP.Höhe.HasValue)
                {
                    Zeile += objMP.Höhe.Value.ToString("N", nfi) + ";";
                }

                Zeile += ";";

                //Datum
                if (objMP.Datum != null)
                {
                    Zeile += objMP.Datum.Value.ToString("dd.MM.yyy");
                }

                //Zeile = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }
        private void create_vMP_mm()
        {
            foreach (Messpunkt MP in m_vMP)
            {
                double Rechtswert = MP.Rechtswert * 1000;
                double Hochwert   = MP.Hochwert * 1000;

                double?Höhe = null;
                if (MP.Höhe.HasValue)
                {
                    Höhe = MP.Höhe.Value * 1000;
                }

                int Precision = MP.PrecisionX - 3;

                if (Precision < 0)
                {
                    Precision = 0;
                }

                Messpunkt objMP = new Messpunkt(MP.NR, Rechtswert, Hochwert, Höhe, 0, 0, MP.Code, new DateTime(), Precision, Precision, Precision);
                m_vMP_mm.Add(objMP);
            }
        }
        private void create_vMP()
        {
            m_vMP.Clear();
            bool bFehler = false;

            int decimals = _config.GetAppSettingInt("decimals");
            NumberFormatInfo NumFormatXYZ = new NumberFormatInfo();

            int Xdigits, Ydigits, Zdigits;
            int max;
            NumberFormatInfo NumFormatXY = new NumberFormatInfo();
            NumberFormatInfo NumFormatZ  = new NumberFormatInfo();

            string[] arText = m_CSV_Text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string row in arText)
            {
                try
                {
                    string Zeile = row.Replace(',', '.');

                    string[] Datensatz = Zeile.Split(new Char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    Xdigits = (Global.StringDigits(Datensatz[1]) > 4) ? 4 : Global.StringDigits(Datensatz[1]);
                    Ydigits = (Global.StringDigits(Datensatz[2]) > 4) ? 4 : Global.StringDigits(Datensatz[2]);
                    Zdigits = (Global.StringDigits(Datensatz[3]) > 4) ? 4 : Global.StringDigits(Datensatz[3]);

                    max = (Xdigits >= Ydigits) ? Xdigits : Ydigits;
                    max = (max >= Zdigits) ? max : Zdigits;

                    NumFormatXY.NumberDecimalDigits = max;
                    NumFormatZ.NumberDecimalDigits  = max;

                    string PNum       = Datensatz[0];
                    double Rechtswert = Math.Round(System.Convert.ToDouble(Datensatz[1], NumFormatXY), NumFormatXY.NumberDecimalDigits);
                    double Hochwert   = Math.Round(System.Convert.ToDouble(Datensatz[2], NumFormatXY), NumFormatXY.NumberDecimalDigits);
                    double?Höhe       = null;

                    try
                    {
                        if (Datensatz[3] != null)
                        {
                            Höhe = Math.Round(System.Convert.ToDouble(Datensatz[3], NumFormatZ), NumFormatZ.NumberDecimalDigits);
                        }
                    }
                    catch { }

                    string Code = String.Empty;
                    try
                    {
                        if (Datensatz[4] != null)
                        {
                            Code = Datensatz[4];
                        }
                    }
                    catch { }

                    Messpunkt objMP = new Messpunkt(PNum, Rechtswert, Hochwert, Höhe, 0, 0, Code, new DateTime(), NumFormatXY.NumberDecimalDigits,
                                                    NumFormatXY.NumberDecimalDigits,
                                                    NumFormatZ.NumberDecimalDigits);
                    m_vMP.Add(objMP);
                }

                catch { bFehler = true; }
            }

            if (bFehler)
            {
                System.Windows.Forms.MessageBox.Show("Fehler bei der Konvertierung festgestellt!!!");
            }

            create_vMP_mm();
        }
        //Methoden
        private void create_vMP(bool isMM)
        {
            bool bFehler = false;

            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalDigits = _config.GetAppSettingInt("decimals");

            string[] arText = m_DAT_Text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string Zeile in arText)
            {
                try
                {
                    string[] Datensatz = Zeile.Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    // NumFormat.NumberDecimalDigits = Global.StringDigits(Datensatz[1]);

                    string PNum       = Datensatz[0];
                    double Rechtswert = System.Convert.ToDouble(Datensatz[1], nfi);
                    double Hochwert   = System.Convert.ToDouble(Datensatz[2], nfi);
                    double?Höhe       = null;
                    int    PresicionX = Global.StringDigits(Datensatz[1]);
                    int    PresicionY = Global.StringDigits(Datensatz[2]);
                    int    PresicionZ = Global.StringDigits(Datensatz[3]);

                    try
                    {
                        if (Datensatz[3] != null)
                        {
                            Höhe = System.Convert.ToDouble(Datensatz[3], nfi);
                        }
                    }
                    catch { }

                    //Einlesen von Meter oder Millimeter?
                    if (isMM)
                    {
                        Rechtswert /= 1000;
                        Hochwert   /= 1000;
                        Höhe       /= 1000;

                        PresicionX += 3;
                        PresicionY += 3;
                        PresicionZ += 3;
                    }

                    //Code
                    string Code = String.Empty;
                    try
                    {
                        if (Datensatz[6] != null)
                        {
                            Code = Datensatz[6];
                        }
                    }
                    catch { }

                    Messpunkt objMP = new Messpunkt(PNum, Rechtswert, Hochwert, Höhe, 0, 0, Code, new DateTime(), PresicionX, PresicionY, PresicionZ);
                    m_vMP.Add(objMP);
                }
                catch { bFehler = true; }
            }

            if (bFehler)
            {
                System.Windows.Forms.MessageBox.Show("Fehler bei der Konvertierung festgestellt!!!");
            }

            create_vMP_mm();
        }
Exemple #9
0
        private string create_DAT(List <Messpunkt> lsMP)
        {
            string Text = String.Empty;

            for (int i = 0; i < lsMP.Count; i++)
            {
                Messpunkt MP = lsMP[i];
                string    Format;
                switch (MP.PrecisionX)
                {
                case 1:
                    Format = "0.0";
                    break;

                case 2:
                    Format = Global.Format2;
                    break;

                case 3:
                    Format = Global.Format3;
                    break;

                case 4:
                    Format = Global.Format4;
                    break;

                case 5:
                    Format = Global.Format5;
                    break;

                default:
                    Format = Global.Format0;
                    break;
                }

                string Zeile = MP.NR.PadLeft(9);

                Zeile += MP.Rechtswert.ToString(Format).PadLeft(13);
                Zeile.Replace(",", ".");

                Zeile += MP.Hochwert.ToString(Format).PadLeft(13);
                Zeile.Replace(",", ".");

                if (MP.Höhe.HasValue)
                {
                    Zeile += MP.Höhe.Value.ToString(Format).PadLeft(11);
                }

                //Code
                if (MP.Code != null)
                {
                    Zeile += MP.Code.PadLeft(13);
                }
                else
                {
                    Zeile += String.Empty.PadLeft(13);
                }

                //Datum
                if (MP.Datum != null)
                {
                    Zeile += MP.Datum.Value.ToString("dd.MM.yyy").PadLeft(13);
                }

                Zeile  = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }
Exemple #10
0
        private string create_CSV(List <Messpunkt> vMP)
        {
            myUtilities.myCodetabelle objCodetabelle = myUtilities.myCodetabelle.Instance;

            string Text = String.Empty;

            for (int i = 0; i < vMP.Count; i++)
            {
                Messpunkt objMP = vMP[i];
                string    Format;
                switch (objMP.PrecisionX)
                {
                case 1:
                    Format = "0.0";
                    break;

                case 2:
                    Format = Global.Format2;
                    break;

                case 3:
                    Format = Global.Format3;
                    break;

                case 4:
                    Format = Global.Format4;
                    break;

                case 5:
                    Format = Global.Format5;
                    break;

                default:
                    Format = Global.Format0;
                    break;
                }

                string Zeile = objMP.NR;

                if (objCodetabelle.Codetabelle)
                {
                    string CodeBez = objCodetabelle.getText(objMP.Code);

                    if (CodeBez == "*")
                    {
                        Zeile = CodeBez + Zeile;
                    }
                    else
                    {
                        Zeile += CodeBez;
                    }
                }

                Zeile += ";";

                Zeile += objMP.Rechtswert.ToString(Format) + ";";
                Zeile.Replace(",", ".");

                Zeile += objMP.Hochwert.ToString(Format) + ";";
                Zeile.Replace(",", ".");

                if (objMP.Höhe.HasValue)
                {
                    Zeile += objMP.Höhe.Value.ToString(Format) + ";";
                }

                //Code
                if (objMP.Code != null && !objCodetabelle.Codetabelle)
                {
                    Zeile += objMP.Code;
                }

                Zeile += ";";

                //Datum
                if (objMP.Datum != null)
                {
                    Zeile += objMP.Datum.Value.ToString("dd.MM.yyy");
                }

                //Zeile = Zeile.Replace(',', '.');
                Zeile += "\r\n";

                Text += Zeile;
            }
            return(Text);
        }