geoarrow_array/geozero/export/scalar/
geometry_collection.rs1use geo_traits::GeometryCollectionTrait;
2use geozero::{GeomProcessor, GeozeroGeometry};
3
4use super::process_geometry;
5use crate::scalar::GeometryCollection;
6
7pub(crate) fn process_geometry_collection<P: GeomProcessor>(
8 geom: &impl GeometryCollectionTrait<T = f64>,
9 geom_idx: usize,
10 processor: &mut P,
11) -> geozero::error::Result<()> {
12 processor.geometrycollection_begin(geom.num_geometries(), geom_idx)?;
13
14 for (i, geometry) in geom.geometries().enumerate() {
15 process_geometry(&geometry, i, processor)?;
16 }
17
18 processor.geometrycollection_end(geom_idx)?;
19 Ok(())
20}
21
22impl GeozeroGeometry for GeometryCollection<'_> {
23 fn process_geom<P: GeomProcessor>(&self, processor: &mut P) -> geozero::error::Result<()>
24 where
25 Self: Sized,
26 {
27 process_geometry_collection(&self, 0, processor)
28 }
29}