public override void Draw(Graphics3D graphics) { // draw tray back faces if (_packProperties.Wrap.Type == PackWrapper.WType.WT_TRAY) { } // draw inner boxes if (_packProperties.Wrap.Type == PackWrapper.WType.WT_POLYETHILENE || _packProperties.Wrap.Type == PackWrapper.WType.WT_TRAY || _forceTransparency) { List <Box> boxes = InnerBoxes; boxes.Sort(new BoxComparerSimplifiedPainterAlgo(graphics.GetWorldToEyeTransformation())); foreach (Box b in boxes) { graphics.Draw(b); } } if (_packProperties.Wrap.Type != PackWrapper.WType.WT_TRAY) { // draw front faces foreach (Face f in Faces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Wrap.Color , _packProperties.Wrap.Transparent || _forceTransparency); } } else { // draw tray front faces foreach (Face f in TrayFaces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Wrap.Color , _packProperties.Wrap.Transparent); } } }
public override void Draw(Graphics3D graphics) { // draw tray back faces if (_packProperties.Wrap.Type == PackWrapper.WType.WT_TRAY) {} // draw inner boxes if (_packProperties.Wrap.Type == PackWrapper.WType.WT_POLYETHILENE || _packProperties.Wrap.Type == PackWrapper.WType.WT_TRAY || _forceTransparency) { List<Box> boxes = InnerBoxes; boxes.Sort( new BoxComparerSimplifiedPainterAlgo(graphics.GetWorldToEyeTransformation()) ); foreach (Box b in boxes) graphics.Draw(b); } if (_packProperties.Wrap.Type != PackWrapper.WType.WT_TRAY) { // draw front faces foreach (Face f in Faces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Wrap.Color , _packProperties.Wrap.Transparent || _forceTransparency); } } else { // draw tray front faces foreach (Face f in TrayFaces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Wrap.Color , _packProperties.Wrap.Transparent); } } }
public override void Draw(Graphics3D graphics) { System.Drawing.Graphics g = graphics.Graphics; var viewDir = graphics.ViewDirection; // draw tray back faces if (null != _packProperties.Tray) { foreach (Face f in TrayFaces) { graphics.Draw( f , Graphics3D.FaceDir.BACK , _packProperties.Tray.Color , false); } } // draw inner boxes if (null == _packProperties.Wrap || _packProperties.Wrap.Type == PackWrapper.WType.WT_POLYETHILENE) { var innerDrawables = InnerDrawables; innerDrawables.Sort(new DrawableComparerSimplifiedPainterAlgo(graphics.GetWorldToEyeTransformation())); foreach (var b in innerDrawables) { b.Draw(graphics); } } if (null != _packProperties.Wrap) { // draw front faces foreach (Face f in Faces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Wrap.Color , _packProperties.Wrap.Transparent); } } if (null != _packProperties.Tray) { // draw tray front faces foreach (Face f in TrayFaces) { graphics.Draw( f , Graphics3D.FaceDir.FRONT , _packProperties.Tray.Color , false); } } // draw top points line if (_packProperties.Content is RevSolidProperties) { Color colorTopPoints = (null != _packProperties.Wrap) ? _packProperties.Wrap.Color : Color.White; Pen penTopPoints = new Pen(new SolidBrush(colorTopPoints), 1.5f); var listConvexHull1 = new List <Vector3D>(); foreach (var pt in ConvexHullResult) { listConvexHull1.Add(GlobalTransformation.transform(pt)); } var tPoints = graphics.TransformPoint(listConvexHull1.ToArray()); int tPointCount = tPoints.Length; for (int i = 1; i < tPointCount; ++i) { g.DrawLine(penTopPoints, tPoints[i - 1], tPoints[i]); } g.DrawLine(penTopPoints, tPoints[tPointCount - 1], tPoints[0]); } // draw strappers Pen penBlack = new Pen(new SolidBrush(Color.Black), 1.5f); foreach (var sf in StrapperFaces) { if (sf.IsVisible(viewDir)) { // get color double cosA = Math.Abs(Vector3D.DotProduct(sf.Normal, graphics.VLight)); Color color = Color.FromArgb((int)(sf.ColorFill.R * cosA), (int)(sf.ColorFill.G * cosA), (int)(sf.ColorFill.B * cosA)); // instantiate brush Brush brushStrapper = new SolidBrush(color); // get face points Point[] pts = graphics.TransformPoint(sf.Points); // fill polygon g.FillPolygon(brushStrapper, pts); // draw path int ptCount = pts.Length; for (int j = 1; j < ptCount; ++j) { g.DrawLine(penBlack, pts[j - 1], pts[j]); } g.DrawLine(penBlack, pts[ptCount - 1], pts[0]); } } }