contains method

bool contains(
  1. RectangleGeographicArea area
)

Tests whether this rectangle completely contains another rectangle.

Checks if the specified rectangle lies entirely within the bounds of this rectangle. The contained rectangle's bounds must be completely inside or exactly match this rectangle's bounds for the test to return true.

Parameters

Returns

  • true if this rectangle completely contains the other rectangle, false otherwise.

Implementation

bool contains(final RectangleGeographicArea area) {
  return bottomRight.longitude >= area.bottomRight.longitude &&
      topLeft.longitude <= area.topLeft.longitude &&
      topLeft.latitude >= area.topLeft.latitude &&
      bottomRight.latitude <= area.bottomRight.latitude;
}