Ejemplo n.º 1
0
        private void TransformMethod()
        {
            if (SelectedSignal != null)
            {
                SampledSignal signal = new SampledSignal();
                signal.PointsY = SelectedSignal.PointsY;
                signal.Name    = $"{SelectedSignal.Name} {SelectedTransform}";
                Stopwatch timer = new Stopwatch();
                timer.Start();
                switch (SelectedTransform.Substring(1, 4))
                {
                case "F1.1":
                    signal.ComplexPoints = FourierTransform.Transform(signal.PointsY);
                    break;

                case "F1.2":
                    FastFourierTransform fourierTransform = new FastFourierTransform();
                    signal.ComplexPoints = fourierTransform.Transform(signal.PointsY);
                    break;

                case "F1.3":
                    signal.ComplexPoints = WaveletTransform.Transform(signal.PointsY);
                    break;
                }
                timer.Stop();
                Time = timer.ElapsedMilliseconds;
                SignalCreator.AddSignal(signal);
            }
        }
        public void Compute()
        {
            Stopwatch      timer   = new Stopwatch();
            List <Complex> complex = new List <Complex>();

            timer.Start();
            string chartCase = SelectedOutputChart.Substring(1, 2);

            switch (SelectedOperation.Substring(1, 4))
            {
            case "F1.1":
                complex = FourierTransform.Transform(SelectedSignal1Tab.TabContent.Data.Samples);
                break;

            case "F1.2":
                FastFourierTransform f = new FastFourierTransform();
                complex = f.Transform(SelectedSignal1Tab.TabContent.Data.Samples);
                break;

            case "F1.3":
                complex = WaveletTransform.Transform(SelectedSignal1Tab.TabContent.Data.Samples);
                break;
            }
            timer.Stop();
            var time = timer.ElapsedMilliseconds;

            if (chartCase.Contains("W1"))
            {
                ComplexChartsW1 window = new ComplexChartsW1(complex);
                window.Show();
                MessageBox.Show("Czas obliczeń: " + time.ToString() + " ms", "Czas", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                ComplexChartsW2 window = new ComplexChartsW2(complex);
                window.Show();
                MessageBox.Show("Czas obliczeń: " + time.ToString() + " ms", "Czas", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }