Ejemplo n.º 1
0
        private void WriteComplicatedWiresManual(string path, ManualFileName file, ref List <ReplaceText> replacements)
        {
            var lineTypes = new List <string>
            {
                "15,40,4,10",
                string.Empty,
                "3",
                "8"
            };
            var labels = new List <string>
            {
                "Wire has red\ncoloring",
                "Wire has blue\ncoloring",
                "Has ★ symbol",
                "LED is on"
            };

            var ruleset            = _ruleManager.VennWireRuleSet;
            var cutInstructionList = new List <CutInstruction>
            {
                ruleset.RuleDict[new VennWireState(true, false, false, false)],
                ruleset.RuleDict[new VennWireState(false, true, false, false)],
                ruleset.RuleDict[new VennWireState(false, false, true, false)],
                ruleset.RuleDict[new VennWireState(false, false, false, true)],
                ruleset.RuleDict[new VennWireState(true, false, true, false)],
                ruleset.RuleDict[new VennWireState(true, true, false, false)],
                ruleset.RuleDict[new VennWireState(false, true, false, true)],
                ruleset.RuleDict[new VennWireState(false, false, true, true)],
                ruleset.RuleDict[new VennWireState(false, true, true, false)],
                ruleset.RuleDict[new VennWireState(true, false, false, true)],
                ruleset.RuleDict[new VennWireState(true, true, true, false)],
                ruleset.RuleDict[new VennWireState(true, true, false, true)],
                ruleset.RuleDict[new VennWireState(false, true, true, true)],
                ruleset.RuleDict[new VennWireState(true, false, true, true)],
                ruleset.RuleDict[new VennWireState(true, true, true, true)],
                ruleset.RuleDict[new VennWireState(false, false, false, false)]
            };

            var vennList = new List <string>();

            using (var enumerator = cutInstructionList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    // ReSharper disable once SwitchStatementMissingSomeCases
                    switch (enumerator.Current)
                    {
                    case CutInstruction.Cut:
                        vennList.Add("C");
                        break;

                    case CutInstruction.DoNotCut:
                        vennList.Add("D");
                        break;

                    case CutInstruction.CutIfSerialEven:
                        vennList.Add("S");
                        break;

                    case CutInstruction.CutIfParallelPortPresent:
                        vennList.Add("P");
                        break;

                    case CutInstruction.CutIfTwoOrMoreBatteriesPresent:
                        vennList.Add("B");
                        break;
                    }
                }
            }

            var vennSVG   = new SVGGenerator(800, 650);
            var legendSVG = new SVGGenerator(275, 200);

            vennSVG.Draw4SetVennDiagram(vennList, lineTypes);
            legendSVG.DrawVennDiagramLegend(labels, lineTypes);
            replacements.Add(new ReplaceText {
                Original = "VENNDIAGRAMSVGDATA", Replacement = vennSVG.ToString()
            });
            replacements.Add(new ReplaceText {
                Original = "VENNLEGENDSVGDATA", Replacement = legendSVG.ToString()
            });
            file.WriteFile(path, replacements);
        }
Ejemplo n.º 2
0
        private void WriteComplicatedWiresManual(string path, ManualFileName file, ref List <ReplaceText> replacements)
        {
            var strokeDashArrays = new List <float[]>
            {
                new [] { 20f, 10f, 5f, 10f },
                new float[0],
                new [] { 4f, 7f },
                new [] { 10f, 4f }
            };
            var labels = new List <string>
            {
                "Manual/venn.legendred",
                "Manual/venn.legendblue",
                "Manual/venn.legendsymbol",
                "Manual/venn.legendled"
            };
            var strokeWidths = new List <float>
            {
                5f,
                6f,
                4f,
                10f
            };

            var ruleset            = _ruleManager.VennWireRuleSet;
            var cutInstructionList = new List <CutInstruction>
            {
                ruleset.RuleDict[new VennWireState(true, false, false, false)],
                ruleset.RuleDict[new VennWireState(false, true, false, false)],
                ruleset.RuleDict[new VennWireState(false, false, true, false)],
                ruleset.RuleDict[new VennWireState(false, false, false, true)],
                ruleset.RuleDict[new VennWireState(true, false, true, false)],
                ruleset.RuleDict[new VennWireState(true, true, false, false)],
                ruleset.RuleDict[new VennWireState(false, true, false, true)],
                ruleset.RuleDict[new VennWireState(false, false, true, true)],
                ruleset.RuleDict[new VennWireState(false, true, true, false)],
                ruleset.RuleDict[new VennWireState(true, false, false, true)],
                ruleset.RuleDict[new VennWireState(true, true, true, false)],
                ruleset.RuleDict[new VennWireState(true, true, false, true)],
                ruleset.RuleDict[new VennWireState(false, true, true, true)],
                ruleset.RuleDict[new VennWireState(true, false, true, true)],
                ruleset.RuleDict[new VennWireState(true, true, true, true)],
                ruleset.RuleDict[new VennWireState(false, false, false, false)]
            };

            var vennList = new List <string>();

            using (var enumerator = cutInstructionList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    // ReSharper disable once SwitchStatementMissingSomeCases
                    switch (enumerator.Current)
                    {
                    case CutInstruction.Cut:
                        vennList.Add("Manual/venn.symbolcut");
                        break;

                    case CutInstruction.DoNotCut:
                        vennList.Add("Manual/venn.symboldonotcut");
                        break;

                    case CutInstruction.CutIfSerialEven:
                        vennList.Add("Manual/venn.symbolserial");
                        break;

                    case CutInstruction.CutIfParallelPortPresent:
                        vennList.Add("Manual/venn.symbolparallel");
                        break;

                    case CutInstruction.CutIfTwoOrMoreBatteriesPresent:
                        vennList.Add("Manual/venn.symbolbattery");
                        break;
                    }
                }
            }

            var vennSVG   = new SVGGenerator(800, 650);
            var legendSVG = new SVGGenerator(275, 200);

            vennSVG.Draw4SetVennDiagram(vennList, strokeDashArrays, strokeWidths);
            legendSVG.DrawVennDiagramLegend(labels, strokeDashArrays, strokeWidths);
            replacements.Add(new ReplaceText {
                Original = "VENNDIAGRAMSVGDATA", Replacement = vennSVG.ToString()
            });
            replacements.Add(new ReplaceText {
                Original = "VENNLEGENDSVGDATA", Replacement = legendSVG.ToString()
            });
            file.WriteFile(path, replacements);
        }