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: boolWrite 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: ShapesWhich 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>
impl<'a> Options<'a>
Sourcepub fn with_reprojector(self, reprojector: &'a dyn Reprojector) -> Self
pub fn with_reprojector(self, reprojector: &'a dyn Reprojector) -> Self
Supply a geodesy backend.
Sourcepub fn with_placement(self, placement: Placement) -> Self
pub fn with_placement(self, placement: Placement) -> Self
Force a placement.
Sourcepub fn with_target_epsg(self, epsg: u64) -> Self
pub fn with_target_epsg(self, epsg: u64) -> Self
Write coordinates in this EPSG system. Needs a backend.
Sourcepub fn with_native_crs(self) -> Self
pub fn with_native_crs(self) -> Self
Write native coordinates, reprojecting nothing. See Options::native_crs.
Sourcepub fn with_shapes(self, shapes: Shapes) -> Self
pub fn with_shapes(self, shapes: Shapes) -> Self
Choose, per type, what form to draw. See crate::shapes::Shapes.
Sourcepub fn with_time_equivalence(self, metres_per_second: f64) -> Self
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.
Sourcepub fn can_place_vertical(&self, object: &SceneObject) -> bool
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.
Sourcepub fn time_equivalence_note(&self, object: &SceneObject) -> Option<String>
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.
Sourcepub fn points(
&self,
object: &SceneObject,
placement: Placement,
) -> Result<Vec<Point>>
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.
Sourcepub fn points_in_epsg(
&self,
object: &SceneObject,
target: u64,
) -> Result<Vec<Point>>
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.