-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
GeometryCollection.is_empty() defaults to using the geo-types implementation over the geo implementation.
This geo-types impl checks only for empty array and not array of empty geometries. geo impl checks for array of empty geometries.
It's a sneaky edge case which was only detected because clippy yelled at me for not using HasDimensions in a blanket macro 🙃
It looks feasible to implement is_empty on all geo-types shapes (following the geo impl)
This would only change the result of GeometryCollection.is_empty() for GeometryCollections which hold only empty Geometries
#[test]
fn geometry_collection_empty() {
let empty_linestring = LineString::empty();
let arr_of_empty = GeometryCollection::<f64>::new_from(vec![empty_linestring.into()]);
let empty_arr = GeometryCollection::<f64>::new_from(vec![]);
// equal
assert_eq!(
arr_of_empty.dimensions(),
empty_arr.dimensions(),
);
// equal
assert_eq!(
HasDimensions::is_empty(&empty_arr),
empty_arr.is_empty()
);
// fails
assert_eq!(
HasDimensions::is_empty(&arr_of_empty),
arr_of_empty.is_empty(),
);
}Metadata
Metadata
Assignees
Labels
No labels