Esempio n. 1
0
        public static Solver.Colorizer ConvertToColorizer(Solver.ColorRange data)
        {
            var returnItem = new Solver.Colorizer {
                Min = (int)data.Min, Max = (int)data.Max, Color = data.Color
            };

            return(returnItem);
        }
Esempio n. 2
0
        public static Solver.Colorizer GetPrevColor(List <Solver.Colorizer> listOfColors, Solver.Colorizer afterThis)
        {
            Solver.Colorizer returnValue = afterThis;

            foreach (Solver.Colorizer colorizer in listOfColors)
            {
                if (IsInBetween(afterThis.Min - 1, colorizer.Min, colorizer.Max))
                {
                    returnValue = colorizer;
                }
            }
            return(returnValue);
        }
Esempio n. 3
0
        private void BtnQuickSolveClick(object sender, RoutedEventArgs e)
        {
            List <Surface> surfacelist =
                gridField.Children.Cast <object>().Where(uiElement => uiElement.GetType() == typeof(Surface)).Cast
                <Surface>().ToList();
            var slvr = new Solver(_charges, surfacelist, (int)gridField.Height, (int)gridField.Width);

            slvr.SolveIt();
            var imagebrush = new ImageBrush();
            //imagebrush.ImageSource = slvr.GetImageRgb24();

            var ListofColors = new List <Solver.Colorizer>();

            var color00 = new Solver.Colorizer();
            var color0  = new Solver.Colorizer();
            var color1  = new Solver.Colorizer();
            var color2  = new Solver.Colorizer();
            var color3  = new Solver.Colorizer();
            var color4  = new Solver.Colorizer();
            var color5  = new Solver.Colorizer();


            color00.Color = Colors.DarkRed;
            color00.Min   = 1001;
            color00.Max   = int.MaxValue;

            color0.Color = Colors.DarkRed;
            color0.Min   = 400;
            color0.Max   = 1000;

            color1.Color = Colors.Red;
            color1.Min   = 100;
            color1.Max   = 399;

            color2.Color = Colors.OrangeRed;
            color2.Min   = 60;
            color2.Max   = 99;

            color3.Color = Colors.Yellow;
            color3.Min   = 30;
            color3.Max   = 59;

            color4.Color = Colors.YellowGreen;
            color4.Min   = 10;
            color4.Max   = 29;

            color5.Color = Colors.Black;
            color5.Min   = 0;
            color5.Max   = 9;


            ListofColors.Add(color00);
            ListofColors.Add(color0);
            ListofColors.Add(color1);
            ListofColors.Add(color2);
            ListofColors.Add(color3);
            ListofColors.Add(color4);
            ListofColors.Add(color5);

            ListofColors.Add(new Solver.Colorizer());
            imagebrush.ImageSource = slvr.CustomeColorizerSolver(ListofColors);
            gridField.Background   = imagebrush;
        }