示例#1
0
        public void UpdateFractions()
        {
            NetworkElement networkElement = OnElement?.SourceElement;

            if (networkElement != null)
            {
                fractionFrom   = sourceObject.FromPos / networkElement.Length;
                fractionTo     = sourceObject.ToPos / networkElement.Length;
                fractionsValid = true;
            }
        }
示例#2
0
        ViewNetworkElement FindMatchingViewElement(NetworkElement element)
        {
            ViewNetworkElement found = null;

            foreach (ViewNetworkElement viewElement in trackElements.Values)
            {
                if (viewElement.ConnectedNetworkObject == element)
                {
                    found = viewElement;
                    break;
                }
            }
            return(found);
        }
示例#3
0
        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);
                }
            }
        }