示例#1
0
        public bool Init2()
        {
            Coordinate coordinate = new Coordinate();


            double dx, dy;

            coordinate = SnapLeftTopcoordinate;
            dy         = (SnapRightBottomcoordinate.Y - SnapLeftTopcoordinate.Y) / (2 * RowCount - 3);
            dx         = (SnapRightBottomcoordinate.X - SnapLeftTopcoordinate.X) / (ColCount - 1);
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    TrayCell trayCell = new TrayCell();
                    trayCells.Add(trayCell);
                    int K = (4 * (j / 2) + j % 2);
                    trayCells[i * RowCount + j].Snapcoordinate.Y = SnapLeftTopcoordinate.Y + (4 * (j / 2) + j % 2) * dy;
                    trayCells[i * RowCount + j].Snapcoordinate.X = SnapLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Snapcoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Snapcoordinate.Z = coordinate.Z;
                    //trayCells[i * ColCount + j].Snapcoordinate = coordinate;
                }
            }

            coordinate = PickLeftTopcoordinate;
            dy         = (PickRightBottomcoordinate.Y - PickLeftTopcoordinate.Y) / (2 * RowCount - 3);
            dx         = (PickRightBottomcoordinate.X - PickLeftTopcoordinate.X) / (ColCount - 1);
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    int K = (4 * (j / 2) + j % 2);
                    trayCells[i * RowCount + j].Pickcoordinate.Y = PickLeftTopcoordinate.Y + K * dy;
                    trayCells[i * RowCount + j].Pickcoordinate.X = PickLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Pickcoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Pickcoordinate.Z = coordinate.Z;
                    //trayCells[i * ColCount + j].Pickcoordinate = coordinate;
                }
            }

            coordinate = PlaceLeftTopcoordinate;
            dy         = (PlaceRightBottomcoordinate.Y - PlaceLeftTopcoordinate.Y) / (2 * RowCount - 3);
            dx         = (PlaceRightBottomcoordinate.X - PlaceLeftTopcoordinate.X) / (ColCount - 1);
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    int K = (4 * (j / 2) + j % 2);
                    trayCells[i * RowCount + j].Placecoordinate.Y = PlaceLeftTopcoordinate.Y + K * dy;
                    trayCells[i * RowCount + j].Placecoordinate.X = PlaceLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Placecoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Placecoordinate.Z = coordinate.Z;
                }
            }

            return(true);
        }
示例#2
0
        public bool Init()
        {
            Coordinate coordinate = new Coordinate();

            trayCells.Clear();
            double dx, dy;

            coordinate = SnapLeftTopcoordinate;
            dy         = RowCount > 1 ? (SnapRightBottomcoordinate.Y - SnapLeftTopcoordinate.Y) / (RowCount - 1) : 0;
            dx         = ColCount > 1 ? (SnapRightBottomcoordinate.X - SnapLeftTopcoordinate.X) / (ColCount - 1) : 0;
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    TrayCell trayCell = new TrayCell();
                    trayCells.Add(trayCell);
                    trayCells[i * RowCount + j].Snapcoordinate.Y = SnapLeftTopcoordinate.Y + j * dy;
                    trayCells[i * RowCount + j].Snapcoordinate.X = SnapLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Snapcoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Snapcoordinate.Z = coordinate.Z;
                    //trayCells[i * ColCount + j].Snapcoordinate = coordinate;
                }
            }

            coordinate = PickLeftTopcoordinate;
            dy         = RowCount > 1 ? (PickRightBottomcoordinate.Y - PickLeftTopcoordinate.Y) / (RowCount - 1) : 0;
            dx         = ColCount > 1 ? (PickRightBottomcoordinate.X - PickLeftTopcoordinate.X) / (ColCount - 1) : 0;
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    trayCells[i * RowCount + j].Pickcoordinate.Y = PickLeftTopcoordinate.Y + j * dy;
                    trayCells[i * RowCount + j].Pickcoordinate.X = PickLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Pickcoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Pickcoordinate.Z = coordinate.Z;
                    //trayCells[i * ColCount + j].Pickcoordinate = coordinate;
                }
            }

            coordinate = PlaceLeftTopcoordinate;
            dy         = RowCount > 1 ? (PlaceRightBottomcoordinate.Y - PlaceLeftTopcoordinate.Y) / (RowCount - 1) : 0;
            dx         = ColCount > 1 ? (PlaceRightBottomcoordinate.X - PlaceLeftTopcoordinate.X) / (ColCount - 1) : 0;
            for (int i = 0; i < ColCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    trayCells[i * RowCount + j].Placecoordinate.Y = PlaceLeftTopcoordinate.Y + j * dy;
                    trayCells[i * RowCount + j].Placecoordinate.X = PlaceLeftTopcoordinate.X + i * dx;
                    trayCells[i * RowCount + j].Placecoordinate.U = coordinate.U;
                    trayCells[i * RowCount + j].Placecoordinate.Z = coordinate.Z;
                }
            }

            return(true);
        }