private IEnumerable<DiagramElement> DrawLine(DiagramElement fromElement, DiagramElement destinationElement, Association destinationAssociation) { Logger.Instance.WriteEntry("DrawLine for {0}", destinationAssociation.AssociatedTo.Name); Logger.Instance.WriteEntry(" From Area: {0}", fromElement.Area); Logger.Instance.WriteEntry(" To Area : {0}", destinationElement.Area); ConnectionLine route = ConnectionLine.FindBestConnectionRoute(fromElement.Area, destinationElement.Area, IsOverlappingWithOtherControls); destinationAssociation.StyleLine(route); var addedElements = new List<DiagramElement>(); Logger.Instance.WriteEntry(" Route calculated from {0:F1}, {1:F1} to {2:F1}, {3:F1}", route.From.X, route.From.Y, route.To.X, route.To.Y); Logger.Instance.WriteEntry(" From angle {0:F1} to angle {1:F1}", route.FromAngle, route.ToAngle); // Create the line diagram element and add to the diagram collection. // The line is linked to the arrow head position. var lineDiagramElement = new DiagramElement(DiagramId, route) { TopLeft = route.From }; lineDiagramElement.RegisterPositionDependency(new[] { fromElement, destinationElement }, IsOverlappingWithOtherControls); addedElements.Add(lineDiagramElement); // Create an arrow head based on the best route and add to the diagram collection. // The arrow head is linked to the associate diagram element. ArrowHead arrowHead = destinationAssociation.CreateLineHead(); var headDiagramElement = new DiagramElement(DiagramId, arrowHead) { TopLeft = route.To }; headDiagramElement.RegisterPositionDependency(new[] { lineDiagramElement }, IsOverlappingWithOtherControls); addedElements.Add(headDiagramElement); return new[] { lineDiagramElement, headDiagramElement }; }