pub struct PolygonSlicerOne<V: PolyVertex = Coord<i32>, A = ()> { /* private fields */ }Expand description
Slices integer polygons into pieces for one fixed tile, keeping original vertices.
The polygon counterpart to SlicerOne: each polygon added is clipped only to
this slicer’s tile. Generic over the PolyVertex type V (default
Coord<i32>) and the per-feature attribute A (default ()).
Implementations§
Source§impl<V: PolyVertex, A> PolygonSlicerOne<V, A>
impl<V: PolyVertex, A> PolygonSlicerOne<V, A>
Sourcepub fn new(extent: u32, buffer: u16, tile: TileId) -> Result<Self, TileError>
pub fn new(extent: u32, buffer: u16, tile: TileId) -> Result<Self, TileError>
Create a slicer bound to tile, with the given tile side / per-tile output resolution
extent and buffer (same coordinate model as SlicerOne).
§Errors
TileError::InvalidExtentifextentis0or greater thani32::MAX.TileError::BufferTooLargeifbufferis not strictly less than half theextent.
Sourcepub fn add_feature_with(
&mut self,
exterior: &[V],
holes: &[&[V]],
attr: A,
) -> Result<&mut Self, TileError>
pub fn add_feature_with( &mut self, exterior: &[V], holes: &[&[V]], attr: A, ) -> Result<&mut Self, TileError>
Add one polygon — exterior ring plus holes — as an independent feature carrying attr,
clipped to this slicer’s tile. Chainable. Recorded only if the exterior
survives in the tile; otherwise attr is dropped. Rings may be given open or closed (a
repeated first/last vertex is fine).
When A = (), prefer add_feature.
Atomic: on error the accumulator is unchanged.
§Errors
TileError::Overflowif the tile’s box, a synthetic corner, or a kept vertex overflowsi32.TileError::GeometryTooLargeif the tile’s vertices exceed theu32indexing of the storage.
Sourcepub fn iter_features(&self) -> impl Iterator<Item = PolygonView<'_, V, A>>
pub fn iter_features(&self) -> impl Iterator<Item = PolygonView<'_, V, A>>
Iterate the tile’s polygon features that reach it, in the order added, each as the
PolygonView of its clipped rings and attr.
Source§impl<V: PolyVertex> PolygonSlicerOne<V, ()>
impl<V: PolyVertex> PolygonSlicerOne<V, ()>
Sourcepub fn add_feature(
&mut self,
exterior: &[V],
holes: &[&[V]],
) -> Result<&mut Self, TileError>
pub fn add_feature( &mut self, exterior: &[V], holes: &[&[V]], ) -> Result<&mut Self, TileError>
Add one polygon (exterior + holes) with no attribute — shorthand for
add_feature_with(…, ()). Available only when A = ().
§Errors
As in add_feature_with.