From d6af1a9a0f9f6165f667fc0944effb69eabe871e Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Tue, 19 Dec 2023 00:05:08 +0900 Subject: [PATCH] =?UTF-8?q?models:=20i-UR=E3=81=BE=E3=82=8F=E3=82=8A?= =?UTF-8?q?=E3=81=AE=E6=95=B4=E7=90=86=E3=81=AA=E3=81=A9=20(#80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i-UR 関係のモデルのモジュールなどを少し整理する。一旦 #70 に対してマージする。 --- nusamai-plateau/citygml/src/values.rs | 6 ++- nusamai-plateau/src/models/cityfurniture.rs | 38 +++++++++++++------ nusamai-plateau/src/models/iur/mod.rs | 11 ++---- .../src/models/iur/{ => urf}/landslide.rs | 0 nusamai-plateau/src/models/iur/urf/mod.rs | 5 +++ .../models/iur/{ => uro}/city_furniture.rs | 2 +- .../iur/{urban_object.rs => uro/common.rs} | 0 nusamai-plateau/src/models/iur/uro/mod.rs | 13 +++++++ .../{ => iur/uro}/other_construction.rs | 0 .../iur/{ => uro}/underground_building.rs | 0 .../models/iur/{ => uro}/utility_network.rs | 0 nusamai-plateau/src/models/mod.rs | 12 +++--- 12 files changed, 58 insertions(+), 29 deletions(-) rename nusamai-plateau/src/models/iur/{ => urf}/landslide.rs (100%) create mode 100644 nusamai-plateau/src/models/iur/urf/mod.rs rename nusamai-plateau/src/models/iur/{ => uro}/city_furniture.rs (91%) rename nusamai-plateau/src/models/iur/{urban_object.rs => uro/common.rs} (100%) create mode 100644 nusamai-plateau/src/models/iur/uro/mod.rs rename nusamai-plateau/src/models/{ => iur/uro}/other_construction.rs (100%) rename nusamai-plateau/src/models/iur/{ => uro}/underground_building.rs (100%) rename nusamai-plateau/src/models/iur/{ => uro}/utility_network.rs (100%) diff --git a/nusamai-plateau/citygml/src/values.rs b/nusamai-plateau/citygml/src/values.rs index ce768d38d..6f23eb107 100644 --- a/nusamai-plateau/citygml/src/values.rs +++ b/nusamai-plateau/citygml/src/values.rs @@ -4,6 +4,8 @@ use crate::CityGMLElement; pub use chrono::NaiveDate; use std::io::BufRead; +pub type Date = chrono::NaiveDate; + impl CityGMLElement for String { #[inline] fn parse(&mut self, st: &mut SubTreeReader) -> Result<(), ParseError> { @@ -166,11 +168,11 @@ impl CityGMLElement for Measure { } } -impl CityGMLElement for NaiveDate { +impl CityGMLElement for Date { #[inline] fn parse(&mut self, st: &mut SubTreeReader) -> Result<(), ParseError> { let text = st.parse_text()?; - match NaiveDate::parse_from_str(text, "%Y-%m-%d") { + match Date::parse_from_str(text, "%Y-%m-%d") { Ok(v) => { *self = v; Ok(()) diff --git a/nusamai-plateau/src/models/cityfurniture.rs b/nusamai-plateau/src/models/cityfurniture.rs index b9f27ede1..5953c9487 100644 --- a/nusamai-plateau/src/models/cityfurniture.rs +++ b/nusamai-plateau/src/models/cityfurniture.rs @@ -1,8 +1,5 @@ -use super::iur::city_furniture::{CityFurnitureDataQualityAttribute, CityFurnitureDetailAttribute}; -use super::iur::urban_object::{ - DmAttribute, FacilityAttribute, FacilityIdAttribute, FacilityTypeAttribute, -}; -use citygml::{CityGMLElement, Code, GeometryRef}; +use super::iur::uro; +use citygml::{CityGMLElement, Code, Date, GeometryRef}; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Default, Debug, CityGMLElement)] @@ -13,6 +10,21 @@ pub struct CityFurniture { #[citygml(path = b"@gml:id")] id: Option, + #[citygml(path = b"gml:identifier")] + identifier: Option, + + #[citygml(path = b"gml:name")] + name: Option, + + #[citygml(path = b"gml:description")] + description: Option, + + #[citygml(path = b"core:creationDate")] + creation_date: Option, + + #[citygml(path = b"core:terminationDate")] + termination_date: Option, + #[citygml(path = b"frn:class")] pub class: Option, @@ -23,20 +35,22 @@ pub struct CityFurniture { pub usage: Vec, #[citygml(path = b"uro:cityFurnitureDetailAttribute")] - pub city_furniture_detail_attribute: Vec, + pub city_furniture_detail_attribute: Vec, - #[citygml(path = b"uro:cityFurnitureDataQualityAttribute/uro:CityFurnitureDataQualityAttribute")] - pub city_furniture_data_quality_attribute: Option, + #[citygml( + path = b"uro:cityFurnitureDataQualityAttribute/uro:CityFurnitureDataQualityAttribute" + )] + pub city_furniture_data_quality_attribute: Option, #[citygml(path = b"uro:frnFacilityTypeAttribute")] - pub frn_facility_type_attribute: Vec, + pub frn_facility_type_attribute: Vec, #[citygml(path = b"uro:frnFacilityIdAttribute")] - pub frn_facility_id_attribute: Option, + pub frn_facility_id_attribute: Option, #[citygml(path = b"uro:frnFacilityAttribute")] - pub frn_facility_attribute: Vec, + pub frn_facility_attribute: Vec, #[citygml(path = b"uro:frnDmAttribute")] - pub frn_dm_attribute: Vec, + pub frn_dm_attribute: Vec, } diff --git a/nusamai-plateau/src/models/iur/mod.rs b/nusamai-plateau/src/models/iur/mod.rs index 16e67011d..adadbcfaa 100644 --- a/nusamai-plateau/src/models/iur/mod.rs +++ b/nusamai-plateau/src/models/iur/mod.rs @@ -1,8 +1,5 @@ -pub mod landslide; -pub mod underground_building; -pub mod utility_network; -pub mod city_furniture; -pub mod urban_object; +//! i-UR (i-Urban Revitalization) Urban Planning ADE +//! -pub use landslide::SedimentDisasterProneArea; -pub use underground_building::UndergroundBuilding; +pub mod urf; +pub mod uro; diff --git a/nusamai-plateau/src/models/iur/landslide.rs b/nusamai-plateau/src/models/iur/urf/landslide.rs similarity index 100% rename from nusamai-plateau/src/models/iur/landslide.rs rename to nusamai-plateau/src/models/iur/urf/landslide.rs diff --git a/nusamai-plateau/src/models/iur/urf/mod.rs b/nusamai-plateau/src/models/iur/urf/mod.rs new file mode 100644 index 000000000..757df7b76 --- /dev/null +++ b/nusamai-plateau/src/models/iur/urf/mod.rs @@ -0,0 +1,5 @@ +//! Urban Object Module + +mod landslide; + +pub use landslide::*; diff --git a/nusamai-plateau/src/models/iur/city_furniture.rs b/nusamai-plateau/src/models/iur/uro/city_furniture.rs similarity index 91% rename from nusamai-plateau/src/models/iur/city_furniture.rs rename to nusamai-plateau/src/models/iur/uro/city_furniture.rs index 2a6d60976..78e96ad43 100644 --- a/nusamai-plateau/src/models/iur/city_furniture.rs +++ b/nusamai-plateau/src/models/iur/uro/city_furniture.rs @@ -26,5 +26,5 @@ pub struct CityFurnitureDataQualityAttribute { pub appearance_src_desc: Vec, #[citygml(path = b"uro:lodType")] - pub lod_type: Option, // uro:CityFurnitureLODType(enumerations) + pub lod_type: Option, // TODO: uro:CityFurnitureLODType(enumerations) } diff --git a/nusamai-plateau/src/models/iur/urban_object.rs b/nusamai-plateau/src/models/iur/uro/common.rs similarity index 100% rename from nusamai-plateau/src/models/iur/urban_object.rs rename to nusamai-plateau/src/models/iur/uro/common.rs diff --git a/nusamai-plateau/src/models/iur/uro/mod.rs b/nusamai-plateau/src/models/iur/uro/mod.rs new file mode 100644 index 000000000..8e9b01990 --- /dev/null +++ b/nusamai-plateau/src/models/iur/uro/mod.rs @@ -0,0 +1,13 @@ +//! Urban Object Module + +mod city_furniture; +mod common; +mod other_construction; +mod underground_building; +mod utility_network; + +pub use city_furniture::*; +pub use common::*; +pub use other_construction::*; +pub use underground_building::*; +// pub use utility_network::*; diff --git a/nusamai-plateau/src/models/other_construction.rs b/nusamai-plateau/src/models/iur/uro/other_construction.rs similarity index 100% rename from nusamai-plateau/src/models/other_construction.rs rename to nusamai-plateau/src/models/iur/uro/other_construction.rs diff --git a/nusamai-plateau/src/models/iur/underground_building.rs b/nusamai-plateau/src/models/iur/uro/underground_building.rs similarity index 100% rename from nusamai-plateau/src/models/iur/underground_building.rs rename to nusamai-plateau/src/models/iur/uro/underground_building.rs diff --git a/nusamai-plateau/src/models/iur/utility_network.rs b/nusamai-plateau/src/models/iur/uro/utility_network.rs similarity index 100% rename from nusamai-plateau/src/models/iur/utility_network.rs rename to nusamai-plateau/src/models/iur/uro/utility_network.rs diff --git a/nusamai-plateau/src/models/mod.rs b/nusamai-plateau/src/models/mod.rs index 3e9be0c4b..b71c7960d 100644 --- a/nusamai-plateau/src/models/mod.rs +++ b/nusamai-plateau/src/models/mod.rs @@ -5,7 +5,6 @@ pub mod cityobjectgroup; pub mod generics; pub mod iur; pub mod landuse; -pub mod other_construction; pub mod relief; pub mod transportation; pub mod tunnel; @@ -17,10 +16,9 @@ pub use building::Building; pub use cityfurniture::CityFurniture; pub use cityobjectgroup::CityObjectGroup; pub use generics::GenericCityObject; -pub use iur::landslide::SedimentDisasterProneArea; -pub use iur::underground_building::UndergroundBuilding; +pub use iur::urf; +pub use iur::uro; pub use landuse::LandUse; -pub use other_construction::OtherConstruction; pub use relief::ReliefFeature; pub use transportation::{Railway, Road, Square, Track, Waterway}; pub use tunnel::Tunnel; @@ -77,14 +75,14 @@ pub enum CityObject { // i-UR urban objects // #[citygml(path = b"uro:OtherConstruction")] - OtherConstruction(OtherConstruction), + OtherConstruction(uro::OtherConstruction), #[citygml(path = b"uro:UndergroundBuilding")] - UndergroundBuilding(UndergroundBuilding), + UndergroundBuilding(uro::UndergroundBuilding), // // i-UR urban functions // #[citygml(path = b"urf:SedimentDisasterProneArea")] - SedimentDisasterProneArea(SedimentDisasterProneArea), + SedimentDisasterProneArea(urf::SedimentDisasterProneArea), // // and more ... }