Skip to main content

DynGeometry

Enum DynGeometry 

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

Source

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>

Source§

fn clone(&self) -> DynGeometry<Scalar, Cs>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Scalar: Debug + CoordinateScalar, Cs: Debug + CoordinateSystem> Debug for DynGeometry<Scalar, Cs>

Source§

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

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

impl<Scalar: CoordinateScalar, Cs: CoordinateSystem> Geometry for DynGeometry<Scalar, Cs>

Source§

type Kind = DynamicGeometryTag

One of the *Tag types from geometry_tag. Read more
Source§

type Point = Point<Scalar, 2, Cs>

The point type this geometry is built from. For a value modelling Point, this is Self. Read more
Source§

impl<Scalar: PartialEq + CoordinateScalar, Cs: PartialEq + CoordinateSystem> PartialEq for DynGeometry<Scalar, Cs>

Source§

fn eq(&self, other: &DynGeometry<Scalar, Cs>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<Scalar: PartialEq + CoordinateScalar, Cs: PartialEq + CoordinateSystem> StructuralPartialEq for DynGeometry<Scalar, Cs>

Auto Trait Implementations§

§

impl<Scalar, Cs> Freeze for DynGeometry<Scalar, Cs>
where Scalar: Freeze,

§

impl<Scalar, Cs> RefUnwindSafe for DynGeometry<Scalar, Cs>
where Scalar: RefUnwindSafe, Cs: RefUnwindSafe,

§

impl<Scalar, Cs> Send for DynGeometry<Scalar, Cs>
where Scalar: Send, Cs: Send,

§

impl<Scalar, Cs> Sync for DynGeometry<Scalar, Cs>
where Scalar: Sync, Cs: Sync,

§

impl<Scalar, Cs> Unpin for DynGeometry<Scalar, Cs>
where Scalar: Unpin, Cs: Unpin,

§

impl<Scalar, Cs> UnsafeUnpin for DynGeometry<Scalar, Cs>
where Scalar: UnsafeUnpin,

§

impl<Scalar, Cs> UnwindSafe for DynGeometry<Scalar, Cs>
where Scalar: UnwindSafe, Cs: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> SameAs<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.