Exemple #1
0
        private void GeneratePlot()
        {
            double orginalXVarValue = xVar.Variable.Value;

            double xValue;
            double yValue;
            double pValue = 0;
            int    numOfCurves;
            int    numOfPoints = 50;

            PointF[] dataPoints = new PointF[101];
            CurveF[] curves;
            if (includePVar)
            {
                double   orginalPVarValue = pVar.Variable.Value;
                double[] paramValues      = pVar.ParameterValues;
                numOfCurves = paramValues.Length;
                curves      = new CurveF[numOfCurves];
                for (int i = 0; i < numOfCurves; i++)
                {
                    pValue = paramValues[i];
                    pVar.Variable.Owner.Specify(pVar.Variable, pValue);
                    for (int j = 0; j < numOfPoints; j++)
                    {
                        xValue = xVar.Min + j * (xVar.Max - xVar.Min) / (numOfPoints - 1);
                        xVar.Variable.Owner.Specify(xVar.Variable, xValue);
                        yValue        = yVar.Variable.Value;
                        dataPoints[j] = new PointF((float)xValue, (float)yValue);
                    }
                    curves[i] = new CurveF(pVar.Name, (float)pValue, dataPoints);
                }

                pVar.Variable.Owner.Specify(pVar.Variable, orginalPVarValue);
            }
            else
            {
                curves = new CurveF[1];
                for (int j = 0; j < numOfPoints; j++)
                {
                    xValue = xVar.Min + j * (xVar.Max - xVar.Min) / (numOfPoints - 1);
                    xVar.Variable.Owner.Specify(xVar.Variable, xValue);
                    yValue        = yVar.Variable.Value;
                    dataPoints[j] = new PointF((float)xValue, (float)yValue);
                }
                curves[0] = new CurveF(yVar.Name, (float)pValue, dataPoints);
            }

            curveFamily = new CurveFamilyF(yVar.Name, yVar.Variable.Type, curves);

            xVar.Variable.Owner.Specify(xVar.Variable, orginalXVarValue);
        }
Exemple #2
0
        public override void SetObjectData()
        {
            base.SetObjectData();
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionPlot2D", typeof(int));

            if (persistedClassVersion == 1)
            {
                this.name        = info.GetValue("Name", typeof(string)) as string;
                this.xVar        = RecallStorableObject("XVar", typeof(PlotVariable)) as PlotVariable;
                this.yVar        = RecallStorableObject("YVar", typeof(PlotVariable)) as PlotVariable;
                this.pVar        = RecallStorableObject("PVar", typeof(PlotParameter)) as PlotParameter;
                this.includePVar = (bool)info.GetValue("IncludePVar", typeof(bool));
                this.curveFamily = RecallStorableObject("CurveFamily", typeof(CurveFamilyF)) as CurveFamilyF;
            }
        }