Struct PolygonBuilder

Source
pub struct PolygonBuilder { /* private fields */ }
Expand description

The GeoArrow equivalent to Vec<Option<Polygon>>: a mutable collection of Polygons.

Converting an PolygonBuilder into a PolygonArray is O(1).

Implementations§

Source§

impl PolygonBuilder

Source

pub fn new(typ: PolygonType) -> Self

Creates a new empty PolygonBuilder.

Source

pub fn with_capacity(typ: PolygonType, capacity: PolygonCapacity) -> Self

Creates a new PolygonBuilder with given capacity and no validity.

Source

pub fn reserve(&mut self, capacity: PolygonCapacity)

Reserves capacity for at least additional more Polygons.

The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

Source

pub fn reserve_exact(&mut self, capacity: PolygonCapacity)

Reserves the minimum capacity for at least additional more Polygons.

Unlike reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.

Source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of self to fit.

Source

pub fn finish(self) -> PolygonArray

Consume the builder and convert to an immutable PolygonArray

Source

pub fn push_polygon( &mut self, value: Option<&impl PolygonTrait<T = f64>>, ) -> GeoArrowResult<()>

Add a new Polygon to the end of this array.

§Errors

This function errors iff the new last item is larger than what O supports.

Source

pub fn push_rect( &mut self, value: Option<&impl RectTrait<T = f64>>, ) -> GeoArrowResult<()>

Add a new Rect to this builder

Source

pub fn push_geometry( &mut self, value: Option<&impl GeometryTrait<T = f64>>, ) -> GeoArrowResult<()>

Add a new geometry to this builder

This will error if the geometry type is not Polygon, a MultiPolygon of length 1, or Rect.

Source

pub fn extend_from_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl PolygonTrait<T = f64> + 'a)>>, )

Extend this builder with the given geometries

Source

pub fn extend_from_geometry_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>, ) -> GeoArrowResult<()>

Extend this builder with the given geometries

Source

pub fn from_polygons( geoms: &[impl PolygonTrait<T = f64>], typ: PolygonType, ) -> Self

Construct a new builder, pre-filling it with the provided geometries

Source

pub fn from_nullable_polygons( geoms: &[Option<impl PolygonTrait<T = f64>>], typ: PolygonType, ) -> Self

Construct a new builder, pre-filling it with the provided geometries

Source

pub fn from_nullable_geometries( geoms: &[Option<impl GeometryTrait<T = f64>>], typ: PolygonType, ) -> GeoArrowResult<Self>

Construct a new builder, pre-filling it with the provided geometries

Trait Implementations§

Source§

impl Debug for PolygonBuilder

Source§

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

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

impl GeomProcessor for PolygonBuilder

Available on crate feature geozero only.
Source§

fn geometrycollection_begin(&mut self, size: usize, idx: usize) -> Result<()>

Begin of GeometryCollection processing Read more
Source§

fn geometrycollection_end(&mut self, idx: usize) -> Result<()>

End of GeometryCollection processing
Source§

fn xy(&mut self, x: f64, y: f64, idx: usize) -> Result<()>

Process coordinate with x,y dimensions
Source§

fn coordinate( &mut self, x: f64, y: f64, z: Option<f64>, m: Option<f64>, t: Option<f64>, tm: Option<u64>, idx: usize, ) -> Result<()>

Process coordinate with all requested dimensions
Source§

fn polygon_begin(&mut self, tagged: bool, size: usize, idx: usize) -> Result<()>

Begin of Polygon processing Read more
Source§

fn linestring_begin( &mut self, tagged: bool, size: usize, idx: usize, ) -> Result<()>

Begin of LineString processing Read more
Source§

fn dimensions(&self) -> CoordDimensions

Additional dimensions requested when processing coordinates
Source§

fn multi_dim(&self) -> bool

Request additional dimensions for coordinate processing
Source§

fn srid(&mut self, srid: Option<i32>) -> Result<(), GeozeroError>

SRID of geometries Read more
Source§

fn empty_point(&mut self, idx: usize) -> Result<(), GeozeroError>

Process empty coordinates, like WKT’s POINT EMPTY Read more
Source§

fn point_begin(&mut self, idx: usize) -> Result<(), GeozeroError>

Begin of Point processing Read more
Source§

fn point_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of Point processing
Source§

fn multipoint_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of MultiPoint processing Read more
Source§

fn multipoint_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of MultiPoint processing Read more
Source§

fn linestring_end( &mut self, tagged: bool, idx: usize, ) -> Result<(), GeozeroError>

End of LineString processing
Source§

fn multilinestring_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of MultiLineString processing Read more
Source§

fn multilinestring_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of MultiLineString processing
Source§

fn polygon_end(&mut self, tagged: bool, idx: usize) -> Result<(), GeozeroError>

End of Polygon processing
Source§

fn multipolygon_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of MultiPolygon processing Read more
Source§

fn multipolygon_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of MultiPolygon processing
Source§

fn circularstring_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of CircularString processing Read more
Source§

fn circularstring_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of CircularString processing
Source§

fn compoundcurve_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of CompoundCurve processing Read more
Source§

fn compoundcurve_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of CompoundCurve processing
Source§

fn curvepolygon_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of CurvePolygon processing Read more
Source§

fn curvepolygon_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of CurvePolygon processing
Source§

fn multicurve_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of MultiCurve processing Read more
Source§

fn multicurve_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of MultiCurve processing
Source§

fn multisurface_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of MultiSurface processing Read more
Source§

fn multisurface_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of MultiSurface processing
Source§

fn triangle_begin( &mut self, tagged: bool, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of Triangle processing Read more
Source§

fn triangle_end(&mut self, tagged: bool, idx: usize) -> Result<(), GeozeroError>

End of Triangle processing
Source§

fn polyhedralsurface_begin( &mut self, size: usize, idx: usize, ) -> Result<(), GeozeroError>

Begin of PolyhedralSurface processing Read more
Source§

fn polyhedralsurface_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of PolyhedralSurface processing
Source§

fn tin_begin(&mut self, size: usize, idx: usize) -> Result<(), GeozeroError>

Begin of Tin processing Read more
Source§

fn tin_end(&mut self, idx: usize) -> Result<(), GeozeroError>

End of Tin processing
Source§

fn pre_process_xy<F>(self, transform_xy: F) -> WrappedXYProcessor<Self, F>
where F: Fn(&mut f64, &mut f64), Self: Sized,

Combinator which inserts a call to transform_xy during processing, before GeomProcessor::xy or GeomProcessor::coordinate is called. Read more
Source§

impl<O: OffsetSizeTrait> TryFrom<(GenericWkbArray<O>, PolygonType)> for PolygonBuilder

Source§

type Error = GeoArrowError

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

fn try_from( (value, typ): (GenericWkbArray<O>, PolygonType), ) -> GeoArrowResult<Self>

Performs the conversion.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,