Skip to main content

PolygonSlicerOne

Struct PolygonSlicerOne 

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

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 (same coordinate model as SlicerOne).

§Errors
Source

pub fn extent(&self) -> u32

The tile side / per-tile output resolution.

Source

pub fn buffer(&self) -> u16

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

Source

pub fn tile(&self) -> TileId

The tile this slicer clips into.

Source

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
Source

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

pub fn len(&self) -> usize

Number of polygon 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, keeping the extent/buffer/tile config and buffer capacity.

Source§

impl<V: PolyVertex> PolygonSlicerOne<V, ()>

Source

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.

Trait Implementations§

Source§

impl<V: Clone + PolyVertex, A: Clone> Clone for PolygonSlicerOne<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 + PolyVertex, A: Debug> Debug for PolygonSlicerOne<V, A>

Source§

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

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

impl<V: Eq + PolyVertex, A: Eq> Eq for PolygonSlicerOne<V, A>

Source§

impl<V: PartialEq + PolyVertex, A: PartialEq> PartialEq for PolygonSlicerOne<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 + PolyVertex, A: PartialEq> StructuralPartialEq for PolygonSlicerOne<V, A>

Auto Trait Implementations§

§

impl<V, A> Freeze for PolygonSlicerOne<V, A>
where Vec<V>: Freeze, Vec<FeatureEntry<A>>: Freeze, ClipScratch<V>: Freeze,

§

impl<V, A> RefUnwindSafe for PolygonSlicerOne<V, A>
where Vec<V>: RefUnwindSafe, Vec<FeatureEntry<A>>: RefUnwindSafe, ClipScratch<V>: RefUnwindSafe,

§

impl<V, A> Send for PolygonSlicerOne<V, A>
where Vec<V>: Send, Vec<FeatureEntry<A>>: Send, ClipScratch<V>: Send,

§

impl<V, A> Sync for PolygonSlicerOne<V, A>
where Vec<V>: Sync, Vec<FeatureEntry<A>>: Sync, ClipScratch<V>: Sync,

§

impl<V, A> Unpin for PolygonSlicerOne<V, A>
where Vec<V>: Unpin, Vec<FeatureEntry<A>>: Unpin, ClipScratch<V>: Unpin,

§

impl<V, A> UnsafeUnpin for PolygonSlicerOne<V, A>
where Vec<V>: UnsafeUnpin, Vec<FeatureEntry<A>>: UnsafeUnpin, ClipScratch<V>: UnsafeUnpin,

§

impl<V, A> UnwindSafe for PolygonSlicerOne<V, A>
where Vec<V>: UnwindSafe, Vec<FeatureEntry<A>>: UnwindSafe, ClipScratch<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.