Enum vtkio::model::Attribute[][src]

pub enum Attribute {
    DataArray(DataArray),
    Field {
        name: String,
        data_array: Vec<FieldArray>,
    },
}

Data structure that stores a VTK attribute.

Variants

DataArray(DataArray)

A data array with any number of components.

This is the standard way to represent data in XML formats.

It is also used to represent VECTORS, NORMALS, TEXTURE_COORDINATES, LOOKUP_TABLEs, COLOR_SCALARS and TENSORS in the legacy VTK format, each of which are identified by the elem field in the DataArray struct.

Field

Field attribute.

Essentially an array of arrays of any size. This can be used to represent data for alternative topologies that don’t correspond to the current data set, like UV coordinate topology with seams.

This is a Legacy only attribute type.

Fields of Field

name: Stringdata_array: Vec<FieldArray>

Implementations

impl Attribute[src]

pub fn name(&self) -> &str[src]

Get the name of this attribute.

pub fn scalars_with_lookup(
    name: impl Into<String>,
    num_comp: u32,
    lookup_table: impl Into<String>
) -> Attribute
[src]

Constructs a new scalars attribute with an associated lookup table.

pub fn scalars(name: impl Into<String>, num_comp: u32) -> Attribute[src]

Constructs a new scalars attribute.

pub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Attribute[src]

Constructs a new color scalars attribute.

pub fn lookup_table(name: impl Into<String>) -> Attribute[src]

Constructs a new lookup table attribute.

pub fn vectors(name: impl Into<String>) -> Attribute[src]

Constructs a new vectors attribute.

pub fn normals(name: impl Into<String>) -> Attribute[src]

Constructs a new normals attribute.

pub fn tensors(name: impl Into<String>) -> Attribute[src]

Constructs a new tensors attribute.

pub fn tcoords(name: impl Into<String>, num_comp: u32) -> Attribute[src]

Constructs a new texture coordinates attribute with the given dimensionality.

pub fn generic(name: impl Into<String>, num_comp: u32) -> Attribute[src]

Constructs a new generic attribute with the given number of components.

pub fn field(name: impl Into<String>) -> Attribute[src]

Constructs a new field attribute with the given name.

pub fn with_data(self, new_data: impl Into<IOBuffer>) -> Self[src]

Sets the data of this attribute to the given buffer.

If this attribute is a Field, then nothing is changed.

If the data was previously already set, it will be overwritten with the one given in this function.

pub fn with_field_data(
    self,
    arrays: impl IntoIterator<Item = FieldArray>
) -> Self
[src]

Adds a vector of FieldArrays to this field attribute.

If this attribute is not a Field, then nothing is changed.

Examples

If it is more convenient to construct all field arrays individually, one can collect them all at once as follows

use vtkio::model::{Attribute, FieldArray};

let field_arrays = vec![
    FieldArray::new("A", 1),
    FieldArray::new("B", 2),
    FieldArray::new("C", 5),
];

let field = Attribute::field("Data").with_field_data(field_arrays);

pub fn add_field_data(self, data: impl Into<FieldArray>) -> Self[src]

Adds a field array to the field attribute.

If this attribute is not a Field, then nothing is changed.

Examples

One can collect a number of field arrays into a field attribute using with a sequence of calls to add_field_data.

use vtkio::model::{Attribute, FieldArray};

let field = Attribute::field("Data")
    .add_field_data(FieldArray::new("A", 1))
    .add_field_data(FieldArray::new("B", 2))
    .add_field_data(FieldArray::new("C", 5));

Trait Implementations

impl Clone for Attribute[src]

impl Debug for Attribute[src]

impl PartialEq<Attribute> for Attribute[src]

impl StructuralPartialEq for Attribute[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.