Esempio n. 1
0
        /// <summary>
        /// edit box / case analysis
        /// </summary>
        public void EditBoxCaseAnalysis(BoxCaseAnalysis boxCaseAnalysis)
        {
            bool recomputeRequired = false;

            if (boxCaseAnalysis.IsBoxAnalysis)
            {
                FormNewBoxCaseAnalysis form = new FormNewBoxCaseAnalysis(boxCaseAnalysis.ParentDocument, boxCaseAnalysis);
                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    boxCaseAnalysis.ID.SetNameDesc(form.AnalysisName, form.AnalysisDescription);
                    // selected box
                    boxCaseAnalysis.BProperties    = form.SelectedBox;
                    boxCaseAnalysis.CaseProperties = form.SelectedCase;
                    // constraint set
                    BCaseConstraintSet   constraintSet        = boxCaseAnalysis.ConstraintSet;
                    BoxCaseConstraintSet boxCaseConstraintSet = constraintSet as BoxCaseConstraintSet;
                    if (null != boxCaseConstraintSet)
                    {
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                        boxCaseConstraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                    }
                    // use maximum case weight
                    constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                    constraintSet.MaximumCaseWeight    = form.MaximumCaseWeight;
                    // use maximum number of items
                    constraintSet.UseMaximumNumberOfBoxes = form.UseMaximumNumberOfBoxes;
                    constraintSet.MaximumNumberOfBoxes    = form.MaximumNumberOfBoxes;
                }
            }
            else if (boxCaseAnalysis.IsBundleAnalysis)
            {
                FormNewAnalysisBundleCase form = new FormNewAnalysisBundleCase(boxCaseAnalysis.ParentDocument, boxCaseAnalysis);
                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    boxCaseAnalysis.ID.SetNameDesc(form.ItemName, form.ItemDescription);
                    // selected bundle
                    boxCaseAnalysis.BProperties    = form.SelectedBundle;
                    boxCaseAnalysis.CaseProperties = form.SelectedCase;
                    // constraint set
                    BCaseConstraintSet constraintSet = boxCaseAnalysis.ConstraintSet;
                    // use maximum case weight
                    constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                    constraintSet.MaximumCaseWeight    = form.MaximumCaseWeight;
                    // use maximum number of items
                    constraintSet.UseMaximumNumberOfBoxes = form.UseMaximumNumberOfBoxes;
                    constraintSet.MaximumNumberOfBoxes    = form.MaximumNumberOfBoxes;
                }
            }
            if (recomputeRequired)
            {
                boxCaseAnalysis.OnEndUpdate(null);
            }
        }
        public void ProcessAnalysis(BoxCaseAnalysis analysis)
        {
            _bProperties    = analysis.BProperties;
            _caseProperties = analysis.CaseProperties;
            _constraintSet  = analysis.ConstraintSet;

            if (!_constraintSet.IsValid)
            {
                throw new EngineException("Constraint set is invalid!");
            }

            analysis.Solutions = GenerateSolutions();
        }