Пример #1
0
 public ReportData(
     CasePalletAnalysis palletAnalysis, SelCasePalletSolution selSolution
     , CylinderPalletAnalysis cylinderPalletAnalysis, SelCylinderPalletSolution selCylinderPalletSolution
     , HCylinderPalletAnalysis hCylinderPalletAnalysis, SelHCylinderPalletSolution selHCylinderPalletSolution
     , BoxCaseAnalysis boxCaseAnalysis, SelBoxCaseSolution selBoxCaseSolution
     , BoxCasePalletAnalysis caseAnalysis, SelBoxCasePalletSolution selCaseSolution
     , PackPalletAnalysis packPalletAnalysis, SelPackPalletSolution selPackPalletSolution
     )
 {
     // case/pallet analysis
     _palletAnalysis = palletAnalysis;
     _selSolution = selSolution;
     // box/case/pallet analysis
     _caseAnalysis = caseAnalysis;
     _selCaseSolution = selCaseSolution;
     // Cylinder analysis
     _cylinderPalletAnalysis = cylinderPalletAnalysis;
     _selCylinderPalletSolution = selCylinderPalletSolution;
     // HCylinder analysis
     _hCylinderPalletAnalysis = hCylinderPalletAnalysis;
     _selHCylinderPalletSolution = selHCylinderPalletSolution;
     // Box case analysis
     _boxCaseAnalysis = boxCaseAnalysis;
     _selBoxCaseSolution = selBoxCaseSolution;
     // Pack pallet analysis
     _packPalletAnalysis = packPalletAnalysis;
     _selPackPalletSolution = selPackPalletSolution;
 }
Пример #2
0
        public SelCylinderPalletSolution(Document document, CylinderPalletAnalysis analysis, CylinderPalletSolution sol)
            : base(document)
        {
            _analysis = analysis;
            _analysis.AddDependancy(this);

            _solution = sol;
            Name      = sol.Title;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public DockContentCylinderPalletAnalysis(IDocument document, CylinderPalletAnalysis analysis)
        {
            _document = document;
            _analysis = analysis;

            _analysis.AddListener(this);

            _analysis.SolutionSelected += new CylinderPalletAnalysis.SelectSolution(onSolutionSelectionChanged);
            _analysis.SolutionSelectionRemoved += new CylinderPalletAnalysis.SelectSolution(onSolutionSelectionChanged);

            InitializeComponent();
        }
Пример #4
0
        public void ProcessAnalysis(CylinderPalletAnalysis analysis)
        {
            _cylProperties = analysis.CylinderProperties;
            _palletProperties = analysis.PalletProperties;
            _interlayerProperties = analysis.InterlayerProperties;
            _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip;
            _constraintSet = analysis.ConstraintSet;
            if (!_constraintSet.IsValid)
                throw new EngineException("Constraint set is invalid!");

            analysis.Solutions = GenerateSolutions();
        }
 /// <summary>
 /// Constructor used while browsing/editing existing analysis
 /// </summary>
 public FormNewAnalysisCylinder(Document document, CylinderPalletAnalysis analysis)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     _analysis = analysis;
     // set caption text
     Text = string.Format(Properties.Resources.ID_EDIT, _analysis.Name);
     // update interlayer UI
     onInterlayerChecked(this, null);
     onInterlayerAntiSlipChecked(this, null);
 }
 private void onCylinderPalletSolutionSelectionRemoved(CylinderPalletAnalysis analysis, SelCylinderPalletSolution selSolution)
 {
     // retrieve parent document
     Document doc = analysis.ParentDocument;
     // get node
     TreeNode selSolutionNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_CYLINDERPALLETANALYSISSOLUTION, doc, analysis, selSolution));
     // test
     if (null == selSolutionNode)
     {
         _log.Error(string.Format("Failed to find a valid tree node for selSolution {0}", selSolution.Name));
         return;
     }
     // remove node
     Nodes.Remove(selSolutionNode);
 }
Пример #7
0
 public void OnNewCylinderPalletAnalysisCreated(Document doc, CylinderPalletAnalysis analysis)
 {
     CreateOrActivateViewCylinderPalletAnalysis(analysis);
 }
