public void Draw(Graphics2D graphics) { if (null == _solution || _solution.Count == 0) { return; } bool showAxis = false; // initialize Graphics2D object graphics.NumberOfViews = 1; graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth); CylinderLayer cylLayer = _solution.CylinderLayerFirst; if (cylLayer != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (Vector3D pos in cylLayer) { graphics.DrawCylinder( new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P)) ); } // draw axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } }
/// <summary> /// Draw a 2D representation of first (and second, if solution does not have homogeneous layers) layer(s) /// The images produced are used in /// </summary> public void Draw(Graphics2D graphics) { if (null == _solution || _solution.Count == 0) { return; } bool showAxis = false; if (_solution.HasHomogeneousLayers) { // initialize Graphics2D object graphics.NumberOfViews = 1; graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth); BoxLayer blayer = _solution.CaseLayerFirst; if (blayer != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer) { graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); } // draw axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } } else { graphics.NumberOfViews = 2; graphics.SetViewport(0.0f, 0.0f, (float)_analysis.PalletProperties.Length, (float)_analysis.PalletProperties.Width); // get first box layer if (_solution.CaseLayersCount < 1) { return; } BoxLayer blayer0 = _solution.CaseLayerFirst; if (blayer0 != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer0) { graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); } // show axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } // get second box layer if (_solution.CaseLayersCount < 2) { return; } BoxLayer blayer1 = _solution.CaseLayerSecond; if (null == blayer1 && _solution.Count > 2) { blayer1 = _solution[2] as BoxLayer; } if (blayer1 != null) { graphics.SetCurrentView(1); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer1) { graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); } // show axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } } }
public void Draw(Graphics2D graphics) { if (null == _solution || _solution.Count == 0) return; bool showAxis = false; // initialize Graphics2D object graphics.NumberOfViews = 1; graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth); CylinderLayer cylLayer = _solution.CylinderLayerFirst; if (cylLayer != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (Vector3D pos in cylLayer) graphics.DrawCylinder( new Cylinder(pickId++, _analysis.CylinderProperties, new CylPosition(pos, HalfAxis.HAxis.AXIS_Z_P)) ); // draw axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } }
/// <summary> /// Draw a 2D representation of first (and second, if solution does not have homogeneous layers) layer(s) /// The images produced are used in /// </summary> public void Draw(Graphics2D graphics) { if (null == _solution || _solution.Count == 0) return; bool showAxis = false; if (_solution.HasHomogeneousLayers) { // initialize Graphics2D object graphics.NumberOfViews = 1; graphics.SetViewport(0.0f, 0.0f, (float)_solution.PalletLength, (float)_solution.PalletWidth); BoxLayer blayer = _solution.CaseLayerFirst; if (blayer != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer) graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); // draw axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } } else { graphics.NumberOfViews = 2; graphics.SetViewport(0.0f, 0.0f, (float)_analysis.PalletProperties.Length, (float)_analysis.PalletProperties.Width); // get first box layer if (_solution.CaseLayersCount < 1) return; BoxLayer blayer0 = _solution.CaseLayerFirst; if (blayer0 != null) { graphics.SetCurrentView(0); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer0) graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); // show axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } // get second box layer if (_solution.CaseLayersCount < 2) return; BoxLayer blayer1 = _solution.CaseLayerSecond; if (null == blayer1 && _solution.Count > 2) blayer1 = _solution[2] as BoxLayer; if (blayer1 != null) { graphics.SetCurrentView(1); graphics.DrawRectangle(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, _analysis.PalletProperties.Width), Color.Black); uint pickId = 0; foreach (BoxPosition bPosition in blayer1) graphics.DrawBox(new Box(pickId++, _analysis.BProperties, bPosition)); // show axes if (showAxis) { // draw axis X graphics.DrawLine(Vector2D.Zero, new Vector2D(_analysis.PalletProperties.Length, 0.0), Color.Red); // draw axis Y graphics.DrawLine(Vector2D.Zero, new Vector2D(0.0, _analysis.PalletProperties.Width), Color.Green); } } } }