Trait geozero::GeomProcessor[][src]

pub trait GeomProcessor {
Show 35 methods fn dimensions(&self) -> CoordDimensions { ... }
fn multi_dim(&self) -> bool { ... }
fn srid(&mut self, srid: Option<i32>) -> Result<()> { ... }
fn xy(&mut self, x: f64, y: f64, idx: usize) -> Result<()> { ... }
fn coordinate(
        &mut self,
        x: f64,
        y: f64,
        z: Option<f64>,
        m: Option<f64>,
        t: Option<f64>,
        tm: Option<u64>,
        idx: usize
    ) -> Result<()> { ... }
fn point_begin(&mut self, idx: usize) -> Result<()> { ... }
fn point_end(&mut self, idx: usize) -> Result<()> { ... }
fn multipoint_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn multipoint_end(&mut self, idx: usize) -> Result<()> { ... }
fn linestring_begin(
        &mut self,
        tagged: bool,
        size: usize,
        idx: usize
    ) -> Result<()> { ... }
fn linestring_end(&mut self, tagged: bool, idx: usize) -> Result<()> { ... }
fn multilinestring_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn multilinestring_end(&mut self, idx: usize) -> Result<()> { ... }
fn polygon_begin(
        &mut self,
        tagged: bool,
        size: usize,
        idx: usize
    ) -> Result<()> { ... }
fn polygon_end(&mut self, tagged: bool, idx: usize) -> Result<()> { ... }
fn multipolygon_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn multipolygon_end(&mut self, idx: usize) -> Result<()> { ... }
fn geometrycollection_begin(
        &mut self,
        size: usize,
        idx: usize
    ) -> Result<()> { ... }
fn geometrycollection_end(&mut self, idx: usize) -> Result<()> { ... }
fn circularstring_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn circularstring_end(&mut self, idx: usize) -> Result<()> { ... }
fn compoundcurve_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn compoundcurve_end(&mut self, idx: usize) -> Result<()> { ... }
fn curvepolygon_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn curvepolygon_end(&mut self, idx: usize) -> Result<()> { ... }
fn multicurve_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn multicurve_end(&mut self, idx: usize) -> Result<()> { ... }
fn multisurface_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn multisurface_end(&mut self, idx: usize) -> Result<()> { ... }
fn triangle_begin(
        &mut self,
        tagged: bool,
        size: usize,
        idx: usize
    ) -> Result<()> { ... }
fn triangle_end(&mut self, tagged: bool, idx: usize) -> Result<()> { ... }
fn polyhedralsurface_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn polyhedralsurface_end(&mut self, idx: usize) -> Result<()> { ... }
fn tin_begin(&mut self, size: usize, idx: usize) -> Result<()> { ... }
fn tin_end(&mut self, idx: usize) -> Result<()> { ... }
}
Expand description

Geometry processing trait

Usage example:

use geozero::{GeomProcessor, error::Result};

struct CoordPrinter;

impl GeomProcessor for CoordPrinter {
    fn xy(&mut self, x: f64, y: f64, _idx: usize) -> Result<()> {
        Ok(println!("({} {})", x, y))
    }
}

Provided methods

Additional dimensions requested when processing coordinates

Request additional dimensions for coordinate processing

SRID of geometries

Emitted before geometry begin

Process coordinate with x,y dimensions

Process coordinate with all requested dimensions

Begin of Point processing

Next: xy/coordinate

End of Point processing

Begin of MultiPoint processing

Next: size * xy/coordinate

End of MultiPoint processing

Begin of LineString processing

An untagged LineString is either a Polygon ring or part of a MultiLineString

Next: size * xy/coordinate

End of LineString processing

Begin of MultiLineString processing

Next: size * LineString (untagged)

End of MultiLineString processing

Begin of Polygon processing

An untagged Polygon is part of a MultiPolygon

Next: size * LineString (untagged) = rings

End of Polygon processing

Begin of MultiPolygon processing

Next: size * Polygon (untagged)

End of MultiPolygon processing

Begin of GeometryCollection processing

End of GeometryCollection processing

Begin of CircularString processing

The CircularString is the basic curve type, similar to a LineString in the linear world. A single segment required three points, the start and end points (first and third) and any other point on the arc. The exception to this is for a closed circle, where the start and end points are the same. In this case the second point MUST be the center of the arc, ie the opposite side of the circle. To chain arcs together, the last point of the previous arc becomes the first point of the next arc, just like in LineString. This means that a valid circular string must have an odd number of points greated than 1.

Next: size * xy/coordinate

End of CircularString processing

Begin of CompoundCurve processing

A compound curve is a single, continuous curve that has both curved (circular) segments and linear segments. That means that in addition to having well-formed components, the end point of every component (except the last) must be coincident with the start point of the following component.

Next: size * (CircularString | LineString (untagged))

End of CompoundCurve processing

Begin of CurvePolygon processing

A CurvePolygon is just like a polygon, with an outer ring and zero or more inner rings. The difference is that a ring can take the form of a circular string, linear string or compound string.

Next: size * (CircularString | LineString (untagged) | CompoundCurve)

End of CurvePolygon processing

Begin of MultiCurve processing

The MultiCurve is a collection of curves, which can include linear strings, circular strings or compound strings.

Next: size * (CircularString | LineString (untagged) | CompoundCurve)

End of MultiCurve processing

Begin of MultiSurface processing

The MultiSurface is a collection of surfaces, which can be (linear) polygons or curve polygons.

Next: size * (CurvePolygon | Polygon (untagged))

End of MultiSurface processing

Begin of Triangle processing

An untagged Triangle is part of a Tin

Next: size * LineString (untagged) = rings

End of Polygon processing

Begin of PolyhedralSurface processing

Next: size * Polygon (untagged)

End of MultiPolygon processing

Begin of Tin processing

Next: size * Polygon (untagged)

End of MultiPolygon processing

Implementors