Exemplo n.º 1
0
        private static bool MakeNoScopeIO(List <ScopedDirIO> inputIO, List <ScopedDirIO> outputIO, ScalarIO io, int fixedX, ref int inputYOffset, ref int outputYOffset, int scopeDepth, bool ignoreDisconnectedIO)
        {
            if (ignoreDisconnectedIO && !io.IsConnectedToAnything())
            {
                return(false);
            }

            scopeDepth = Math.Max(0, scopeDepth);
            if (io is Input)
            {
                int        scopeOffset = (scopeDepth + 1) * ScopeWidth;
                Point      inputPos    = new Point(0, inputYOffset);
                DirectedIO dirIO       = new DirectedIO(io, inputPos, MoveDirs.Right);
                inputIO.Add(new ScopedDirIO(dirIO, scopeOffset));

                inputYOffset += MinSpaceBetweenIO;
                return(true);
            }
            else if (io is Output)
            {
                int        scopeOffset = -(scopeDepth + 1) * ScopeWidth;
                Point      outputPos   = new Point(fixedX, outputYOffset);
                DirectedIO dirIO       = new DirectedIO(io, outputPos, MoveDirs.Right);
                outputIO.Add(new ScopedDirIO(dirIO, scopeOffset));

                outputYOffset += MinSpaceBetweenIO;
                return(true);
            }
            else
            {
                throw new Exception($"Unknown scalar io type. Type: {io}");
            }
        }
Exemplo n.º 2
0
        public void SetX(int newX)
        {
            Point currPos = DirIO.Position;
            Point newPos  = new Point(newX, DirIO.Position.Y);
            Point offset  = newPos - currPos;

            DirIO = DirIO.WithOffsetPosition(offset);
        }
Exemplo n.º 3
0
        public void SetY(int newY)
        {
            Point currPos = DirIO.Position;
            Point newPos  = new Point(DirIO.Position.X, newY);
            Point offset  = newPos - currPos;

            DirIO = DirIO.WithOffsetPosition(offset);
        }
Exemplo n.º 4
0
 public ScopedDirIO(DirectedIO dirIO, int scopeXOffset)
 {
     this.DirIO        = dirIO;
     this.ScopeXOffset = scopeXOffset;
 }