/// <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)); }
/// <summary> /// Use this method when solution does not refer an analysis (e.g. when displaying CaseOptimizer result) /// </summary> public void Draw(Graphics3D graphics) { if (null == _boxCaseSolution) throw new Exception("No box/case solution defined!"); BoxCaseAnalysis boxCaseAnalysis = _boxCaseSolution.Analysis; // retrieve case properties BProperties boxProperties = boxCaseAnalysis.BProperties; if (null == boxProperties) return; BoxProperties caseProperties = boxCaseAnalysis.CaseProperties; // draw case (inside) Case case_ = new Case(caseProperties); case_.DrawInside(graphics); // draw solution uint pickId = 0; foreach (ILayer layer in _boxCaseSolution) { BoxLayer blayer = layer as BoxLayer; if (null != blayer) { foreach (BoxPosition bPosition in blayer) graphics.AddBox(new Box(pickId++, boxProperties, bPosition)); } } // get case analysis if (_showDimensions) { graphics.AddDimensions(new DimensionCube( Vector3D.Zero , caseProperties.Length, caseProperties.Width, caseProperties.Height , System.Drawing.Color.Black , true)); graphics.AddDimensions(new DimensionCube( _boxCaseSolution.LoadBoundingBox , System.Drawing.Color.Red , false)); } }
/// <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)); } }