Exemple #1
0
 public TestTraceSpec()
 {
     TestMarkerList = new List <XYTestMarker>();
     TestLimit      = new XYTestLimit();
 }
Exemple #2
0
        public void ShowChart(TestStep step)
        {
            windowChart.clearData();
            windowChart.Traces.Clear();
            this.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
            List <SymtChartLib.XAxis> lstXAxis = new List <SymtChartLib.XAxis>();
            int k = 0;

            if (step as LoopTestStep != null)
            {
                return;
            }
            foreach (TestTrace tr in step.ItemList.Where(x => x is TestTrace))
            {
                if (lstXAxis.Select(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Unit == tr.XAxisInfo.Unit).Count() == 0)
                {
                    lstXAxis.Add(new SymtChartLib.XAxis()
                    {
                        Start = tr.XAxisInfo.Start, Stop = tr.XAxisInfo.Stop, Center = tr.XAxisInfo.Center
                    });
                }
                SymtChartLib.Trace trace = new SymtChartLib.Trace();

                k++;
                //trace.Title = step.Name + tr.TypeName + step.ItemList.IndexOf(tr);
                trace.Title     = step.Name + "_" + tr.TypeName;
                trace.AxisIndex = lstXAxis.FindIndex(x => x.Start == tr.XAxisInfo.Start && x.Stop == tr.XAxisInfo.Stop && x.Center == tr.XAxisInfo.Center);
                if (tr.ResultData != null)
                {
                    List <XYData> xyData = tr.ResultData;
                    if (xyData.Count > 0)
                    {
                        Point[] point = new Point[xyData.Count];
                        for (int i = 0; i < xyData.Count; i++)
                        {
                            Point p = new Point()
                            {
                                X = xyData[i].X, Y = xyData[i].Y
                            };
                            point[i] = p;
                        }

                        trace.TraceData = point;
                        windowChart.Traces.Add(trace);
                    }
                }
                if (tr.TestSpecList.Count > 0 && specIndex >= 0)
                {
                    XYTestLimit testLimit = tr.TestSpecList[specIndex].TestLimit;
                    if (testLimit != null)
                    {
                        foreach (var limit in testLimit.LimitLine)
                        {
                            SymtChartLib.LimitLineTypeEnum type = new SymtChartLib.LimitLineTypeEnum();
                            if (limit.Type == ModelBaseLib.LimitLineTypeEnum.Max)
                            {
                                type = SymtChartLib.LimitLineTypeEnum.Max;
                            }
                            else if (limit.Type == ModelBaseLib.LimitLineTypeEnum.Min)
                            {
                                type = SymtChartLib.LimitLineTypeEnum.Min;
                            }
                            else
                            {
                                type = SymtChartLib.LimitLineTypeEnum.None;
                            }
                            trace.LimitLineList.Add(new SymtChartLib.LimitLine()
                            {
                                X1 = limit.X1, Y1 = limit.Y1, X2 = limit.X2, Y2 = limit.Y2, Type = type
                            });
                        }
                    }
                }
                trace.Scale             = tr.Scale;
                trace.DivisionCount     = tr.DivCount;
                trace.ReferenceLevel    = tr.RefValue;
                trace.Unit              = tr.Unit;
                trace.ReferencePosition = tr.RefPosition;
            }
            windowChart.XAxisList = lstXAxis;
            windowChart.UpdateData();
        }