Пример #8
0
 /// <summary>
 /// Creates a new cylinder analysis in this document + compute solutions
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="description">Description</param>
 /// <param name="cylinder">Cylinder</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer or null</param>
 /// <param name="constraintSet">Cylinder/pallet analysis constraint set</param>
 /// <param name="solver">Solver</param>
 /// <returns>Cylinder/pallet analysis</returns>
 public CylinderPalletAnalysis CreateNewCylinderPalletAnalysis(
     string name, string description
     , CylinderProperties cylinder, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerPropertiesAntiSlip
     , CylinderPalletConstraintSet constraintSet
     , ICylinderAnalysisSolver solver)
 {
     CylinderPalletAnalysis analysis = new CylinderPalletAnalysis(
         cylinder, pallet,
         interlayer, interlayerPropertiesAntiSlip,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _cylinderPalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {	// remove analysis from list if it has no valid solution
         _cylinderPalletAnalyses.Remove(analysis);
         return null;
     }
     // notify listeners
     NotifyOnNewCylinderPalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Пример #9
0
        public void SaveCylinderPalletSolution(
            CylinderPalletAnalysis analysis
            , CylinderPalletSolution sol
            , SelCylinderPalletSolution selSolution
            , XmlElement solutionsElt
            , XmlDocument xmlDoc)
        {
            // Solution
            XmlElement solutionElt = xmlDoc.CreateElement("Solution");
            solutionsElt.AppendChild(solutionElt);
            // title
            XmlAttribute titleAttribute = xmlDoc.CreateAttribute("Title");
            titleAttribute.Value = sol.Title;
            solutionElt.Attributes.Append(titleAttribute);
            // limit
            XmlAttribute limitReached = xmlDoc.CreateAttribute("LimitReached");
            limitReached.Value = string.Format("{0}", (int)sol.LimitReached);
            solutionElt.Attributes.Append(limitReached);
            // layers
            XmlElement layersElt = xmlDoc.CreateElement("Layers");
            solutionElt.AppendChild(layersElt);

            foreach (ILayer layer in sol)
            {
                CylinderLayer cylLayer = layer as CylinderLayer;
                if (null != cylLayer)
                    Save(cylLayer, layersElt, xmlDoc);

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    // Interlayer
                    XmlElement interlayerElt = xmlDoc.CreateElement("Interlayer");
                    layersElt.AppendChild(interlayerElt);
                    // ZLow
                    XmlAttribute zlowAttribute = xmlDoc.CreateAttribute("ZLow");
                    zlowAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", interlayerPos.ZLow);
                    interlayerElt.Attributes.Append(zlowAttribute);
                }
            }
            if (null != selSolution)
            {
                // selected attribute
                XmlAttribute selAttribute = xmlDoc.CreateAttribute("Selected");
                selAttribute.Value = "true";
                solutionElt.Attributes.Append(selAttribute);
            }
        }
Пример #10
0
 void CylinderPalletAnalysis_InsertSubNodes(Document doc, CylinderPalletAnalysis analysis, TreeNode nodeAnalysis)
 {
     // sanity check
     if (null == nodeAnalysis) return;
     // remove any existing subnodes
     nodeAnalysis.Nodes.Clear();
     // insert sub cylinder node
     int indexIconBoxAnalysis = 6;
     TreeNode subCylNode = new TreeNode(analysis.CylinderProperties.Name, indexIconBoxAnalysis, indexIconBoxAnalysis);
     subCylNode.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISBOX, doc, analysis, analysis.CylinderProperties);
     nodeAnalysis.Nodes.Add(subCylNode);
     int indexIconPalletAnalysis = 7;
     TreeNode subPalletNode = new TreeNode(analysis.PalletProperties.Name, indexIconPalletAnalysis, indexIconPalletAnalysis);
     subPalletNode.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISPALLET, doc, analysis, analysis.PalletProperties);
     nodeAnalysis.Nodes.Add(subPalletNode);
     // insert sub interlayer node if any
     if (analysis.HasInterlayer)
     {
         TreeNode subInterlayer = new TreeNode(analysis.InterlayerProperties.Name, 8, 8);
         subInterlayer.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISINTERLAYER, doc, analysis, analysis.InterlayerProperties);
         nodeAnalysis.Nodes.Add(subInterlayer);
     }
     nodeAnalysis.Expand();
 }
