geometry_cs/family.rs
1//! Coordinate-system family markers.
2//!
3//! Mirrors `boost::geometry::traits::cs_tag<Cs>` from
4//! `boost/geometry/core/cs.hpp:194-225`: the metafunction that collapses
5//! every concrete `cs::spherical<Degree>`, `cs::spherical<Radian>`,
6//! `cs::spherical_equatorial<…>` down to a single family tag
7//! (`spherical_polar_tag` / `spherical_equatorial_tag`) so strategies
8//! dispatch once per family instead of once per `<Unit>` instantiation.
9//!
10//! Per proposal §3.3 we collapse Boost's two spherical tags into one
11//! `SphericalFamily` (the equatorial convention, matching the
12//! quickstart and OGC). Strategies ported from
13//! `boost/geometry/strategies/spherical/*` that expect colatitude must
14//! flip the sign on `π/2 − lat` when translated.
15
16/// Cartesian family marker.
17///
18/// Mirrors `boost::geometry::cartesian_tag`
19/// (`boost/geometry/core/tags.hpp`, the tag chain at
20/// `cs.hpp:213-217`).
21///
22/// # Examples
23///
24/// ```
25/// use geometry_cs::{Cartesian, CartesianFamily, CoordinateSystem};
26/// let _: <Cartesian as CoordinateSystem>::Family = CartesianFamily;
27/// ```
28#[derive(Debug, Default, Clone, Copy)]
29pub struct CartesianFamily;
30
31/// Spherical family marker.
32///
33/// Mirrors `boost::geometry::spherical_polar_tag` /
34/// `spherical_equatorial_tag` (`boost/geometry/core/tags.hpp`, the tag
35/// chain at `cs.hpp:200-211`). We collapse both Boost tags into a
36/// single family per proposal §3.3.
37///
38/// # Examples
39///
40/// ```
41/// use geometry_cs::{CoordinateSystem, Degree, Spherical, SphericalFamily};
42/// let _: <Spherical<Degree> as CoordinateSystem>::Family = SphericalFamily;
43/// ```
44#[derive(Debug, Default, Clone, Copy)]
45pub struct SphericalFamily;
46
47/// Geographic family marker.
48///
49/// Mirrors `boost::geometry::geographic_tag` (`boost/geometry/core/tags.hpp`,
50/// the tag chain at `cs.hpp:194-198`).
51///
52/// # Examples
53///
54/// ```
55/// use geometry_cs::{CoordinateSystem, Degree, Geographic, GeographicFamily};
56/// let _: <Geographic<Degree> as CoordinateSystem>::Family = GeographicFamily;
57/// ```
58#[derive(Debug, Default, Clone, Copy)]
59pub struct GeographicFamily;
60
61/// Polar family marker.
62///
63/// Mirrors the family tag implied by `cs::polar<DegreeOrRadian>` in
64/// `boost/geometry/core/cs.hpp:155-165`. Boost never gives the polar
65/// system a dedicated `cs_tag` specialisation (the type is mostly
66/// vestigial in the C++ code base); we name it explicitly so that
67/// future polar strategies have a family to bind on.
68///
69/// # Examples
70///
71/// ```
72/// use geometry_cs::{CoordinateSystem, Polar, PolarFamily, Radian};
73/// let _: <Polar<Radian> as CoordinateSystem>::Family = PolarFamily;
74/// ```
75#[derive(Debug, Default, Clone, Copy)]
76pub struct PolarFamily;