Rectangle class

A rectangle is a latitude-longitude viewport, represented as two diagonally opposite low and high points. The low point marks the southwest corner of the rectangle, and the high point represents the northeast corner of the rectangle. A viewport is considered a closed region, meaning it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive:

  • If low = high, the viewport consists of that single point.
  • If low.longitude > high.longitude, the longitude range is inverted (the viewport crosses the 180 degree longitude line).
  • If low.longitude = -180 degrees and high.longitude = 180 degrees, the viewport includes all longitudes.
  • If low.longitude = 180 degrees and high.longitude = -180 degrees, the longitude range is empty.
  • If low.latitude > high.latitude, the latitude range is empty.

Both low and high must be populated, and the represented box cannot be empty. An empty viewport results in an error.

Inheritance
Available extensions
Annotations
  • @JsonSerializable()
  • @CopyWith()

Constructors

Rectangle.new({required ReferencePoint low, required ReferencePoint high})
Rectangle.fromJson(Map<String, dynamic> json)
factory

Properties

copyWith → _$RectangleCWProxy

Available on Rectangle, provided by the $RectangleCopyWith extension

Returns a callable class that can be used as follows: instanceOfRectangle.copyWith(...).
no setter
hashCode int
The hash code for this object.
no setterinherited
high ReferencePoint
The high point represents the northeast corner of the rectangle.
final
low ReferencePoint
The low point marks the southwest corner of the rectangle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromJsonList(List? jsonList) List<Rectangle>?
inherited
fromJsonMap(Map<String, dynamic>? json) Rectangle?
override
fromJsonString(String? json) Rectangle?
inherited
fromJsonStringList(String? jsonStringList) List<Rectangle>?
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toFieldsMask({String? parentKey}) List<String>
inherited
toJson() Map<String, dynamic>
override
toJsonMap() Map<String, dynamic>
inherited
toJsonString() String
inherited
toString() String
This is just to suggest children to implement a named constructor to support creating objects fromJson(...) and fromJsonString(...) as easy as T.build().fromJson(...) or T.build().fromJsonString(...)
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited