예제 #1
0
        public Bitmap GetLayerImage(Packable content)
        {
            Graphics2DImage graphics = new Graphics2DImage(SizeImage);

            graphics.SetViewport(PtMin, PtMax);

            uint pickId = 0;

            foreach (var bp in Positions)
            {
                Box b;
                if (content is PackProperties pack)
                {
                    b = new Pack(pickId++, pack, bp);
                }
                else
                {
                    b = new Box(pickId++, content as PackableBrick, bp);
                }
                graphics.DrawBox(b);
            }
            graphics.DrawRectangle(Vector2D.Zero, DimContainer, Color.OrangeRed);

            if (-1 != SelectedIndex)
            {
                var bp = Positions[SelectedIndex];

                Box boxSelected;
                if (content is PackProperties pack)
                {
                    boxSelected = new Pack((uint)SelectedIndex, pack, bp);
                }
                else
                {
                    boxSelected = new Box((uint)SelectedIndex, content as PackableBrick, bp);
                }
                graphics.DrawBoxSelected(boxSelected);

                // draw position
                graphics.DrawText($"({bp.Position.X:0.##}, {bp.Position.Y:0.##}, {bp.Position.Z:0.##}), {HalfAxis.ToString(bp.DirectionLength)}, {HalfAxis.ToString(bp.DirectionWidth)}", FontSize);
            }
            return(graphics.Bitmap);
        }