public Bitmap GeneratePalletImage(PalletProperties palletProperties)
        {
            Graphics2DImage graphics = new Graphics2DImage(ImageSize);

            graphics.SetViewport(PtMin - new Vector2D(0.5f, 0.5f), PtMax + new Vector2D(0.5, 0.5));
            graphics.MarginRatio = 0.0f;

            Pallet pallet = new Pallet(palletProperties);

            pallet.Draw(graphics);

            return(graphics.Bitmap);
        }
        public Bitmap GenerateCaseImage(Packable content, int number, CaseAlignement caseAlignment)
        {
            Graphics2DImage graphics = new Graphics2DImage(ImageSize);

            graphics.SetViewport(PtMin - new Vector2D(0.5f, 0.5f), PtMax + new Vector2D(0.5, 0.5));
            graphics.MarginRatio = 0.0f;

            double length = 0.0, width = 0.0;

            if (content is PackableBrick packable)
            {
                length = packable.Length;
                width  = packable.Width;
            }

            uint pickId = 0;

            for (int i = 0; i < number; ++i)
            {
                Vector3D v = Vector3D.Zero;
                switch (caseAlignment)
                {
                case CaseAlignement.SHARING_LENGTH: v = new Vector3D(0.0, i * width, 0.0); break;

                case CaseAlignement.SHARING_WIDTH: v = new Vector3D(i * length, 0.0, 0.0); break;

                default: break;
                }

                Box b;
                if (content is PackProperties pack)
                {
                    b = new Pack(pickId++, pack, new BoxPosition(v));
                }
                else if (content is PackableBrick brick)
                {
                    b = new Box(pickId++, brick, new BoxPosition(v))
                    {
                        ShowOrientationMark = true
                    }
                }
                ;
                else
                {
                    return(null);
                }
                b.Draw(graphics);
            }
            return(graphics.Bitmap);
        }
Exemplo n.º 3
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);
        }