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: StringThe representation’s uuid.
uri: StringIts ETP URI - what an application looks it up by.
title: StringIts citation title, or an empty string when it has none.
qualified_type: StringIts qualified type, e.g. resqml20.obj_TriangulatedSetRepresentation.
geometry: GeometryThe 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: MetadataWhatever 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
impl SceneObject
Sourcepub fn points_in(&self, placement: Placement) -> Result<Vec<Point>>
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.
Sourcepub fn geometry_in(&self, placement: Placement) -> Result<Geometry>
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.
Sourcepub fn mesh_in(
&self,
placement: Placement,
) -> Result<(Vec<Point>, Vec<[u32; 3]>)>
pub fn mesh_in( &self, placement: Placement, ) -> Result<(Vec<Point>, Vec<[u32; 3]>)>
Points and triangles together, placed as asked.
Sourcepub fn drawable_in(&self, placement: Placement) -> Result<Drawable>
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.
Sourcepub fn place_points(
&self,
points: Vec<Point>,
placement: Placement,
) -> Result<Vec<Point>>
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.
Sourcepub fn epsg(&self) -> Option<u64>
pub fn epsg(&self) -> Option<u64>
The EPSG code of the system these coordinates sit in, when there is one.
Sourcepub fn as_shape(&self, shape: Shape) -> Result<Cow<'_, SceneObject>>
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.
Sourcepub fn drawable_only(&self) -> Option<SceneObject>
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.