public void UpdateFractions() { NetworkElement networkElement = OnElement?.SourceElement; if (networkElement != null) { fractionFrom = sourceObject.FromPos / networkElement.Length; fractionTo = sourceObject.ToPos / networkElement.Length; fractionsValid = true; } }
ViewNetworkElement FindMatchingViewElement(NetworkElement element) { ViewNetworkElement found = null; foreach (ViewNetworkElement viewElement in trackElements.Values) { if (viewElement.ConnectedNetworkObject == element) { found = viewElement; break; } } return(found); }
public ViewNetworkElement(NetworkElement element) { sourceObject = element; ID = element.ID + "-ViewObject"; NameInView = element.ID; logicalLine = new Line2d(element.LogicalStartPoint, element.LogicalEndPoint); if (element.From != null) { Point fromPoint = element.From.LogicalCenter; if (fromPoint != Point.Empty && !fromPoint.Equals(element.LogicalStartPoint)) { fromConnector = new Line2d(element.LogicalStartPoint, fromPoint); } } if (element.To != null) { Point toPoint = element.To.LogicalCenter; if (toPoint != Point.Empty && !toPoint.Equals(element.LogicalStartPoint)) { toConnector = new Line2d(element.LogicalEndPoint, toPoint); } } }