예제 #1
0
        /// <summary>
        /// Draw layers
        /// Images are used during report generation
        /// </summary>
        public void DrawLayers(Graphics3D graphics, bool showPallet, int layerIndex)
        {
            if (null == _caseSolution)
            {
                throw new Exception("No solution defined!");
            }
            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;

            // draw solution
            uint pickId = 0;
            int  iLayer = 0, iLayerCount = 0;

            while (iLayerCount <= layerIndex && iLayer < _caseSolution.Count)
            {
                ILayer   layer  = _caseSolution[iLayer];
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                    ++iLayerCount;
                }
                ++iLayer;
            }
        }
 public void ProcessAnalysis(BoxCasePalletAnalysis analysis)
 {
     _boxProperties        = analysis.BoxProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _palletSolutionList   = analysis.PalletSolutionsList;
     _constraintSet        = analysis.ConstraintSet;
     analysis.Solutions    = GenerateSolutions();
 }
예제 #3
0
 /// <summary>
 /// Constructor used while browsing/editing case analysis
 /// </summary>
 /// <param name="document">Document</param>
 /// <param name="caseAnalysis">Case analysis</param>
 public FormNewCaseAnalysis(Document document, BoxCasePalletAnalysis caseAnalysis)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document     = document;
     _caseAnalysis = caseAnalysis;
 }
예제 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="document">Document to which the case analysis begins</param>
        /// <param name="caseAnalysis">Case analysis browsed</param>
        public DockContentBoxCasePalletAnalysis(IDocument document, BoxCasePalletAnalysis caseAnalysis)
        {
            _document     = document;
            _caseAnalysis = caseAnalysis;
            _caseAnalysis.AddListener(this);

            _caseAnalysis.SolutionSelected         += new Basics.BoxCasePalletAnalysis.SelectSolution(SolutionSelectionChanged);
            _caseAnalysis.SolutionSelectionRemoved += new Basics.BoxCasePalletAnalysis.SelectSolution(SolutionSelectionChanged);

            InitializeComponent();
        }
예제 #5
0
        /// <summary>
        /// creates new case analysis view
        /// </summary>
        /// <param name="analysis"></param>
        /// <returns></returns>
        public DockContentBoxCasePalletAnalysis CreateCaseAnalysisView(BoxCasePalletAnalysis analysis)
        {
            // check if analysis has valid solutions
            if (!analysis.HasValidSolutions)
            {
                MessageBox.Show(string.Format(Properties.Resources.ID_ANALYSISHASNOVALIDSOLUTION, analysis.Name));
                return(null);
            }
            // show Box/Case/Pallet analysis view
            DockContentBoxCasePalletAnalysis form = new DockContentBoxCasePalletAnalysis(this, analysis);

            AddView(form);
            return(form);
        }
예제 #6
0
        /// <summary>
        /// Edit given box/case/pallet analysis
        /// </summary>
        /// <param name="caseAnalysis"></param>
        public void EditCaseAnalysis(BoxCasePalletAnalysis caseAnalysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired   = false;
            FormNewCaseAnalysis form = new FormNewCaseAnalysis(caseAnalysis.ParentDocument, caseAnalysis);

            form.Boxes = Boxes.ToArray();
            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                // analysis name / description
                caseAnalysis.Name        = form.CaseAnalysisName;
                caseAnalysis.Description = form.CaseAnalysisDescription;
                // selected box
                caseAnalysis.BoxProperties = form.SelectedBox;
                // pallet solutions
                caseAnalysis.PalletSolutionsList = form.PalletSolutionList;
                // constraint set
                BoxCasePalletConstraintSet constraintSet = caseAnalysis.ConstraintSet;
                // aligned / alternate layers
                constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                // patterns
                constraintSet.AllowedPatternString = form.AllowedPatternsString;
                // allowed axes
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                // use maximum case weight
                constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                constraintSet.MaximumCaseWeight    = form.MaximumCaseWeight;
                // use maximum number of boxes
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                // minimum number of items
                constraintSet.MinimumNumberOfItems    = form.MinimumNumberOfItems;
                constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems;
                // number of solutions kept
                constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept;
            }
            if (recomputeRequired)
            {
                caseAnalysis.OnEndUpdate(null);
            }
        }
예제 #7
0
 public void OnNewBoxCasePalletAnalysisCreated(Document doc, BoxCasePalletAnalysis caseAnalysis)
 {
     _log.Info(string.Format("Loaded case analysis {0}", caseAnalysis.Name));
 }
