Exemplo n.º 1
0
        public void Draw(double t, PlotModel pm)
        {
            Pos.Points.Clear();
            Trg.Points.Clear();

            _curr4Draw.SynchMe(t);
            var lst = new List <SolPoint>(SolPointList.Value);

            foreach (var sp in lst)
            {
                _curr4Draw.SynchMeTo(sp);
                var t2 = sp.T;
                if (t2 > t)
                {
                    break;
                }

                Pos.Points.Add(new DataPoint(_curr4Draw.X, _curr4Draw.Y));
                Trg.Points.Add(new DataPoint(_curr4Draw.targFunc(t2).X, _curr4Draw.targFunc(t2).Y));
            }


            pm.Title = $"{t:0.###} s";
            pm.InvalidatePlot(true);
            //Thread.Sleep(1000);
        }
Exemplo n.º 2
0
        private void button_Save_Click_1(object sender, RoutedEventArgs e)
        {
            controller.Pause();
            button.Content = "Paused";
            var unit4save = new PTURDyn();

            unit4save.Rebuild();

            int newVal = (int)slider.Value;
            int index  = newVal < vm.SolPointList.Value.Count ? newVal : vm.SolPointList.Value.Count - 1;

            if (index < 0)
            {
                return;
            }
            unit4save.SynchMeTo(vm.SolPointList.Value[index]);
            var sd = new SaveFileDialog()
            {
                Filter   = "XML Files|*.xml",
                FileName = "sph1D"
            };

            if (sd.ShowDialog() == true)
            {
                var sw = new StreamWriter(sd.FileName);
                unit4save.Serialize(sw);
                sw.Close();
            }
        }
Exemplo n.º 3
0
        public ViewModelPTUR()
        {
            _curr4Draw = new PTURDyn();
            _curr4Draw.Rebuild();
            Model1Rx = new VMPropRx <PlotModel, SolPoint>(() => {
                var Model1 = GetNewModel("params", "X", "Y");
                Pos        = new LineSeries()
                {
                    Title = "Traect",
                    // StrokeThickness = 2,
                    Color = OxyColors.Green
                };

                Model1.Series.Add(Pos);

                Trg = new LineSeries()
                {
                    Title = "Trg",
                    // StrokeThickness = 2,
                    Color = OxyColors.Red
                };
                Model1.Series.Add(Trg);
                return(Model1);
            },
                                                          (sp, pm) => {
                _curr4Draw.SynchMeTo(sp);
                Draw(sp.T, pm);
                return(pm);
            }
                                                          );

            SolPointList = new VMPropRx <List <SolPoint>, SolPoint>(
                () => new List <SolPoint>(),
                (sp, lst) => {
                lst.Add(sp);
                return(lst);
            });
        }