Пример #11
0
 public NodeTag(NodeType type, Document document, CylinderPalletAnalysis analysis, SelCylinderPalletSolution selSolution, TruckAnalysis truckAnalysis)
 {
     _type = type;
     _document = document;
     _itemProperties = null;
     _cylinderPalletAnalysis = analysis;
     _selCylinderPalletSolution = selSolution;
     _truckAnalysis = truckAnalysis;
 }
 public CylinderPalletSolutionViewer(CylinderPalletSolution solution)
 {
     _analysis = null != solution ? solution.Analysis : null;
     _solution = solution;
 }
Пример #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 public CylinderPalletSolution(CylinderPalletAnalysis analysis, string title, bool homogeneousLayer)
 {
     _parentAnalysis   = analysis;
     _title            = title;
     _homogeneousLayer = homogeneousLayer;
 }
 void onSolutionSelectionChanged(CylinderPalletAnalysis analysis, SelCylinderPalletSolution selSolution)
 {
     UpdateSelectButtonText();
     UpdateGridCheckBoxes();
 }
Пример #15
0
 public NodeTag(NodeType type, Document document, ItemBase itemProperties)
 {
     _type = type;
     _document = document;
     _itemProperties = itemProperties;
     if (_type == NodeType.NT_CASEPALLETANALYSIS && itemProperties is CasePalletAnalysis)
     {
         _casePalletAnalysis = itemProperties as CasePalletAnalysis;
         _itemProperties = null;
     }
     else if (_type == NodeType.NT_PACKPALLETANALYSIS && itemProperties is PackPalletAnalysis)
     {
         _packPalletAnalysis = itemProperties as PackPalletAnalysis;
         _itemProperties = null;
     }
     else if (_type == NodeType.NT_BOXCASEANALYSIS && itemProperties is BoxCaseAnalysis)
     {
         _boxCaseAnalysis = itemProperties as BoxCaseAnalysis;
         _itemProperties = null;
     }
     else if (_type == NodeType.NT_BOXCASEPALLETANALYSIS && itemProperties is BoxCasePalletAnalysis)
     {
         _boxCasePalletAnalysis = itemProperties as BoxCasePalletAnalysis;
         _itemProperties = null;
     }
     else if (_type == NodeType.NT_CYLINDERPALLETANALYSIS && itemProperties is CylinderPalletAnalysis)
     {
         _cylinderPalletAnalysis = itemProperties as CylinderPalletAnalysis;
         _itemProperties = null;
     }
     else if (_type == NodeType.NT_HCYLINDERPALLETANALYSIS && itemProperties is HCylinderPalletAnalysis)
     {
         _hCylinderPalletAnalysis = itemProperties as HCylinderPalletAnalysis;
         _itemProperties = null;
     }
 }
Пример #16
0
 /// <summary>
 /// Creates new DockContentAnalysis view
 /// </summary>
 /// <param name="analysis"></param>
 /// <returns></returns>
 public DockContentCylinderPalletAnalysis CreateAnalysisViewCylinderPallet(CylinderPalletAnalysis analysis)
 {
     DockContentCylinderPalletAnalysis form = new DockContentCylinderPalletAnalysis(this, analysis);
     AddView(form);
     return form;
 }
Пример #17
0
 public NodeTag(NodeType type, Document document, CylinderPalletAnalysis analysis, ItemBase itemProperties)
 {
     _type = type;
     _document = document;
     _itemProperties = itemProperties;
     _cylinderPalletAnalysis = analysis;
 }
