pub struct Mosaic<V: Vertex = Coord<i32>> { /* private fields */ }Expand description
Reassembles tiled polyline features back into whole features as tiles are added.
Generic over the Vertex type V (defaults to Coord<i32>). Needs only the extent the
tiles were sliced at — never the buffer (see the module docs). A payload-carrying vertex (e.g.
Measured) additionally makes payload Conflicts
meaningful.
Implementations§
Source§impl<V: Vertex> Mosaic<V>
impl<V: Vertex> Mosaic<V>
Sourcepub fn new(extent: u32) -> Result<Self, TileError>
pub fn new(extent: u32) -> Result<Self, TileError>
Create an empty mosaic for tiles sliced at extent.
§Errors
TileError::InvalidExtent if extent is 0 or greater than i32::MAX.
Sourcepub fn add<L: AsRef<[V]>>(
&mut self,
tile: TileId,
runs: &[L],
) -> Result<(), TileError>
pub fn add<L: AsRef<[V]>>( &mut self, tile: TileId, runs: &[L], ) -> Result<(), TileError>
Add tile’s runs (in its local frame) to the mosaic. runs is anything sliceable to [V]
(e.g. &[&[V]] collected from a tile’s features). Re-adding a tile replaces its contents. A
tile with no ≥2-vertex run contributes nothing.
§Errors
TileError::Conflictif the tile disagrees with already-added tiles on a shared border segment. The mosaic is unchanged.TileError::Overflowif a vertex overflowsi32when rebased into the global frame.
Sourcepub fn purge(&mut self, tile: TileId) -> bool
pub fn purge(&mut self, tile: TileId) -> bool
Remove tile and all geometry it contributed. Returns whether the tile was present.
Sourcepub fn iter_features(&self) -> impl Iterator<Item = Vec<V>>
pub fn iter_features(&self) -> impl Iterator<Item = Vec<V>>
Iterate every reassembled feature — geometry stitched across tile borders into maximal polylines, in the global frame. A single iterator over the whole mosaic; deterministic order.