示例#1
0
        public Bitmap DrawMap(HeatMap map)
        {
            Bmp         = new Bitmap(map.Width * Scale, map.Height * Scale);
            using var g = Graphics.FromImage(Bmp);

            for (int i = 0; i < map.Height; i++)
            {
                for (int j = 0; j < map.Width; j++)
                {
                    var f = map.GetHeat(i, j);

                    if (f > 0)
                    {
                        using (var p = new SolidBrush(Color.FromArgb(0, (int)(255 * f), 0)))
                            g.FillRectangle(p, j * Scale, i * Scale, Scale, Scale);
                    }
                    else if (f < 0)
                    {
                        using (var p = new SolidBrush(Color.FromArgb((int)(-255 * f), 0, 0)))
                            g.FillRectangle(p, j * Scale, i * Scale, Scale, Scale);
                    }
                }
            }

            return(Bmp);
        }
示例#2
0
        private void DrawFrame(int idx)
        {
            var item  = _maps[idx];
            var total = item.Values /*.Subtract(item.Infl)*/;
            var map   = new HeatMap(total);

            Drawer.DrawMap(map);
            Drawer.DrawPacs(item.Pacs.Select(p => p.Pos));

            foreach (var pred in item.Predictions)
            {
                foreach (var paths in pred.Path)
                {
                    Drawer.DrawPath(paths[0], Color.CornflowerBlue);
                    Drawer.DrawPath(paths[1], Color.Blue);
                }
            }
        }