pub struct CityJSON {
pub thetype: CityJSONType,
pub version: String,
pub transform: Transform,
pub city_objects: HashMap<String, CityObject>,
pub vertices: Vec<Vec<i64>>,
pub metadata: Option<Metadata>,
pub appearance: Option<Appearance>,
pub geometry_templates: Option<GeometryTemplates>,
pub extensions: Option<Value>,
pub other: Value,
/* private fields */
}Fields§
§thetype: CityJSONType§version: String§transform: Transform§city_objects: HashMap<String, CityObject>§vertices: Vec<Vec<i64>>§metadata: Option<Metadata>§appearance: Option<Appearance>§geometry_templates: Option<GeometryTemplates>§extensions: Option<Value>§other: ValueImplementations§
Source§impl CityJSON
impl CityJSON
Sourcepub fn get_metadata(&self) -> Self
pub fn get_metadata(&self) -> Self
Get the “first line” (aka metadata or header) of a CityJSONSeq
Sourcepub fn get_cjfeature(&self, i: usize) -> Option<CityJSONFeature>
pub fn get_cjfeature(&self, i: usize) -> Option<CityJSONFeature>
Getter for the features in a CityJSON dataset. Starts at 0, and return Option::None if the index is out of bounds.
Sourcepub fn add_transform_correction(&mut self, t: Transform)
pub fn add_transform_correction(&mut self, t: Transform)
Used when many CityJSONSeq are used, the “transform” can be modified (the new value is a “correction”).
pub fn add_cjfeature(&mut self, cjf: &mut CityJSONFeature)
pub fn remove_duplicate_vertices(&mut self)
pub fn update_geographicalextent(&mut self)
pub fn update_transform(&mut self)
pub fn number_of_city_objects(&self) -> usize
Sourcepub fn sort_cjfeatures(&mut self, ss: SortingStrategy)
pub fn sort_cjfeatures(&mut self, ss: SortingStrategy)
When getting the CityJSONFeatures, this controls the order in which they are returned. By default they are returned in the order they were added.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CityJSON
impl<'de> Deserialize<'de> for CityJSON
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 PartialEq for CityJSON
Hand-written rather than derived: sorted_ids and transform_correction
are #[serde(skip)] internal bookkeeping, not part of the CityJSON
document. sorted_ids in particular is populated by iterating
city_objects (a HashMap, whose iteration order is not guaranteed
stable across independently-constructed maps) and can be further
reordered by sort_cjfeatures(SortingStrategy::Random), so a derived
PartialEq that included it would make == spuriously false for two
values representing the identical document. Excluding it here is what
makes equality mean “same document”, which is the only sense of equality
this crate (or its callers) should ever want. This does not violate the
“never hand-write” constraint, which is about Serialize/Deserialize
– a hand-written PartialEq cannot corrupt output.
impl PartialEq for CityJSON
Hand-written rather than derived: sorted_ids and transform_correction
are #[serde(skip)] internal bookkeeping, not part of the CityJSON
document. sorted_ids in particular is populated by iterating
city_objects (a HashMap, whose iteration order is not guaranteed
stable across independently-constructed maps) and can be further
reordered by sort_cjfeatures(SortingStrategy::Random), so a derived
PartialEq that included it would make == spuriously false for two
values representing the identical document. Excluding it here is what
makes equality mean “same document”, which is the only sense of equality
this crate (or its callers) should ever want. This does not violate the
“never hand-write” constraint, which is about Serialize/Deserialize
– a hand-written PartialEq cannot corrupt output.