Beispiel #1
0
        public FormNewBase(Document document, ItemBase item)
        {
            InitializeComponent();

            _document = document;
            _item = item;
        }
Beispiel #2
0
 public void AddDependancy(ItemBase dependancie)
 {
     if (_dependancies.Contains(dependancie))
     {
         _log.Warn(string.Format("Tried to add {0} as a dependancy of {1} a second time!", dependancie.Name, this.Name));
         return;
     }
     _dependancies.Add(dependancie);    
 }
        public override void OnAttributeModified(ItemBase modifiedAttribute)
        {
            Vector3D outerDim = _caseDefinition.OuterDimensions(_boxProperties, _constraintSet);
            Length = outerDim.X;
            Width = outerDim.Y;
            Height = outerDim.Z;

            Vector3D innerDim = _caseDefinition.InnerDimensions(_boxProperties);
            InsideLength = innerDim.X;
            InsideWidth = innerDim.Y;
            InsideHeight = innerDim.Z;
        }
 private void FillCombo(ComboBox cb, ItemBase[] items, ItemBase selectedItem)
 {
     cb.Items.Clear();
     foreach (ItemBase item in items)
         cb.Items.Add(new ItemBaseEncapsulator(item));
     if (cb.Items.Count > 0)
     {
         if (null == selectedItem)
             cb.SelectedIndex = 0;
         else
         {
             for (int i = 0; i < cb.Items.Count; ++i)
             {
                 ItemBaseEncapsulator itemEncapsulator = cb.Items[i] as ItemBaseEncapsulator;
                 if (itemEncapsulator.Item == selectedItem)
                 {
                     cb.SelectedIndex = i;
                     break;
                 }
             }
         }
     }
 }
Beispiel #5
0
 public override void OnAttributeModified(ItemBase modifiedAttribute)
 {
     // clear solutions
     _caseSolutions.Clear();
 }
Beispiel #6
0
 private void NotifyOnAnalysisRemoved(ItemBase analysis)
 {
     foreach (IDocumentListener listener in _listeners)
         listener.OnAnalysisRemoved(this, analysis);
 }
