pub struct Layer { /* private fields */ }Expand description
An owned planar layer. Cached views cannot be invalidated through mutation.
Caches do not depend on a topology or LayerId, so one Arc<Layer> can be
registered in several topologies and its cleaned parts, indexes, polygon
union and cross-geometry views are built once and reused.
Construction defers finite-coordinate and duplicate-FID checks until rule registration, warnings or validation. Cleaning removes consecutive duplicate coordinates and skips lines with fewer than two coordinates and polygon rings with fewer than four coordinates or three distinct vertices. A degenerate exterior skips the polygon; degenerate holes are skipped individually. Part indices retain the original traversal positions. Coordinate units are supplied by the caller; the core does not interpret or transform a CRS.
Implementations§
Source§impl Layer
impl Layer
Sourcepub fn from_geometries(
name: impl Into<String>,
geometries: impl IntoIterator<Item = Geometry>,
) -> Self
pub fn from_geometries( name: impl Into<String>, geometries: impl IntoIterator<Item = Geometry>, ) -> Self
Own geometries in input order, assigning signed FIDs starting at zero. Validation is deferred until this layer’s parts are requested.
Sourcepub fn from_features(
name: impl Into<String>,
features: impl IntoIterator<Item = (i64, Geometry)>,
) -> Self
pub fn from_features( name: impl Into<String>, features: impl IntoIterator<Item = (i64, Geometry)>, ) -> Self
Own features in input order, preserving signed FIDs and original geometries. FIDs must be unique within this layer; validation is deferred.
Sourcepub fn features(&self) -> impl ExactSizeIterator<Item = (i64, &Geometry)>
pub fn features(&self) -> impl ExactSizeIterator<Item = (i64, &Geometry)>
Iterate original, uncleaned features in input order.
Sourcepub fn feature(&self, index: usize) -> Option<(i64, &Geometry)>
pub fn feature(&self, index: usize) -> Option<(i64, &Geometry)>
Return the original feature at a zero-based input position.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Layer
impl RefUnwindSafe for Layer
impl Send for Layer
impl Sync for Layer
impl Unpin for Layer
impl UnsafeUnpin for Layer
impl UnwindSafe for Layer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more