pub struct Pj { /* private fields */ }Expand description
A prepared coordinate operation with input/output unit handling.
Wraps an inner Operation and applies the unit conversions, prime-meridian
and central-meridian shifts, and axis bookkeeping that PROJ performs around
the raw projection math.
§Field visibility and invariants
A Pj is a prepared operation: its fields are mutually consistent by
construction (only crate::create and the crate-internal
registry::build_single_op produce a valid one). All fields are therefore
pub(crate) and reachable
from outside the crate only through the read accessors on Pj. Flipping,
for example, inverted or bypass_prepare_finalize after
construction would silently invalidate the prepare/finalize contract, so
those knobs are deliberately not externally writable.
The operation’s boundary — its reference ellipsoid and forward-sense
input/output units — is exposed read-only through the
ellipsoid, left and right
accessors, which downstream crates (the CLI, parity harnesses) depend on.
Their invariant: left/right are the forward-sense input/output units of
the whole operation, and ellipsoid is the reference ellipsoid the boundary
math is expressed against. They are read-only; mutating them would not
re-derive any of the dependent fields.
Implementations§
Source§impl Pj
impl Pj
Sourcepub fn operation(&self) -> &dyn Operation
pub fn operation(&self) -> &dyn Operation
The inner operation (projection or conversion) as a trait reference.
Sourcepub fn op_name(&self) -> &str
pub fn op_name(&self) -> &str
The operation name (e.g. "merc", "axisswap"); empty for a pipeline.
Sourcepub fn inverted(&self) -> bool
pub fn inverted(&self) -> bool
Whether this operation runs inverted in its containing pipeline.
Sourcepub fn inner_has_inverse(&self) -> bool
pub fn inner_has_inverse(&self) -> bool
Whether the wrapped inner operation provides an inverse.
Unlike the Operation::has_inverse default (which the Pj wrapper
inherits as always-true), this reports the inner operation’s own
answer — e.g. false for a forward-only projection like urm5 or a
singular affine. The pipeline builder uses it to reject, at creation
time, a step whose required direction has no implementation, mirroring
PROJ’s pj_create_pipeline forward-path check (src/pipeline.cpp).
Sourcepub fn is_latlong(&self) -> bool
pub fn is_latlong(&self) -> bool
Whether this is a pass-through geographic (lat/long) operation.
Sourcepub fn from_greenwich(&self) -> f64
pub fn from_greenwich(&self) -> f64
Prime-meridian offset from Greenwich (radians).
Sourcepub fn ellipsoid(&self) -> Ellipsoid
pub fn ellipsoid(&self) -> Ellipsoid
The reference ellipsoid the boundary math is expressed against.
Sourcepub fn forward(&self, c: Coord) -> ProjResult<Coord>
pub fn forward(&self, c: Coord) -> ProjResult<Coord>
Run the operation in the forward direction, honoring inverted.
Sourcepub fn inverse(&self, c: Coord) -> ProjResult<Coord>
pub fn inverse(&self, c: Coord) -> ProjResult<Coord>
Run the operation in the inverse direction, honoring inverted.
Sourcepub fn factors(&self, coord: Coord) -> ProjResult<Factors>
pub fn factors(&self, coord: Coord) -> ProjResult<Factors>
Compute map-scale factors (Tissot indicatrix) at a geographic coordinate.
coord must be in geographic input units — radians if self.left == IoUnits::Radians,
degrees if self.left == IoUnits::Degrees. The coordinate layout is
Coord::new(longitude, latitude, z, t).
Returns the oxiproj_core::Factors struct describing Tissot indicatrix parameters
at the given point.
Ported from PROJ 9.8.0 src/factors.cpp (proj_factors → pj_factors → pj_deriv).
Sourcepub fn factors_exact(&self, coord: Coord) -> ProjResult<FactorsExact>
pub fn factors_exact(&self, coord: Coord) -> ProjResult<FactorsExact>
Compute exact distortion factors via automatic differentiation.
Returns Err(ProjError::UnsupportedOperation) when:
ad_projisNone(no AD-capable projection registered), or- the projection’s
project_fwd_genericreturnsUnsupportedOperation.
coord must be in the same geographic input units as for Pj::factors.
Trait Implementations§
Source§impl Operation for Pj
impl Operation for Pj
Source§fn forward_4d(&self, c: Coord) -> ProjResult<Coord>
fn forward_4d(&self, c: Coord) -> ProjResult<Coord>
Source§fn inverse_4d(&self, c: Coord) -> ProjResult<Coord>
fn inverse_4d(&self, c: Coord) -> ProjResult<Coord>
Source§fn forward_2d(&self, lp: Lp) -> ProjResult<Xy>
fn forward_2d(&self, lp: Lp) -> ProjResult<Xy>
Source§fn inverse_2d(&self, xy: Xy) -> ProjResult<Lp>
fn inverse_2d(&self, xy: Xy) -> ProjResult<Lp>
Source§fn has_inverse(&self) -> bool
fn has_inverse(&self) -> bool
true).