Enum omf::AttributeData

source ·
pub enum AttributeData {
    Number {
        values: Array<Number>,
        colormap: Option<NumberColormap>,
    },
    Vector {
        values: Array<Vector>,
    },
    Text {
        values: Array<Text>,
    },
    Category {
        values: Array<Index>,
        names: Array<Name>,
        gradient: Option<Array<Gradient>>,
        attributes: Vec<Attribute>,
    },
    Boolean {
        values: Array<Boolean>,
    },
    Color {
        values: Array<Color>,
    },
    MappedTexture {
        image: Array<Image>,
        texcoords: Array<Texcoord>,
    },
    ProjectedTexture {
        image: Array<Image>,
        orient: Orient2,
        width: f64,
        height: f64,
    },
}
Expand description

The various types of data that can be attached to an Attribute.

Variants§

§

Number

Number data with flexible type.

Values can be stored as 32 or 64-bit signed integers, 32 or 64-bit floating point, date, or date-time. Valid dates are approximately ±262,000 years from the common era. Date-time values are written with microsecond accuracy, and times are always in UTC.

Fields

§values: Array<Number>

Array with Number type storing the attribute values.

§colormap: Option<NumberColormap>

Optional colormap. If absent then the importing application should invent one.

Make sure the colormap uses the same number type as values.

§

Vector

2D or 3D vector data.

Fields

§values: Array<Vector>

Array with Vector type storing the attribute values.

§

Text

Text data.

Fields

§values: Array<Text>

Array with Text type storing the attribute values.

§

Category

Category data.

A name is required for each category, a color is optional, and other values can be attached as sub-attributes.

Fields

§values: Array<Index>

Array with Index type storing the category indices.

Values are indices into the names array, colors array, and any sub-attributes, and must be within range for them.

§names: Array<Name>

Array with Name type storing category names.

§gradient: Option<Array<Gradient>>

Optional array with Gradient type storing category colors.

If present, must be the same length as names. If absent then the importing application should invent colors.

§attributes: Vec<Attribute>

Additional attributes that use the same indices.

This could be used to store the density of rock types in a lithology attribute for example. The location field of these attributes must be Categoriescrate::Location::Categories. They must have the same length as names.

§

Boolean

Boolean or filter data.

Fields

§values: Array<Boolean>

Array with Boolean type storing the attribute values.

These values may be true, false, or null. Applications that don’t support three-valued logic may treat null as false.

§

Color

Color data.

Fields

§values: Array<Color>

Array with Color type storing the attribute values.

Null values may be replaced by the element color, or a default color as the application prefers.

§

MappedTexture

A texture applied with UV mapping.

Typically applied to surface vertices. Applications may ignore other locations.

Fields

§image: Array<Image>

Array with Image type storing the texture image.

§texcoords: Array<Texcoord>

Array with Texcoord type storing the UV texture coordinates.

Each item is a normalized (U, V) pair. For values outside [0, 1] the texture wraps.

§

ProjectedTexture

A texture defined as a rectangle in space projected along its normal.

Behavior of the texture outside the projected rectangle is not defined. The texture might repeat, clip the element, or itself be clipped to reveal the flat color of the element.

The attribute location must be Projected.

Fields

§image: Array<Image>

Array with Image type storing the texture image.

§orient: Orient2

Orientation of the image.

§width: f64

Width of the image projection in space.

§height: f64

Height of the image projection in space.

Implementations§

source§

impl AttributeData

source

pub fn is_empty(&self) -> bool

True if the attribute data length is zero.

source

pub fn len(&self) -> u64

Length of the attribute data; zero for projected textures.

Trait Implementations§

source§

impl Clone for AttributeData

source§

fn clone(&self) -> AttributeData

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for AttributeData

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for AttributeData

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl JsonSchema for AttributeData

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl PartialEq for AttributeData

source§

fn eq(&self, other: &AttributeData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for AttributeData

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Validate for AttributeData

source§

fn validate(&mut self) -> Result<Problems, Problems>

Call to validate the object, returning errors and warnings. Read more
source§

impl StructuralPartialEq for AttributeData

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,