Skip to main content

wxy_domain/
frame.rs

1//! Frames: what the numbers a mapping produces mean.
2//!
3//! This crate does not interpret frames. A CRS definition travels as an
4//! opaque string (EPSG code, PROJ string, WKT or PROJJSON) and a CRS backend
5//! elsewhere decides what it means; see mdsumner/rust-proj-capability for
6//! the backend question.
7
8/// The frame a mapping's output coordinates are in.
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub enum Frame {
11    /// Index space only: no frame was given.
12    Index,
13    /// A coordinate reference system, as an opaque definition.
14    Crs(String),
15    /// Anything else with a meaning a reader could name (for example
16    /// `"scan_angle"` before the satellite height is known, or a model's
17    /// own grid coordinates).
18    Other(String),
19}
20
21impl Frame {
22    pub fn crs(def: impl Into<String>) -> Self {
23        Frame::Crs(def.into())
24    }
25
26    pub fn is_index(&self) -> bool {
27        matches!(self, Frame::Index)
28    }
29}