예제 #1
0
 public Rectangle(ICellPosition upperLeft, ICellPosition lowerRight)
 {
     //Дерьмо ниже на случай, если кто-то перепутает позиции.
     UpperLeft = new CellPosition(Math.Min(upperLeft.RowIndex, lowerRight.RowIndex),
                                  Math.Min(upperLeft.ColumnIndex, lowerRight.ColumnIndex));
     LowerRight = new CellPosition(Math.Max(upperLeft.RowIndex, lowerRight.RowIndex),
                                   Math.Max(upperLeft.ColumnIndex, lowerRight.ColumnIndex));
     Size = lowerRight.Subtract(upperLeft).Add(new ObjectSize(1, 1));
 }
예제 #2
0
 public static ICellPosition ToGlobalCoordinates(this ICellPosition relativeCoordinates, ICellPosition originCoordinates)
 {
     return(relativeCoordinates.Add(originCoordinates.Subtract(new CellPosition(1, 1))));
 }
예제 #3
0
 public static ICellPosition ToRelativeCoordinates(this ICellPosition globalCoordinates, ICellPosition newOrigin)
 {
     return(new CellPosition(1, 1).Add(globalCoordinates.Subtract(newOrigin)));
 }