Polygon.withFactory constructor
Polygon.withFactory(
- LinearRing? shell,
- List<
LinearRing> ? holes, - GeometryFactory factory
Constructs a Polygon
with the given exterior boundary and
interior boundaries.
@param shell the outer boundary of the new Polygon
,
or null
or an empty LinearRing
if the empty
geometry is to be created.
@param holes the inner boundaries of the new Polygon
, or null
or empty LinearRing
s if the empty
geometry is to be created.
Implementation
Polygon.withFactory(
LinearRing? shell, List<LinearRing>? holes, GeometryFactory factory)
: super(factory) {
if (shell == null) {
shell = getFactory().createLinearRingEmpty();
}
if (holes == null) {
holes = <LinearRing>[];
}
if (Geometry.hasNullElements(holes)) {
throw new ArgumentError("holes must not contain null elements");
}
if (shell.isEmpty() && Geometry.hasNonEmptyElements(holes)) {
throw new ArgumentError("shell is empty but holes are not");
}
this.shell = shell;
this.holes = holes;
}