private bool ScanRowForOverlap(int maxColumns, ReservationGrid reservationGrid, LayoutInfo layoutInfo, int stopCol, int rowOffset) { for(int i = layoutInfo.ColumnStart; i < stopCol; i++) { if(reservationGrid.IsReserved(i, rowOffset)) { // If we hit reserved space, advance startCol past it. If we hit the end of the row, // just stop. AdvanceUntilFits will move to the next row and call us again. for(layoutInfo.ColumnStart = i + 1; layoutInfo.ColumnStart < maxColumns && reservationGrid.IsReserved(layoutInfo.ColumnStart, rowOffset); layoutInfo.ColumnStart++); return true; } } return false; }
/// <devdoc> /// IsOverlappingWithReservationGrid: part of xAssignRowsAndColumns. /// check to see if the absolutely positioned layoutInfo fits in the reservation grid /// </devdoc> private bool IsOverlappingWithReservationGrid(LayoutInfo fixedLayoutInfo, ReservationGrid reservationGrid, int currentRow) { //since we shall not put anything above our current row, this means that the fixedLayoutInfo overlaps with something already placed on the table if (fixedLayoutInfo.RowPosition < currentRow) { return true; } for (int rowOffset = fixedLayoutInfo.RowPosition - currentRow; rowOffset < fixedLayoutInfo.RowPosition - currentRow + fixedLayoutInfo.RowSpan; rowOffset++) { for (int colOffset = fixedLayoutInfo.ColumnPosition; colOffset < fixedLayoutInfo.ColumnPosition + fixedLayoutInfo.ColumnSpan; colOffset++) { if (reservationGrid.IsReserved(colOffset, rowOffset)) { return true; } } } return false; }