public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { if (ctrl == graphCtrlBoxesLayout) { // ### draw case definition try { // get selected solution CaseOptimSolution solution = SelectedSolution; if (null == solution) { return; } // instantiate case definition viewer CaseDefinitionViewer cdv = new CaseDefinitionViewer(SelectedSolution.CaseDefinition, SelectedBox, BuildCaseOptimConstraintSet()) { Orientation = SelectedSolution.PalletSolution.FirstCaseOrientation }; cdv.Draw(graphics); } catch (Exception ex) { _log.Error(ex.ToString()); } } if (ctrl == graphCtrlPallet) { // ### draw associated pallet solution try { // get selected solution CaseOptimSolution solution = SelectedSolution; // get selected box BoxProperties boxProperties = SelectedBox; // get selected pallet PalletProperties palletProperties = SelectedPallet; if (null != solution && null != boxProperties && null != palletProperties) { Vector3D outerDim = solution.CaseDefinition.OuterDimensions(boxProperties, BuildCaseOptimConstraintSet()); BoxProperties caseProperties = new BoxProperties(null, outerDim.X, outerDim.Y, outerDim.Z); caseProperties.SetColor(Color.Chocolate); CasePalletSolutionViewer.Draw(graphics, solution.PalletSolution, caseProperties, null, palletProperties); } } catch (Exception ex) { _log.Error(ex.ToString()); } } }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { if (graphCtrlBoxCase == ctrl) { BoxProperties boxProperties = new BoxProperties(null , _caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height); boxProperties.SetAllColors(_faceColors); boxProperties.TextureList = _textures; Box box = new Box(0, boxProperties); graphics.AddBox(box); graphics.AddDimensions(new DimensionCube(_caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height)); } else if (graphCtrlCaseDefinition == ctrl) { CaseDefinitionViewer viewer = new CaseDefinitionViewer(_caseOfBoxesProperties.CaseDefinition, _caseOfBoxesProperties.InsideBoxProperties, _caseOfBoxesProperties.CaseOptimConstraintSet); viewer.CaseProperties = _caseOfBoxesProperties; viewer.Orientation = new Basics.Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P); viewer.Draw(graphics); } }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { if (ctrl == graphCtrlPallet) { // instantiate solution viewer CasePalletSolutionViewer sv = new CasePalletSolutionViewer(GetCurrentSolution()); sv.Draw(graphics); } else if (ctrl == graphCtrlCase) { // get case of boxes CaseOfBoxesProperties caseOfBoxes = _analysis.BProperties as CaseOfBoxesProperties; // draw CaseDefinitionViewer cdv = new CaseDefinitionViewer(caseOfBoxes.CaseDefinition, caseOfBoxes.InsideBoxProperties, caseOfBoxes.CaseOptimConstraintSet); cdv.CaseProperties = caseOfBoxes; cdv.Orientation = GetCurrentSolution().FirstCaseOrientation; cdv.Draw(graphics); } }
public void Draw(Graphics3DControl ctrl, Graphics3D graphics) { // ### draw pallet if (graphCtrlPallet == ctrl) { PalletProperties pp = SelectedPallet; Pallet pallet = new Pallet(pp); pallet.Draw(graphics, Transform3D.Identity); DimensionCube dc = new DimensionCube(pp.Length, pp.Width, pp.Height) { FontSize = 6.0f }; graphics.AddDimensions(dc); } // ### draw case definition else if (ctrl == graphCtrlBoxesLayout) { // ### draw case definition try { // get selected solution CaseOptimSolution solution = SelectedSolution; if (null == solution) { return; } // instantiate case definition viewer CaseDefinitionViewer cdv = new CaseDefinitionViewer(SelectedSolution.CaseDefinition, SelectedBox, BuildCaseOptimConstraintSet()); cdv.Orientation = SelectedSolution.PalletSolution.FirstCaseOrientation; cdv.Draw(graphics); } catch (Exception ex) { _log.Error(ex.ToString()); } } // ### draw associated pallet solution else if (ctrl == graphCtrlPalletLayout) { try { // get selected solution CaseOptimSolution solution = SelectedSolution; // get selected box BoxProperties boxProperties = SelectedBox; // get selected pallet PalletProperties palletProperties = SelectedPallet; if (null != solution && null != boxProperties && null != palletProperties) { Vector3D outerDim = solution.CaseDefinition.OuterDimensions(boxProperties, BuildCaseOptimConstraintSet()); BoxProperties caseProperties = new BoxProperties(null, outerDim.X, outerDim.Y, outerDim.Z); caseProperties.SetColor(Color.Chocolate); CasePalletSolutionViewer.Draw(graphics, solution.PalletSolution, caseProperties, null, palletProperties); } } catch (Exception ex) { _log.Error(ex.ToString()); } } }
private void Draw() { // ### draw case definition try { // sanity check if (pbBoxesLayout.Size.Width < 1 || pbBoxesLayout.Size.Height < 1) { return; } // instantiate graphics Graphics3DImage graphics = new Graphics3DImage(pbBoxesLayout.Size); // set camera position graphics.CameraPosition = Graphics3D.Corner_0; // set camera target graphics.Target = new Vector3D(0.0, 0.0, 0.0); // set viewport (not actually needed) graphics.SetViewport(-500.0f, -500.0f, 500.0f, 500.0f); // show images graphics.ShowTextures = true; // get selected solution CaseOptimSolution solution = SelectedSolution; if (null == solution) { return; } // instantiate case definition viewer CaseDefinitionViewer cdv = new CaseDefinitionViewer(SelectedSolution.CaseDefinition, SelectedBox, BuildCaseOptimConstraintSet()); cdv.Orientation = SelectedSolution.PalletSolution.FirstCaseOrientation; cdv.Draw(graphics); // show generated bitmap on picture box control pbBoxesLayout.Image = graphics.Bitmap; } catch (Exception ex) { _log.Error(ex.ToString()); } // ### draw associated pallet solution try { // sanity check if (pbPalletSolution.Size.Width < 1 || pbPalletSolution.Size.Height < 1) { return; } // instantiate graphics Graphics3DImage graphics = new Graphics3DImage(pbPalletSolution.Size); // set camera position graphics.CameraPosition = Graphics3D.Corner_0; // set camera target graphics.Target = new Vector3D(0.0, 0.0, 0.0); // set viewport (not actually needed) graphics.SetViewport(-500.0f, -500.0f, 500.0f, 500.0f); // show images graphics.ShowTextures = true; // get selected solution CaseOptimSolution solution = SelectedSolution; // get selected box BoxProperties boxProperties = SelectedBox; // get selected pallet PalletProperties palletProperties = SelectedPallet; if (null != solution && null != boxProperties && null != palletProperties) { Vector3D outerDim = solution.CaseDefinition.OuterDimensions(boxProperties, BuildCaseOptimConstraintSet()); BoxProperties caseProperties = new BoxProperties(null, outerDim.X, outerDim.Y, outerDim.Z); caseProperties.SetColor(Color.Chocolate); CasePalletSolutionViewer.Draw(graphics, solution.PalletSolution, caseProperties, null, palletProperties); } // show generated bitmap or picture box control pbPalletSolution.Image = graphics.Bitmap; } catch (Exception ex) { _log.Error(ex.ToString()); } }