Skip to main content

SlicerOne

Struct SlicerOne 

Source
pub struct SlicerOne<V: Vertex = Coord<i32>, A = ()> { /* private fields */ }
Expand description

Slices integer polylines into pieces for one fixed tile, accumulating only that tile.

The single-tile counterpart to SlicerAll: add_feature / add_feature_with work exactly the same, but each polyline is clipped only to this slicer’s tile. Because there is a single tile, the read API skips the tile level — iter_features yields the features directly.

Generic over the Vertex type V (defaults to Coord<i32>) and the per-feature attribute type A (defaults to ()); see SlicerAll for both axes.

Implementations§

Source§

impl<V: Vertex, A> SlicerOne<V, A>

Source

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 (see SlicerAll::new for the coordinate model).

§Errors
Source

pub fn extent(&self) -> u32

The tile side / per-tile output resolution: kept vertices land in 0..extent.

Source

pub fn buffer(&self) -> u16

The buffer kept around every tile, in tile-space units.

Source

pub fn tile(&self) -> TileId

The tile this slicer clips into.

Source

pub fn add_feature_with<P: AsRef<[V]>>( &mut self, polyline: P, attr: A, ) -> Result<&mut Self, TileError>

Add polyline as an independent feature carrying attr, clipped to this slicer’s tile. Chainable. The feature (and its attribute) is recorded only if something of polyline lands in the tile; otherwise attr is dropped. Reach it back through FeatureView::attr.

When A = (), prefer add_feature.

Atomic: the polyline is fully sliced first, so on error the accumulator is left unchanged.

§Errors

TileError::Overflow if the tile’s box or a kept vertex overflows i32.

Source

pub fn iter_features(&self) -> impl Iterator<Item = FeatureView<'_, V, A>>

Iterate this tile’s features, in the order they were first added. Each FeatureView exposes that feature’s clipped polylines and its attr.

Source

pub fn len(&self) -> usize

Number of features accumulated for the tile.

Source

pub fn is_empty(&self) -> bool

Whether nothing has been accumulated yet.

Source

pub fn clear(&mut self)

Discard everything accumulated so far, keeping the extent/buffer/tile config.

Source§

impl<V: Vertex> SlicerOne<V, ()>

Source

pub fn add_feature<P: AsRef<[V]>>( &mut self, polyline: P, ) -> Result<&mut Self, TileError>

Add polyline as an independent feature with no attribute — shorthand for add_feature_with(polyline, ()). Available only when A = ().

§Errors

TileError::Overflow if the tile’s box or a kept vertex overflows i32.

Trait Implementations§

Source§

impl<V: Clone + Vertex, A: Clone> Clone for SlicerOne<V, A>

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, A: Debug> Debug for SlicerOne<V, A>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<V: Eq + Vertex, A: Eq> Eq for SlicerOne<V, A>

Source§

impl<V: PartialEq + Vertex, A: PartialEq> PartialEq for SlicerOne<V, A>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<V: PartialEq + Vertex, A: PartialEq> StructuralPartialEq for SlicerOne<V, A>

Auto Trait Implementations§

§

impl<V, A> Freeze for SlicerOne<V, A>
where TileBuf<V, A>: Freeze,

§

impl<V, A> RefUnwindSafe for SlicerOne<V, A>
where TileBuf<V, A>: RefUnwindSafe,

§

impl<V, A> Send for SlicerOne<V, A>
where TileBuf<V, A>: Send,

§

impl<V, A> Sync for SlicerOne<V, A>
where TileBuf<V, A>: Sync,

§

impl<V, A> Unpin for SlicerOne<V, A>
where TileBuf<V, A>: Unpin,

§

impl<V, A> UnsafeUnpin for SlicerOne<V, A>
where TileBuf<V, A>: UnsafeUnpin,

§

impl<V, A> UnwindSafe for SlicerOne<V, A>
where TileBuf<V, A>: 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.