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 boolean 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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more