(geom: &nodedb_types::geometry::Geometry)
| 426 | } |
| 427 | |
| 428 | fn count_points(geom: &nodedb_types::geometry::Geometry) -> usize { |
| 429 | use nodedb_types::geometry::Geometry; |
| 430 | match geom { |
| 431 | Geometry::Point { .. } => 1, |
| 432 | Geometry::LineString { coordinates } => coordinates.len(), |
| 433 | Geometry::Polygon { coordinates } => coordinates.iter().map(|r| r.len()).sum(), |
| 434 | Geometry::MultiPoint { coordinates } => coordinates.len(), |
| 435 | Geometry::MultiLineString { coordinates } => coordinates.iter().map(|ls| ls.len()).sum(), |
| 436 | Geometry::MultiPolygon { coordinates } => coordinates |
| 437 | .iter() |
| 438 | .flat_map(|poly| poly.iter()) |
| 439 | .map(|ring| ring.len()) |
| 440 | .sum(), |
| 441 | Geometry::GeometryCollection { geometries } => geometries.iter().map(count_points).sum(), |
| 442 | _ => 0, |
| 443 | } |
| 444 | } |
no test coverage detected