Beispiel #7
0
 public virtual void OnAttributeModified(ItemBase modifiedAttribute)
 {
 }
 public void Update(ItemBase item)
 { 
     // update grid
     FillGrid();
     // select first solution
     if (gridSolutions.RowsCount > 0)
         gridSolutions.Selection.SelectRow(1, true);
     if (_analysis.Solutions.Count > 0)
         _sol = _analysis.Solutions[0];
     // draw
     graphCtrlSolution.Invalidate();
 }
 public override void OnEndUpdate(ItemBase updatedAttribute)
 {
     Modify();
     base.OnEndUpdate(updatedAttribute);
 }
 public FormNewAnalysisCasePallet(Document doc, ItemBase analysis)
     : base(doc, analysis)
 {
     InitializeComponent();
 }
 /// <summary>
 /// handles new type creation
 /// </summary>
 /// <param name="doc"></param>
 /// <param name="itemProperties"></param>
 public void OnNewTypeCreated(Document doc, ItemBase itemProperties)
 {
     int iconIndex = 0;
     NodeTag.NodeType nodeType = NodeTag.NodeType.NT_BOX;
     NodeTag.NodeType parentNodeType = NodeTag.NodeType.NT_LISTBOX;
     if (itemProperties.GetType() == typeof(CaseOfBoxesProperties))
     {
         iconIndex = 17;
         nodeType = NodeTag.NodeType.NT_CASEOFBOXES;
         parentNodeType = NodeTag.NodeType.NT_LISTCASE;
     }
     else if (itemProperties.GetType() == typeof(BoxProperties))
     {
         BoxProperties boxProperties = itemProperties as BoxProperties;
         if (boxProperties.HasInsideDimensions)
         {
             iconIndex = 4;
             nodeType = NodeTag.NodeType.NT_CASE;
             parentNodeType = NodeTag.NodeType.NT_LISTCASE;
         }
         else
         {
             iconIndex = 3;
             nodeType = NodeTag.NodeType.NT_BOX;
             parentNodeType = NodeTag.NodeType.NT_LISTBOX;
         }
     }
     else if (itemProperties.GetType() == typeof(BundleProperties))
     {
         iconIndex = 5;
         nodeType = NodeTag.NodeType.NT_BUNDLE;
         parentNodeType = NodeTag.NodeType.NT_LISTBUNDLE;
     }
     else if (itemProperties.GetType() == typeof(CylinderProperties))
     {
         iconIndex = 6;
         nodeType = NodeTag.NodeType.NT_CYLINDER;
         parentNodeType = NodeTag.NodeType.NT_LISTCYLINDER;
     }
     else if (itemProperties.GetType() == typeof(PalletProperties))
     {
         iconIndex = 7;
         nodeType = NodeTag.NodeType.NT_PALLET;
         parentNodeType = NodeTag.NodeType.NT_LISTPALLET;
     }
     else if (itemProperties.GetType() == typeof(InterlayerProperties))
     {
         iconIndex = 8;
         nodeType = NodeTag.NodeType.NT_INTERLAYER;
         parentNodeType = NodeTag.NodeType.NT_LISTINTERLAYER;
     }
     else if (itemProperties.GetType() == typeof(TruckProperties))
     {
         iconIndex = 9;
         nodeType = NodeTag.NodeType.NT_TRUCK;
         parentNodeType = NodeTag.NodeType.NT_LISTTRUCK;
     }
     else if (itemProperties.GetType() == typeof(PalletCornerProperties))
     {
         iconIndex = 10;
         nodeType = NodeTag.NodeType.NT_PALLETCORNERS;
         parentNodeType = NodeTag.NodeType.NT_LISTPALLETCORNERS;
     }
     else if (itemProperties.GetType() == typeof(PalletCapProperties))
     {
         iconIndex = 11;
         nodeType = NodeTag.NodeType.NT_PALLETCAP;
         parentNodeType = NodeTag.NodeType.NT_LISTPALLETCAP;
     }
     else if (itemProperties.GetType() == typeof(PalletFilmProperties))
     {
         iconIndex = 12;
         nodeType = NodeTag.NodeType.NT_PALLETFILM;
         parentNodeType = NodeTag.NodeType.NT_LISTPALLETFILM;
     }
     else if (itemProperties.GetType() == typeof(PackProperties))
     {
         iconIndex = 22;
         nodeType = NodeTag.NodeType.NT_PACK;
         parentNodeType = NodeTag.NodeType.NT_LISTPACK;
     }
     else
     {
         Debug.Assert(false);
         _log.Error("AnalysisTreeView.OnNewTypeCreated() -> unknown type!");
         return;
     }
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(parentNodeType, doc));
     if (null == parentNode)
     {
         _log.Error(string.Format("Failed to load parentNode for {0}", itemProperties.Name));
         return;
     }
     // instantiate node
     TreeNode nodeItem = new TreeNode(itemProperties.Name, iconIndex, iconIndex);
     // set node tag
     nodeItem.Tag = new NodeTag(nodeType, doc, itemProperties);
     // insert
     parentNode.Nodes.Add(nodeItem);
     parentNode.Expand();
     // if item is CaseOfBoxesProperties
     if (itemProperties is CaseOfBoxesProperties)
     {
         // insert sub node
         CaseOfBoxesProperties caseOfBoxesProperties = itemProperties as CaseOfBoxesProperties;
         TreeNode subNode = new TreeNode(caseOfBoxesProperties.InsideBoxProperties.Name, 3, 3);
         subNode.Tag = new NodeTag(NodeTag.NodeType.NT_BOX, doc, caseOfBoxesProperties.InsideBoxProperties);
         nodeItem.Nodes.Add(subNode);
     }
 }
