public SelPackPalletSolution(Document document, PackPalletAnalysis analysis, PackPalletSolution sol) : base(document) { _analysis = analysis; _solution = sol; ID.Name = sol.Title; }
public void ProcessAnalysis(PackPalletAnalysis analysis) { _packProperties = analysis.PackProperties; _palletProperties = analysis.PalletProperties; _interlayerProperties = analysis.InterlayerProperties; _constraintSet = analysis.ConstraintSet; analysis.Solutions = GenerateSolutions(); }
public DockContentPackPalletAnalysis(IDocument document, PackPalletAnalysis analysis) { _document = document; _analysis = analysis; _analysis.AddListener(this); InitializeComponent(); _analysis.SolutionSelected += new PackPalletAnalysis.SelectSolution(onSolutionSelectionChanged); _analysis.SolutionSelectionRemoved += new PackPalletAnalysis.SelectSolution(onSolutionSelectionChanged); }
public SelPackPalletSolution(Document document, PackPalletAnalysis analysis, PackPalletSolution sol) : base(document) { _analysis = analysis; _solution = sol; Name = sol.Title; }
public ReportData(PackPalletAnalysis packPalletAnalysis, SelPackPalletSolution selPackPalletSolution) { _packPalletAnalysis = packPalletAnalysis; _selPackPalletSolution = selPackPalletSolution; }
public PackPalletSolution(PackPalletAnalysis analysis, string title, BoxLayer layer) { _parentAnalysis = analysis; _title = title; _layer = layer; }
public PackPalletAnalysis CreateNewPackPalletAnalysis( string name, string description , PackProperties pack, PalletProperties pallet , InterlayerProperties interlayer , PackPalletConstraintSet constraintSet , List<PackPalletSolution> solutions) { PackPalletAnalysis analysis = new PackPalletAnalysis( pack , pallet , interlayer , constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _packPalletAnalyses.Add(analysis); // set solutions analysis.Solutions = solutions; // notify listeners NotifyOnNewPackPalletAnalysisCreated(analysis); // set solution selected if it is unique if (solutions.Count == 1) analysis.SelectSolutionByIndex(0); return analysis; }
private void NotifyOnNewPackPalletAnalysisCreated(PackPalletAnalysis analysis) { foreach (IDocumentListener listener in _listeners) listener.OnNewPackPalletAnalysisCreated(this, analysis); }
void PackPalletAnalysis_InsertSubNodes(Document doc, PackPalletAnalysis analysis, TreeNode nodeAnalysis) { // sanity check if (null == nodeAnalysis) return; // remove any existing subnodes nodeAnalysis.Nodes.Clear(); // insert sub pack node TreeNode subPackNode = new TreeNode(analysis.PackProperties.Name, 22, 22); subPackNode.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISPACK, doc, analysis, analysis.PackProperties); nodeAnalysis.Nodes.Add(subPackNode); TreeNode subPalletNode = new TreeNode(analysis.PalletProperties.Name, 7, 7); subPalletNode.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISPALLET, doc, analysis, analysis.PalletProperties); nodeAnalysis.Nodes.Add(subPalletNode); if (analysis.HasInterlayer) { TreeNode subInterlayerNode = new TreeNode(analysis.InterlayerProperties.Name, 8, 8); subInterlayerNode.Tag = new NodeTag(NodeTag.NodeType.NT_ANALYSISINTERLAYER, doc, analysis, analysis.InterlayerProperties); nodeAnalysis.Nodes.Add(subInterlayerNode); } nodeAnalysis.Expand(); }
private void onPackPalletAnalysisSolutionSelectionRemoved(PackPalletAnalysis analysis, SelPackPalletSolution selSolution) { // retrieve parent document Document doc = analysis.ParentDocument; // get node TreeNode selSolutionNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_PACKPALLETANALYSISSOLUTION, 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); }
private void onPackPalletAnalysisSolutionSelected(PackPalletAnalysis analysis, SelPackPalletSolution selSolution) { // retrieve parent document Document doc = analysis.ParentDocument; // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_PACKPALLETANALYSIS, doc, analysis)); if (null == parentNode) throw new Exception("Failed to locate Analysis (NT_PACKPALLETANALYSIS) node..."); // insert selected solution node TreeNode nodeSelSolution = new TreeNode(selSolution.Name, 15, 15); nodeSelSolution.Tag = new NodeTag(NodeTag.NodeType.NT_PACKPALLETANALYSISSOLUTION, doc, analysis, selSolution); parentNode.Nodes.Add(nodeSelSolution); // expand tree nodes parentNode.Expand(); }
private void onPackPalletAnalysisModified(PackPalletAnalysis analysis) { // retrieve parent document Document doc = analysis.ParentDocument; // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_PACKPALLETANALYSIS, doc, analysis)); if (null == parentNode) throw new Exception("Failed to locate Analysis (NT_PACKPALLETANALYSIS) node..."); // insert case/pallet/interlayer node PackPalletAnalysis_InsertSubNodes(doc, analysis, parentNode); // expand tree node parentNode.Expand(); }
public void CreateOrActivateViewPackPalletAnalysis(PackPalletAnalysis analysis) { // ---> search among existing views // ---> activate if found foreach (IDocument doc in Documents) foreach (IView view in doc.Views) { DockContentPackPalletAnalysis form = view as DockContentPackPalletAnalysis; if (null == form) continue; if (analysis == form.Analysis) { form.Activate(); return; } } // ---> not found // ---> create new form // get document DocumentSB parentDocument = (DocumentSB)analysis.ParentDocument; DockContentPackPalletAnalysis formAnalysis = parentDocument.CreateAnalysisViewPackPallet(analysis); formAnalysis.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document); }
public void OnNewPackPalletAnalysisCreated(Document doc, PackPalletAnalysis analysis) { CreateOrActivateViewPackPalletAnalysis(analysis); }
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; }
public PackPalletSolutionViewer(PackPalletSolution solution) { _analysis = null != solution ? solution.Analysis : null; _solution = solution; }
public void SavePackPalletAnalysis(PackPalletAnalysis analysis, XmlElement parentElement, XmlDocument xmlDoc) { // create analysis element XmlElement xmlAnalysisElt = xmlDoc.CreateElement("PackPalletAnalysis"); 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 packIdAttribute = xmlDoc.CreateAttribute("PackId"); packIdAttribute.Value = string.Format("{0}", analysis.PackProperties.Guid); xmlAnalysisElt.Attributes.Append(packIdAttribute); // 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); } // Constraint set XmlElement constraintSetElt = xmlDoc.CreateElement("ConstraintSet"); xmlAnalysisElt.AppendChild(constraintSetElt); SaveDouble(analysis.ConstraintSet.OverhangX, xmlDoc, constraintSetElt, "OverhangX"); SaveDouble(analysis.ConstraintSet.OverhangY, xmlDoc, constraintSetElt, "OverhangY"); SaveOptDouble(analysis.ConstraintSet.MinOverhangX, xmlDoc, constraintSetElt, "MinOverhangX"); SaveOptDouble(analysis.ConstraintSet.MinOverhangY, xmlDoc, constraintSetElt, "MinOverhangY"); SaveOptDouble(analysis.ConstraintSet.MinimumSpace, xmlDoc, constraintSetElt, "MinimumSpace"); SaveOptDouble(analysis.ConstraintSet.MaximumSpaceAllowed, xmlDoc, constraintSetElt, "MaximumSpaceAllowed"); SaveOptDouble(analysis.ConstraintSet.MaximumPalletHeight, xmlDoc, constraintSetElt, "MaximumPalletHeight"); SaveOptDouble(analysis.ConstraintSet.MaximumPalletWeight, xmlDoc, constraintSetElt, "MaximumPalletWeight"); SaveOptDouble(analysis.ConstraintSet.MaximumLayerWeight, xmlDoc, constraintSetElt, "MaximumLayerWeight"); SaveInt(analysis.ConstraintSet.LayerSwapPeriod, xmlDoc, constraintSetElt, "LayerSwapPeriod"); SaveInt(analysis.ConstraintSet.InterlayerPeriod, xmlDoc, constraintSetElt, "InterlayerPeriod"); // solutions XmlElement solutionsElt = xmlDoc.CreateElement("Solutions"); xmlAnalysisElt.AppendChild(solutionsElt); int solIndex = 0; foreach (PackPalletSolution sol in analysis.Solutions) { SavePackPalletSolution( sol , analysis.GetSelSolutionBySolutionIndex(solIndex) // null if not selected , solutionsElt , xmlDoc); ++solIndex; } }
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; } }
public PackPalletAnalysis CreateNewPackPalletAnalysis( string name, string description , PackProperties pack, PalletProperties pallet , InterlayerProperties interlayer , PackPalletConstraintSet constraintSet , IPackPalletAnalysisSolver solver) { PackPalletAnalysis analysis = new PackPalletAnalysis( pack , pallet , interlayer , constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _packPalletAnalyses.Add(analysis); // compute analysis solver.ProcessAnalysis(analysis); if (analysis.Solutions.Count < 1) { // remove analysis from list if it has no valid solution _packPalletAnalyses.Remove(analysis); Modify(); return null; } // notify listeners NotifyOnNewPackPalletAnalysisCreated(analysis); Modify(); return analysis; }
public NodeTag(NodeType type, Document document, PackPalletAnalysis analysis, ItemBase itemProperties) { _type = type; _document = document; _itemProperties = itemProperties; _packPalletAnalysis = analysis; }
public PackPalletSolution(PackPalletAnalysis analysis, string title, Layer3DBox layer) { _parentAnalysis = analysis; _title = title; _layer = layer; }
public NodeTag(NodeType type, Document document, PackPalletAnalysis analysis, SelPackPalletSolution selSolution) { _type = type; _document = document; _itemProperties = null; _packPalletAnalysis = analysis; _selPackPalletSolution = selSolution; }
public void OnNewPackPalletAnalysisCreated(Document doc, PackPalletAnalysis analysis) { // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_LISTANALYSIS, doc)); // insert analysis node int indexIconAnalysis = 23; TreeNode nodeAnalysis = new TreeNode(analysis.Name, indexIconAnalysis, indexIconAnalysis); nodeAnalysis.Tag = new NodeTag(NodeTag.NodeType.NT_PACKPALLETANALYSIS, doc, analysis); parentNode.Nodes.Add(nodeAnalysis); parentNode.Expand(); PackPalletAnalysis_InsertSubNodes(doc, analysis, nodeAnalysis); // add event handlers for solution selection analysis.Modified += new PackPalletAnalysis.ModifyAnalysis(onPackPalletAnalysisModified); analysis.SolutionSelected += new PackPalletAnalysis.SelectSolution(onPackPalletAnalysisSolutionSelected); analysis.SolutionSelectionRemoved += new PackPalletAnalysis.SelectSolution(onPackPalletAnalysisSolutionSelectionRemoved); }
public DockContentPackPalletAnalysis CreateAnalysisViewPackPallet(PackPalletAnalysis analysis) { DockContentPackPalletAnalysis form = new DockContentPackPalletAnalysis(this, analysis); AddView(form); return form; }
public FormNewAnalysisPackPallet(Document document, PackPalletAnalysis analysis) : base(document, analysis) { InitializeComponent(); _analysis = analysis; }
public void EditPackPalletAnalsyis(PackPalletAnalysis analysis) { // do we need to recompute analysis bool recomputeRequired = false; FormNewAnalysisPackPallet form = new FormNewAnalysisPackPallet(this, analysis); form.Packs = ListByType(typeof(PackProperties)).ToArray(); form.Pallets = Pallets.ToArray(); form.Interlayers = ListByType(typeof(InterlayerProperties)).ToArray(); if (recomputeRequired = (DialogResult.OK == form.ShowDialog())) { // analysis name / description analysis.Name = form.ItemName; analysis.Description = form.ItemDescription; // analysis pack / pallet /interlayer analysis.PackProperties = form.PackProperties; analysis.PalletProperties = form.PalletProperties; analysis.InterlayerProperties = form.InterlayerProperties; // constraint set PackPalletConstraintSet constraintSet = analysis.ConstraintSet; constraintSet.OverhangX = form.OverhangX; constraintSet.OverhangY = form.OverhangY; constraintSet.MinOverhangX = form.MinimumOverhangX; constraintSet.MinOverhangY = form.MinimumOverhangY; constraintSet.MinimumSpace = form.MinimumSpace; constraintSet.MaximumSpaceAllowed = form.MaximumSpace; constraintSet.LayerSwapPeriod = form.LayerSwapPeriod; constraintSet.InterlayerPeriod = form.InterlayerPeriod; constraintSet.HasFirstInterlayer = form.HasFirstInterlayer; // stop criterions constraintSet.MaximumPalletHeight = form.MaximumPalletHeight; constraintSet.MaximumPalletWeight = form.MaximumPalletWeight; } if (recomputeRequired) { analysis.OnEndUpdate(null); if (analysis.Solutions.Count < 1) MessageBox.Show(Properties.Resources.ID_ANALYSISHASNOSOLUTION, Application.ProductName, MessageBoxButtons.OK); } }
void onSolutionSelectionChanged(PackPalletAnalysis analysis, SelPackPalletSolution selSolution) { UpdateSelectButtonText(); UpdateGridCheckBoxes(); }
public void OnNewPackPalletAnalysisCreated(Document doc, PackPalletAnalysis analysis) { _log.Info(string.Format("Loaded analysis {0}", analysis.Name)); }