Esempio n. 1
0
        public void attachNode(BaseNode newNode)
        {
            if (this is TerminalNode && newNode is TerminalNode || this is HolderNode && newNode is HolderNode)
            {
                if (newNode.connectedShape() == null)
                {
                    ;
                }
                //do nothing
                if (this.connectedShape() == null)
                {
                    ;
                }
                //donothing
                this.OutConnector.EndNode = newNode;
                newNode.NodeLocation      = this.NodeLocation;
                newNode.shiftDown(0);
                return;
            }

            BaseNode oldOutNode = this.OutConnector.EndNode;

            this.OutConnector.EndNode = newNode;

            float x = this.NodeLocation.X;
            float y = oldOutNode.NodeLocation.Y;

            if (this.NodeLocation.X != oldOutNode.NodeLocation.X)
            {
                if (this.ParentNode is IfElseNode && this == (this.parentNode as IfElseNode).MiddleNode)
                {
                    x = this.parentNode.NodeLocation.X;
                }
                else if (this is HolderNode)
                {
                    x = oldOutNode.NodeLocation.X;
                }
                else if (oldOutNode is HolderNode)
                {
                    x = this.NodeLocation.X;
                }
            }

            newNode.OutConnector.EndNode = oldOutNode;
            oldOutNode.shiftDown(0);
            newNode.NodeLocation = new PointF(x, y);
            controller.balanceNodes(newNode);
        }
Esempio n. 2
0
        public void attachNode(BaseNode newNode)
        {
            if (this is TerminalNode && newNode is TerminalNode ||
                this is HolderNode && newNode is HolderNode)
            {
                if (newNode.connectedShape() == null)
                {
                    //do nothing
                }
                if (this.connectedShape() == null)
                {
                    //donothing
                }
                OutConnector.EndNode = newNode;
                newNode.NodeLocation = this.NodeLocation;
                newNode.shiftDown(0);
                return;
            }

            BaseNode oldOutNode = OutConnector.EndNode;

            OutConnector.EndNode = newNode;
            //newNode.OutConnector.EndNode = oldOutNode;
            float x = this.NodeLocation.X;
            float y = oldOutNode.NodeLocation.Y;

            //if the holdernode and nodes in the same track have different x choose nodes x
            if (this.NodeLocation.X != oldOutNode.NodeLocation.X)
            {
                if (this.ParentNode is IfElseNode &&
                    this == (this.parentNode as IfElseNode).MiddleNode)
                {
                    x = this.parentNode.NodeLocation.X;
                }
                else if (this is HolderNode)
                {
                    x = oldOutNode.NodeLocation.X;
                }
                else if (oldOutNode is HolderNode)
                {
                    x = this.NodeLocation.X;
                }
            }
            newNode.OutConnector.EndNode = oldOutNode;
            oldOutNode.shiftDown(0);
            newNode.NodeLocation = new PointF(x, y);
            controller.balanceNodes(newNode);
        }