Пример #1
0
        public DrawerModel GetDrawerData(Factor factors, double start, double end, double step)
        {
            var drawModel = new DrawerModel();

            for (double x = start; x <= end; x += step)
            {
                double y = 0;

                factors.Terms.ForEach(term =>
                {
                    if (term.Symbol != default(char))
                    {
                        y += ((term.Sign == Sign.Plus) ? term.Number : -term.Number) * Math.Pow(x, term.SymbolsPower);
                    }
                    else
                    {
                        y += (term.Sign == Sign.Plus) ? term.Number : -term.Number;
                    }
                });

                drawModel.AddData(x, y);
            }

            return(drawModel);
        }
Пример #2
0
        public DrawerModel GetGraphicDataFromFunction(dynamic algorithm, IUserAlgorithmStrategyProvider strategyProvider, UserAlgorithmStore store)
        {
            var drawerModel = new DrawerModel();

            if (algorithm == null)
            {
                return(drawerModel);
            }

            ExecuteAlgorithm(algorithm.Algorithm, strategyProvider, store);
            var returnVariable = store.ReturnVariable;

            var xs = store.ListVariables["x"];
            var ys = store.ListVariables["y"];

            if (xs.Count != ys.Count)
            {
                throw new Exception("Mistake in Graphic builder algorithm");
            }

            for (var i = 0; i < xs.Count; i++)
            {
                drawerModel.AddData(xs[i], ys[i]);
            }

            return(drawerModel);
        }
        public void DrawPlot(DrawerModel drawModel)
        {
            var x = drawModel.X.ToArray();
            var y = drawModel.Y.ToArray();

            scottPlotUC1.PlotXY(x, y);
            scottPlotUC1.AxisAuto();
        }
Пример #4
0
        public DrawerModel GetGraphicDataFromSetOfPoints(dynamic setOfPoints, IUserAlgorithmStrategyProvider strategyProvider, UserAlgorithmStore store)
        {
            var drawerModel = new DrawerModel();

            if (setOfPoints == null)
            {
                return(drawerModel);
            }

            var points = setOfPoints.ToObject <PointModel[]>();

            (points as PointModel[]).ToList().ForEach(point =>
            {
                drawerModel.AddData(point.X, point.Y);
            });

            return(drawerModel);
        }
Пример #5
0
        public List <DrawerModel> GetTableItems()
        {
            var persistantStorageService = ServiceLocator.Instance.Resolve <IPersistantStorage>();

            if (persistantStorageService == null)
            {
                return(null);
            }

            var returnList = new List <DrawerModel>();

            var myCards = new DrawerModel();

            myCards.Title = navigation_item_my_cards;
            myCards.Image = "Home";
            returnList.Add(myCards);


            var discover = new DrawerModel();

            discover.Title         = navigation_item_discover;
            discover.Image         = "Discover";
            discover.Notifications = persistantStorageService.GetDiscoverNotificationCount();
            returnList.Add(discover);

            var connections = new DrawerModel();

            connections.Title = navigation_item_connections;
            connections.Image = "Connections";
            returnList.Add(connections);

            var settings = new DrawerModel();

            settings.Title = navigation_item_settings;
            settings.Image = "Settings";
            returnList.Add(settings);


            return(returnList);
        }