Skip to main content

Crate geometry_adapt_geo_types

Crate geometry_adapt_geo_types 

Source
Expand description

Adapt geo-types geometries to the geometry-trait concept surface.

Mirrors the role of the Boost BOOST_GEOMETRY_REGISTER_* macros in boost/geometry/geometries/adapted/ — those specialise the C++ traits::{tag, dimension, coordinate_type, coordinate_system, access} metafunctions (and, for containers, ring_const_type, exterior_ring, interior_rings, …) for a foreign storage layout. Rust has no specialisation and the orphan rule forbids implementing a foreign concept trait for a foreign geo-types type, so — as with geometry_adapt::Adapt and the geometry_adapt_nalgebra sibling — each foreign value is wrapped in a local newtype and the geometry concepts hang off the wrapper.

§Point wrappers

  • GeoCoordgeo_types::Coord, the (x, y) ordinate pair.
  • GeoPointgeo_types::Point, the newtype around a Coord.

Both pin Cs = Cartesian, DIM = 2, and are read-write (geometry_trait::PointMut).

§Container wrappers

Because the container concepts yield their points by reference (points() -> impl Iterator<Item = &Self::Point>) and this crate is #![forbid(unsafe_code)], the container wrappers store their vertices as the wrapped point type (GeoCoord / GeoPoint) rather than re-casting the raw geo-types storage. Construction and into_inner copy ordinates element-by-element; both coordinate representations are Copy, so the round trip is lossless.

§DynGeometry interop

crate::dyn_conversion provides From<geo_types::Geometry<T>>DynGeometry<T, Cartesian> so a whole geometry tree can move between the two ecosystems.

Modules§

dyn_conversion
Bidirectional conversion between geo_types::Geometry<T> and DynGeometry<T, Cartesian>.

Structs§

GeoCollection
Shape-only adapter for geo_types::GeometryCollection<T>.
GeoCoord
Shape-only adapter for geo_types::Coord<T>.
GeoLine
Shape-only adapter for geo_types::Line<T>.
GeoLineString
Shape-only adapter for geo_types::LineString<T>.
GeoMultiLineString
Shape-only adapter for geo_types::MultiLineString<T>.
GeoMultiPoint
Shape-only adapter for geo_types::MultiPoint<T>.
GeoMultiPolygon
Shape-only adapter for geo_types::MultiPolygon<T>.
GeoPoint
Shape-only adapter for geo_types::Point<T>.
GeoPolygon
Shape-only adapter for geo_types::Polygon<T>.
GeoRect
Shape-only adapter for geo_types::Rect<T>.
GeoRing
Shape-only adapter presenting a geo_types::LineString<T> as a Ring.