예제 #8
0
        /// <summary>
        /// Draw a 2D representation of first (and second, if solution does not have homogeneous layers) layer(s)
        /// </summary>
        public void Draw(Graphics2D graphics)
        {
            if (null == _caseSolution)
            {
                throw new Exception("No case solution defined!");
            }

            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;

            if (_caseSolution.HasHomogeneousLayers)
            {
                graphics.NumberOfViews = 1;
                graphics.SetViewport(0.0f, 0.0f, (float)_caseSolution.CaseLength, (float)_caseSolution.CaseWidth);

                BoxLayer blayer = _caseSolution[0] as BoxLayer;
                if (blayer != null)
                {
                    graphics.SetCurrentView(0);
                    graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_caseSolution.CaseLength, _caseSolution.CaseWidth), Color.Black);
                    uint pickId = 0;
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.DrawBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                }
            }
            else
            {
                graphics.NumberOfViews = 2;
                graphics.SetViewport(0.0f, 0.0f, (float)_caseSolution.CaseLength, (float)_caseSolution.CaseWidth);

                // get first box layer
                if (_caseSolution.Count < 1)
                {
                    return;
                }
                BoxLayer blayer0 = _caseSolution[0] as BoxLayer;
                if (blayer0 != null)
                {
                    graphics.SetCurrentView(0);
                    graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_caseSolution.CaseLength, _caseSolution.CaseWidth), Color.Black);
                    uint pickId = 0;
                    foreach (BoxPosition bPosition in blayer0)
                    {
                        graphics.DrawBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                }

                // get second box layer
                if (_caseSolution.Count < 2)
                {
                    return;
                }
                BoxLayer blayer1 = _caseSolution[1] as BoxLayer;
                if (null == blayer1 && _caseSolution.Count > 2)
                {
                    blayer1 = _caseSolution[2] as BoxLayer;
                }
                if (blayer1 != null)
                {
                    graphics.SetCurrentView(1);
                    graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_caseSolution.CaseLength, _caseSolution.CaseWidth), Color.Black);
                    uint pickId = 0;
                    foreach (BoxPosition bPosition in blayer1)
                    {
                        graphics.DrawBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Draw case solution
        /// </summary>
        public void Draw(Graphics3D graphics)
        {
            if (null == _caseSolution)
            {
                throw new Exception("No case solution defined!");
            }

            // load pallet solution
            BoxProperties caseProperties;

            CasePalletSolution palletSolution = _caseSolution.PalletSolutionDesc.LoadPalletSolution();

            if (null == palletSolution)
            {
                caseProperties = new BoxProperties(null, _caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight);
            }
            else
            {
                CasePalletAnalysis palletAnalysis = palletSolution.Analysis;
                // retrieve case properties
                caseProperties = palletAnalysis.BProperties as BoxProperties;
            }
            if (null == caseProperties)
            {
                return;
            }
            // draw case (inside)
            Case case_ = new Case(caseProperties);

            case_.DrawInside(graphics);
            // get case analysis
            BoxCasePalletAnalysis caseAnalysis = _caseSolution.ParentCaseAnalysis;
            // draw solution
            uint pickId = 0;

            foreach (ILayer layer in _caseSolution)
            {
                BoxLayer blayer = layer as BoxLayer;
                if (null != blayer)
                {
                    foreach (BoxPosition bPosition in blayer)
                    {
                        graphics.AddBox(new Box(pickId++, caseAnalysis.BoxProperties, bPosition));
                    }
                }

                InterlayerPos interlayerPos = layer as InterlayerPos;
                if (null != interlayerPos)
                {
                    Box box = new Box(pickId++, caseAnalysis.InterlayerProperties);
                    // set position
                    box.Position = new Vector3D(0.0, 0.0, interlayerPos.ZLow);
                    // draw
                    graphics.AddBox(box);
                }
            }
            // get case analysis
            if (_showDimensions)
            {
                graphics.AddDimensions(new DimensionCube(_caseSolution.CaseLength, _caseSolution.CaseWidth, _caseSolution.CaseHeight));
            }
        }
예제 #10
0
 void SolutionSelectionChanged(BoxCasePalletAnalysis analysis, SelBoxCasePalletSolution selSolution)
 {
     UpdateSelectButtonText();
     UpdateGridCheckBoxes();
 }