Пример #1
0
        public static void DeleteColumnStructureTest(StructureParameters s)
        {
            DeleteColumns deleteColumn = new DeleteColumns(s, new int[] { 40, 200, 500 });

            deleteColumn.Apply();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachColumnLöschen.png");
            SaveFieldPlan(s, "tests/StructureFilterTests/FeldplanNachColumnLöschen.html");
            deleteColumn.Undo();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachColumnLoeschenUndo.png");
        }
Пример #2
0
        public static void InsertColumnStructureTest(StructureParameters s)
        {
            AddColumns addColumns = new AddColumns(s, 40, 2, 1, true);

            addColumns.Apply();
            AddColumns addColumns2 = new AddColumns(s, 1500, 2, 5, false);

            addColumns2.Apply();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachColumnEinfügen.png");
            SaveFieldPlan(s, "tests/StructureFilterTests/FeldplanNachColumnEinfuegen.html");
            addColumns2.Undo();
            addColumns.Undo();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachColumnEinfügenUndo.png");
        }
Пример #3
0
        static void WallTest(String path)
        {
            Progress <String>   progress = new Progress <string>(pr => Console.WriteLine(pr));
            StreamReader        sr       = new StreamReader(new FileStream("Structures.xml", FileMode.Open));
            XElement            xml      = XElement.Parse(sr.ReadToEnd());
            StructureParameters p        = new StructureParameters(Path.GetFullPath("tests/WallTest.DObject"), path, xml.Elements().ElementAt(1), 30000,
                                                                   "colors.DColor", ColorDetectionMode.Cie1976Comparison, new Dithering(),
                                                                   AverageMode.Corner, new NoColorRestriction(), true);
            var watch = System.Diagnostics.Stopwatch.StartNew();

            //DominoTransfer t = await Dispatcher.CurrentDispatcher.Invoke(async () => await Task.Run(() => p.Generate(wb, progress)));
            sr.Close();
            //DominoTransfer t = p.Generate();
            //Console.WriteLine("Size: " + t.shapes.Count());
            watch.Stop();
            Console.WriteLine(watch.ElapsedMilliseconds);
            watch = System.Diagnostics.Stopwatch.StartNew();
            //Mat b2 = t.GenerateImage(borders: false);
            watch.Stop();
            Console.WriteLine(watch.ElapsedMilliseconds);
            //b2.Save("tests/WallTest.png");
            p.Save();
            ((NonEmptyCalculation)p.PrimaryCalculation).Dithering = new JarvisJudiceNinkeDithering();
            p.Generate().GenerateImage().Save("tests/Wall_dithered.png");
            sr.Close();
            //FileStream fs = new FileStream(@"WallPlanTest.html", FileMode.Create);
            //StreamWriter sw = new StreamWriter(fs);
            //sw.Write(p.GetHTMLProcotol(new ObjectProtocolParameters()
            //{
            //    backColorMode = ColorMode.Normal,
            //    foreColorMode = ColorMode.Intelligent,
            //    orientation = Orientation.Horizontal,
            //    reverse = false,
            //    summaryMode = SummaryMode.Large,
            //    textFormat = "<font face=\"Verdana\">",
            //    templateLength = 20,
            //    textRegex = "%count% %color%",
            //    title = "Field"
            //}));
            //p.SaveXLSFieldPlan("ExcelFieldPlanTest.xlsx", new ObjectProtocolParameters()
            //{
            //    backColorMode = ColorMode.Normal,
            //    foreColorMode = ColorMode.Intelligent,
            //    orientation = Orientation.Horizontal,
            //    reverse = false,
            //    summaryMode = SummaryMode.Large,
            //    textFormat = "<font face=\"Verdana\">",
            //    templateLength = 20,
            //    textRegex = "%count%",
            //    title = "Field",
            //    path = Directory.GetCurrentDirectory()

            //});
            //sw.Close();
            p.Save();
            Workspace.Clear();
            StructureParameters p2 = Workspace.Load <StructureParameters>(Path.GetFullPath("tests/WallTest.DObject"));

            p2.Generate().GenerateImage().Save("tests/wall_after_load.png");
        }
Пример #4
0
        public static void CopyPasteFieldTest(StructureParameters s)
        {
            int[] source_area = new int[100];
            int   start       = 33;
            int   end         = 459 + 126 * 10;

            for (int j = 0; j < 100; j++)
            {
                source_area[j] = start + j;
            }
            PasteFilter paste = new PasteFilter(s, start, source_area, end);

            paste.Apply();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachPaste.png");
            paste.Undo();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/nachPasteUndo.png");
        }
Пример #5
0
        public static void PostFilterStructureTest(string path)
        {
            StreamReader        sr  = new StreamReader(new FileStream("Structures.xml", FileMode.Open));
            XElement            xml = XElement.Parse(sr.ReadToEnd());
            StructureParameters s   = new StructureParameters(Path.GetFullPath("tests/PostFilterTest.DObject"), path, xml.Elements().ElementAt(6), 3000,
                                                              "colors.DColor", ColorDetectionMode.Cie1976Comparison, new Dithering(),
                                                              AverageMode.Corner, new NoColorRestriction(), true);

            sr.Close();
            s.Generate().GenerateImage().Save("tests/StructureFilterTests/vorFilter.png");
            InsertRowStructureTest(s);
            DeleteRowStructureTest(s);
            InsertColumnStructureTest(s);
            DeleteColumnStructureTest(s);
        }