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 SelHCylinderPalletSolution(Document document, HCylinderPalletAnalysis analysis, HCylinderPalletSolution sol) : base(document) { _analysis = analysis; _analysis.AddDependancy(this); _solution = sol; Name = sol.Title; }
/// <summary> /// Constructor used while browsing/editing existing analysis /// </summary> public FormNewAnalysisHCylinder(Document document, HCylinderPalletAnalysis 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); }
public DockContentHCylinderPalletAnalysis(IDocument document, HCylinderPalletAnalysis analysis) { _document = document; _analysis = analysis; _analysis.AddListener(this); _analysis.SolutionSelected += new HCylinderPalletAnalysis.SelectSolution(onSolutionSelectionChanged); _analysis.SolutionSelectionRemoved += new HCylinderPalletAnalysis.SelectSolution(onSolutionSelectionChanged); InitializeComponent(); }
void HCylinderPalletAnalysis_InsertSubNodes(Document doc, HCylinderPalletAnalysis 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); nodeAnalysis.Expand(); }
public void OnNewHCylinderPalletAnalysisCreated(Document doc, HCylinderPalletAnalysis analysis) { // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_LISTANALYSIS, doc)); // insert analysis node int indexIconAnalysis = 21; TreeNode nodeAnalysis = new TreeNode(analysis.Name, indexIconAnalysis, indexIconAnalysis); nodeAnalysis.Tag = new NodeTag(NodeTag.NodeType.NT_HCYLINDERPALLETANALYSIS, doc, analysis); parentNode.Nodes.Add(nodeAnalysis); parentNode.Expand(); HCylinderPalletAnalysis_InsertSubNodes(doc, analysis, nodeAnalysis); // add event handlers for solution selection analysis.Modified += new HCylinderPalletAnalysis.ModifyAnalysis(onHCylinderAnalysisModified); analysis.SolutionSelected += new HCylinderPalletAnalysis.SelectSolution(onHCylinderAnalysisSolutionSelected); analysis.SolutionSelectionRemoved += new HCylinderPalletAnalysis.SelectSolution(onHCylinderPalletSolutionSelectionRemoved); }
public NodeTag(NodeType type, Document document, HCylinderPalletAnalysis analysis, SelHCylinderPalletSolution selSolution, TruckAnalysis truckAnalysis) { _type = type; _document = document; _itemProperties = null; _hCylinderPalletAnalysis = analysis; _selHCylinderPalletSolution = selSolution; _truckAnalysis = truckAnalysis; }
public NodeTag(NodeType type, Document document, HCylinderPalletAnalysis analysis, ItemBase itemProperties) { _type = type; _document = document; _itemProperties = itemProperties; _hCylinderPalletAnalysis = analysis; }
public void OnNewHCylinderPalletAnalysisCreated(Document doc, HCylinderPalletAnalysis analysis) { CreateOrActivateViewHCylinderPalletAnalysis(analysis); }
private void NotifyOnNewHCylinderPalletAnalysisCreated(HCylinderPalletAnalysis analysis) { foreach (IDocumentListener listener in _listeners) listener.OnNewHCylinderPalletAnalysisCreated(this, analysis); }
/// <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 HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis( string name, string description , CylinderProperties cylinder, PalletProperties pallet , HCylinderPalletConstraintSet constraintSet , List<HCylinderPalletSolution> solutions) { HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _hCylinderPalletAnalyses.Add(analysis); // set solutions analysis.Solutions = solutions; // notify listeners NotifyOnNewHCylinderPalletAnalysisCreated(analysis); // set solution selected if its unique if (solutions.Count == 1) analysis.SelectSolutionByIndex(0); return analysis; }
public void OnNewHCylinderPalletAnalysisCreated(Document doc, HCylinderPalletAnalysis analysis) { }
public void SaveHCylinderPalletAnalysis(HCylinderPalletAnalysis analysis, XmlElement parentElement, XmlDocument xmlDoc) { // create analysis element XmlElement xmlAnalysisElt = xmlDoc.CreateElement("HCylinderPalletAnalysis"); 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); 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); } // 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 int solIndex = 0; XmlElement solutionsElt = xmlDoc.CreateElement("Solutions"); xmlAnalysisElt.AppendChild(solutionsElt); foreach (HCylinderPalletSolution sol in analysis.Solutions) { SaveHCylinderPalletSolution( analysis , sol , analysis.GetSelSolutionBySolutionIndex(solIndex) // null if not selected , solutionsElt , xmlDoc); ++solIndex; } }
public void EditHCylinderPalletAnalysis(HCylinderPalletAnalysis analysis) { bool recomputeRequired = false; FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this, analysis); form.Cylinders = Cylinders.ToArray(); form.Pallets = Pallets.ToArray(); if (recomputeRequired = (DialogResult.OK == form.ShowDialog())) { analysis.CylinderProperties = form.SelectedCylinder; analysis.PalletProperties = form.SelectedPallet; // analysis name / description analysis.Name = form.AnalysisName; analysis.Description = form.AnalysisDescription; // constraint set HCylinderPalletConstraintSet constraintSet = analysis.ConstraintSet; // overhang / underhang constraintSet.OverhangX = form.OverhangX; constraintSet.OverhangY = form.OverhangY; // stop criterions constraintSet.MaximumPalletHeight = form.MaximumPalletHeight; constraintSet.UseMaximumPalletHeight = form.UseMaximumPalletHeight; constraintSet.MaximumPalletWeight = form.MaximumPalletWeight; constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight; constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems; constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems; // allowed patterns constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn); constraintSet.RowSpacing = form.RowSpacing; } if (recomputeRequired) analysis.OnEndUpdate(null); }
/// <summary> /// Creates new DockContentAnalysis view /// </summary> /// <param name="analysis"></param> /// <returns></returns> public DockContentHCylinderPalletAnalysis CreateAnalysisViewHCylinderPallet(HCylinderPalletAnalysis analysis) { DockContentHCylinderPalletAnalysis form = new DockContentHCylinderPalletAnalysis(this, analysis); AddView(form); return form; }
public HCylinderPalletSolution(HCylinderPalletAnalysis parentAnalysis, string title) { _parentAnalysis = parentAnalysis; _title = title; }
public void ProcessAnalysis(HCylinderPalletAnalysis analysis) { _cylProperties = analysis.CylinderProperties; _palletProperties = analysis.PalletProperties; _constraintSet = analysis.ConstraintSet; if (!_constraintSet.IsValid) throw new EngineException("Constraint set is invalid!"); analysis.Solutions = GenerateSolutions(); }
public HCylinderPalletSolutionViewer(HCylinderPalletSolution solution) { _analysis = null != solution ? solution.Analysis : null; _solution = solution; }
public void SaveHCylinderPalletSolution( HCylinderPalletAnalysis analysis , HCylinderPalletSolution sol , SelHCylinderPalletSolution 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 positionsElt = xmlDoc.CreateElement("CylPositions"); solutionElt.AppendChild(positionsElt); foreach (CylPosition cylPos in sol) { // CylPosition XmlElement positionElt = xmlDoc.CreateElement("CylPosition"); positionsElt.AppendChild(positionElt); // XmlAttribute XmlAttribute attPosition = xmlDoc.CreateAttribute("Position"); attPosition.Value = cylPos.XYZ.ToString(); positionElt.Attributes.Append(attPosition); XmlAttribute attAxisDir = xmlDoc.CreateAttribute("AxisDir"); attAxisDir.Value = HalfAxis.ToString(cylPos.Direction); positionElt.Attributes.Append(attAxisDir); } if (null != selSolution) { // selected attribute XmlAttribute selAttribute = xmlDoc.CreateAttribute("Selected"); selAttribute.Value = "true"; solutionElt.Attributes.Append(selAttribute); } }
private void onHCylinderAnalysisModified(HCylinderPalletAnalysis analysis) { // retrieve parent document Document doc = analysis.ParentDocument; // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_HCYLINDERPALLETANALYSIS, doc, analysis)); // remove & insert sub nodes HCylinderPalletAnalysis_InsertSubNodes(doc, analysis, parentNode); // expand tree node parentNode.Expand(); }
public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis( string name, string description, CylinderProperties cylinder, PalletProperties pallet, HCylinderPalletConstraintSet constraintSet, IHCylinderAnalysisSolver solver) { HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _hCylinderPalletAnalyses.Add(analysis); // compute analysis solver.ProcessAnalysis(analysis); if (analysis.Solutions.Count < 1) { // remove analysis from list if it has no valid solution _hCylinderPalletAnalyses.Remove(analysis); return null; } // notify listeners NotifyOnNewHCylinderPalletAnalysisCreated(analysis); Modify(); return analysis; }
private void onHCylinderAnalysisSolutionSelected(HCylinderPalletAnalysis analysis, SelHCylinderPalletSolution selSolution) { // retrieve parent document Document doc = analysis.ParentDocument; // get parent node TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_HCYLINDERPALLETANALYSIS, doc, analysis)); // inserted selected solution node TreeNode nodeSelSolution = new TreeNode(selSolution.Name, 15, 15); nodeSelSolution.Tag = new NodeTag(NodeTag.NodeType.NT_HCYLINDERPALLETANALYSISSOLUTION, doc, analysis, selSolution); parentNode.Nodes.Add(nodeSelSolution); // expand tree nodes parentNode.Expand(); }
void onSolutionSelectionChanged(HCylinderPalletAnalysis analysis, SelHCylinderPalletSolution selSolution) { UpdateSelectButtonText(); UpdateGridCheckBoxes(); }
private void onHCylinderPalletSolutionSelectionRemoved(HCylinderPalletAnalysis analysis, SelHCylinderPalletSolution selSolution) { // retrieve parent document Document doc = analysis.ParentDocument; // get node TreeNode selSolutionNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_HCYLINDERPALLETANALYSISSOLUTION, 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); }
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 void CreateOrActivateViewHCylinderPalletAnalysis(HCylinderPalletAnalysis analysis) { // ---> search among existing views // ---> activate if found foreach (IDocument doc in Documents) foreach (IView view in doc.Views) { DockContentHCylinderPalletAnalysis form = view as DockContentHCylinderPalletAnalysis; if (null == form) continue; if (analysis == form.Analysis) { form.Activate(); return; } } // ---> not found // ---> create new form // get document DocumentSB parentDocument = (DocumentSB)analysis.ParentDocument; DockContentHCylinderPalletAnalysis formAnalysis = parentDocument.CreateAnalysisViewHCylinderPallet(analysis); formAnalysis.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document); }