Beispiel #12
0
 public virtual void OnAttributeModified(ItemBase modifiedAttribute) {}
 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 doc, BoxCasePalletAnalysis caseAnalysis, ItemBase itemProperties)
 {
     _type = type;
     _document = doc;
     _boxCasePalletAnalysis = caseAnalysis;
     _itemProperties = itemProperties;
     _selSolution = null;
 }
 public NodeTag(NodeType type, Document document, HCylinderPalletAnalysis analysis, ItemBase itemProperties)
 {
     _type = type;
     _document = document;
     _itemProperties = itemProperties;
     _hCylinderPalletAnalysis = analysis;
 }
 public NodeTag(NodeType type, Document document, CylinderPalletAnalysis analysis, SelCylinderPalletSolution selSolution)
 {
     _type = type;
     _document = document;
     _itemProperties = null;
     _cylinderPalletAnalysis = analysis;
     _selCylinderPalletSolution = selSolution;
 }
Beispiel #17
0
 public virtual void OnEndUpdate(ItemBase updatedAttribute)
 {
 }
Beispiel #18
0
        public void RemoveItem(ItemBase item)
        {
            // sanity check
            if (null == item)
            {
                Debug.Assert(false);
                return;
            }
            // dispose item first as it may remove dependancies itself
            _log.Debug(string.Format("Disposing {0}...", item.Name));
            item.Dispose();

            // notify listeners / remove
            if (item.GetType() == typeof(BoxProperties)
                || item.GetType() == typeof(BundleProperties)
                || item.GetType() == typeof(CaseOfBoxesProperties)
                || item.GetType() == typeof(PackProperties)
                || item.GetType() == typeof(PalletProperties)
                || item.GetType() == typeof(InterlayerProperties)
                || item.GetType() == typeof(PalletCornerProperties)
                || item.GetType() == typeof(PalletCapProperties)
                || item.GetType() == typeof(PalletFilmProperties)
                || item.GetType() == typeof(TruckProperties)
                || item.GetType() == typeof(CylinderProperties))
            {
                NotifyOnTypeRemoved(item);
                if (!_typeList.Remove(item))
                    _log.Warn(string.Format("Failed to properly remove item {0}", item.Name));
            }
            else if (item.GetType() == typeof(CasePalletAnalysis))
            {
                NotifyOnAnalysisRemoved(item as CasePalletAnalysis);
                if (!_casePalletAnalyses.Remove(item as CasePalletAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(PackPalletAnalysis))
            { 
                NotifyOnAnalysisRemoved(item as PackPalletAnalysis);
                if (!_packPalletAnalyses.Remove(item as PackPalletAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(BoxCaseAnalysis))
            {
                NotifyOnAnalysisRemoved(item as BoxCaseAnalysis);
                if (!_boxCaseAnalyses.Remove(item as BoxCaseAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(CylinderPalletAnalysis))
            {
                NotifyOnAnalysisRemoved(item as CylinderPalletAnalysis);
                if (!_cylinderPalletAnalyses.Remove(item as CylinderPalletAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(HCylinderPalletAnalysis))
            {
                NotifyOnAnalysisRemoved(item as HCylinderPalletAnalysis);
                if (!_hCylinderPalletAnalyses.Remove(item as HCylinderPalletAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(TruckAnalysis))
            {
                TruckAnalysis truckAnalysis = item as TruckAnalysis;
                NotifyOnTruckAnalysisRemoved(truckAnalysis.ParentSelSolution, truckAnalysis);
            }
            else if (item.GetType() == typeof(BoxCasePalletAnalysis))
            {
                BoxCasePalletAnalysis caseAnalysis = item as BoxCasePalletAnalysis;
                NotifyOnAnalysisRemoved(caseAnalysis);
                if (!_boxCasePalletOptimizations.Remove(caseAnalysis))
                    _log.Warn(string.Format("Failed to properly remove analysis {0}", item.Name));
            }
            else if (item.GetType() == typeof(ECTAnalysis))
            {
                ECTAnalysis ectAnalysis = item as ECTAnalysis;
                NotifyOnECTAnalysisRemoved(ectAnalysis.ParentSelSolution, ectAnalysis);
            }
            else if (item.GetType() == typeof(SelCasePalletSolution)) { }
            else if (item.GetType() == typeof(SelBoxCasePalletSolution)) { }
            else if (item.GetType() == typeof(SelBoxCaseSolution)) { }
            else if (item.GetType() == typeof(SelCylinderPalletSolution)) { }
            else if (item.GetType() == typeof(SelHCylinderPalletSolution)) { }
            else if (item.GetType() == typeof(SelPackPalletSolution)) { }
            else
                Debug.Assert(false);
            Modify();
        }
 /// <summary>
 /// handles new type removed
 /// </summary>
 /// <param name="doc"></param>
 /// <param name="itemBase"></param>
 public void OnTypeRemoved(Document doc, ItemBase itemBase)
 {
     NodeTag.NodeType nodeType = NodeTag.NodeType.NT_UNKNOWN;
     if (itemBase.GetType() == typeof(BoxProperties))
     {
         BoxProperties box = itemBase as BoxProperties;
         if (box.HasInsideDimensions)
             nodeType = NodeTag.NodeType.NT_CASE;
         else
             nodeType = NodeTag.NodeType.NT_BOX;
     }
     else if (itemBase.GetType() == typeof(BundleProperties))
         nodeType = NodeTag.NodeType.NT_BUNDLE;
     else if (itemBase.GetType() == typeof(PackProperties))
         nodeType = NodeTag.NodeType.NT_PACK;
     else if (itemBase.GetType() == typeof(CaseOfBoxesProperties))
         nodeType = NodeTag.NodeType.NT_CASEOFBOXES;
     else if (itemBase.GetType() == typeof(InterlayerProperties))
         nodeType = NodeTag.NodeType.NT_INTERLAYER;
     else if (itemBase.GetType() == typeof(PalletCornerProperties))
         nodeType = NodeTag.NodeType.NT_PALLETCORNERS;
     else if (itemBase.GetType() == typeof(PalletCapProperties))
         nodeType = NodeTag.NodeType.NT_PALLETCAP;
     else if (itemBase.GetType() == typeof(PalletFilmProperties))
         nodeType = NodeTag.NodeType.NT_PALLETFILM;
     else if (itemBase.GetType() == typeof(PalletProperties))
         nodeType = NodeTag.NodeType.NT_PALLET;
     else if (itemBase.GetType() == typeof(TruckProperties))
         nodeType = NodeTag.NodeType.NT_TRUCK;
     else if (itemBase.GetType() == typeof(CylinderProperties))
         nodeType = NodeTag.NodeType.NT_CYLINDER;
     Debug.Assert(nodeType != NodeTag.NodeType.NT_UNKNOWN);
     if (nodeType == NodeTag.NodeType.NT_UNKNOWN)
         return; // ->not found exit
     // get node
     TreeNode typeNode = FindNode(null, new NodeTag(nodeType, doc, itemBase));
     // remove node
     if (null != typeNode)
         Nodes.Remove(typeNode);
 }
 public override void OnAttributeModified(ItemBase modifiedAttribute)
 {
     // clear selected solutions
     while (_selectedSolutions.Count > 0)
         UnSelectSolution(_selectedSolutions[0]);
     // clear solutions
     _solutions.Clear();
     // base
     base.OnAttributeModified(modifiedAttribute);
 }
Beispiel #21
0
 public void OnTypeRemoved(Document doc, ItemBase itemBase)
 { 
 }
Beispiel #22
0
 public virtual void OnEndUpdate(ItemBase updatedAttribute) {}
Beispiel #23
0
 public void OnNewTypeCreated(Document doc, ItemBase itemBase)
 {
     _log.Info(string.Format("Loaded item {0}", itemBase.Name));
 }
Beispiel #24
0
 public void RemoveDependancy(ItemBase dependancie)
 {   _dependancies.Remove(dependancie);  }
Beispiel #25
0
 public override void OnAttributeModified(ItemBase modifiedAttribute)
 {
     // clear selected solutions
     while (_selectedSolutions.Count > 0)
         UnSelectSolution(_selectedSolutions[0]);
     // clear solutions
     _solutions.Clear();
     // get default analysis solver
     if (null != _solver)
         _solver.ProcessAnalysis(this);
     else
         _log.Error("_solver == null : solver was not set");
     if (_solutions.Count == 0)
         _log.Debug("Recomputed analysis has no solutions");
     // set modified / propagate modifications
     Modify();
 }
 public override void OnAttributeModified(ItemBase modifiedAttribute)
 {
     // clear solutions
     _caseSolutions.Clear();
 }
Beispiel #27
0
 public void RemoveDependancy(ItemBase dependancie)
 {
     _dependancies.Remove(dependancie);
 }
Beispiel #28
0
 public void OnAnalysisRemoved(Document doc, ItemBase itemBase)
 {
 }
Beispiel #29
0
 public bool IsValidNewTypeName(string name, ItemBase itemToName)
 {
     // make sure is not empty
     if (name.Trim() == string.Empty)
         return false;
     // make sure it is not already used
     return null == _typeList.Find(
         delegate(ItemBase item)
         {
             return (item != itemToName) && string.Equals(item.Name.Trim(), name.Trim(), StringComparison.CurrentCultureIgnoreCase);
         }
         );
 }
 /// <summary>
 /// overrides IItemListener.Update
 /// </summary>
 /// <param name="item"></param>
 public void Update(ItemBase item)
 {
     // update grid
     FillGrid();
     // select first solution
     if (gridSolutions.RowsCount > 0)
         gridSolutions.Selection.SelectRow(1, true);
     // draw
     graphCtrlCaseSolution.Invalidate();
     graphCtrlPalletSolution.Invalidate();
 }
Beispiel #31
0
 public bool IsValidNewAnalysisName(string name, ItemBase analysisToRename)
 {
     string trimmedName = name.Trim();
     return (null == _casePalletAnalyses.Find(
         delegate(CasePalletAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ))
         && (null == _cylinderPalletAnalyses.Find(
         delegate(CylinderPalletAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ))
         && (null == _hCylinderPalletAnalyses.Find(
         delegate(HCylinderPalletAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ))
         && (null == _boxCaseAnalyses.Find(
         delegate(BoxCaseAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ))
         && (null == _boxCasePalletOptimizations.Find(
         delegate(BoxCasePalletAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ))
         && (null == _packPalletAnalyses.Find(
         delegate(PackPalletAnalysis analysis)
         {
             return analysis != analysisToRename
                 && string.Equals(analysis.Name, trimmedName, StringComparison.InvariantCultureIgnoreCase);
         }
         ));
 }
Beispiel #32
0
        public override void OnEndUpdate(ItemBase updatedAttribute)
        {
            if (null != Modified)
                Modified(this);
            // get default analysis solver
            if (null != _solver)
            {
                // clear solutions
                _solutions.Clear();
                _solver.ProcessAnalysis(this);
            }
            else
                _log.Error("_solver == null : solver was not set");

            if (_solutions.Count == 0)
                _log.Debug("Recomputed analysis has no solutions");
            // set modified / propagate modifications
            Modify();
        }
Beispiel #33
0
 public void AddType(ItemBase item)
 {
     // insert in list
     _typeList.Add(item);
     // notify listeners
     NotifyOnNewTypeCreated(item);
     Modify();
 }
 public void Kill(ItemBase item)
 {
     Close();
     _analysis.RemoveListener(this);
 }
Beispiel #35
0
 private void NotifyOnTypeRemoved(ItemBase item)
 {
     foreach (IDocumentListener listener in _listeners)
         listener.OnTypeRemoved(this, item);
 }