pub enum DynGeometry<Scalar: CoordinateScalar, Cs: CoordinateSystem = Cartesian> {
Point(Point<Scalar, 2, Cs>),
LineString(Linestring<Point<Scalar, 2, Cs>>),
Polygon(Polygon<Point<Scalar, 2, Cs>>),
MultiPoint(MultiPoint<Point<Scalar, 2, Cs>>),
MultiLineString(MultiLinestring<Linestring<Point<Scalar, 2, Cs>>>),
MultiPolygon(MultiPolygon<Polygon<Point<Scalar, 2, Cs>>>),
GeometryCollection(Vec<DynGeometry<Scalar, Cs>>),
}Expand description
A geometry whose OGC kind is decided at runtime.
Mirrors Boost’s boost::geometry::dynamic_geometry_tag family
(core/tags.hpp:124-125,
geometries/adapted/boost_variant.hpp). One variant per OGC kind;
every variant carries the matching model::* struct parameterised
by the supplied Scalar and Cs.
The parameterisation deliberately fixes a single
(Scalar, Cs) across all variants — heterogeneous scalar or
coordinate-system mixing inside one collection is out of scope
for v1 (it would require runtime CS conversion, which is a
phase_07 projections concern).
§Layout
GeometryCollection wraps a Vec<DynGeometry<Scalar, Cs>> —
nested collections are allowed. The recursive variant is required
because OGC GeometryCollection itself is heterogeneous.
§Example
use geometry_cs::Cartesian;
use geometry_model::{DynGeometry, DynKind, Point2D};
let p = DynGeometry::<f64, Cartesian>::Point(Point2D::new(1.0, 2.0));
assert_eq!(p.kind(), DynKind::Point);Variants§
Point(Point<Scalar, 2, Cs>)
OGC Point. The dimension is fixed at 2D; 3D points go through
PolyhedralSurface (or wait for the v1.1 DynPoint3 variant —
not in this task).
LineString(Linestring<Point<Scalar, 2, Cs>>)
OGC LineString. Wraps Linestring<Point<Scalar, 2, Cs>>.
Polygon(Polygon<Point<Scalar, 2, Cs>>)
OGC Polygon. The two const-generic bools default to Boost’s
(ClockWise = true, Closed = true).
MultiPoint(MultiPoint<Point<Scalar, 2, Cs>>)
OGC MultiPoint.
MultiLineString(MultiLinestring<Linestring<Point<Scalar, 2, Cs>>>)
OGC MultiLineString.
MultiPolygon(MultiPolygon<Polygon<Point<Scalar, 2, Cs>>>)
OGC MultiPolygon.
GeometryCollection(Vec<DynGeometry<Scalar, Cs>>)
OGC GeometryCollection — a Vec of dyn-geometries. Nested
collections are permitted.
Implementations§
Source§impl<Scalar: CoordinateScalar, Cs: CoordinateSystem> DynGeometry<Scalar, Cs>
impl<Scalar: CoordinateScalar, Cs: CoordinateSystem> DynGeometry<Scalar, Cs>
Sourcepub fn kind(&self) -> DynKind
pub fn kind(&self) -> DynKind
Discriminant of this value.
Mirrors tag<G>::type on dynamic_geometry_tag Boost types
(core/tag.hpp + the variant adapters). Pure run-time
inspection — algorithms should not branch on kind() directly;
the _dyn algorithm wrappers in KC2.T2 match each arm and
forward to the static algorithm, keeping dispatch monomorphic
per arm.
Trait Implementations§
Source§impl<Scalar: Clone + CoordinateScalar, Cs: Clone + CoordinateSystem> Clone for DynGeometry<Scalar, Cs>
impl<Scalar: Clone + CoordinateScalar, Cs: Clone + CoordinateSystem> Clone for DynGeometry<Scalar, Cs>
Source§fn clone(&self) -> DynGeometry<Scalar, Cs>
fn clone(&self) -> DynGeometry<Scalar, Cs>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more