Пример #1
0
 public void AddCell(int rowIndex, int columnIndex)
 {
     if (_currentRowIndex == -1)
     {
         _currentRowIndex  = rowIndex;
         _firstColumnIndex = columnIndex;
         _lastColumnIndex  = columnIndex;
     }
     else
     {
         if (_currentRowIndex == rowIndex && _lastColumnIndex + 1 == columnIndex)
         {
             _lastColumnIndex = columnIndex;
         }
         else
         {
             // cell does not fit on end of current row
             if (_currentRectangleGroup == null)
             {
                 _currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
             }
             else
             {
                 if (!_currentRectangleGroup.AcceptRow(_currentRowIndex, _firstColumnIndex, _lastColumnIndex))
                 {
                     _rectangleGroups.Add(_currentRectangleGroup);
                     _currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
                 }
             }
             _currentRowIndex  = rowIndex;
             _firstColumnIndex = columnIndex;
             _lastColumnIndex  = columnIndex;
         }
     }
 }
Пример #2
0
 public bool ContainsCell(int rowIndex, int columnIndex)
 {
     for (int i = _rectangleGroups.Count - 1; i >= 0; i--)
     {
         BlankCellRectangleGroup bcrg = (BlankCellRectangleGroup)_rectangleGroups[i];
         if (bcrg.ContainsCell(rowIndex, columnIndex))
         {
             return(true);
         }
     }
     if (_currentRectangleGroup != null && _currentRectangleGroup.ContainsCell(rowIndex, columnIndex))
     {
         return(true);
     }
     if (_currentRowIndex != -1 && _currentRowIndex == rowIndex)
     {
         if (_firstColumnIndex <= columnIndex && columnIndex <= _lastColumnIndex)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
 public void AddCell(int rowIndex, int columnIndex)
 {
     if (_currentRowIndex == -1)
     {
         _currentRowIndex = rowIndex;
         _firstColumnIndex = columnIndex;
         _lastColumnIndex = columnIndex;
     }
     else
     {
         if (_currentRowIndex == rowIndex && _lastColumnIndex + 1 == columnIndex)
         {
             _lastColumnIndex = columnIndex;
         }
         else
         {
             // cell does not fit on end of current row
             if (_currentRectangleGroup == null)
             {
                 _currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
             }
             else
             {
                 if (!_currentRectangleGroup.AcceptRow(_currentRowIndex, _firstColumnIndex, _lastColumnIndex))
                 {
                     _rectangleGroups.Add(_currentRectangleGroup);
                     _currentRectangleGroup = new BlankCellRectangleGroup(_currentRowIndex, _firstColumnIndex, _lastColumnIndex);
                 }
             }
             _currentRowIndex = rowIndex;
             _firstColumnIndex = columnIndex;
             _lastColumnIndex = columnIndex;
         }
     }
 }