Example #1
0
 public GetBlockAction(Robot robot, ColorCartridgeSlot target)
 {
     Robot  = robot;
     Target = target;
 }
Example #2
0
        private void InitCartridges(SizeF cartridgeSize, float topSideWidth, float leftSideHeight)
        {
            int cartridgesInRow = (int)(topSideWidth / cartridgeSize.Width);
            int cartridgesInCol = (int)(leftSideHeight / cartridgeSize.Width);

            if (cartridgesInRow == 0 && cartridgesInCol == 0)
            {
                throw new ArgumentException("Color cartridge is bigger than 3 palletes");
            }

            CartridgesSlots = new ColorCartridgeSlot[cartridgesInCol + 2, cartridgesInRow + 2];

            float spacingInRow = cartridgesInRow > 1 ? (topSideWidth - cartridgesInRow * cartridgeSize.Width) / (cartridgesInRow - 1) : 0;

            float rowLeft   = cartridgeSize.Height + PalletesSeparation;
            float topRowTop = 0;
            float botRowTop = cartridgeSize.Height + leftSideHeight + 2 * PalletesSeparation;

            for (int i = 0; i < cartridgesInRow; ++i)
            {
                float left = rowLeft + i * (cartridgeSize.Width + spacingInRow);
                CartridgesSlots[0, 1 + i] = new ColorCartridgeSlot()
                {
                    Cartridge = null,
                    Size      = cartridgeSize,
                    TopLeft   = new PointF(left, topRowTop)
                };
                CartridgesSlots[CartridgesSlots.Rows() - 1, 1 + i] = new ColorCartridgeSlot()
                {
                    Cartridge = null,
                    Size      = cartridgeSize,
                    TopLeft   = new PointF(left, botRowTop)
                };
            }

            float spacingInCol = cartridgesInCol > 1 ? (leftSideHeight - cartridgesInCol * cartridgeSize.Width) / (cartridgesInCol - 1) : 0;

            float colTop       = cartridgeSize.Height + PalletesSeparation;
            float leftColLeft  = 0;
            float rightColLeft = cartridgeSize.Height + topSideWidth + 2 * PalletesSeparation;
            SizeF turnedSize   = new SizeF(cartridgeSize.Height, cartridgeSize.Width);

            for (int i = 0; i < cartridgesInCol; ++i)
            {
                float top = colTop + i * (cartridgeSize.Width + spacingInCol);
                CartridgesSlots[1 + i, 0] = new ColorCartridgeSlot()
                {
                    Cartridge = null,
                    Size      = turnedSize,
                    TopLeft   = new PointF(leftColLeft, top)
                };
                CartridgesSlots[1 + i, CartridgesSlots.Cols() - 1] = new ColorCartridgeSlot()
                {
                    Cartridge = null,
                    Size      = turnedSize,
                    TopLeft   = new PointF(rightColLeft, top)
                };
            }

            CartridgesSlotsCount = 2 * (CartridgesSlots.Rows() - 2 + CartridgesSlots.Cols() - 2);
        }