Пример #18
0
        public void EditCylinderPalletAnalysis(CylinderPalletAnalysis analysis)
        {
            bool recomputeRequired = false;
            FormNewAnalysisCylinder form = new FormNewAnalysisCylinder(this, analysis);
            form.Cylinders = Cylinders.ToArray();
            form.Pallets = Pallets.ToArray();
            form.Interlayers = Interlayers.ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                analysis.CylinderProperties = form.SelectedCylinder;
                analysis.PalletProperties = form.SelectedPallet;
                analysis.InterlayerProperties = form.SelectedInterlayer;
                analysis.InterlayerPropertiesAntiSlip = form.SelectedInterlayerAntiSlip;
                // analysis name / description
                analysis.Name = form.AnalysisName;
                analysis.Description = form.AnalysisDescription;
                // constraint set
                CylinderPalletConstraintSet constraintSet = analysis.ConstraintSet;
                // interlayers
                constraintSet.HasInterlayer = form.HasInterlayer;
                constraintSet.InterlayerPeriod = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // stop criterions
                constraintSet.UseMaximumPalletHeight = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletHeight = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight;
                constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems;
                constraintSet.UseMaximumLoadOnLowerCylinder = form.UseMaximumLoadOnLowerCylinder;
                constraintSet.MaximumLoadOnLowerCylinder = form.MaximumLoadOnLowerCylinder;
            }
            if (recomputeRequired)
                analysis.OnEndUpdate(null);
        }
Пример #19
0
 /// <summary>
 /// handles new cylinder/pallet analysis creation
 /// </summary>
 public void OnNewCylinderPalletAnalysisCreated(Document doc, CylinderPalletAnalysis analysis)
 {
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_LISTANALYSIS, doc));
     // insert analysis node
     int indexIconAnalysis = 20;
     TreeNode nodeAnalysis = new TreeNode(analysis.Name, indexIconAnalysis, indexIconAnalysis);
     nodeAnalysis.Tag = new NodeTag(NodeTag.NodeType.NT_CYLINDERPALLETANALYSIS, doc, analysis);
     parentNode.Nodes.Add(nodeAnalysis);
     parentNode.Expand();
     CylinderPalletAnalysis_InsertSubNodes(doc, analysis, nodeAnalysis);
     // add event handlers for solution selection
     analysis.Modified += new CylinderPalletAnalysis.ModifyAnalysis(onCylinderAnalysisModified);
     analysis.SolutionSelected += new CylinderPalletAnalysis.SelectSolution(onCylinderAnalysisSolutionSelected);
     analysis.SolutionSelectionRemoved += new CylinderPalletAnalysis.SelectSolution(onCylinderPalletSolutionSelectionRemoved);
 }
Пример #20
0
 public void OnNewCylinderPalletAnalysisCreated(Document doc, CylinderPalletAnalysis analysis)
 {
     _log.Info(string.Format("Loaded cylinder/pallet analysis {0}", analysis.Name));
 }
