Draw() public method

public Draw ( Graphics g ) : void
g Graphics
return void
コード例 #1
0
        private void PerfectFilterButton_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(FilterstextBox.Text.Replace('.', ','), out var alpha);

            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var ppl   = Analyser.GetH();
            var curve = _controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0];
            var x     = new PointPairList();

            for (var i = 0; i < curve.Points.Count; i++)
            {
                x.Add(curve.Points[i]);
            }
            Plotter.Clear(_controlZgcList[(int)numericUpDownGraphNo.Value - 1]);
            if (alpha == 0)
            {
                var result = Analyser.PerfectFilter(x, ppl);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], result, "Исходная функция");
            }
            else
            {
                var result = Analyser.PerfectFilterNoise(x, ppl, alpha);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], result, "Исходная функция");
            }
        }
コード例 #2
0
        private void addRandomButton_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= int.TryParse(nTextBox.Text, out var N);
            flag &= double.TryParse(fromTextBox.Text.Replace('.', ','), out var from);
            flag &= double.TryParse(dtTextBox.Text.Replace('.', ','), out var dt);
            flag &= double.TryParse(sTextBox.Text.Replace('.', ','), out var s);

            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            if (RandomTypeCheckBox.Checked)
            {
                var ppl = Plotter.GetMyRandom(s, from, dt, N);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Мой рандом");
            }
            else
            {
                var ppl = Plotter.GetRandom(s, from, dt, N);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Рандом");
            }
        }
コード例 #3
0
        private void plotter_dat_button_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(dtTextBox.Text.Replace('.', ','), out var dt);

            if (!flag)
            {
                return;
            }

            var res = new PointPairList();

            if (File.Exists(dataFilePath_textBox.Text))
            {
                var i = 0;
                using (var reader = new BinaryReader(File.Open(dataFilePath_textBox.Text, FileMode.Open)))
                {
                    while (reader.BaseStream.Position != reader.BaseStream.Length)
                    {
                        res.Add(dt * i++, reader.ReadSingle());
                    }
                }
            }

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], res, "Dat File");
        }
コード例 #4
0
        private void applyBsPotterButton_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(bs_fc1.Text.Replace('.', ','), out var fc);
            flag &= double.TryParse(bs_fc_2.Text.Replace('.', ','), out var fc2);
            flag &= int.TryParse(bs_m.Text, out var m);
            flag &= double.TryParse(dtTextBox.Text.Replace('.', ','), out var dt);
            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var curve = _controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0];
            var x     = new PointPairList();

            for (var i = 0; i < curve.Points.Count; i++)
            {
                x.Add(curve.Points[i]);
            }

            var h = Analyser.GetHarryPotter_BS(fc, fc2, m, dt);
            var y = Analyser.GetConvolution(x, h);

            Plotter.Clear(_controlZgcList[(int)numericUpDownGraphNo.Value - 1]);
            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], y, "Pottered");
        }
コード例 #5
0
        private void buttonGetHistogram_Click_Click(object sender, EventArgs e)
        {
            var hist = Data.GetHistogram();
            var min  = Data.GetMin();
            var ppl  = ConvertIntArrayToCurveList(hist, min);

            Plotter.Draw(_controlZgcList[(int)GraphNumberNum.Value - 1], ppl, "Histogram");
        }
コード例 #6
0
        private void pltRxxButton_Click(object sender, EventArgs e)
        {
            if (_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList.Count == 0)
            {
                return;
            }

            var list = GraphConverter.GetPointPairListFromCurve(_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0]);
            var res  = Analyser.GetRxx(list);

            Plotter.Clear(rxxZedGraphControl);
            Plotter.Draw(rxxZedGraphControl, res, "Rxx");
        }
コード例 #7
0
        private void plotDistributionButton_Click(object sender, EventArgs e)
        {
            if (_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList.Count == 0)
            {
                return;
            }

            var list = GraphConverter.GetPointPairListFromCurve(_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0]);
            var res  = Analyser.GetDistribution(list);

            Plotter.Clear(distributionZedGraphControl);
            Plotter.Draw(distributionZedGraphControl, res, "Распределение");
        }
コード例 #8
0
        private void spectrePlotButton_Click(object sender, EventArgs e)
        {
            if (_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList.Count == 0)
            {
                return;
            }

            var list = GraphConverter.GetPointPairListFromCurve(_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0]);
            var res  = Analyser.GetSpectre(list, norm_checked.Checked);

            res.RemoveRange(list.Count / 2, list.Count - list.Count / 2);
            Plotter.Clear(spectreZedGraphControl);
            Plotter.Draw(spectreZedGraphControl, res, "Spectre");
        }
