Ejemplo n.º 1
0
 public CasePalletAnalysis(
     BProperties boxProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     InterlayerProperties interlayerPropertiesAntiSlip,
     PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm,
     PalletConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument ||
         (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
     {
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     }
     if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet) ||
         (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet))
     {
         throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox");
     }
     // has interlayer ?
     constraintSet.HasInterlayer = null != interlayerProperties;
     // setting members
     this.BProperties                  = boxProperties;
     this.PalletProperties             = palletProperties;
     this.InterlayerProperties         = interlayerProperties;
     this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     this.PalletCornerProperties       = palletCorners;
     this.PalletCapProperties          = palletCap;
     this.PalletFilmProperties         = palletFilm;
     this.ConstraintSet                = constraintSet;
 }
Ejemplo n.º 2
0
        public FormNewPalletFilm(Document doc, PalletFilmProperties item)
            : base(doc, item)
        {
            InitializeComponent();

            if (null != item)
            {
                chkbTransparency.Checked = item.UseTransparency;
                chkbHatching.Checked = item.UseHatching;
                HatchSpacing = UnitsManager.ConvertLengthFrom(item.HatchSpacing, UnitsManager.UnitSystem.UNIT_METRIC1);
                HatchAngle = item.HatchAngle;
                FilmColor = item.Color;
            }
            else
            {
                chkbTransparency.Checked = true;
                chkbHatching.Checked = true;
                HatchSpacing = UnitsManager.ConvertLengthFrom(150.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                HatchAngle = 45.0;
                FilmColor = Color.LightSkyBlue;
            }
            chkbHatching_CheckedChanged(this, null);
            UpdateStatus(string.Empty);
            // units
            UnitsManager.AdaptUnitLabels(this);
        }
Ejemplo n.º 3
0
 public CasePalletAnalysis(
     BProperties boxProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     InterlayerProperties interlayerPropertiesAntiSlip,
     PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm,
     PalletConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument
         || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet)
         || (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet))
         throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox");
     // has interlayer ?
     constraintSet.HasInterlayer = null != interlayerProperties;
     // setting members
     this.BProperties = boxProperties;
     this.PalletProperties = palletProperties;
     this.InterlayerProperties = interlayerProperties;
     this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     this.PalletCornerProperties = palletCorners;
     this.PalletCapProperties = palletCap;
     this.PalletFilmProperties = palletFilm;
     this.ConstraintSet = constraintSet;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new analysis without generating solutions
 /// </summary>
 /// <param name="name">Name of analysis</param>
 /// <param name="description">Description</param>
 /// <param name="box">Case</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer</param>
 /// <param name="constraintSet">PalletConstraintSet</param>
 /// <param name="solutions">Solutions</param>
 /// <returns>CasePalletAnalysis generated using input parameters</returns>
 public CasePalletAnalysis CreateNewCasePalletAnalysis(
     string name, string description
     , BProperties box, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip
     , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm
     , PalletConstraintSet constraintSet
     , List<CasePalletSolution> solutions)
 {
     CasePalletAnalysis analysis = new CasePalletAnalysis(
         box, pallet,
         interlayer, interlayerAntiSlip,
         palletCorners, palletCap, palletFilm,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _casePalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewCasePalletAnalysisCreated(analysis);
     // set solution selected if it is unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Ejemplo n.º 5
0
        public AnalysisCasePallet CreateNewAnalysisCasePallet(
            string name, string description
            , BProperties box, PalletProperties pallet
            , List<InterlayerProperties> interlayers
            , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm
            , ConstraintSetCasePallet constraintSet
            , List<LayerDesc> layerDescs
            )
        {
            AnalysisCasePallet analysis = new AnalysisCasePallet(box, pallet, constraintSet);
            foreach (InterlayerProperties interlayer in interlayers)
                analysis.AddInterlayer(interlayer);
            analysis.PalletCornerProperties     = palletCorners;
            analysis.PalletCapProperties        = palletCap;
            analysis.PalletFilmProperties       = palletFilm;
            analysis.AddSolution(layerDescs);

            // notify listeners
            NotifyOnNewAnalysisCreated(analysis);
            Modify();

            return analysis;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new analysis in this document + compute solutions
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="box"></param>
 /// <param name="pallet"></param>
 /// <param name="interlayer"></param>
 /// <param name="constraintSet"></param>
 /// <param name="solver">Node : analysis creation requires a solver</param>
 /// <returns>An analysis</returns>
 public CasePalletAnalysis CreateNewCasePalletAnalysis(
     string name, string description
     , BProperties box, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip
     , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm
     , PalletConstraintSet constraintSet
     , ICasePalletAnalysisSolver solver)
 {
     CasePalletAnalysis analysis = new CasePalletAnalysis(
         box, pallet,
         interlayer, interlayerAntiSlip,
         palletCorners, palletCap, palletFilm,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _casePalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {	// remove analysis from list if it has no valid solution
         _casePalletAnalyses.Remove(analysis);
         return null;
     }
     // notify listeners
     NotifyOnNewCasePalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Ejemplo n.º 7
0
 public PalletFilmProperties CreateNewPalletFilm(
     string name, string description,
     bool useTransparency,
     bool useHatching, double hatchSpacing, double hatchAngle,
     Color color)
 {
     // instantiate and initialize
     PalletFilmProperties palletFilm = new PalletFilmProperties(
         this,
         name, description,
         useTransparency,
         useHatching, hatchSpacing, hatchAngle,
         color);
     // insert in list
     _typeList.Add(palletFilm);
     // notify listeners
     NotifyOnNewTypeCreated(palletFilm);
     Modify();
     return palletFilm;
 }
Ejemplo n.º 8
0
 public PalletFilmProperties CreateNewPalletFilm(PalletFilmProperties palletFilm)
 {
     // instantiate and initialize
     PalletFilmProperties palletFilmClone = new PalletFilmProperties(
         this,
         palletFilm.Name, palletFilm.Description,
         palletFilm.UseTransparency, palletFilm.UseHatching,
         palletFilm.HatchSpacing, palletFilm.HatchAngle,
         palletFilm.Color);
     // insert in list
     _typeList.Add(palletFilmClone);
     // notify listeners
     NotifyOnNewTypeCreated(palletFilmClone);
     Modify();
     return palletFilmClone; 
 }
Ejemplo n.º 9
0
 public void Save(PalletFilmProperties filmProperties, XmlElement parentElement, XmlDocument xmlDoc)
 {
     // create PalletFilmProperties element
     XmlElement xmlFilmProperties = xmlDoc.CreateElement("PalletFilmProperties");
     parentElement.AppendChild(xmlFilmProperties);
     // Id
     XmlAttribute guidAttribute = xmlDoc.CreateAttribute("Id");
     guidAttribute.Value = filmProperties.Guid.ToString();
     xmlFilmProperties.Attributes.Append(guidAttribute);
     // Name
     XmlAttribute nameAttribute = xmlDoc.CreateAttribute("Name");
     nameAttribute.Value = filmProperties.Name;
     xmlFilmProperties.Attributes.Append(nameAttribute);
     // Description
     XmlAttribute descAttribute = xmlDoc.CreateAttribute("Description");
     descAttribute.Value = filmProperties.Description;
     xmlFilmProperties.Attributes.Append(descAttribute);
     // Transparency
     XmlAttribute transparencyAttribute = xmlDoc.CreateAttribute("Transparency");
     transparencyAttribute.Value = filmProperties.UseTransparency.ToString();
     xmlFilmProperties.Attributes.Append(transparencyAttribute);
     // Hatching
     XmlAttribute hatchingAttribute = xmlDoc.CreateAttribute("Hatching");
     hatchingAttribute.Value = filmProperties.UseHatching.ToString();
     xmlFilmProperties.Attributes.Append(hatchingAttribute);
     // HatchSpacing
     XmlAttribute hatchSpacingAttribute = xmlDoc.CreateAttribute("HatchSpacing");
     hatchSpacingAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", filmProperties.HatchSpacing);
     xmlFilmProperties.Attributes.Append(hatchSpacingAttribute);
     // HatchAngle
     XmlAttribute hatchAngleAttribute = xmlDoc.CreateAttribute("HatchAngle");
     hatchAngleAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", filmProperties.HatchAngle);
     xmlFilmProperties.Attributes.Append(hatchAngleAttribute);
     // Color
     XmlAttribute colorAttribute = xmlDoc.CreateAttribute("Color");
     colorAttribute.Value = string.Format("{0}", filmProperties.Color.ToArgb());
     xmlFilmProperties.Attributes.Append(colorAttribute); 
 }
Ejemplo n.º 10
0
 private void AppendPalletFilmElement(PalletFilmProperties palletFilmProp, CasePalletAnalysis analyis, XmlElement elemPalletAnalysis, XmlDocument xmlDoc)
 {
     // sanity check
     if (null == palletFilmProp) return;
     // namespace
     string ns = xmlDoc.DocumentElement.NamespaceURI;
     // interlayer
     XmlElement elemPalletFilm = xmlDoc.CreateElement("palletFilm", ns);
     elemPalletAnalysis.AppendChild(elemPalletFilm);
     // name
     XmlElement elemName = xmlDoc.CreateElement("name", ns);
     elemName.InnerText = palletFilmProp.Name;
     elemPalletFilm.AppendChild(elemName);
     // description
     XmlElement elemDescription = xmlDoc.CreateElement("description", ns);
     elemDescription.InnerText = palletFilmProp.Description;
     elemPalletFilm.AppendChild(elemDescription);
     // number of turns
     XmlElement elemNumberOfTurns = xmlDoc.CreateElement("numberOfTurns", ns);
     elemNumberOfTurns.InnerText = analyis.ConstraintSet.PalletFilmTurns.ToString();
     elemPalletFilm.AppendChild(elemNumberOfTurns);
 }