PolygonGeographicArea class Core
Polygonal geographic area defined by a sequence of coordinate vertices.
Represents complex geographic regions with irregular boundaries using a series of connected coordinate points. This implementation provides the highest precision for representing detailed geographic boundaries such as administrative regions, natural features, or custom area definitions.
The polygon is defined by an ordered list of coordinates that form the boundary vertices. The polygon is automatically closed by connecting the last vertex back to the first vertex.
Polygon Requirements
For correct operation, polygons should have:
- At least 3 coordinate vertices to form a valid shape
- No self-intersecting edges that cross each other
- No overlapping segments that trace the same path
Use Cases
Polygonal areas are ideal for:
- Administrative boundaries (countries, states, cities)
- Natural geographic features (lakes, forests, parks)
- Custom business districts or service areas
- Precise geofencing with complex shapes
See also:
- GeographicArea: Abstract base class for all geographic areas.
- RectangleGeographicArea: Simple rectangular areas.
- CircleGeographicArea: Circular areas with center and radius.
- Implemented types
Constructors
-
PolygonGeographicArea({List<
Coordinates> coordinates = const <Coordinates>[]}) - Creates a polygonal geographic area from a list of coordinate vertices.
-
PolygonGeographicArea.fromJson(Map<
String, dynamic> json) -
Deserializes a JSON-compatible map to create an instance.
factory
Properties
- 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
-
coordinates
↔ List<
Coordinates> -
The ordered list of coordinates defining the polygon boundary.
getter/setter pair
- 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
- type → GeographicAreaType
-
Gets the specific type identifier for this geographic area implementation.
no setteroverride
Methods
-
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
-
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
-
toJson(
) → Map< String, dynamic> -
Serializes this instance to a JSON-compatible map.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
covariant PolygonGeographicArea other) → bool -
The equality operator.
override