protected override void SetTrack(PointF ModelOrigin, Color backColor) { PointF canvasOrigin = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF[] points = new PointF[this.points.Length]; for (int i = 0; i < this.points.Length; i++) { points[i] = new PointF(this.points[i].X + canvasOrigin.X, this.points[i].Y + canvasOrigin.Y); } this.polyLine = new PolyLineDraw(points, Properties.Settings.Default.TrackWidth, backColor, true); }
public bool IsHitting(PointF mouseLocationInModel, DirectiveDraw entity) { PolyLineDraw polyLine = entity as PolyLineDraw; for (int i = 0; i < polyLine.points.Length - 1; i++) { if (Geometry.PointInLine(mouseLocationInModel, polyLine.points[i], polyLine.points[i + 1], polyLine.lineWidth)) { return(true); } } return(false); }
public bool IsContain(RectangleF mouseRect, DirectiveDraw entity) { PolyLineDraw polyLine = entity as PolyLineDraw; for (int i = 0; i < polyLine.points.Length - 1; i++) { if (!Geometry.RectContainLine(mouseRect, polyLine.points[i], polyLine.points[i + 1])) { return(false); } } return(true); }