Example #1
0
        public void Draw(Graphics2D graphics, Packable packable, double height, bool selected, bool annotate)
        {
            graphics.NumberOfViews = 1;
            graphics.Clear(selected ? Color.LightBlue : Color.White);
            graphics.SetViewport(0.0f, 0.0f, (float)_layer.Length, (float)_layer.Width);
            graphics.SetCurrentView(0);
            graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_layer.Length, _layer.Width), Color.Black);

            // draw layer (brick)
            if (_layer is Layer2D)
            {
                Layer2D layer2D = _layer as Layer2D;
                uint    pickId  = 0;
                foreach (LayerPosition bPosition in layer2D)
                {
                    Box b = null;
                    if (packable is PackProperties)
                    {
                        b = new Pack(pickId++, packable as PackProperties, bPosition);
                    }
                    else if (packable is PackableBrick)
                    {
                        b = new Box(pickId++, packable as PackableBrick, bPosition);
                    }
                    if (null != b)
                    {
                        b.Draw(graphics);
                    }
                }
            }
            // draw layer (cylinder)
            else if (_layer is Layer2DCyl)
            {
                Layer2DCyl layer2DCyl = _layer as Layer2DCyl;
                uint       pickId     = 0;
                foreach (Vector2D pos in layer2DCyl)
                {
                    Cylinder c = new Cylinder(pickId++, packable as CylinderProperties, new CylPosition(new Vector3D(pos.X, pos.Y, 0.0), HalfAxis.HAxis.AXIS_Z_P));
                    graphics.DrawCylinder(c);
                }
            }
            // draw axes
            bool showAxis = false;

            if (showAxis)
            {
                // draw axis X
                graphics.DrawLine(Vector2D.Zero, new Vector2D(_layer.Length, 0.0), Color.Red);
                // draw axis Y
                graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _layer.Width), Color.Green);
            }
            // annotate thumbnail
            if (annotate)
            {
                Annotate(graphics.Graphics, graphics.Size, height);
            }
        }
        public void Draw(Graphics2D graphics)
        {
            if (null == _solution || _solution.Count == 0)
            {
                return;
            }

            bool showAxis = false;

            // initialize Graphics2D object
            graphics.NumberOfViews = 1;
            graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth);

            CylinderLayer cylLayer = _solution.CylinderLayerFirst;

            if (cylLayer != null)
            {
                graphics.SetCurrentView(0);
                graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black);
                uint pickId = 0;
                foreach (Vector3D pos in cylLayer)
                {
                    graphics.DrawCylinder(
                        new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P))
                        );
                }

                // draw axes
                if (showAxis)
                {
                    // draw axis X
                    graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red);
                    // draw axis Y
                    graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green);
                }
            }
        }
        public void Draw(Graphics2D graphics)
        {
            if (null == _solution || _solution.Count == 0)
                return;

            bool showAxis = false;

            // initialize Graphics2D object
            graphics.NumberOfViews = 1;
            graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth);

            CylinderLayer cylLayer = _solution.CylinderLayerFirst;
            if (cylLayer != null)
            {
                graphics.SetCurrentView(0);
                graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black);
                uint pickId = 0;
                foreach (Vector3D pos in cylLayer)
                    graphics.DrawCylinder(
                        new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P))
                        );

                // draw axes
                if (showAxis)
                {
                    // draw axis X
                    graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red);
                    // draw axis Y
                    graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green);
                }
            }
        }