buildMap<T extends Geometry> static method
Builds a geometry map from the content provided by geometries
.
Only geometry objects of T
are built, any other geometries are ignored.
The content provided by GeometryContent should provide also the name
attribute for each geometry object. When name
is not available, then
an index as String is used a key.
An optional expected count
, when given, specifies the number of geometry
objects in the content. Note that when given the count MUST be exact.
Implementation
static Map<String, T> buildMap<T extends Geometry>(
WriteGeometries geometries, {
int? count,
}) {
final map = <String, T>{};
var index = 0;
final builder =
GeometryBuilder<T, Geometry>._((T geometry, {String? name}) {
map[name ?? index.toString()] = geometry;
index++;
});
geometries.call(builder);
return map;
}