Skip to main content

SceneObject

Struct SceneObject 

Source
pub struct SceneObject {
    pub uuid: String,
    pub uri: String,
    pub title: String,
    pub qualified_type: String,
    pub geometry: Geometry,
    pub crs: Option<Crs>,
    pub interpretation: Option<Related>,
    pub feature: Option<Related>,
    pub metadata: Metadata,
    pub attributes: Vec<Attribute>,
}
Expand description

One representation, ready to be written out.

Fields§

§uuid: String

The representation’s uuid.

§uri: String

Its ETP URI - what an application looks it up by.

§title: String

Its citation title, or an empty string when it has none.

§qualified_type: String

Its qualified type, e.g. resqml20.obj_TriangulatedSetRepresentation.

§geometry: Geometry

The shape.

§crs: Option<Crs>

Where it is, when it names a coordinate system.

§interpretation: Option<Related>

The interpretation this represents, when it names one.

§feature: Option<Related>

The feature that interpretation interprets, when it can be followed.

§metadata: Metadata

Whatever a Spec was asked to collect.

Empty unless the caller supplied one. Exporters write these verbatim, so the same spec produces the same keys in an OBJ comment, a GeoJSON property and a VTK field array - one configuration, every format.

§attributes: Vec<Attribute>

Values hanging on this shape: one number per node, per cell, per triangle.

Empty unless the caller filled it with attributes_for, because reading them means reading every property of the package and their external arrays - which an export of pure geometry has no reason to pay for.

Implementations§

Source§

impl SceneObject

Source

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

The points of every patch, placed as asked, in one array.

The order matches Geometry::merged, so the indices that call returns address these points.

Source

pub fn geometry_in(&self, placement: Placement) -> Result<Geometry>

The shape itself, every patch placed as asked - its topology untouched.

What an operation computing for the scene must read: the scene draws the projected placement, so a geometry computed in the local frame and handed back as an artefact lands where the file’s numbers are, not where the object is drawn - offsets, rotation and the vertical flip missing. The same place as every other placement here, so the two cannot drift.

Source

pub fn mesh_in( &self, placement: Placement, ) -> Result<(Vec<Point>, Vec<[u32; 3]>)>

Points and triangles together, placed as asked.

Source

pub fn drawable_in(&self, placement: Placement) -> Result<Drawable>

Points, triangles and line segments, placed.

What a viewer wants: mesh_in answers only for triangles, so a grid and a trajectory came back with no indices at all and were drawn as point clouds. See crate::geometry::Geometry::drawable.

Source

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

Place points that are not part of this object’s own geometry - in the same coordinate system, through the same place every patch goes through, so a caller drawing something alongside the shape (a frame’s head portion, crate::well::head_portion) cannot place it differently from the shape itself.

Source

pub fn epsg(&self) -> Option<u64>

The EPSG code of the system these coordinates sit in, when there is one.

Source

pub fn as_shape(&self, shape: Shape) -> Result<Cow<'_, SceneObject>>

This object drawn in the shape asked for.

Borrowed when the shape is already what the object naturally is, which is the ordinary case - Shape::Auto on anything, or a rule that happens to agree with the file.

The points never move, because every conversion in crate::shape is arithmetic on indices. A point-scoped property therefore comes through untouched. A cell-scoped one may not: asking a hexahedral grid for its surface replaces a million cells with the faces around them, and there is no value per face to be had. Such an attribute is dropped rather than written against elements it was not measured on - the same rule as everywhere else here, and the reason it is safe for the case that matters is that a 2D grid drawn as quadrilaterals has exactly as many cells as before, so nothing is lost there.

Source

pub fn drawable_only(&self) -> Option<SceneObject>

This object with every node that has no position removed - or None when every node has one, which is the ordinary case and costs one pass and no copy.

What crate::geometry::of returns is what the file says; this is what can be drawn. The two are kept apart on purpose: a package with 34 000 null Z values should be reported as holding them and exported without them. Reading and drawing are two questions, and answering the first with the second’s answer is how a node count silently stops matching the file. See crate::defined for what the standard does and does not say about those nulls.

The attributes come along. Their values go through the same index maps the geometry was compacted with, so a property still lines up with the elements it was written for - leaving them alone would colour the survivors with their neighbours’ numbers, which is the worst of the three possible outcomes because it is the one that looks right.

An attribute whose length never matched the geometry is passed through untouched, to be refused by the check that already exists rather than silently reshaped here.

Trait Implementations§

Source§

impl Clone for SceneObject

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SceneObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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