Skip to main content

Options

Struct Options 

Source
pub struct Options<'a> {
    pub reprojector: Option<&'a dyn Reprojector>,
    pub placement: Option<Placement>,
    pub target_epsg: Option<u64>,
    pub native_crs: bool,
    pub shapes: Shapes,
    pub time_equivalence: Option<f64>,
}
Expand description

What a caller can ask of an export, beyond the object itself.

Fields§

§reprojector: Option<&'a dyn Reprojector>

A geodesy backend, for the formats that need real coordinates.

None is a supported state: an exporter that needs one says so by name rather than writing projected metres into a longitude field.

§placement: Option<Placement>

Override the placement the exporter would choose.

For a caller that knows better - a viewer that wants local coordinates out of a format that would normally be projected.

§target_epsg: Option<u64>

Reproject into this EPSG system before writing.

Overrides placement, which stops meaning anything once a datum is crossed: reprojection starts from placed metres or it starts from nowhere.

§native_crs: bool

Write coordinates as they are stored, reprojecting nothing.

The escape hatch for the formats whose specification fixes a coordinate system - GeoJSON is WGS 84 by definition. With this set, such a format writes the placed native coordinates instead, embeds the legacy 2008 crs member when the EPSG code is known (QGIS and GDAL honour it), and accepts objects that name no CRS at all.

The file is then knowingly non-conformant. That is the point: for a package under repair, coordinates one can look at beat a refusal - but it has to be asked for, because a conformant-looking file with the wrong coordinate system is the silent failure this crate is arranged against.

§shapes: Shapes

Which form to draw each type in - see crate::shapes.

Empty means every object in its natural shape, which is what every export did before there was anything to ask.

§time_equivalence: Option<f64>

Length units one second of vertical travel time stands for.

None - the default - keeps the refusal: a representation in a time system cannot be written in metres, and saying so is the honest answer.

§This is an equivalence, not a conversion

A seismic surface has no depth. Getting one needs a velocity model the package does not carry, and RESQML puts the time kind - two-way against one-way - outside the CRS on purpose (TRG §12.9 leaves it to the acquisition activity), so nothing in the file even says whether to halve. Every number this produces is therefore half or double a real depth depending on a fact the file withholds.

What it buys is a mesh: a surface that can sit in the same file as the depth objects around it, at a size somebody can look at. That is a legitimate thing to want and this is the only honest way to give it - the caller states the number, and the number is written into the file beside the geometry so the mesh carries its own caveat. A mesh loses its context the day it is exported; the export is the last moment anything can still say what it holds.

Metres per second, matching the metres every exporter writes.

Implementations§

Source§

impl<'a> Options<'a>

Source

pub fn new() -> Self

Nothing special.

Source

pub fn with_reprojector(self, reprojector: &'a dyn Reprojector) -> Self

Supply a geodesy backend.

Source

pub fn with_placement(self, placement: Placement) -> Self

Force a placement.

Source

pub fn with_target_epsg(self, epsg: u64) -> Self

Write coordinates in this EPSG system. Needs a backend.

Source

pub fn with_native_crs(self) -> Self

Write native coordinates, reprojecting nothing. See Options::native_crs.

Source

pub fn with_shapes(self, shapes: Shapes) -> Self

Choose, per type, what form to draw. See crate::shapes::Shapes.

Source

pub fn with_time_equivalence(self, metres_per_second: f64) -> Self

State what one second of vertical travel time stands for, in metres, so that time-domain objects can be written at all.

See Options::time_equivalence for what this does and does not claim.

Source

pub fn can_place_vertical(&self, object: &SceneObject) -> bool

Whether this object’s vertical axis can be placed at all.

false for a time-domain object with no equivalence stated - which is the state every export was in until one could be. Asked before writing, so such an object is skipped and counted rather than failing the whole export at the first one: nine seismic horizons in ALWYN used to abort a run that had forty perfectly writable surfaces in it, and “the export failed” is not what a person needed to be told.

Source

pub fn time_equivalence_note(&self, object: &SceneObject) -> Option<String>

The sentence an exporter writes into the file, and a caller prints.

One place, so the comment in an OBJ, the field in a VTK and the line on a terminal cannot drift into saying different things about the same number. It names the equivalence and what it is not, because the second half is what stops somebody measuring a depth off the result.

Source

pub fn points( &self, object: &SceneObject, placement: Placement, ) -> Result<Vec<Point>>

The points an exporter should write, placed and reprojected as asked.

The single funnel every exporter goes through, so that “which coordinates am I writing” has one answer and not one per format.

Source

pub fn points_in_epsg( &self, object: &SceneObject, target: u64, ) -> Result<Vec<Point>>

The points, in one named EPSG system.

For a format whose coordinate system is fixed by its own specification - GeoJSON is WGS 84 and nothing else - rather than chosen by the caller.

Placement is always Metres here, and not the caller’s choice: a reprojection consumes projected metres. Feeding it local coordinates, or metres that have already been reprojected, is the kind of mistake that produces a plausible-looking file in the wrong hemisphere.

Trait Implementations§

Source§

impl<'a> Default for Options<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Options<'a>

§

impl<'a> !Send for Options<'a>

§

impl<'a> !Sync for Options<'a>

§

impl<'a> !UnwindSafe for Options<'a>

§

impl<'a> Freeze for Options<'a>

§

impl<'a> Unpin for Options<'a>

§

impl<'a> UnsafeUnpin for Options<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more