Пример #21
0
        static int Main(string[] args)
        {
            ILog log = LogManager.GetLogger(typeof(Program));
            XmlConfigurator.Configure();

            try
            {
                bool useSingleColor = false;
                // instantiate document
                Document doc = new Document("Test", "Test", "fga", DateTime.Now, null);

                // define pallet properties
                PalletProperties palletProperties = new PalletProperties(doc, "EUR2", 1200, 1000, 150);
                Console.WriteLine("=== Pallet properties ===");
                Console.WriteLine(palletProperties.ToString());

                bool testCylinder = false;
                if (!testCylinder)
                {
                    // define box properties
                    BoxProperties boxProperties = new BoxProperties(doc, 162, 210, 250);
                    boxProperties.Name = "Box1";
                    boxProperties.Weight = 3.0;
                    if (!useSingleColor)
                    {
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_X_N, Color.Red);
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_X_P, Color.Red);
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_Y_N, Color.Green);
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_Y_P, Color.Green);
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_Z_N, Color.Blue);
                        boxProperties.SetColor(HalfAxis.HAxis.AXIS_Z_P, Color.Blue);
                    }
                    else
                        boxProperties.SetColor(Color.Chocolate);

                    Console.WriteLine(boxProperties.ToString());

                    InterlayerProperties interlayerProperties = null;

                    // define constraints
                    CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, true);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, true);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, true);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, true);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, true);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true);

                    constraintSet.SetAllowedPattern("Trilock");

                    constraintSet.AllowAlignedLayers = true;
                    constraintSet.AllowAlternateLayers = false;

                    constraintSet.MaximumPalletWeight = 2000;
                    constraintSet.MaximumNumberOfItems = 2000;
                    constraintSet.MaximumHeight = 2000.0;
                    constraintSet.UseMaximumHeight = true;
                    constraintSet.UseMaximumPalletWeight = true;
                    constraintSet.UseMaximumWeightOnBox = false;
                    constraintSet.AllowLastLayerOrientationChange = true;
                    Console.WriteLine("=== Constraint set ===");
                    Console.WriteLine(constraintSet.ToString());

                    // initialize analysis
                    CasePalletAnalysis analysis = new CasePalletAnalysis(
                        boxProperties, palletProperties, interlayerProperties,
                        null, null, null, null,
                        constraintSet);

                    // initialize solver
                    CasePalletSolver solver = new CasePalletSolver();
                    solver.ProcessAnalysis(analysis);

                    Console.WriteLine("=== Solutions ===");
                    int solIndex = 0;
                    foreach (CasePalletSolution sol in analysis.Solutions)
                    {
                        // instantiate graphics
                        Graphics3DImage graphics = new Graphics3DImage(new Size(1000, 1000));
                        graphics.CameraPosition = new Vector3D(10000.0, 10000.0, 10000.0);
                        graphics.Target = Vector3D.Zero;
                        graphics.SetViewport(-500.0f, -500.0f, 500.0f, 500.0f);
                        // instantiate solution viewer
                        CasePalletSolutionViewer sv = new CasePalletSolutionViewer(sol);
                        sv.Draw(graphics);
                        // save
                        string fileName = string.Format("Pallet_{0}.bmp", solIndex++);
                        string filePath = Path.Combine(Path.GetTempPath(), fileName);
                        Console.WriteLine("Saving file " + filePath + "...");
                        graphics.SaveAs(filePath);
                    }
                }
                else
                {
                    // cylinder
                    Console.WriteLine("=== Cylinder properties ===");
                    CylinderProperties cylProperties = new CylinderProperties(doc, "Cylinder", "Default cylinder",
                        90, 45.0, 100, 1.5, Color.Gray, Color.SkyBlue, Color.SkyBlue);
                    Console.WriteLine(cylProperties.ToString());
                    // constraint set
                    Console.WriteLine("=== Constraint set ===");
                    CylinderPalletConstraintSet constraintSet = new CylinderPalletConstraintSet();
                    constraintSet.UseMaximumPalletHeight = true;
                    constraintSet.MaximumPalletHeight = 1200.0;
                    constraintSet.UseMaximumPalletWeight = true;
                    constraintSet.MaximumPalletWeight = 2000;
                    constraintSet.UseMaximumNumberOfItems = true;
                    constraintSet.MaximumNumberOfItems = 2000;
                    Console.WriteLine(constraintSet.ToString());
                    // cylinder analysis
                    CylinderPalletAnalysis analysis = new CylinderPalletAnalysis(cylProperties, palletProperties, null, null, constraintSet);
                    // initialize solver
                    CylinderSolver solver = new CylinderSolver();
                    solver.ProcessAnalysis(analysis);
                    Console.WriteLine("=== Solutions ===");
                    int solIndex = 0;
                    foreach (CylinderPalletSolution sol in analysis.Solutions)
                    {
                        // instantiate graphics
                        Graphics3DImage graphics = new Graphics3DImage(new Size(512, 512));
                        graphics.CameraPosition = new Vector3D(10000.0, 10000.0, 10000.0);
                        graphics.Target = Vector3D.Zero;
                        graphics.SetViewport(-500.0f, -500.0f, 500.0f, 500.0f);
                        // instantiate solution viewer
                        CylinderPalletSolutionViewer sv = new CylinderPalletSolutionViewer(sol);
                        sv.Draw(graphics);
                        string fileName = string.Format("Pallet_{0}.jpg", solIndex++);
                        string filePath = Path.Combine(Path.GetTempPath(), fileName);
                        Console.WriteLine("Saving file " + filePath + "...");
                        graphics.SaveAs(filePath);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return 0;
        }
Пример #22
0
        public SelCylinderPalletSolution(Document document, CylinderPalletAnalysis analysis, CylinderPalletSolution sol)
            : base(document)
        {
            _analysis = analysis;
            _analysis.AddDependancy(this);

            _solution = sol;
            Name = sol.Title;
        }
Пример #23
0
 public void SaveCylinderPalletAnalysis(CylinderPalletAnalysis analysis, XmlElement parentElement, XmlDocument xmlDoc)
 {
     // create analysis element
     XmlElement xmlAnalysisElt = xmlDoc.CreateElement("CylinderPalletAnalysis");
     parentElement.AppendChild(xmlAnalysisElt);
     // Name
     XmlAttribute analysisNameAttribute = xmlDoc.CreateAttribute("Name");
     analysisNameAttribute.Value = analysis.Name;
     xmlAnalysisElt.Attributes.Append(analysisNameAttribute);
     // Description
     XmlAttribute analysisDescriptionAttribute = xmlDoc.CreateAttribute("Description");
     analysisDescriptionAttribute.Value = analysis.Description;
     xmlAnalysisElt.Attributes.Append(analysisDescriptionAttribute);
     // BoxId
     XmlAttribute cylinderIdAttribute = xmlDoc.CreateAttribute("CylinderId");
     cylinderIdAttribute.Value = string.Format("{0}", analysis.CylinderProperties.Guid);
     xmlAnalysisElt.Attributes.Append(cylinderIdAttribute);
     // PalletId
     XmlAttribute palletIdAttribute = xmlDoc.CreateAttribute("PalletId");
     palletIdAttribute.Value = string.Format("{0}", analysis.PalletProperties.Guid);
     xmlAnalysisElt.Attributes.Append(palletIdAttribute);
     // InterlayerId
     if (null != analysis.InterlayerProperties)
     {
         XmlAttribute interlayerIdAttribute = xmlDoc.CreateAttribute("InterlayerId");
         interlayerIdAttribute.Value = string.Format("{0}", analysis.InterlayerProperties.Guid);
         xmlAnalysisElt.Attributes.Append(interlayerIdAttribute);
     }
     if (null != analysis.InterlayerPropertiesAntiSlip)
     {
         XmlAttribute interlayerIdAttribute = xmlDoc.CreateAttribute("InterlayerAntiSlipId");
         interlayerIdAttribute.Value = string.Format("{0}", analysis.InterlayerPropertiesAntiSlip.Guid);
         xmlAnalysisElt.Attributes.Append(interlayerIdAttribute);
     }
     XmlElement constraintSetElement = xmlDoc.CreateElement("ConstraintSet");
     xmlAnalysisElt.AppendChild(constraintSetElement);
     // stop criterions
     if (analysis.ConstraintSet.UseMaximumPalletHeight)
     {
         XmlAttribute maximumHeightAttribute = xmlDoc.CreateAttribute("MaximumHeight");
         maximumHeightAttribute.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", analysis.ConstraintSet.MaximumPalletHeight);
         constraintSetElement.Attributes.Append(maximumHeightAttribute);
     }
     if (analysis.ConstraintSet.UseMaximumNumberOfItems)
     {
         XmlAttribute maximumNumberOfItems = xmlDoc.CreateAttribute("ManimumNumberOfItems");
         maximumNumberOfItems.Value = string.Format("{0}", analysis.ConstraintSet.MaximumNumberOfItems);
         constraintSetElement.Attributes.Append(maximumNumberOfItems);
     }
     if (analysis.ConstraintSet.UseMaximumPalletWeight)
     {
         XmlAttribute maximumPalletWeight = xmlDoc.CreateAttribute("MaximumPalletWeight");
         maximumPalletWeight.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", analysis.ConstraintSet.MaximumPalletWeight);
         constraintSetElement.Attributes.Append(maximumPalletWeight);
     }
     if (analysis.ConstraintSet.UseMaximumLoadOnLowerCylinder)
     {
         XmlAttribute maximumWeightOnBox = xmlDoc.CreateAttribute("MaximumLoadOnLowerCylinder");
         maximumWeightOnBox.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", analysis.ConstraintSet.MaximumLoadOnLowerCylinder);
         constraintSetElement.Attributes.Append(maximumWeightOnBox);
     }
     // overhang / underhang
     XmlAttribute overhangX = xmlDoc.CreateAttribute("OverhangX");
     overhangX.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", analysis.ConstraintSet.OverhangX);
     constraintSetElement.Attributes.Append(overhangX);
     XmlAttribute overhangY = xmlDoc.CreateAttribute("OverhangY");
     overhangY.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", analysis.ConstraintSet.OverhangY);
     constraintSetElement.Attributes.Append(overhangY);
     // solutions
     XmlElement solutionsElt = xmlDoc.CreateElement("Solutions");
     xmlAnalysisElt.AppendChild(solutionsElt);
     int solIndex = 0;
     foreach (CylinderPalletSolution sol in analysis.Solutions)
     {
         SaveCylinderPalletSolution(
             analysis
             , sol
             , analysis.GetSelSolutionBySolutionIndex(solIndex) // null if not selected
             , solutionsElt
             , xmlDoc);
         ++solIndex;
     }
 }
Пример #24
0
 private void onCylinderAnalysisModified(CylinderPalletAnalysis analysis)
 {
     // retrieve parent document
     Document doc = analysis.ParentDocument;
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_CYLINDERPALLETANALYSIS, doc, analysis));
     // remove & insert sub nodes
     CylinderPalletAnalysis_InsertSubNodes(doc, analysis, parentNode);
     // expand tree node
     parentNode.Expand();
 }
