/// <summary>Creates a path using a ractangle for bounds.</summary> public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath path = new GraphicsPath(); for (int i = 0; i < points.Count; i++) { ShapePoint p1 = points[i]; ShapePoint p2 = i < points.Count - 1 ? points[i + 1] : points[0]; Point rp1 = p1.GetPoint(dimension, bounds); Point rp2 = p2.GetPoint(dimension, bounds); if (p1.Bezier) { path.AddBezier(rp1, p1.ControlPoint1.GetPoint(dimension, bounds), p1.ControlPoint2.GetPoint(dimension, bounds), rp2); } else { path.AddLine(rp1, rp2); } } path.CloseAllFigures(); return(path); }
public bool IsVisible(ShapePoint nextPoint, Point pt, int width) { if (this.bezier) { return(this.IsCurveVisible(this.GetCurve(nextPoint), pt, (double)width)); } return(this.IsLineVisible(this.GetPoint(), nextPoint.GetPoint(), pt, (double)width)); }
/// <summary> /// /// </summary> /// <param name="nextPoint"></param> /// <param name="pt"></param> /// <param name="width"></param> /// <returns></returns> public bool IsVisible(ShapePoint nextPoint, Point pt, int width) { if (bezier) { return(IsCurveVisible(GetCurve(nextPoint), pt, width)); } else { return(IsLineVisible(GetPoint(), nextPoint.GetPoint(), pt, width)); } }
public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath graphicsPath = new GraphicsPath(); for (int index = 0; index < this.points.Count; ++index) { ShapePoint point1 = this.points[index]; ShapePoint shapePoint = index < this.points.Count - 1 ? this.points[index + 1] : this.points[0]; Point point2 = point1.GetPoint(this.dimension, bounds); Point point3 = shapePoint.GetPoint(this.dimension, bounds); if (point1.Bezier) { graphicsPath.AddBezier(point2, point1.ControlPoint1.GetPoint(this.dimension, bounds), point1.ControlPoint2.GetPoint(this.dimension, bounds), point3); } else { graphicsPath.AddLine(point2, point3); } } graphicsPath.CloseAllFigures(); return(graphicsPath); }