galileo_types/
geometry_type.rs

1//! See documentation for [`GeometryType`] trait.
2use serde::{Deserialize, Serialize};
3
4/// This trait allows automatically implement [`Geometry`](crate::Geometry) trait for types that implement specific
5/// geometry traits (e.g. [`Polygon`](crate::Polygon) etc).
6pub trait GeometryType {
7    /// Type of the geometry. [`Geometry`](crate::Geometry) trait is implemented for one of the following types:
8    /// * [`PointGeometryType`]
9    /// * [`MultiPointGeometryType`]
10    /// * [`ContourGeometryType`]
11    /// * [`MultiContourGeometryType`]
12    /// * [`PolygonGeometryType`]
13    /// * [`MultiPolygonGeometryType`]
14    type Type;
15
16    /// Coordinate space that this geometry uses. This specifies what kind of coordinates the geometry uses.
17    ///
18    /// The defined coordinate spaces are:
19    /// * [`GeoSpace2d`]
20    /// * [`CartesianSpace2d`]
21    /// * [`CartesianSpace3d`]
22    ///
23    /// Some types are not bound by the coordinate space they can represent. In this case [`AmbiguousSpace`] space can
24    /// be used. These can be converted into a specific coordinate space using [`Disambiguate`](crate::Disambiguate) trait.
25    type Space;
26}
27
28/// Point geometry marker.
29#[derive(
30    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
31)]
32pub struct PointGeometryType;
33
34/// Multipoint geometry marker.
35#[derive(
36    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
37)]
38pub struct MultiPointGeometryType;
39
40/// Contour geometry marker.
41#[derive(
42    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
43)]
44pub struct ContourGeometryType;
45
46/// MultiContour geometry marker.
47#[derive(
48    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
49)]
50pub struct MultiContourGeometryType;
51
52/// Polygon geometry marker.
53#[derive(
54    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
55)]
56pub struct PolygonGeometryType;
57
58/// MultiPolygon geometry marker.
59#[derive(
60    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
61)]
62pub struct MultiPolygonGeometryType;
63
64/// Geographic coordinate space marker.
65#[derive(
66    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
67)]
68pub struct GeoSpace2d;
69
70/// 2d cartesian coordinate space marker.
71#[derive(
72    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
73)]
74pub struct CartesianSpace2d;
75
76/// 3d cartesian coordinate space marker.
77#[derive(
78    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
79)]
80pub struct CartesianSpace3d;
81
82/// See [`Disambiguate`](super::disambig::Disambiguate).
83#[derive(
84    Debug, Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash, Deserialize, Serialize,
85)]
86pub struct AmbiguousSpace;