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); } } }
private void DrawArrow(int[] arrow, Graphics3D graphics) { Vector3D pt0 = _pts[arrow[0]]; Vector3D pt0_ = pt0 + (pt0 - _pts[arrow[2]]) * offsetPerc; Vector3D pt00_ = pt0 + (pt0 - _pts[arrow[2]]) * offsetPerc * 1.1; Vector3D pt1 = _pts[arrow[1]]; Vector3D pt1_ = pt1 + (pt1 - _pts[arrow[3]]) * offsetPerc; Vector3D pt11_ = pt1 + (pt1 - _pts[arrow[3]]) * offsetPerc * 1.1; if ((pt1 - pt0).GetLengthSquared() < 1.0E-03) { return; } string text = string.Format("{0:0.0}", (pt1 - pt0).GetLength()); graphics.Draw(text, 0.5 * (pt1_ + pt0_), _color, graphics.FontSize); graphics.Draw(new Segment(pt0_, pt0_ + (pt1 - pt0) * (2.0 / 5.0), _color)); graphics.Draw(new Segment(pt0_ + (pt1 - pt0) * (3.0 / 5.0), pt1_, _color)); graphics.Draw(new Segment(pt0, pt00_, _color)); graphics.Draw(new Segment(pt1, pt11_, _color)); }
public void Draw(Graphics3D g) { if (null == Root) { return; } List <Face> faces = new List <Face>(); Draw(Root, g.CameraPosition, ref faces); foreach (Face f in faces) { g.Draw(f, Graphics3D.FaceDir.FRONT); } }
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]); } } }
public override void Draw(Graphics3D graphics) { graphics.Draw(Face, Graphics3D.FaceDir.BACK); }
private void DrawArrow(int[] arrow, Graphics3D graphics) { Vector3D pt0 = _pts[arrow[0]]; Vector3D pt0_ = pt0 + (pt0 - _pts[arrow[2]]) * offsetPerc; Vector3D pt00_ = pt0 + (pt0 - _pts[arrow[2]]) * offsetPerc * 1.1; Vector3D pt1 = _pts[arrow[1]]; Vector3D pt1_ = pt1 + (pt1 - _pts[arrow[3]]) * offsetPerc; Vector3D pt11_ = pt1 + (pt1 - _pts[arrow[3]]) * offsetPerc * 1.1; if ((pt1 - pt0).GetLengthSquared() < 1.0E-03) return; string text = string.Format("{0:0.0}", (pt1-pt0).GetLength()); graphics.Draw(text, 0.5 * (pt1_ + pt0_), _color, _fontSize); graphics.Draw(new Segment(pt0_, pt0_ + (pt1 - pt0) * (2.0 / 5.0), _color)); graphics.Draw(new Segment(pt0_ + (pt1 - pt0) * (3.0 / 5.0), pt1_, _color)); graphics.Draw(new Segment(pt0, pt00_, _color)); graphics.Draw(new Segment(pt1, pt11_, _color)); }