public LinkStroke(Point pointFrom, string formId, int anchor, LinkTypes linkType, StylusPointCollection stylusPointCollection) : base(stylusPointCollection) { guid = Guid.NewGuid(); name = "Link"; this.linkType = (int)linkType; from = new AnchorPoint(formId, anchor, ""); to = new AnchorPoint(); to.SetDefaults(); strokeType = (int)StrokeTypes.LINK; style = new LinkStyle(); style.SetDefaults(); path = new List <Coordinates>(); path.Add(new Coordinates(pointFrom)); }
public LinkStroke(StylusPointCollection pts) : base(pts) { guid = Guid.NewGuid(); name = "Link"; from = new AnchorPoint(); from.SetDefaults(); to = new AnchorPoint(); to.SetDefaults(); strokeType = (int)StrokeTypes.LINK; linkType = (int)LinkTypes.TWO_WAY_ASSOCIATION; style = new LinkStyle(); style.SetDefaults(); path = new List <Coordinates>(); DrawingAttributes.Width = getThickness(); DrawingAttributes.Height = getThickness(); StylusPoint firstPoint = pts[0]; StylusPoint lastPoint = pts[pts.Count - 1]; // garder uniquement le premier point while (StylusPoints.Count > 1) { StylusPoints.RemoveAt(1); } path.Add(new Coordinates(StylusPoints[0].ToPoint())); if (!lastPoint.Equals(firstPoint)) { StylusPoints.Add(new StylusPoint(lastPoint.X, lastPoint.Y)); path.Add(new Coordinates(lastPoint.X, lastPoint.Y)); } else { StylusPoints.Add(new StylusPoint(firstPoint.X + 100, lastPoint.Y + 100)); path.Add(new Coordinates(StylusPoints[1].X, StylusPoints[1].Y)); } addStylusPointsToLink(); }