Exemplo n.º 1
0
 public Plot2D(string name, PlotVariable xVar, PlotVariable yVar, PlotParameter parameter, bool includePVar)
 {
     this.name        = name;
     this.xVar        = xVar;
     this.yVar        = yVar;
     this.pVar        = parameter;
     this.includePVar = includePVar;
     GeneratePlot();
 }
Exemplo n.º 2
0
        public ErrorMessage FinishSpecifications(string name)
        {
            ErrorMessage errorMsg = null;

            if (catalog.IsInCatalog(name))
            {
                errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Specification", "The plot catalog has already got a plot named " + name);
            }
            //         if (xVarMin > xVarMax)
            //         {
            //            errorMsg = new ErrorMessage(ErrorType.Error, "Inappropriate Specification", "The minimum value of the independent variable must be smaller than its maximum value");
            //         }
            //         else if (yVarMin > yVarMax)
            //         {
            //            errorMsg = new ErrorMessage(ErrorType.Error, "Inappropriate Specification", "The minimum value of the dependent variable must be smaller than its maximum value");
            //         }
            //         else if ((double)pVarValues[0] > (double)pVarValues[pVarValues.Count-1])
            //         {
            //            errorMsg = new ErrorMessage(ErrorType.Error, "Inappropriate Specification", "The minimum value of the parameter variable must be smaller than its maximum value");
            //         }
            //         else if (xVar == null)
            //         {
            //            errorMsg = new ErrorMessage(ErrorType.Error, "Inappropriate Specification", "The independent variable must be selected");
            //         }
            //         else if (yVar == null)
            //         {
            //            errorMsg = new ErrorMessage(ErrorType.Error, "Inappropriate Specification", "The dependent variable must be selected");
            //         }
            else if (includePVar && pVar == null)
            {
                errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Specification", "The parameter variable must be selected");
            }
            else
            {
                double       xVarMin = 0.8 * xVar.Value;
                double       xVarMax = 1.2 * xVar.Value;
                double       yVarMin = 0.8 * yVar.Value;
                double       yVarMax = 1.2 * yVar.Value;
                PlotVariable xV      = new PlotVariable(xVar, xVarMin, xVarMax);
                PlotVariable yV      = new PlotVariable(yVar, yVarMin, yVarMax);

                PlotParameter pV = null;

                if (pVar != null)
                {
                    double[] values = { pVar.Value };

                    pV = new PlotParameter(pVar, values);
                }
                Plot2D plot = new Plot2D(name, xV, yV, pV, includePVar);
                catalog.AddPlot2D(plot);
            }
            return(errorMsg);
        }
Exemplo n.º 3
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;
            }
        }