Пример #25
0
 private void NotifyOnNewCylinderPalletAnalysisCreated(CylinderPalletAnalysis analysis)
 {
     foreach (IDocumentListener listener in _listeners)
         listener.OnNewCylinderPalletAnalysisCreated(this, analysis);
 }
Пример #26
0
 private void onCylinderAnalysisSolutionSelected(CylinderPalletAnalysis analysis, SelCylinderPalletSolution selSolution)
 {
     // retrieve parent document
     Document doc = analysis.ParentDocument;
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_CYLINDERPALLETANALYSIS, doc, analysis));
     // inserted selected solution node
     TreeNode nodeSelSolution = new TreeNode(selSolution.Name, 15, 15);
     nodeSelSolution.Tag = new NodeTag(NodeTag.NodeType.NT_CYLINDERPALLETANALYSISSOLUTION, doc, analysis, selSolution);
     parentNode.Nodes.Add(nodeSelSolution);
     // expand tree nodes
     parentNode.Expand();
 }
Пример #27
0
 /// <summary>
 /// Creates a new cylinder/pallet analysis without generating solutions
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="description">Description</param>
 /// <param name="cylinder">Cylinder</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer or null</param>
 /// <param name="constraintSet">Cylinder/pallet analysis constraint set</param>
 /// <param name="solutions">Solutions</param>
 /// <returns>Cylinder/pallet analysis</returns>
 public CylinderPalletAnalysis CreateNewCylinderPalletAnalysis(
     string name, string description
     , CylinderProperties cylinder, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip
     , CylinderPalletConstraintSet constraintSet
     , List<CylinderPalletSolution> solutions)
 {
     CylinderPalletAnalysis analysis = new CylinderPalletAnalysis(
         cylinder, pallet,
         interlayer, interlayerAntiSlip,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _cylinderPalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewCylinderPalletAnalysisCreated(analysis);
     // set solution selected if its unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Пример #28
0
 public void CreateOrActivateViewCylinderPalletAnalysis(CylinderPalletAnalysis analysis)
 {
     // ---> search among existing views
     // ---> activate if found
     foreach (IDocument doc in Documents)
         foreach (IView view in doc.Views)
         {
             DockContentCylinderPalletAnalysis form = view as DockContentCylinderPalletAnalysis;
             if (null == form) continue;
             if (analysis == form.Analysis)
             {
                 form.Activate();
                 return;
             }
         }
     // ---> not found
     // ---> create new form
     // get document
     DocumentSB parentDocument = (DocumentSB)analysis.ParentDocument;
     DockContentCylinderPalletAnalysis formAnalysis = parentDocument.CreateAnalysisViewCylinderPallet(analysis);
     formAnalysis.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
 }