From d95e93846f855eecab37256c86fbd873a8e6bbdc Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Fri, 25 Oct 2024 00:22:28 +0900 Subject: [PATCH] Follow tinymvt TagsEncoder API changes (#674) --- nusamai/src/sink/mvt/mod.rs | 6 ++---- nusamai/src/sink/mvt/tags.rs | 27 +++++++++++---------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/nusamai/src/sink/mvt/mod.rs b/nusamai/src/sink/mvt/mod.rs index 76040f8e..7457041e 100644 --- a/nusamai/src/sink/mvt/mod.rs +++ b/nusamai/src/sink/mvt/mod.rs @@ -433,14 +433,12 @@ fn make_tile(default_detail: i32, serialized_feats: &[Vec]) -> Result = Vec::new(); - let layer = if let object::Value::Object(obj) = &feature.properties { let layer = layers.entry_ref(obj.typename.as_ref()).or_default(); // Encode attributes as MVT tags for (key, value) in &obj.attributes { - convert_properties(&mut tags, &mut layer.tags_enc, key, value); + convert_properties(&mut layer.tags_enc, key, value); } // Make a MVT feature id (u64) by hashing the original feature id string. @@ -457,7 +455,7 @@ fn make_tile(default_detail: i32, serialized_feats: &[Vec]) -> Result, - tags_enc: &mut TagsEncoder, - name: &str, - tree: &object::Value, -) { +pub fn convert_properties(tags_enc: &mut TagsEncoder, name: &str, tree: &object::Value) { match &tree { nusamai_citygml::Value::String(v) => { - tags.extend(tags_enc.add(name, v.clone().into())); + tags_enc.add(name, v.clone().into()); } nusamai_citygml::Value::Code(v) => { - tags.extend(tags_enc.add(name, v.value().into())); + tags_enc.add(name, v.value().into()); } nusamai_citygml::Value::Integer(v) => { - tags.extend(tags_enc.add(name, (*v).into())); + tags_enc.add(name, (*v).into()); } nusamai_citygml::Value::NonNegativeInteger(v) => { - tags.extend(tags_enc.add(name, (*v).into())); + tags_enc.add(name, (*v).into()); } nusamai_citygml::Value::Double(v) => { - tags.extend(tags_enc.add(name, (*v).into())); + tags_enc.add(name, (*v).into()); } nusamai_citygml::Value::Measure(v) => { - tags.extend(tags_enc.add(name, v.value().into())); + tags_enc.add(name, v.value().into()); } nusamai_citygml::Value::Boolean(v) => { - tags.extend(tags_enc.add(name, (*v).into())); + tags_enc.add(name, (*v).into()); } nusamai_citygml::Value::Uri(v) => { - tags.extend(tags_enc.add(name, v.value().to_string().into())); + tags_enc.add(name, v.value().to_string().into()); } nusamai_citygml::Value::Date(v) => { - tags.extend(tags_enc.add(name, v.to_string().into())); + tags_enc.add(name, v.to_string().into()); } nusamai_citygml::Value::Point(v) => { - tags.extend(tags_enc.add(name, format!("{:?}", v).into())); // FIXME + tags_enc.add(name, format!("{:?}", v).into()); // FIXME } nusamai_citygml::Value::Array(_arr) => { // ignore non-root attributes