Example #1
0
        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;
            }
        }
Example #2
0
        internal Anchor(int baseWidth, int baseHeight, Assessment assessment)
        {
            Width      = baseWidth;
            Height     = baseHeight;
            Assessment = assessment;

            ShadeItemKeys = new List <ShadeItemKey>();
            ItemParsers   = new List <ItemParser>();

            switch (assessment.AssessmentType)
            {
            case AssessmentType.Item10:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 0.7047, 0.225, 0.28, 0, 0, 0, 0);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.25, 0.004, 0.2);
                SetParser   = new SetParser(0.51, 0.5, 0.975, 1);
                ItemParsers.Add(new ItemParser(0.05, 0.12, 0.447, 0.87, 1, 5));
                ItemParsers.Add(new ItemParser(0.5475, 0.12, 0.945, 0.87, 6, 5));
                break;

            case AssessmentType.Item20:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.383, 0.225, 0.13, 0, 0, 0, 0);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.004, 0.2);
                SetParser   = new SetParser(0.51, 0.5, 0.975, 1);
                ItemParsers.Add(new ItemParser(0.055, 0.03, 0.45, 0.96, 1, 10));
                ItemParsers.Add(new ItemParser(0.5525, 0.03, 0.94, 0.96, 11, 10));
                break;

            case AssessmentType.Item30:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.383, 0.225, 0.13, 0, 0, 0, 0);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.004, 0.2);
                SetParser   = new SetParser(0.51, 0.5, 0.975, 1);
                ItemParsers.Add(new ItemParser(0.0525, 0.05, 0.4494, 0.945, 1, 15));
                ItemParsers.Add(new ItemParser(0.55, 0.05, 0.9425, 0.945, 16, 15));
                break;

            case AssessmentType.Item40:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.4091, 0.225, 0.085, 0, 0, 0, 0);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.0035, 0.2);
                SetParser   = new SetParser(0.65, 0.5, 0.96, 1);
                ItemParsers.Add(new ItemParser(0.071, 0.0458, 0.33, 0.955, 1, 15));
                ItemParsers.Add(new ItemParser(0.378, 0.0458, 0.6325, 0.955, 16, 15));
                ItemParsers.Add(new ItemParser(0.677, 0.0458, 0.9375, 0.655, 31, 10));
                break;

            case AssessmentType.Item50:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.4759, 0.15, 0.081, 25, 0, 25, 25);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.0035, 0.2);
                SetParser   = new SetParser(0.65, 0.5, 0.96, 1);
                ItemParsers.Add(new ItemParser(0.07, 0.05, 0.328, 0.95, 1, 20));
                ItemParsers.Add(new ItemParser(0.377, 0.05, 0.634, 0.948, 21, 20));
                ItemParsers.Add(new ItemParser(0.68, 0.05, 0.937, 0.495, 41, 10));
                break;

            case AssessmentType.Item60:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.4759, 0.15, 0.081, 25, 0, 25, 25);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.0035, 0.2);
                SetParser   = new SetParser(0.65, 0.5, 0.96, 1);
                ItemParsers.Add(new ItemParser(0.07, 0.05, 0.328, 0.95, 1, 20));
                ItemParsers.Add(new ItemParser(0.377, 0.05, 0.634, 0.948, 21, 20));
                ItemParsers.Add(new ItemParser(0.68, 0.05, 0.937, 0.95, 41, 20));
                break;

            case AssessmentType.Item70:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.3497, 0.15, 0.065, 25, 0, 25, 90);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.00325, 0.2);
                SetParser   = new SetParser(0.75, 0.45, 0.968, 1);
                ItemParsers.Add(new ItemParser(0.047, 0.03, 0.232, 0.964, 1, 20));
                ItemParsers.Add(new ItemParser(0.288, 0.03, 0.472, 0.964, 21, 20));
                ItemParsers.Add(new ItemParser(0.53, 0.03, 0.71, 0.964, 41, 20));
                ItemParsers.Add(new ItemParser(0.765, 0.03, 0.95, 0.5, 61, 10));
                break;

            case AssessmentType.Item80:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.3497, 0.15, 0.065, 25, 0, 25, 90);
                PaperParser = new PaperParser(AnchorRect, 0.25, 0.2, 0.00325, 0.2);
                SetParser   = new SetParser(0.75, 0.45, 0.968, 1);
                ItemParsers.Add(new ItemParser(0.047, 0.03, 0.232, 0.964, 1, 20));
                ItemParsers.Add(new ItemParser(0.288, 0.03, 0.472, 0.964, 21, 20));
                ItemParsers.Add(new ItemParser(0.53, 0.03, 0.71, 0.964, 41, 20));
                ItemParsers.Add(new ItemParser(0.765, 0.03, 0.95, 0.964, 61, 20));
                break;

            case AssessmentType.Item90:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.4344, 0.15, 0.0575, 25, 0, 25, 40);
                PaperParser = new PaperParser(AnchorRect, 0.3, 0.25, 0.00325, 0.2);
                SetParser   = new SetParser(0.75, 0.45, 0.968, 1);
                ItemParsers.Add(new ItemParser(0.047, 0.03, 0.232, 0.964, 1, 25));
                ItemParsers.Add(new ItemParser(0.288, 0.03, 0.472, 0.964, 26, 25));
                ItemParsers.Add(new ItemParser(0.53, 0.03, 0.71, 0.964, 51, 25));
                ItemParsers.Add(new ItemParser(0.765, 0.03, 0.95, 0.588, 76, 15));
                break;

            case AssessmentType.Item100:
                AnchorRect  = new AnchorRect(baseWidth, baseHeight, 1.4344, 0.15, 0.0575, 25, 0, 25, 40);
                PaperParser = new PaperParser(AnchorRect, 0.3, 0.25, 0.00325, 0.2);
                SetParser   = new SetParser(0.75, 0.45, 0.968, 1);
                ItemParsers.Add(new ItemParser(0.047, 0.03, 0.232, 0.964, 1, 25));
                ItemParsers.Add(new ItemParser(0.288, 0.03, 0.472, 0.964, 26, 25));
                ItemParsers.Add(new ItemParser(0.53, 0.03, 0.71, 0.964, 51, 25));
                ItemParsers.Add(new ItemParser(0.765, 0.03, 0.95, 0.964, 76, 25));
                break;
            }
        }
Example #3
0
        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));
            }
        }