public JoystickControlViewModel(FlightdataModel fdm)
 {
     this.model             = fdm;
     rudderSliderPos        = RudderMargin.Left;
     throttleSliderPos      = ThrottleMargin.Top;
     sliderJumps            = 2 / sliderAccuracy;
     model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); };
 }
Esempio n. 2
0
        public GraphsVm(FlightdataModel data, OxyPlot.Wpf.PlotView pv_features, OxyPlot.Wpf.PlotView pvCorr, OxyPlot.Wpf.PlotView pvReg)
        {
            //initizlize dat model.
            this.data = data;
            //setting up the pv
            this.pv_features = pv_features;
            this.pvCor       = pvCorr;
            this.pvReg       = pvReg;

            //creating a stopwatch,to set up the time.
            this.clock = new Stopwatch();
            clock.Start();
            //initizling plotmodel and list.
            this.plotModelFeatures = new PlotModel();
            this.plotModelCor      = new PlotModel();
            this.plotModelReg      = new PlotModel();

            this.featuresList = new List <float>();
            this.corrList     = new List <float>();

            //usual mvvm propertychanged setup.
            this.data.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e)
            {
                NotifyPropertyChanged("VM_" + e.PropertyName);
            };

            //at every line property change - build the graph after 450 ms passed.
            this.data.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e)
            {
                //if currentline has been changed,and there more then 500 ms passed - set up the graph again for cleaner view.
                if (clock.ElapsedMilliseconds > 450 + lastStopTime && e.PropertyName == "CurrentLine" &&
                    VM_ChosenFeature != null && VM_ChosenCorr != null)
                {
                    //plot1
                    this.VM_PlotModelFeatures.Series.Clear();
                    FeatureList = this.data.FeatureChosenValues();
                    SetUpModel(VM_PlotModelFeatures);
                    LoadData(featuresList, VM_PlotModelFeatures);
                    this.pv_features.InvalidatePlot(true);

                    //plot2
                    Updatecorr(VM_ChosenFeature);
                    corrList = data.FeatureChosenCorrValues();
                    this.VM_PlotModelCor.Series.Clear();
                    SetUpModel(VM_PlotModelCor);
                    LoadData(corrList, VM_PlotModelCor);
                    this.pvCor.InvalidatePlot(true);

                    //plot3
                    this.VM_PlotModelReg.Series.Clear();
                    SetUpModel(VM_PlotModelReg);
                    LoadRegData(FeatureList, corrList, VM_PlotModelReg);
                    this.pvReg.InvalidatePlot(true);

                    this.lastStopTime = clock.ElapsedMilliseconds;
                }
            };
        }
Esempio n. 3
0
        //Graphs



        //constructor
        public FlightSimM(string server, Int32 port)
        {
            this.serverPath = server;
            this.port       = port;
            //default speed(X1)
            this.playRythm    = 100;
            this.aDetector    = new SimpleAnomalyDetector();
            this.colDataNames = new List <string>();
            this.stop         = false;
            this.data         = Single.SingleDataModel();
            this.closeFlag    = false;
            aDetector         = new SimpleAnomalyDetector();

            this.currentValSlider = 0;
        }