Ejemplo n.º 1
0
        private static InterlayerProperties LoadInterlayerById(Document doc, List<interlayer> listInterlayer, string sid)
        {
            interlayer interlayerItem = listInterlayer.Find(delegate(interlayer i) { return i.id == sid; });
            if (null == interlayerItem)
                return null;
            else
            {
                // dimensions
                double[] dimensions = interlayerItem.dimensions.ToArray();
                // instantiate interlayer properties
                InterlayerProperties interlayerProperties = new InterlayerProperties(
                    doc
                    , interlayerItem.name
                    , interlayerItem.description
                    , dimensions[0], dimensions[1], dimensions[2]
                    , interlayerItem.weight
                    , Color.FromArgb((int)interlayerItem.color[0], (int)interlayerItem.color[1], (int)interlayerItem.color[2], (int)interlayerItem.color[3])
                    );
                // insert in list
                if (null != doc)
                    doc.AddType(interlayerProperties);

                return interlayerProperties;
            }
        }
Ejemplo n.º 2
0
 private static BundleProperties LoadBundleById(Document doc, List<bundle> listBundles, string sid)
 {
     bundle bundleItem = listBundles.Find(delegate(bundle b) { return b.id == sid; });
     if (null == bundleItem)
         return null;
     else
     {
         double[] bundleDim = bundleItem.flatDimensions.ToArray();
         // instantiate bundle
         BundleProperties bundleProperties = new BundleProperties(
             doc, bundleItem.name, bundleItem.description
             , bundleDim[0], bundleDim[1], bundleDim[2]
             , bundleItem.flatWeight, (int)bundleItem.numberFlats
             , System.Drawing.Color.FromArgb((int)bundleItem.color[0], (int)bundleItem.color[1], (int)bundleItem.color[2]));
         // insert in list
         if (null != doc)
             doc.AddType(bundleProperties);
         return bundleProperties;
     }
 }
Ejemplo n.º 3
0
        private static PalletProperties LoadPalletById(Document doc, List<pallet> listPallet, string sid)
        {
            pallet palletItem = listPallet.Find(delegate(pallet p) { return p.id == sid; });
            if (null == palletItem)
                return null;
            else
            {
                // dimensions
                double[] dimensions = palletItem.dimensions.ToArray();
                // type
                string typeName = string.Empty;
                switch (palletItem.type)
                {
                    case palletType.BLOCK: typeName = "BLOCK"; break;
                    case palletType.EUR: typeName = "EUR"; break;
                    case palletType.EUR2: typeName = "EUR2"; break;
                    case palletType.EUR3: typeName = "EUR3"; break;
                    case palletType.EUR6: typeName = "EUR6"; break;
                    case palletType.GMA: typeName = "GMA"; break;
                    case palletType.STANDARD_UK: typeName = "STANDARD_UK"; break;
                    default:
                        throw new Exception("Pallet with id = {0} has an unknown pallet type");
                }
                // instantiate pallet properties
                PalletProperties palletProperties = new PalletProperties(doc, typeName, dimensions[0], dimensions[1], dimensions[2]);
                // name
                palletProperties.Name = palletItem.name;
                // description
                palletProperties.Description = palletItem.description;
                // color
                palletProperties.Color = System.Drawing.Color.FromArgb((int)palletItem.color[0], (int)palletItem.color[1], (int)palletItem.color[2], (int)palletItem.color[3]);
                // weight
                palletProperties.Weight = palletItem.weight;
                // insert in list
                if (null != doc)
                    doc.AddType(palletProperties);

                return palletProperties;
            }
        }
Ejemplo n.º 4
0
 private static BoxProperties LoadCaseById(Document doc, List<@case> listCase, string sid)
 {
     @case caseItem = listCase.Find(delegate(@case c) { return c.id == sid; });
     if (null == caseItem)
         return null;
     else
     {
         double[] outerLength = caseItem.outerdimensions.ToArray();
         double[] insideLength = caseItem.innerDimensions.ToArray();
         // instantiate BoxProperties
         BoxProperties bProperties = new BoxProperties(doc, outerLength[0], outerLength[1], outerLength[2], insideLength[0], insideLength[1], insideLength[2]);
         // name
         bProperties.Name = caseItem.name;
         // description
         bProperties.Description = caseItem.description;
         // face colors
         foreach (faceColor fc in caseItem.faceColors)
         {
             System.Drawing.Color color = System.Drawing.Color.FromArgb((int)fc.color[0], (int)fc.color[1], (int)fc.color[2], (int)fc.color[3]);
             switch (fc.faceNormal)
             {
                 case axisDir.XN: bProperties.SetColor(HalfAxis.HAxis.AXIS_X_N, color); break;
                 case axisDir.XP: bProperties.SetColor(HalfAxis.HAxis.AXIS_X_P, color); break;
                 case axisDir.YN: bProperties.SetColor(HalfAxis.HAxis.AXIS_Y_N, color); break;
                 case axisDir.YP: bProperties.SetColor(HalfAxis.HAxis.AXIS_Y_P, color); break;
                 case axisDir.ZN: bProperties.SetColor(HalfAxis.HAxis.AXIS_Z_N, color); break;
                 case axisDir.ZP: bProperties.SetColor(HalfAxis.HAxis.AXIS_Z_P, color); break;
                 default: break;
             }
         }
         // face textures
         // weight
         bProperties.Weight = caseItem.weight;
         // insert in list
         if (null != doc)
             doc.AddType(bProperties);
         return bProperties;
     }
 }