/// <summary>
        /// Draw layers
        /// Images are used during report generation
        /// </summary>
        public void DrawLayers(Graphics3D graphics, bool showPallet, int layerIndex)
        {
            if (null == _solution)
            {
                throw new Exception("No solution defined!");
            }

            if (!graphics.ShowBoxIds)  // -> if box ids are drawn, we do not draw pallet
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // draw solution
            uint pickId = 0;
            int  iLayer = 0, iLayerCount = 0;

            while (iLayerCount <= layerIndex && iLayer < _solution.Count)
            {
                ILayer     layer  = _solution[iLayer];
                Layer3DBox blayer = layer as Layer3DBox;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, _analysis.BProperties, bPosition));
                    }
                    ++iLayerCount;
                }
                ++iLayer;
            }
            // flush
            graphics.Flush();
        }
Example #2
0
        public void Draw(Graphics3D graphics, IEnumerable <BoxExplicitDir> boxes, bool selected, bool showOuterDimensions)
        {
            graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
            graphics.CameraPosition  = Graphics3D.Corner_0;
            // draw case (inside)
            Case crate = new Case(0, Dimensions, Dimensions, CrateColor);

            crate.DrawInside(graphics, Transform3D.Identity);

            var tree = new BSPTree();

            foreach (var box in boxes)
            {
                tree.InsertBox(box);
            }
            tree.Draw(graphics);

            crate.DrawEnd(graphics);
            if (showOuterDimensions)
            {
                graphics.AddDimensions(new DimensionCube(Dimensions));
            }

            graphics.Flush();
        }
        /// <summary>
        /// Draw layers
        /// Images are used during report generation
        /// </summary>
        public void DrawLayers(Graphics3D graphics, bool showPallet, int layerIndex)
        {
            if (null == _solution)
            {
                throw new Exception("No solution defined!");
            }

            if (!graphics.ShowBoxIds) // -> if box ids are drawn, we do not draw pallet
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // draw solution
            uint          pickId   = 0;
            CylinderLayer cylLayer = _solution.CylinderLayerFirst;

            if (cylLayer != null)
            {
                foreach (Vector3D pos in cylLayer)
                {
                    graphics.AddCylinder(new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P)));
                }
            }
            // flush
            graphics.Flush();
        }
Example #4
0
 public void Draw(Graphics3D graphics, IEnumerable <Box> boxes, bool selected, bool annotate)
 {
     graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
     graphics.CameraPosition  = Graphics3D.Corner_0;
     // draw boxes
     foreach (var box in boxes)
     {
         graphics.AddBox(box);
     }
     graphics.Flush();
     if (annotate)
     {
         Annotate(graphics.Graphics, graphics.Size);
     }
 }
Example #5
0
        public void Draw(Graphics3D graphics, Packable packable, double height, bool selected, bool annotate)
        {
            graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
            graphics.CameraPosition  = Graphics3D.Corner_0;

            // draw layer (brick)
            if (_layer is Layer2DBrick layer2D)
            {
                uint pickId = 0;
                foreach (var bPosition in layer2D.Positions)
                {
                    if (packable is PackProperties)
                    {
                        graphics.AddBox(new Pack(pickId++, packable as PackProperties, bPosition));
                    }
                    else if (packable is PackableBrick)
                    {
                        graphics.AddBox(new Box(pickId++, packable as PackableBrick, bPosition));
                    }
                }
            }
            // draw layer (cylinder)
            else if (_layer is Layer2DCylImp)
            {
                Layer2DCylImp layer2DCyl = _layer as Layer2DCylImp;
                uint          pickId     = 0;
                foreach (Vector2D pos in layer2DCyl)
                {
                    Cyl cyl = null;
                    if (packable is CylinderProperties cylProperties)
                    {
                        cyl = new Cylinder(pickId++, cylProperties, new CylPosition(new Vector3D(pos.X, pos.Y, 0.0), HalfAxis.HAxis.AXIS_Z_P));
                    }
                    else if (packable is BottleProperties bottleProperties)
                    {
                        cyl = new Bottle(pickId++, bottleProperties, new CylPosition(new Vector3D(pos.X, pos.Y, 0.0), HalfAxis.HAxis.AXIS_Z_P));
                    }
                    graphics.AddCylinder(cyl);
                }
            }
            graphics.Flush();
            // annotate thumbnail
            if (annotate)
            {
                Annotate(graphics.Graphics, graphics.Size, height);
            }
        }
Example #6
0
        public void Draw(Graphics3D graphics, CylinderProperties cylProperties, double height, bool selected, bool annotate)
        {
            graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
            graphics.CameraPosition  = Graphics3D.Corner_0;

            uint pickId = 0;

            foreach (var cp in Layout.Positions)
            {
                graphics.AddCylinder(new Cylinder(pickId++, cylProperties, cp));
            }
            graphics.Flush();

            if (annotate)
            {
                Annotate(graphics.Graphics, graphics.Size, height);
            }
        }
Example #7
0
        public void Draw(Graphics3D graphics, IEnumerable <Box> boxes, bool selected, bool showOuterDimensions)
        {
            graphics.BackgroundColor = selected ? Color.LightBlue : Color.White;
            graphics.CameraPosition  = Graphics3D.Corner_0;
            // draw case (inside)
            Case crate = new Case(0, Dimensions, Dimensions, CrateColor);

            crate.DrawInside(graphics, Transform3D.Identity);

            var bbox = BBox3D.Initial;

            foreach (var b in boxes)
            {
                graphics.AddBox(b);
                bbox.Extend(b.BBox);
            }
            crate.DrawEnd(graphics);
            if (showOuterDimensions)
            {
                graphics.AddDimensions(new DimensionCube(Dimensions));
            }

            graphics.Flush();
        }
                /// <summary>
        /// Draw layers
        /// Images are used during report generation
        /// </summary>
        public void DrawLayers(Graphics3D graphics, bool showPallet, int layerIndex)
        {
            if (null == _solution)
                throw new Exception("No solution defined!");

            if (!graphics.ShowBoxIds) // -> if box ids are drawn, we do not draw pallet
            {
                // draw pallet
                Pallet pallet = new Pallet(_analysis.PalletProperties);
                pallet.Draw(graphics, Transform3D.Identity);
            }
            // draw solution
            uint pickId = 0;
            CylinderLayer cylLayer = _solution.CylinderLayerFirst;
            if (cylLayer != null)
            {
                foreach (Vector3D pos in cylLayer)
                    graphics.AddCylinder(new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P)));
            }
            // flush
            graphics.Flush();
        }
        /// <summary>
        /// Draw layers
        /// Images are used during report generation
        /// </summary>
        public void DrawLayers(Graphics3D graphics, bool showPallet, int layerIndex)
        {
             if (null == _solution)
                throw new Exception("No solution defined!");

             if (!graphics.ShowBoxIds) // -> if box ids are drawn, we do not draw pallet
             {
                 // draw pallet
                 Pallet pallet = new Pallet(_analysis.PalletProperties);
                 pallet.Draw(graphics, Transform3D.Identity);
             }
            // draw solution
            uint pickId = 0;
            int iLayer = 0, iLayerCount = 0;
            while (iLayerCount <= layerIndex && iLayer < _solution.Count)
            {
                ILayer layer = _solution[iLayer];
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                        graphics.AddBox(new Box(pickId++, _analysis.BProperties, bPosition));
                    ++iLayerCount;
                }
                ++iLayer;
            }
            // flush
            graphics.Flush();
        }