makeUnion method

RectangleGeographicArea makeUnion(
  1. RectangleGeographicArea area
)

Creates a new RectangleGeographicArea as the union of this rectangle and another rectangle.

Parameters

Returns

Implementation

RectangleGeographicArea makeUnion(final RectangleGeographicArea area) {
  return RectangleGeographicArea(
    topLeft: Coordinates(
      longitude: min(topLeft.longitude, area.topLeft.longitude),
      latitude: max(topLeft.latitude, area.topLeft.latitude),
    ),
    bottomRight: Coordinates(
      longitude: max(bottomRight.longitude, area.bottomRight.longitude),
      latitude: min(bottomRight.latitude, area.bottomRight.latitude),
    ),
  );
}