public void Process(PaperParser paperParser) { MainRect = paperParser.HeaderRect.GetInnerRect(LeftOffset, TopOffset, RightOffset, BottomOffset); SetARegion = MainRect.GetInnerRect(0, 0, 1.0 / 3.0, 1); SetBRegion = MainRect.GetInnerRect(1.0 / 3.0, 0, 2.0 / 3.0, 1); SetCRegion = MainRect.GetInnerRect(2.0 / 3.0, 0, 1, 1); isSetAShaded = false; isSetBShaded = false; isSetCShaded = false; ShadeSet = null; shadedSetCount = 0; foreach (Shade s in paperParser.HeaderShades) { if (SetARegion.IsInside(s.Center)) { isSetAShaded = true; ShadeSet = s; } else if (SetBRegion.IsInside(s.Center)) { isSetBShaded = true; ShadeSet = s; } else if (SetCRegion.IsInside(s.Center)) { isSetCShaded = true; ShadeSet = s; } } shadedSetCount += isSetAShaded ? 1 : 0; shadedSetCount += isSetBShaded ? 1 : 0; shadedSetCount += isSetCShaded ? 1 : 0; if (shadedSetCount == 0) { SetParserResult = SetParserResult.Unshaded; } else if (shadedSetCount > 1) { SetParserResult = SetParserResult.Multishaded; } else if (isSetAShaded) { SetParserResult = SetParserResult.SetA; AssessmentSetResult = AssessmentSet.SetA; } else if (isSetBShaded) { SetParserResult = SetParserResult.SetB; AssessmentSetResult = AssessmentSet.SetB; } else if (isSetCShaded) { SetParserResult = SetParserResult.SetC; AssessmentSetResult = AssessmentSet.SetC; } }
internal void Process(PaperParser paperParser) { MainRect = paperParser.BodyRect.GetInnerRect(LeftOffset, TopOffset, RightOffset, BottomOffset); ARegion = MainRect.GetInnerRect(0, 0, 1.0 / 5.0, 1); BRegion = MainRect.GetInnerRect(1.0 / 5.0, 0, 2.0 / 5.0, 1); CRegion = MainRect.GetInnerRect(2.0 / 5.0, 0, 3.0 / 5.0, 1); DRegion = MainRect.GetInnerRect(3.0 / 5.0, 0, 4.0 / 5.0, 1); ERegion = MainRect.GetInnerRect(4.0 / 5.0, 0, 1, 1); for (int i = 0; i < ItemCount; i++) { ItemRegion[i] = MainRect.GetInnerRect(0, (double)i / ItemCount, 1, (double)(i + 1) / ItemCount); } num = 0; ItemKeys.Clear(); foreach (Shade s in paperParser.BodyShades) { num = 0; for (int i = 0; i < ItemCount; i++) { if (ItemRegion[i].IsInside(s.Center)) { num = i + ItemStart; } } if (num == 0) { continue; } if (ARegion.IsInside(s.Center)) { key = Key.A; } else if (BRegion.IsInside(s.Center)) { key = Key.B; } else if (CRegion.IsInside(s.Center)) { key = Key.C; } else if (DRegion.IsInside(s.Center)) { key = Key.D; } else if (ERegion.IsInside(s.Center)) { key = Key.E; } else { continue; } ItemKeys.Add(new ShadeItemKey(s, num, key)); } }