예제 #1
0
        internal override void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection <PlotInfo> dataCollection,
                                              Plot2DRange plotRange, uint samplesCount)
        {
            if (!this.IsValid)
            {
                return;
            }

            dataCollection.SuspendNotifications();

            dataCollection.Clear();

            double step = (plotRange.YMax - plotRange.YMin) / samplesCount;

            for (double y = plotRange.YMin; y <= plotRange.YMax; y += step)
            {
                double x = this.F(y);
                if (Double.IsInfinity(x) || Double.IsNaN(x))
                {
                    continue;
                }

                dataCollection.Add(new PlotInfo(x, y));
            }

            dataCollection.ResumeNotifications();
        }
예제 #2
0
        private FunctionViewModel(FunctionBase function, Plot2DRange plotRange, uint samplesCount)
        {
            this.PlotData = new Telerik.Windows.Data.RadObservableCollection<PlotInfo>();
            this.isBeingEdited = false;
            this.samplesCount = samplesCount;

            this.Function = function;
            this.Function.PropertyChanged += (s,e) => this.UpdatePlotData();

            this.PlotRange = plotRange;
            this.PlotRange.PropertyChanged += (s, e) => this.UpdatePlotData();
        }
예제 #3
0
 public static FunctionViewModel CreateInverseRealFunctionVM(Plot2DRange plotRange)
 {
     return new FunctionViewModel(
         new InverselRealFunction(),
         plotRange,
         1000);
 }
예제 #4
0
 private FunctionViewModel(Plot2DRange plotRange)
     : this(new RealFunction(), plotRange, 1000)
 {
 }
예제 #5
0
 public static FunctionViewModel CreateRealFunctionVM(Plot2DRange plotRange, uint samplesCount)
 {
     return new FunctionViewModel(new RealFunction(), plotRange, samplesCount);
 }
예제 #6
0
 public static FunctionViewModel CreateRealFunctionVM(string functionString, Plot2DRange plotRange)
 {
     var f = new FunctionViewModel(plotRange);
     f.Function.FunctionString = functionString;
     return f;
 }
예제 #7
0
 public static FunctionViewModel CreateRealFunctionVM(Plot2DRange plotRange)
 {
     return new FunctionViewModel(plotRange);
 }
예제 #8
0
 internal abstract void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection<PlotInfo> dataCollection,
     Plot2DRange plotRange, uint samplesCount);
예제 #9
0
        internal override void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection<PlotInfo> dataCollection,
            Plot2DRange plotRange, uint samplesCount)
        {
            if (!this.IsValid)
                return;

            dataCollection.SuspendNotifications();

            dataCollection.Clear();

            double step = (plotRange.XMax - plotRange.XMin) / samplesCount;

            for (double x = plotRange.XMin; x <= plotRange.XMax; x += step)
            {
                double y = this.F(x);
                if (Double.IsInfinity(y) || Double.IsNaN(y))
                    dataCollection.Add(new PlotInfo(x, double.NaN));

                dataCollection.Add(new PlotInfo(x, y));
            }

            dataCollection.ResumeNotifications();
        }
예제 #10
0
 internal abstract void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection <PlotInfo> dataCollection,
                                       Plot2DRange plotRange, uint samplesCount);