Skip to main content

Mosaic

Struct Mosaic 

Source
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>

Source

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.

Source

pub fn extent(&self) -> u32

The extent every tile is sliced at.

Source

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::Conflict if the tile disagrees with already-added tiles on a shared border segment. The mosaic is unchanged.
  • TileError::Overflow if a vertex overflows i32 when rebased into the global frame.
Source

pub fn purge(&mut self, tile: TileId) -> bool

Remove tile and all geometry it contributed. Returns whether the tile was present.

Source

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.

Source

pub fn contains(&self, tile: TileId) -> bool

Whether tile is currently in the mosaic.

Source

pub fn len(&self) -> usize

The number of tiles currently in the mosaic.

Source

pub fn is_empty(&self) -> bool

Whether no tile has been added yet.

Source

pub fn clear(&mut self)

Discard every tile, keeping the extent.

Trait Implementations§

Source§

impl<V: Clone + Vertex> Clone for Mosaic<V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug + Vertex> Debug for Mosaic<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<V> Freeze for Mosaic<V>
where EdgeIndex<V>: Freeze,

§

impl<V> RefUnwindSafe for Mosaic<V>
where EdgeIndex<V>: RefUnwindSafe,

§

impl<V> Send for Mosaic<V>
where EdgeIndex<V>: Send,

§

impl<V> Sync for Mosaic<V>
where EdgeIndex<V>: Sync,

§

impl<V> Unpin for Mosaic<V>
where EdgeIndex<V>: Unpin,

§

impl<V> UnsafeUnpin for Mosaic<V>
where EdgeIndex<V>: UnsafeUnpin,

§

impl<V> UnwindSafe for Mosaic<V>
where EdgeIndex<V>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.