Trait geodesy::Context

source ·
pub trait Context {
    // Required methods
    fn new() -> Self
       where Self: Sized;
    fn op(&mut self, definition: &str) -> Result<OpHandle, Error>;
    fn apply(
        &self,
        op: OpHandle,
        direction: Direction,
        operands: &mut dyn CoordinateSet
    ) -> Result<usize, Error>;
    fn globals(&self) -> BTreeMap<String, String>;
    fn steps(&self, op: OpHandle) -> Result<&Vec<String>, Error>;
    fn params(
        &self,
        op: OpHandle,
        index: usize
    ) -> Result<ParsedParameters, Error>;
    fn register_op(&mut self, name: &str, constructor: OpConstructor);
    fn register_resource(&mut self, name: &str, definition: &str);
    fn get_op(&self, name: &str) -> Result<OpConstructor, Error>;
    fn get_resource(&self, name: &str) -> Result<String, Error>;
    fn get_blob(&self, name: &str) -> Result<Vec<u8>, Error>;
    fn get_grid(&self, name: &str) -> Result<Arc<dyn Grid>, Error>;
}
Expand description

Modes of communication between the Rust Geodesy internals and the external world (i.e. resources like grids, transformation definitions, or ellipsoid parameters).

Required Methods§

source

fn new() -> Self
where Self: Sized,

In general, implementations should make sure that new differs from default only by adding access to the builtin adaptors (geo:in, gis:out etc.)

source

fn op(&mut self, definition: &str) -> Result<OpHandle, Error>

Instantiate the operation given by definition

source

fn apply( &self, op: OpHandle, direction: Direction, operands: &mut dyn CoordinateSet ) -> Result<usize, Error>

Apply operation op to operands

source

fn globals(&self) -> BTreeMap<String, String>

Globally defined default values (typically just ellps=GRS80)

source

fn steps(&self, op: OpHandle) -> Result<&Vec<String>, Error>

Definitions of steps

source

fn params(&self, op: OpHandle, index: usize) -> Result<ParsedParameters, Error>

Parsed parameters of a specific step

source

fn register_op(&mut self, name: &str, constructor: OpConstructor)

Register a new user-defined operator

source

fn register_resource(&mut self, name: &str, definition: &str)

Register a new user-defined resource (macro, ellipsoid parameter set…)

source

fn get_op(&self, name: &str) -> Result<OpConstructor, Error>

Helper for the Op instantiation logic in Op::op(...)

source

fn get_resource(&self, name: &str) -> Result<String, Error>

Helper for the Op instantiation logic in Op::op(...)

source

fn get_blob(&self, name: &str) -> Result<Vec<u8>, Error>

Access blob-like resources by identifier

source

fn get_grid(&self, name: &str) -> Result<Arc<dyn Grid>, Error>

Access grid resources by identifier

Implementors§