Exemple #1
0
        public BoxLayer CreateNewLayer(double zLow, string patternName)
        {
            BoxLayer layer = new BoxLayer(zLow, patternName);

            Add(layer);
            return(layer);
        }
        public int CompareTo(object obj)
        {
            CasePalletSolution sol = (CasePalletSolution)obj;
            if (this.CaseCount > sol.CaseCount)
                return -1;
            else if (this.CaseCount == sol.CaseCount)
            {
                if ((sol.Count > 0 && sol[0] is BoxLayer)
                    && (this.Count > 0 && this[0] is BoxLayer))
                {
                    BoxLayer layerSol = (BoxLayer)sol[0];
                    int iPatternSol = PatternNameToIndex(layerSol.PatternName);
                    BoxLayer layerThis = (BoxLayer)this[0];
                    int iPatternThis = PatternNameToIndex(layerThis.PatternName);

                    if (iPatternSol > iPatternThis)
                        return -1;
                    else if (iPatternSol == iPatternThis)
                        return 0;
                    else
                        return 1;
                }
                return 0;
            }
            else
                return 1;
        }
        private BBox3D ComputeLoadBBox3D()
        {
            BBox3D   bbox          = new BBox3D();
            bool     hasInterlayer = false;
            double   zInterlayer   = 0.0;
            BoxLayer layer0        = GetBoxLayer(0, ref hasInterlayer, ref zInterlayer);

            bbox.Extend(layer0.BoundingBox(Analysis.PackProperties));
            BoxLayer layerN = GetBoxLayer(LayerCount - 1, ref hasInterlayer, ref zInterlayer);

            bbox.Extend(layerN.BoundingBox(Analysis.PackProperties));
            return(bbox);
        }
 private BBox3D ComputeLoadBBox3D()
 {
     BBox3D bbox = new BBox3D();
     int iLayer = 0;
     while (iLayer < Count)
     {
         ILayer layer = this[iLayer];
         BoxLayer blayer = layer as BoxLayer;
         if (null != blayer)
             bbox.Extend(blayer.BoundingBox(Analysis.BProperties));
         ++iLayer;
     }
     return bbox;
 }
        public BoxLayer GetBoxLayer(int iLayerIndex, ref bool hasInterlayer, ref double zInterlayer)
        {
            if (null == _parentAnalysis)
            {
                throw new Exception("_parentAnalysis not set.");
            }

            double interlayerThickness = (null != _parentAnalysis.InterlayerProperties) ? _parentAnalysis.InterlayerProperties.Thickness : 0.0;
            double packHeight          = _parentAnalysis.PackProperties.Height;
            double zLow = _parentAnalysis.PalletProperties.Height;
            int    i    = 0;

            while (i <= iLayerIndex - 1)
            {
                LayerDescriptor desc = _listLayers[i];
                zLow += (desc.HasInterlayer ? interlayerThickness : 0.0) + packHeight;
                ++i;
            }
            zInterlayer   = zLow;
            hasInterlayer = _listLayers[iLayerIndex].HasInterlayer;
            zLow         += hasInterlayer ? interlayerThickness : 0.0;

            Transform3D swapTransform = Transform3D.Identity;

            if (_listLayers[iLayerIndex].Swapped)
            {
                Matrix4D matRot = new Matrix4D(
                    -1.0, 0.0, 0.0, _parentAnalysis.PalletProperties.Length
                    , 0.0, -1.0, 0.0, _parentAnalysis.PalletProperties.Width
                    , 0.0, 0.0, 1.0, 0.0
                    , 0.0, 0.0, 0.0, 1.0);
                swapTransform = new Transform3D(matRot);
            }

            // build BoxLayer
            BoxLayer layer = new BoxLayer(zLow + (hasInterlayer ? interlayerThickness : 0.0), _layer.PatternName);

            foreach (BoxPosition b in _layer)
            {
                layer.Add(
                    new BoxPosition(
                        swapTransform.transform(b.Position + zLow * Vector3D.ZAxis)
                        , HalfAxis.Transform(b.DirectionLength, swapTransform)
                        , HalfAxis.Transform(b.DirectionWidth, swapTransform))
                    );
            }
            return(layer);
        }
Exemple #6
0
        public int CompareTo(object obj)
        {
            BoxCasePalletSolution sol = (BoxCasePalletSolution)obj;

            if (this.BoxPerPalletCount > sol.BoxPerPalletCount)
            {
                return(-1);
            }
            else if (this.BoxPerPalletCount == sol.BoxPerPalletCount)
            {
                if ((sol.Count > 0 && sol[0] is BoxLayer) &&
                    (this.Count > 0 && this[0] is BoxLayer))
                {
                    BoxLayer layerSol     = (BoxLayer)sol[0];
                    int      iPatternSol  = PatternNameToIndex(layerSol.PatternName);
                    BoxLayer layerThis    = (BoxLayer)this[0];
                    int      iPatternThis = PatternNameToIndex(layerThis.PatternName);

                    if (iPatternSol > iPatternThis)
                    {
                        return(-1);
                    }
                    else if (iPatternSol == iPatternThis)
                    {
                        return(0);
                    }
                    else
                    {
                        return(1);
                    }
                }
                return(0);
            }
            else
            {
                return(1);
            }
        }
Exemple #7
0
 public void SetLayer(BoxLayer layer)
 {
     _layer = layer;
 }
 public PackPalletSolution(PackPalletAnalysis analysis, string title, BoxLayer layer)
 {
     _parentAnalysis = analysis;
     _title          = title;
     _layer          = layer;
 }