Exemplo n.º 1
0
        //處理大片裡面切割的小片評分機制
        public void DealSplitPieces(List<FlawInfoAddPriority> piece)
        {
            //Debug
            DebugTool.WriteLog("PxPTab.cs", "DealSplitPieces() entry.", MapWindowVariable.FlawPieces.Count.ToString(), MapWindowVariable.CurrentPiece.ToString());

            SplitPieces tmpSplitPieces = new SplitPieces();
            tmpSplitPieces.Pieces = new List<SplitPiece>();
            foreach (var r in GradeVariable.RoiRowsGrid)
            {
                foreach (var c in GradeVariable.RoiColumnsGrid)
                {

                    SplitPiece tmpsp = new SplitPiece();
                    tmpsp.Name = string.Format("ROI-{0}{1}", r.Name, c.Name);
                    tmpsp.Score = 0;
                    if (GradeVariable.IsPointEnable)
                    {
                        foreach (var s in piece)
                        {
                            if (s.SubPieceName == string.Format("ROI-{0}{1}", r.Name, c.Name))
                            {
                                tmpsp.Score += s.PointScore;
                            }
                        }
                    }

                    if (GradeVariable.IsMarkGradeEnable)
                    {
                        foreach (var m in GradeVariable.MarkGradeSubPieces)
                        {
                            int tmpPrevScore = -1;
                            foreach (var g in m.Grades)
                            {
                                if (m.Name == tmpsp.Name)
                                {
                                    if (tmpsp.Score <= g.Score && tmpsp.Score > tmpPrevScore)
                                    {
                                        tmpsp.GradeLevel = g.GradeName;
                                        break;
                                    }
                                    else
                                    {
                                        tmpsp.GradeLevel = "F";
                                        tmpPrevScore = g.Score;
                                    }

                                }
                            }
                        }
                    }
                    else
                    {
                        tmpsp.GradeLevel = "None";
                    }

                    tmpSplitPieces.Pieces.Add(tmpsp);
                }

            }
            GradeVariable.SplitPiecesContainer.Add(tmpSplitPieces);

            //Debug
            DebugTool.WriteLog("PxPTab.cs", "DealSplitPieces() complete.", MapWindowVariable.FlawPieces.Count.ToString(), MapWindowVariable.CurrentPiece.ToString());
        }
Exemplo n.º 2
0
        // 處理大片裡面切割的小片評分機制
        public void DealSplitPieces(List<FlawInfoAddPriority> piece)
        {
            SplitPieces tmpSplitPieces = new SplitPieces();
            tmpSplitPieces.Pieces = new List<SplitPiece>();
            foreach (RoiGrade r in GradeVariable.RoiRowsGrid)
            {
                foreach (RoiGrade c in GradeVariable.RoiColumnsGrid)
                {
                    SplitPiece tmpsp = new SplitPiece();
                    tmpsp.Name = string.Format("ROI-{0}{1}", r.Name, c.Name);
                    tmpsp.Score = 0;
                    if (GradeVariable.IsPointEnable)
                    {
                        foreach (FlawInfoAddPriority s in piece)
                        {
                            if (s.SubPieceName == string.Format("ROI-{0}{1}", r.Name, c.Name))
                            {
                                tmpsp.Score += s.PointScore;
                            }
                        }
                    }

                    if (GradeVariable.IsMarkGradeEnable)
                    {
                        foreach (MarkSubPiece m in GradeVariable.MarkGradeSubPieces)
                        {
                            int tmpPrevScore = -1;
                            foreach (MarkGrade g in m.Grades)
                            {
                                if (m.Name == tmpsp.Name)
                                {
                                    if (tmpsp.Score <= g.Score && tmpsp.Score > tmpPrevScore)
                                    {
                                        tmpsp.GradeLevel = g.GradeName;
                                        break;
                                    }
                                    else
                                    {
                                        tmpsp.GradeLevel = "F";
                                        tmpPrevScore = g.Score;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        tmpsp.GradeLevel = "None";
                    }

                    tmpSplitPieces.Pieces.Add(tmpsp);
                }
            }
            GradeVariable.SplitPiecesContainer.Add(tmpSplitPieces);
        }