pub struct Attribute {
pub name: String,
pub description: String,
pub units: String,
pub metadata: Map<String, Value>,
pub location: Location,
pub data: AttributeData,
}
Expand description
Fields§
§name: String
Attribute name. Should be unique within the containing element.
description: String
Optional attribute description.
units: String
Optional unit of the attribute data, default empty.
OMF does not currently attempt to standardize the strings you can use here, but our recommendations are:
-
Use full names, so “kilometers” rather than “km”. The abbreviations for non-metric units aren’t consistent and complex units can be confusing.
-
Use plurals, so “feet” rather than “foot”.
-
Avoid ambiguity, so “long tons” rather than just “tons”.
-
Accept American and British spellings, so “meter” and “metre” are the same.
metadata: Map<String, Value>
Attribute metadata.
location: Location
Selects which part of the element the attribute is attached to.
See the documentation for each Geometry
variant for a list of what
locations are valid.
data: AttributeData
The attribute data.
Implementations§
source§impl Attribute
impl Attribute
sourcepub fn from_numbers(
name: impl Into<String>,
location: Location,
values: Array<Number>,
) -> Self
pub fn from_numbers( name: impl Into<String>, location: Location, values: Array<Number>, ) -> Self
Convenience function to create a number attribute.
sourcepub fn from_numbers_continuous_colormap(
name: impl Into<String>,
location: Location,
values: Array<Number>,
range: impl Into<NumberRange>,
gradient: Array<Gradient>,
) -> Self
pub fn from_numbers_continuous_colormap( name: impl Into<String>, location: Location, values: Array<Number>, range: impl Into<NumberRange>, gradient: Array<Gradient>, ) -> Self
Convenience function to create a number attribute with a continuous colormap.
sourcepub fn from_numbers_discrete_colormap(
name: impl Into<String>,
location: Location,
values: Array<Number>,
boundaries: Array<Boundary>,
gradient: Array<Gradient>,
) -> Self
pub fn from_numbers_discrete_colormap( name: impl Into<String>, location: Location, values: Array<Number>, boundaries: Array<Boundary>, gradient: Array<Gradient>, ) -> Self
Convenience function to create a number attribute with a discrete colormap.
sourcepub fn from_vectors(
name: impl Into<String>,
location: Location,
values: Array<Vector>,
) -> Self
pub fn from_vectors( name: impl Into<String>, location: Location, values: Array<Vector>, ) -> Self
Convenience function to create a vector attribute.
sourcepub fn from_strings(
name: impl Into<String>,
location: Location,
values: Array<Text>,
) -> Self
pub fn from_strings( name: impl Into<String>, location: Location, values: Array<Text>, ) -> Self
Convenience function to create a string attribute.
sourcepub fn from_categories(
name: impl Into<String>,
location: Location,
values: Array<Index>,
names: Array<Name>,
gradient: Option<Array<Gradient>>,
attributes: impl IntoIterator<Item = Attribute>,
) -> Self
pub fn from_categories( name: impl Into<String>, location: Location, values: Array<Index>, names: Array<Name>, gradient: Option<Array<Gradient>>, attributes: impl IntoIterator<Item = Attribute>, ) -> Self
Convenience function to create a category attribute.
sourcepub fn from_booleans(
name: impl Into<String>,
location: Location,
values: Array<Boolean>,
) -> Self
pub fn from_booleans( name: impl Into<String>, location: Location, values: Array<Boolean>, ) -> Self
Convenience function to create a number attribute.
sourcepub fn from_colors(
name: impl Into<String>,
location: Location,
values: Array<Color>,
) -> Self
pub fn from_colors( name: impl Into<String>, location: Location, values: Array<Color>, ) -> Self
Convenience function to create a color attribute.
sourcepub fn from_texture_map(
name: impl Into<String>,
image: Array<Image>,
location: Location,
texcoords: Array<Texcoord>,
) -> Self
pub fn from_texture_map( name: impl Into<String>, image: Array<Image>, location: Location, texcoords: Array<Texcoord>, ) -> Self
Convenience function to create a mapped texture attribute.
sourcepub fn from_texture_project(
name: impl Into<String>,
image: Array<Image>,
orient: Orient2,
width: f64,
height: f64,
) -> Self
pub fn from_texture_project( name: impl Into<String>, image: Array<Image>, orient: Orient2, width: f64, height: f64, ) -> Self
Convenience function to create a projected texture attribute.
pub fn is_empty(&self) -> bool
Trait Implementations§
source§impl<'de> Deserialize<'de> for Attribute
impl<'de> Deserialize<'de> for Attribute
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl JsonSchema for Attribute
impl JsonSchema for Attribute
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreimpl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)