Esempio n. 1
0
        public override void DisconnectOutput()
        {
            OutputConnection output = toOutputLine.Output;

            Connector other = output.GetNextConnector();

            if (other == null)
            {
                return;
            }

            //other.StartPoint.RemoveConnection();
            output.RemoveConnection(this);
        }
        public ArithmeticLogicUnit(int x, int y) : base(x, y)
        {
            Size size   = GetSize();
            int  width  = size.Width;
            int  height = size.Height;

            allVertices    = new Point[8];
            allVertices[0] = new Point(x, y);

            int sixthWidth = width / 6;

            x += sixthWidth;
            y -= sixthWidth;
            allVertices[1] = new Point(x, y);

            x            += sixthWidth;
            AltInputPoint = new Point(x, y);

            x += sixthWidth;
            allVertices[2] = new Point(x, y);

            x -= sixthWidth;
            y += height;
            allVertices[3] = new Point(x, y);

            int thirdWidth = width / 3;

            x     -= thirdWidth;
            Output = new OutputConnection(new Point(x, y));

            x -= thirdWidth;
            allVertices[4] = new Point(x, y);

            x -= sixthWidth;
            y -= height;
            allVertices[5] = new Point(x, y);

            x         += sixthWidth;
            InputPoint = new Point(x, y);

            x += sixthWidth;
            allVertices[6] = new Point(x, y);

            x += sixthWidth;
            y += sixthWidth;
            allVertices[7] = new Point(x, y);
        }
Esempio n. 3
0
        //public override void ConnectInputTo(Connector other)
        //{
        //    if (other == null)
        //    {
        //        return;
        //    }

        //    OutputConnection otherOutput = other.Output;
        //    Point contactPoint = otherOutput.Center;

        //    OutputConnection input = fromInputLine.StartPoint;
        //    input.AddConnection(contactPoint, other);
        //    otherOutput.AddConnection(input.Branches);
        //}

        //public override void DisconnectInput()
        //{
        //    OutputConnection input = fromInputLine.StartPoint;

        //    Connector other = input.Branches;
        //    if (other == null)
        //    {
        //        return;
        //    }

        //    other.Output.RemoveConnection();
        //    input.RemoveConnection();
        //}

        public override void ConnectTo(Connector other)
        {
            if (other == null)
            {
                return;
            }

            //OutputConnection otherInput = other.StartPoint;
            //Point contactPoint = Output.Center;

            OutputConnection output = toOutputLine.Output;

            output.AddConnection(other);
            //otherInput.AddConnection(contactPoint, toOutputLine);

            buffer.Sink = other;
        }