Max() 공개 정적인 메소드

Returns a position with the bigger Row and the bigger column
public static Max ( Position p_Position1, Position p_Position2 ) : Position
p_Position1 Position
p_Position2 Position
리턴 Position
예제 #1
0
 /// <summary>
 /// Returns a range with the smaller Start and the bigger End. The Union of the 2 Range. If one of the range is empty then the return is the other range.
 /// </summary>
 /// <param name="p_Range1"></param>
 /// <param name="p_Range2"></param>
 /// <returns></returns>
 public static Range GetBounds(Range p_Range1, Range p_Range2)
 {
     if (p_Range1.IsEmpty())
     {
         return(p_Range2);
     }
     else if (p_Range2.IsEmpty())
     {
         return(p_Range1);
     }
     else
     {
         return(new Range(Position.Min(p_Range1.Start, p_Range2.Start),
                          Position.Max(p_Range1.End, p_Range2.End), false));
     }
 }
예제 #2
0
        public Range FindDestinationRange(GridVirtual destinationGrid, Position dropDestination)
        {
            if (dropDestination.IsEmpty())
            {
                return(Range.Empty);
            }

            Position destinationStart = new Position(dropDestination.Row + (mSourceRange.Start.Row - mStartDragPosition.Row),
                                                     dropDestination.Column + (mSourceRange.Start.Column - mStartDragPosition.Column));

            destinationStart = Position.Max(destinationStart, new Position(0, 0));

            Range destination = mSourceRange;

            destination.MoveTo(destinationStart);

            destination = destination.Intersect(destinationGrid.CompleteRange);

            return(destination);
        }
예제 #3
0
        /// <summary>
        /// Returns the intersection between the 2 Range. If one of the range is empty then the return is empty.
        /// </summary>
        /// <param name="p_Range1"></param>
        /// <param name="p_Range2"></param>
        /// <returns></returns>
        public static Range Intersect(Range p_Range1, Range p_Range2)
        {
            if (p_Range1.IsEmpty() || p_Range2.IsEmpty())
            {
                return(Range.Empty);
            }

            Position startNew = Position.Max(p_Range1.Start, p_Range2.Start);
            Position endNew   = Position.Min(p_Range1.End, p_Range2.End);

            if (startNew.Column > endNew.Column ||
                startNew.Row > endNew.Row)
            {
                return(Range.Empty);
            }
            else
            {
                return(new Range(startNew, endNew, false));
            }
        }