コード例 #1
0
        public void RemovePlot2D(Plot2D plot)
        {
            string name = plot.Name;

            plotList.Remove(plot);
            OnPlot2DDeleted(name);
        }
コード例 #2
0
 private void OnPlot2DChanged(Plot2D plot)
 {
     if (Plot2DChanged != null)
     {
         Plot2DChanged(plot);
     }
 }
コード例 #3
0
 private void OnPlot2DAdded(Plot2D plot)
 {
     if (Plot2DAdded != null)
     {
         Plot2DAdded(plot);
     }
 }
コード例 #4
0
        //public PlotCatalog(IList list) {
        //   plotList = list;
        //}

        public void AddPlot2D(Plot2D plot)
        {
            if (!IsInCatalog(plot))
            {
                plotList.Add(plot);
                OnPlot2DAdded(plot);
            }
        }
コード例 #5
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);
        }
コード例 #6
0
//      public void Remove(int index) {
//         if (index < materialList.Count && index >= 0) {
//            Plot2D material = (Plot2D) materialList[index];
//            if (material.IsUserDefined) {
//               string name = material.Name;
//               materialList.RemoveAt(index);
//               OnPlot2DDeleted(name);
//            }
//         }
//      }
//
        public Plot2D GetPlot2D(string name)
        {
            Plot2D ret = null;

            foreach (Plot2D plot in plotList)
            {
                if (plot.Name.Equals(name))
                {
                    ret = plot;
                    break;
                }
            }
            return(ret);
        }
コード例 #7
0
        public bool IsInCatalog(Plot2D aPlot)
        {
            bool isInCatalog = false;

            foreach (Plot2D plot in plotList)
            {
                if (plot.Name.Equals(aPlot.Name))
                {
                    isInCatalog = true;
                    break;
                }
            }

            return(isInCatalog);
        }
コード例 #8
0
 public void UpdatePlot2D(Plot2D plot)
 {
     OnPlot2DChanged(plot);
 }