/// <summary>
        /// Default constructor
        /// </summary>
        public UserControlSeriesTab()
        {
            InitializeComponent();
            userControlSeries.ShowStrip(false);
            SeriesPainterControlPovider sp =
                new SeriesPainterControlPovider(toolStripButtonType, pic,
                                                StaticExtensionDataPerformerUI.DefaultSeriesPaintingArray);

            userControlSeries.PainterProvider = sp;
            userControlSeries.Performer.SetMouseIndicator(
                toolStripStatusCoord);
            creator = VariableDetector.GetCreator(this);
        }
        void Set(Dictionary <string, string> variables)
        {
            MathFormula f = MathFormula.FromString(MathSymbolFactory.Sizes, formula);

            measures.Clear();
            Dictionary <char, object> table = new Dictionary <char, object>();

            foreach (string key in variables.Keys)
            {
                IMeasurement m = this.FindMeasurement(variables[key], false);
                measures[key[0]] = m;
                table[key[0]]    = m.Type;
            }
            IFormulaObjectCreator creator = VariableDetector.GetCreator(table);

            f    = f.FullTransform(null);
            tree = ObjectFormulaTree.CreateTree(f, creator);
            arg  = new ElementaryObjectArgument();
            arg.Add(tree);
            this.variables = variables;
        }
Exemple #3
0
        /// <summary>
        /// Accepts formulas
        /// </summary>
        private void acceptFormulas()
        {
            output.Clear();
            acc.Clear();

            foreach (char c in vars.Keys)
            {
                Variable v;
                output.Add(Variable.GetMeasure(c, this, out v));
                acc[c + ""] = v;
            }
            foreach (char c in parameters.Keys)
            {
                IMeasurement        m = parameters[c] as IMeasurement;
                VariableMeasurement v = c.Create(m, this);
                acc[c + ""] = v;
            }
            foreach (char c in aliases.Keys)
            {
                AliasNameVariable v = new AliasNameVariable(c, this);
                acc[c + ""] = v;
                object[] o = aliases[c] as object[];
            }
            IAlias         al = this;
            IList <string> l  = al.AliasNames;

            foreach (string n in l)
            {
                if (n.Length == 1)
                {
                }
            }
            IFormulaObjectCreator creator = VariableDetector.GetCreator(this);

            variables.Clear();
            foreach (char c in vars.Keys)
            {
                variables[c] = new object[4];
            }
            IList <string>           an = AliasNames;
            List <ObjectFormulaTree> tt = new List <ObjectFormulaTree>();
            string proh = "\u03B4";

            foreach (char c in parameters.Keys)
            {
                IMeasurement m = parameters[c];
                if (m.Type is IOneVariableFunction)
                {
                    proh += c;
                }
            }
            foreach (char c in vars.Keys)
            {
                object   t  = null;
                object[] os = vars[c] as object[];
                if (an.Contains(c + ""))
                {
                    t = GetType(c + "");
                }
                else
                {
                    t = os[2];
                }
                if (t is IOneVariableFunction)
                {
                    proh += c;
                }
            }
            foreach (char c in vars.Keys)
            {
                object[] os = vars[c] as object[];
                object   t  = null;
                if (an.Contains(c + ""))
                {
                    t = GetType(c + "");
                }
                else
                {
                    t = os[2];
                }
                object[]          ol   = variables[c] as object[];
                string            f    = os[1] as string;
                MathFormula       form = MathFormula.FromString(MathSymbolFactory.Sizes, f);
                ObjectFormulaTree tree = ObjectFormulaTree.CreateTree(form.FullTransform(proh), creator);
                if (!t.Equals(tree.ReturnType))
                {
                    throw new Exception("Illegal return type");
                }
                ol[1] = tree;
                tt.Add(tree);
            }
            trees = tt.ToArray();
        }