Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLATEAUモデル: 都市設備(CityFurniture)の実装 - 続き #70

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions nusamai-plateau/citygml/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<R: BufRead>(&mut self, st: &mut SubTreeReader<R>) -> Result<(), ParseError> {
Expand Down Expand Up @@ -166,11 +168,11 @@ impl CityGMLElement for Measure {
}
}

impl CityGMLElement for NaiveDate {
impl CityGMLElement for Date {
#[inline]
fn parse<R: BufRead>(&mut self, st: &mut SubTreeReader<R>) -> 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(())
Expand Down
38 changes: 37 additions & 1 deletion nusamai-plateau/src/models/cityfurniture.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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)]
Expand All @@ -9,6 +10,21 @@ pub struct CityFurniture {
#[citygml(path = b"@gml:id")]
id: Option<String>,

#[citygml(path = b"gml:identifier")]
identifier: Option<String>,

#[citygml(path = b"gml:name")]
name: Option<String>,

#[citygml(path = b"gml:description")]
description: Option<String>,

#[citygml(path = b"core:creationDate")]
creation_date: Option<Date>,

#[citygml(path = b"core:terminationDate")]
termination_date: Option<Date>,

#[citygml(path = b"frn:class")]
ciscorn marked this conversation as resolved.
Show resolved Hide resolved
pub class: Option<Code>,

Expand All @@ -17,4 +33,24 @@ pub struct CityFurniture {

#[citygml(path = b"frn:usage")]
pub usage: Vec<Code>,

#[citygml(path = b"uro:cityFurnitureDetailAttribute")]
pub city_furniture_detail_attribute: Vec<uro::CityFurnitureDetailAttribute>,

#[citygml(
path = b"uro:cityFurnitureDataQualityAttribute/uro:CityFurnitureDataQualityAttribute"
)]
pub city_furniture_data_quality_attribute: Option<uro::CityFurnitureDataQualityAttribute>,

#[citygml(path = b"uro:frnFacilityTypeAttribute")]
pub frn_facility_type_attribute: Vec<uro::FacilityTypeAttribute>,

#[citygml(path = b"uro:frnFacilityIdAttribute")]
pub frn_facility_id_attribute: Option<uro::FacilityIdAttribute>,

#[citygml(path = b"uro:frnFacilityAttribute")]
pub frn_facility_attribute: Vec<uro::FacilityAttribute>,

#[citygml(path = b"uro:frnDmAttribute")]
pub frn_dm_attribute: Vec<uro::DmAttribute>,
}
ciscorn marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 4 additions & 5 deletions nusamai-plateau/src/models/iur/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod landslide;
pub mod underground_building;
pub mod utility_network;
//! i-UR (i-Urban Revitalization) Urban Planning ADE
//!

pub use landslide::SedimentDisasterProneArea;
pub use underground_building::UndergroundBuilding;
pub mod urf;
pub mod uro;
5 changes: 5 additions & 0 deletions nusamai-plateau/src/models/iur/urf/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! Urban Object Module

mod landslide;

pub use landslide::*;
30 changes: 30 additions & 0 deletions nusamai-plateau/src/models/iur/uro/city_furniture.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use citygml::{CityGMLElement, Code};

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, CityGMLElement)]

Check warning on line 4 in nusamai-plateau/src/models/iur/uro/city_furniture.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/city_furniture.rs#L3-L4

Added lines #L3 - L4 were not covered by tests
pub struct CityFurnitureDetailAttribute {
#[citygml(path = b"uro:facilityType")]
pub facility_type: Option<Code>,

#[citygml(path = b"uro:description")]
pub description: Option<String>,
}

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

Check warning on line 13 in nusamai-plateau/src/models/iur/uro/city_furniture.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/city_furniture.rs#L13

Added line #L13 was not covered by tests
#[derive(Default, Debug, CityGMLElement)]
pub struct CityFurnitureDataQualityAttribute {
#[citygml(path = b"uro:srcScale")]
pub src_scale: Vec<Code>,

#[citygml(path = b"uro:geometrySrcDesc")]
pub geometry_src_desc: Vec<Code>,

#[citygml(path = b"uro:thematicSrcDesc")]
pub thematic_src_desc: Vec<Code>,

#[citygml(path = b"uro:appearanceSrcDesc")]
pub appearance_src_desc: Vec<Code>,

#[citygml(path = b"uro:lodType")]
pub lod_type: Option<String>, // TODO: uro:CityFurnitureLODType(enumerations)
}
65 changes: 65 additions & 0 deletions nusamai-plateau/src/models/iur/uro/common.rs
ciscorn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
use citygml::{CityGMLElement, Code};

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, CityGMLElement)]

Check warning on line 4 in nusamai-plateau/src/models/iur/uro/common.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/common.rs#L3-L4

Added lines #L3 - L4 were not covered by tests
pub struct FacilityTypeAttribute {
#[citygml(path = b"uro:class")]
pub class: Option<Code>,

#[citygml(path = b"uro:function")]
pub function: Vec<Code>,
}

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, CityGMLElement)]

Check warning on line 14 in nusamai-plateau/src/models/iur/uro/common.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/common.rs#L13-L14

Added lines #L13 - L14 were not covered by tests
pub struct FacilityIdAttribute {
#[citygml(path = b"uro:id")]
pub id: Option<String>,

#[citygml(path = b"uro:partId")]
pub part_id: Option<String>,

#[citygml(path = b"uro:branchId")]
pub branch_id: Option<String>,

#[citygml(path = b"uro:prefecture")]
pub prefecture: Vec<Code>,

#[citygml(path = b"uro:city")]
pub city: Vec<Code>,

#[citygml(path = b"uro:route")]
pub route: Option<String>,

#[citygml(path = b"uro:startPost")]
pub start_post: Option<String>,

#[citygml(path = b"uro:endPost")]
pub end_post: Option<String>,

#[citygml(path = b"uro:startLat")]
pub start_lat: Option<f64>,

#[citygml(path = b"uro:startLong")]
pub start_long: Option<f64>,

#[citygml(path = b"uro:alternativeName")]
pub alternative_name: Vec<String>,
}

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, CityGMLElement)]

Check warning on line 51 in nusamai-plateau/src/models/iur/uro/common.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/common.rs#L50-L51

Added lines #L50 - L51 were not covered by tests
pub struct DmAttribute {
#[citygml(path = b"uro:dmCode")]
pub dm_code: Code,

#[citygml(path = b"uro:meshCode")]
pub mesh_code: Vec<Code>,
}

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, CityGMLElement)]

Check warning on line 61 in nusamai-plateau/src/models/iur/uro/common.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-plateau/src/models/iur/uro/common.rs#L60-L61

Added lines #L60 - L61 were not covered by tests
pub struct FacilityAttribute {
#[citygml(path = b"uro:facilityId")]
pub facility_id: Option<String>,
}
13 changes: 13 additions & 0 deletions nusamai-plateau/src/models/iur/uro/mod.rs
Original file line number Diff line number Diff line change
@@ -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::*;
12 changes: 5 additions & 7 deletions nusamai-plateau/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 ...
}
Loading