コード例 #9
0
        private void anti_noise_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= int.TryParse(anti_noise_n_text_box.Text, out var N);
            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var ppl = Analyser.Accum(N, with_grph.Checked);

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Анти-шум");
        }
コード例 #10
0
        private void dtmf_plot_button_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(Rate_Texbox.Text.Replace('.', ','), out var sample_rate);
            var dtmf_c = dtmf_textbox.Text;

            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var res = DTMF.dtmf_from_label(dtmf_c, sample_rate);

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], res, "DTMF");
        }
コード例 #11
0
        private void Fur1DButton_Click(object sender, EventArgs e)
        {
            if (_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList.Count == 0)
            {
                return;
            }

            var list = GraphConverter.GetPointPairListFromCurve(_controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0]);
            var res  = Analyser.ListToComplex(list);

            res = Analyser.ReverseSpectre(Analyser.GetSpectre(res));

            var newlist = Analyser.ComplexToPointPairList(res);

            Plotter.Clear(spectreZedGraphControl);
            Plotter.Draw(spectreZedGraphControl, newlist, "Reversed Graph");
        }
コード例 #12
0
        private void Potter_HPF_button_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(fc_Hp.Text.Replace('.', ','), out var fc);
            flag &= int.TryParse(m_Hp.Text, out var m);
            flag &= double.TryParse(dtTextBox.Text.Replace('.', ','), out var dt);
            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var ppl = Analyser.GetHarryPotter_HPF(fc, m, dt);

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Potter_HPF");
        }
コード例 #13
0
        private void addSinButton_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= int.TryParse(nTextBox.Text, out var N);
            flag &= double.TryParse(fromTextBox.Text.Replace('.', ','), out var from);
            flag &= double.TryParse(dtTextBox.Text.Replace('.', ','), out var dt);
            flag &= double.TryParse(ampTextBox.Text.Replace('.', ','), out var a);
            flag &= double.TryParse(fTextBox.Text.Replace('.', ','), out var f);

            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var ppl = Plotter.GetSin(a, f, from, dt, N);

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Синус");
        }
コード例 #14
0
        public void Redraw()
        {
            Icon newIcon;
            Icon oldIcon = this.Icon;

            using (Bitmap bm = new Bitmap(this.Size.Width, this.Size.Height))
            {
                // Update the plotter size if our size has changed.
                if (_plotter.Size != this.Size)
                {
                    _plotter.Size = this.Size;
                }

                using (Graphics g = Graphics.FromImage(bm))
                    _plotter.Draw(g);

                newIcon = Icon.FromHandle(bm.GetHicon());
            }

            this.Icon = newIcon;
            ProcessHacker.Native.Api.Win32.DestroyIcon(oldIcon.Handle);
        }
コード例 #15
0
ファイル: TypeGraphViewer.cs プロジェクト: mono/heap-prof
    protected override bool OnExposeEvent(Gdk.EventExpose args)
    {
        if (bitmap_cache == null) {
            bitmap_cache = new Gdk.Pixmap (GdkWindow, graph_area.Width, graph_area.Height, -1);
            bitmap_cache.DrawRectangle (Style.WhiteGC, true, 0, 0,
                graph_area.Width, graph_area.Height);

            using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (bitmap_cache)) {
                plot = new Plotter (graph_area.Width, graph_area.Height, parent.CurrentTabulator, tl);
                plot.Draw (g);
            }
        }
        Gdk.Rectangle area = args.Area;

        GdkWindow.DrawDrawable (Style.BlackGC,
                        bitmap_cache,
                        0, 0,
                        graph_area.X, graph_area.Y,
                        graph_area.Width, graph_area.Height);

        DrawXScale (area);
        DrawYScale (area);

        return true;
    }
コード例 #16
0
        private void CardioPlotter_Click(object sender, EventArgs e)
        {
            var ppl = Analyser.Heart();

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Кардиограмма");
        }
コード例 #17
0
        private void BadHeatButton_Click(object sender, EventArgs e)
        {
            var ppl = Analyser.BadHeart();

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], ppl, "Тахиокардия");
        }
コード例 #18
0
        private void plot_for_wav_button_Click(object sender, EventArgs e)
        {
            var res = Wav.Wav_ReadFile(Wav_textbox.Text);

            Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], res, "Wav File");
        }