Skip to content

Commit

Permalink
Plateau model bridge (#168)
Browse files Browse the repository at this point in the history
橋梁モデルの属性読み込みとテスト

#167 を含めています

relate #165

---------

Co-authored-by: Taku Fukada <naninunenor@gmail.com>
  • Loading branch information
xinmiaooo and ciscorn authored Jan 10, 2024
1 parent 8a25af4 commit 720e90c
Show file tree
Hide file tree
Showing 18 changed files with 84,489 additions and 7 deletions.
11 changes: 8 additions & 3 deletions nusamai-citygml/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ impl<R: BufRead> SubTreeReader<'_, '_, R> {
MultiSurface => self.parse_multi_surface_prop(geomref, lod)?,
Geometry => self.parse_geometry_prop(geomref, lod)?, // FIXME: not only surfaces
Triangulated => self.parse_triangulated_prop(geomref, lod)?, // FIXME
Point => todo!(),
MultiPoint => todo!(),
MultiCurve => todo!(),
Point => todo!(), // FIXME
MultiPoint => todo!(), // FIXME
MultiCurve => todo!(), // FIXME
}

self.state
Expand Down Expand Up @@ -397,6 +397,11 @@ impl<R: BufRead> SubTreeReader<'_, '_, R> {
(Bound(GML31_NS), b"Polygon") => todo!(),
(Bound(GML31_NS), b"TriangulatedSurface") => todo!(),
(Bound(GML31_NS), b"Tin") => todo!(),
(Bound(GML31_NS), b"MultiCurve") => {
// FIXME, TODO
self.skip_current_element()?; // FIXME, TODO
GeometryType::Curve
} // FIXME:
_ => {
return Err(ParseError::SchemaViolation(format!(
"Unexpected element <{}>",
Expand Down
346 changes: 343 additions & 3 deletions nusamai-plateau/src/models/bridge.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,349 @@
use nusamai_citygml::{citygml_feature, CityGMLElement};
use super::core::Address;
use super::iur::uro;
use nusamai_citygml::{citygml_feature, CityGMLElement, citygml_property, Code, GYear};

#[citygml_feature(name = "brid:Bridge")]
pub struct Bridge {
#[citygml(path = b"brid:class")]
pub class: Option<String>,
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:yearOfConstruction")]
pub year_of_construction: Option<GYear>,

#[citygml(path = b"brid:yearOfDemolition")]
pub year_of_demolition: Option<GYear>,

#[citygml(path = b"brid:isMovable")]
pub is_movable: Option<bool>,

#[citygml(path = b"brid:outerBridgeConstruction/brid:BridgeConstructionElement")]
pub outer_bridge_construction: Vec<BridgeConstructionElement>,

#[citygml(path = b"brid:outerBridgeInstallation/brid:BridgeInstallation")]
pub outer_bridge_installation: Vec<BridgeInstallation>,

#[citygml(path = b"brid:interiorBridgeInstallation/brid:IntBridgeInstallation")]
pub interior_bridge_installation: Vec<IntBridgeInstallation>,

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

#[citygml(path = b"brid:interiorBridgeRoom/brid:BridgeRoom")]
pub interior_bridge_room: Vec<BridgeRoom>,

#[citygml(path = b"brid:consistsOfBridgePart/brid:BridgePart")]
pub consists_of_bridge_part: Vec<BridgePart>,

#[citygml(path = b"brid:address/core:Address")]
pub address: Vec<Address>,

#[citygml(path = b"uro:bridBaseAttribute/uro:ConstructionBaseAttribute")]
pub brid_base_attribute: Vec<uro::ConstructionBaseAttribute>,

#[citygml(path = b"uro:bridDataQualityAttribute/uro:ConstructionDataQualityAttribute")]
pub brid_data_quality_attribute: Option<uro::ConstructionDataQualityAttribute>,

#[citygml(path = b"uro:bridDisasterRiskAttribute")]
pub brid_disaster_risk_attribute: Vec<uro::DisasterRiskAttributeProperty>, // -> uro:DisasterRiskAttribute

#[citygml(path = b"uro:bridDmAttribute")]
pub brid_dm_attribute: Vec<uro::DmAttributeProperty>, // -> uro:DmAttribute

#[citygml(path = b"uro:bridFacilityAttribute")]
pub brid_facility_attribute: Vec<uro::FacilityAttributeProperty>, // -> uro:FacilityAttribute

#[citygml(path = b"uro:bridFacilityIdAttribute")]
pub brid_facility_id_attribute: Option<uro::FacilityIdAttributeProperty>, // -> uro:FacilityIdAttribute

#[citygml(path = b"uro:bridFacilityTypeAttribute/uro:FacilityTypeAttribute")]
pub brid_facility_type_attribute: Vec<uro::FacilityTypeAttribute>,

#[citygml(path = b"uro:bridFunctionalAttribute/uro:BridgeFunctionalAttribute")]
pub brid_functional_attribute: Vec<uro::BridgeFunctionalAttribute>,

#[citygml(path = b"uro:bridRiskAssessmentAttribute/uro:ConstructionRiskAssessmentAttribute")]
pub brid_risk_assessment_attribute: Vec<uro::ConstructionRiskAssessmentAttribute>,

#[citygml(path = b"uro:bridStructureAttribute/uro:BridgeStructureAttribute")]
pub brid_structure_attribute: Vec<uro::BridgeStructureAttribute>,

}


#[citygml_feature(name = "brid:BridgePart")]
pub struct BridgePart {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:yearOfConstruction")]
pub year_of_construction: Option<GYear>,

#[citygml(path = b"brid:yearOfDemolition")]
pub year_of_demolition: Option<GYear>,

#[citygml(path = b"brid:isMovable")]
pub is_movable: Option<bool>,

#[citygml(path = b"brid:outerBridgeConstruction/brid:BridgeConstructionElement")]
pub outer_bridge_construction: Vec<BridgeConstructionElement>,

#[citygml(path = b"brid:outerBridgeInstallation/brid:BridgeInstallation")]
pub outer_bridge_installation: Vec<BridgeInstallation>,

#[citygml(path = b"brid:interiorBridgeInstallation/brid:IntBridgeInstallation")]
pub interior_bridge_installation: Vec<IntBridgeInstallation>,

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

#[citygml(path = b"brid:interiorBridgeRoom/brid:BridgeRoom")]
pub interior_bridge_room: Vec<BridgeRoom>,

#[citygml(path = b"brid:consistsOfBridgePart/brid:BridgePart")]
pub consists_of_bridge_part: Vec<BridgePart>,

#[citygml(path = b"brid:address/core:Address")]
pub address: Vec<Address>,

#[citygml(path = b"uro:bridBaseAttribute/uro:ConstructionBaseAttribute")]
pub brid_base_attribute: Vec<uro::ConstructionBaseAttribute>,

#[citygml(path = b"uro:bridDataQualityAttribute/uro:ConstructionDataQualityAttribute")]
pub brid_data_quality_attribute: Option<uro::ConstructionDataQualityAttribute>,

#[citygml(path = b"uro:bridDisasterRiskAttribute")]
pub brid_disaster_risk_attribute: Vec<uro::DisasterRiskAttributeProperty>, // -> uro:DisasterRiskAttribute

#[citygml(path = b"uro:bridDmAttribute")]
pub brid_dm_attribute: Vec<uro::DmAttributeProperty>, // -> uro:DmAttribute

#[citygml(path = b"uro:bridFacilityAttribute")]
pub brid_facility_attribute: Vec<uro::FacilityAttributeProperty>, // -> uro:FacilityAttribute

#[citygml(path = b"uro:bridFacilityIdAttribute")]
pub brid_facility_id_attribute: Option<uro::FacilityIdAttributeProperty>, // -> uro:FacilityIdAttribute

#[citygml(path = b"uro:bridFacilityTypeAttribute/uro:FacilityTypeAttribute")]
pub brid_facility_type_attribute: Vec<uro::FacilityTypeAttribute>,

#[citygml(path = b"uro:bridFunctionalAttribute/uro:BridgeFunctionalAttribute")]
pub brid_functional_attribute: Vec<uro::BridgeFunctionalAttribute>,

#[citygml(path = b"uro:bridRiskAssessmentAttribute/uro:ConstructionRiskAssessmentAttribute")]
pub brid_risk_assessment_attribute: Vec<uro::ConstructionRiskAssessmentAttribute>,

#[citygml(path = b"uro:bridStructureAttribute/uro:BridgeStructureAttribute")]
pub brid_structure_attribute: Vec<uro::BridgeStructureAttribute>,

}

#[citygml_feature(name = "brid:BridgeConstructionElement")]
pub struct BridgeConstructionElement {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

}

#[citygml_feature(name = "brid:BridgeRoom")]
pub struct BridgeRoom {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

#[citygml(path = b"brid:interiorFurniture/brid:BridgeFurniture")]
pub interior_furniture: Vec<BridgeFurniture>,

#[citygml(path = b"brid:bridgeRoomInstallation/brid:IntBridgeInstallation")]
pub bridge_room_installation: Vec<IntBridgeInstallation>,

}
#[citygml_feature(name = "brid:RoofSurface")]
pub struct RoofSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:WallSurface")]
pub struct WallSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:GroundSurface")]
pub struct GroundSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:OuterCeilingSurface")]
pub struct OuterCeilingSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:OuterFloorSurface")]
pub struct OuterFloorSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:ClosureSurface")]
pub struct ClosureSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:InteriorWallSurface")]
pub struct InteriorWallSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}


#[citygml_feature(name = "brid:BridgeInstallation")]
pub struct BridgeInstallation {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

}

#[citygml_feature(name = "brid:IntBridgeInstallation")]
pub struct IntBridgeInstallation {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"brid:boundedBy")]
pub bounded_by: Vec<BoundarySurfaceProperty>, // -> brid:_BoundarySurface

}

#[citygml_feature(name = "brid:BridgeFurniture")]
pub struct BridgeFurniture {
#[citygml(path = b"brid:class")]
pub class: Option<Code>,

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

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

}

#[citygml_property(name = "bldg:_OpeningProperty")]
pub enum OpeningProperty {
#[citygml(path = b"bldg:Door")]
Door(Door),
#[citygml(path = b"bldg:Window")]
Window(Window),
}

// TODO: Building と類似の構造を持つ
#[citygml_feature(name = "bldg:Door")]
pub struct Door {
#[citygml(path = b"uro:ifcOpeningAttribute")]
pub ifc_opening_attribute: Vec<uro::IfcAttributeProperty>, // -> uro:IfcAttribute

#[citygml(path = b"uro:indoorOpeningAttribute")]
pub indoor_opening_attribute: Vec<uro::IndoorAttributeProperty>, // -> uro:IndoorAttribute

#[citygml(path = b"bldg:address/core:Address")]
pub address: Vec<Address>,

}

#[citygml_feature(name = "bldg:Window")]
pub struct Window {
#[citygml(path = b"uro:ifcOpeningAttribute")]
pub ifc_opening_attribute: Vec<uro::IfcAttributeProperty>, // -> uro:IfcAttribute

#[citygml(path = b"uro:indoorOpeningAttribute")]
pub indoor_opening_attribute: Vec<uro::IndoorAttributeProperty>, // -> uro:IndoorAttribute

}

#[citygml_property(name = "brid:_BoundarySurfaceProperty")]
pub enum BoundarySurfaceProperty {
#[citygml(path = b"brid:CeilingSurface")]
CeilingSurface(CeilingSurface),
#[citygml(path = b"brid:ClosureSurface")]
ClosureSurface(ClosureSurface),
#[citygml(path = b"brid:FloorSurface")]
FloorSurface(FloorSurface),
#[citygml(path = b"brid:GroundSurface")]
GroundSurface(GroundSurface),
#[citygml(path = b"brid:InteriorWallSurface")]
InteriorWallSurface(InteriorWallSurface),
#[citygml(path = b"brid:OuterCeilingSurface")]
OuterCeilingSurface(OuterCeilingSurface),
#[citygml(path = b"brid:OuterFloorSurface")]
OuterFloorSurface(OuterFloorSurface),
#[citygml(path = b"brid:RoofSurface")]
RoofSurface(RoofSurface),
#[citygml(path = b"brid:WallSurface")]
WallSurface(WallSurface),
}

#[citygml_feature(name = "brid:CeilingSurface")]
pub struct CeilingSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}

#[citygml_feature(name = "brid:FloorSurface")]
pub struct FloorSurface {
#[citygml(path = b"brid:opening")]
pub opening: Vec<OpeningProperty>, // -> brid:_Opening

}
Loading

0 comments on commit 720e90c

Please sign in to comment.