RectangleGeographicArea class Geographic

Rectangular geographic area aligned with latitude and longitude lines.

Represents a geographic rectangle defined by its top-left (northwest) and bottom-right (southeast) corner coordinates. The rectangle's sides are parallel to parallels and meridians, making it suitable for bounding boxes, search areas, and map viewport definitions.

For a valid rectangle, the top-left coordinate must have:

  • latitude greater than bottom-right latitude (north is "up")
  • longitude less than bottom-right longitude (west is "left")

This class provides operations for rectangle intersection, union, containment testing, and various construction methods from bounds or center points.

A valid RectangleGeographicArea requires:

  • topLeft.latitude > bottomRight.latitude
  • topLeft.longitude < bottomRight.longitude

The constructor does not enforce these constraints, so callers must ensure proper coordinate ordering.

See also:

Implemented types

Constructors

RectangleGeographicArea({required Coordinates topLeft, required Coordinates bottomRight})
Creates a rectangular geographic area from corner coordinates.

Properties

bottomRight ↔ Coordinates
The southeast corner coordinate of the rectangle.
getter/setter pair
boundingBox → RectangleGeographicArea
Gets the smallest rectangle that completely encloses this geographic area.
no setteroverride
centerPoint → Coordinates
Gets the representative center point of this geographic area.
no setteroverride
copy → RectangleGeographicArea
Creates a deep copy of this rectangle with identical coordinates.
no setter
hashCode → int
The hash code for this object.
no setteroverride
isDefault → bool
Indicates whether this geographic area is in a default or empty state.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
topLeft ↔ Coordinates
The northwest corner coordinate of the rectangle.
getter/setter pair
type → GeographicAreaType
Gets the specific type identifier for this geographic area implementation.
no setteroverride

Methods

contains(RectangleGeographicArea area) → bool
Tests whether this rectangle completely contains another rectangle.
containsCoordinates(Coordinates point) → bool
Tests whether a coordinate point lies within this geographic area.
override
convert(GeographicAreaType toType) → GeographicArea?
Attempts to convert this geographic area to a different type.
override
intersects(RectangleGeographicArea area) → bool
Tests whether this rectangle intersects with another rectangle.
makeIntersection(RectangleGeographicArea area) → RectangleGeographicArea
Creates the intersection of this rectangle with another rectangle.
makeUnion(RectangleGeographicArea area) → RectangleGeographicArea
Creates the union of this rectangle with another rectangle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets this geographic area to its default empty state.
override
setFromBounds({required double minLat, required double maxLat, required double minLon, required double maxLon}) → void
Sets rectangle coordinates using minimum and maximum latitude/longitude bounds.
setFromCenterAndRadii({required Coordinates coords, required double horizRadius, required double vertRadius}) → void
Sets rectangle coordinates using a center point and horizontal/vertical radii.
toJson() → Map<String, dynamic>
Serializes this instance to a JSON-compatible map.
toString() → String
A string representation of this object.
override

Operators

operator ==(covariant RectangleGeographicArea other) → bool
The equality operator.
override