Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Multiselect = true;
            fileDialog.Title       = "请选择文件";
            fileDialog.Filter      = "所有文件(*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                FileInfo     file = new FileInfo(fileDialog.FileName);
                StreamReader sr   = file.OpenText();
                string       s;
                MyMathXYData tmpdata = new MyMathXYData();
                while ((s = sr.ReadLine()) != null)
                {
                    //  解析数据
                    TPSAForeGenetic.Add(s);
                }
                InitAForgeGenetic();
                this.myAGWave1.Data = TPSAForeGenetic.Result;
                this.myAGWave1.MaxX = TPSAForeGenetic.Result.getMaxX() * 1.5;
                this.myAGWave1.MaxY = TPSAForeGenetic.Result.getMaxY() * 1.5;
                this.myAGWave1.MyWaveShow();
                sr.Close();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Multiselect = true;
            fileDialog.Title       = "请选择文件";
            fileDialog.Filter      = "所有文件(*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                FileInfo     file = new FileInfo(fileDialog.FileName);
                StreamReader sr   = file.OpenText();
                string       s;
                MyMathXYData tmpdata = new MyMathXYData();
                while ((s = sr.ReadLine()) != null)
                {
                    //  解析数据
                    tmpdata.Add(s);
                }
                //  Data.DataPoint = tmpdata.XLinearFilter(1000);
                Data.DataPoint = tmpdata.DataPoint;
                X_Max          = (float)Data.getMaxX() + 3;
                X_Min          = (float)Data.getMinX() - 3;
                Y_Max          = (float)Data.getMaxY() + 3;
                Y_Min          = (float)Data.getMinY() - 3;
                waveshow();
                this.Invalidate();
                sr.Close();
            }
        }
Exemple #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            double[] tmpx = Data.XToArray();
            double[] tmpy = Data.YToArray();

            MyMathXYData tmpdata = new MyMathXYData();

            //MyMath.Filter.ButtordFilter(ref tmpy, 2, 5, 10);

            //double[] pfit = MyMath.Filter.polyfit(tmpx, tmpy, 25);
            //for (int i = 0; i < tmpy.Length; i++)
            //{
            //    tmpy[i] = MyMath.Filter.MyPolyVal(pfit, tmpx[i]);
            //}



            double[] tmpyl = new double[tmpy.Length / 2];
            double[] tmpyh = new double[tmpy.Length / 2];
            for (int i = 0; i < tmpyh.Length; i++)
            {
                tmpyh[tmpyh.Length - i - 1] = tmpy[i];
            }
            for (int i = 0; i < tmpyl.Length; i++)
            {
                tmpyl[tmpyl.Length - i - 1] = tmpy[tmpy.Length - 1 - i];
            }
            MyMath.Filter.PolyFilter(ref tmpyh, 8, 1);
            MyMath.Filter.PolyFilter(ref tmpyl, 8, 1);
            for (int i = 0; i < tmpyh.Length; i++)
            {
                tmpy[i] = tmpyh[tmpyh.Length - i - 1];
            }
            for (int i = 0; i < tmpyl.Length; i++)
            {
                tmpy[tmpy.Length - 1 - i] = tmpyl[tmpyl.Length - i - 1];
            }



            tmpdata.setdata(tmpx, tmpy);
            Result.DataPoint = tmpdata.XLinearFilter(1000);
            X_Max            = ((float)Result.getMaxX() + 3) > X_Max ? (float)Result.getMaxX() + 3 : X_Max;
            X_Min            = ((float)Result.getMinX() - 3) < X_Min ? (float)Result.getMinX() - 3 : X_Min;
            Y_Max            = ((float)Result.getMaxY() + 3) > Y_Max ? (float)Result.getMaxY() + 3 : Y_Max;
            Y_Min            = ((float)Result.getMinY() - 3) < Y_Min ? (float)Result.getMinY() - 3 : Y_Min;
            waveshow();
            this.Invalidate();


            //OpenFileDialog fileDialog = new OpenFileDialog();
            //fileDialog.Multiselect = true;
            //fileDialog.Title = "请选择文件参数文件";
            //fileDialog.Filter = "所有文件(*.*)|*.*";
            //if (fileDialog.ShowDialog() == DialogResult.OK)
            //{
            //    FileInfo file = new FileInfo(fileDialog.FileName);
            //    StreamReader sr = file.OpenText();
            //    string s;
            //    MyMathXYData par = new MyMathXYData();
            //    while ((s = sr.ReadLine()) != null)
            //    {
            //        //  解析数据
            //        par.Add(s);
            //    }
            //    double[] az = par.XToArray();
            //    double[] bz = par.YToArray();
            //    MyMath.Filter.FilterFilter(ref tmpy, az, bz);
            //    tmpdata.setdata(tmpx, tmpy);
            //    Result.DataPoint = tmpdata.XLinearFilter(1000);
            //    X_Max = ((float)Result.getMaxX() + 1) > X_Max ? (float)Result.getMaxX() + 1 : X_Max;
            //    X_Min = ((float)Result.getMinX() - 1) < X_Min ? (float)Result.getMinX() - 1 : X_Min;
            //    Y_Max = ((float)Result.getMaxY() + 1) > Y_Max ? (float)Result.getMaxY() + 1 : Y_Max;
            //    Y_Min = ((float)Result.getMinY() - 1) < Y_Min ? (float)Result.getMinY() + 1 : Y_Min;
            //    this.Invalidate();
            //    sr.Close();
            //}
        }