makeUnion method
Creates the union of this rectangle with another rectangle.
Computes a new rectangle that encompasses both this rectangle and the specified rectangle. The resulting rectangle will be the smallest axis-aligned rectangle that contains both input rectangles completely.
Parameters
area: The RectangleGeographicArea to unite with this rectangle.
Returns
- A new RectangleGeographicArea representing the union of both rectangles.
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),
),
);
}