Skip to content

Commit

Permalink
Pleteau model Railway (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinmiaooo authored Jan 12, 2024
2 parents 2779adf + 578086e commit cabd85f
Show file tree
Hide file tree
Showing 6 changed files with 3,668 additions and 6 deletions.
17 changes: 15 additions & 2 deletions nusamai-citygml/macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fn generate_citygml_impl_for_struct(
});
};

add_arm(0, b"lod0Point", "Point"); // only in CityGML 2.0
add_arm(0, b"lod0Point", "Point");
add_arm(0, b"lod0RoofEdge", "MultiSurface"); // only in CityGML 2.0
add_arm(0, b"lod0FootPrint", "MultiSurface"); // only in CityGML 2.0
add_arm(0, b"lod0MultiCurve", "MultiCurve");
Expand All @@ -196,7 +196,20 @@ fn generate_citygml_impl_for_struct(
add_arm(2, b"lod2Geometry", "Geometry"); // only in CityGML 2.0
add_arm(3, b"lod3Geometry", "Geometry"); // only in CityGML 2.0
add_arm(4, b"lod4Geometry", "Geometry"); // only in CityGML 2.0
add_arm(0, b"tin", "Triangulated");

match &prefix.value()[..] {
b"tran" => {
add_arm(0, b"lod0Network", "MultiCurve");
}
b"uro" => {
add_arm(2, b"lod2Network", "MultiCurve");
add_arm(3, b"lod3Network", "MultiCurve");
}
b"dem" => {
add_arm(0, b"tin", "Triangulated");
}
_ => {}
}

geom_into_object_expr = quote! {
Some(self.#field_ident)
Expand Down
5 changes: 4 additions & 1 deletion nusamai-citygml/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ impl<R: BufRead> SubTreeReader<'_, '_, R> {
Triangulated => self.parse_triangulated_prop(geomref, lod)?, // FIXME
Point => todo!(), // FIXME
MultiPoint => todo!(), // FIXME
MultiCurve => todo!(), // FIXME
MultiCurve => {
self.skip_current_element()?;
log::warn!("CompositeCurve is not supported yet.");
} // FIXME
}

self.state
Expand Down
25 changes: 24 additions & 1 deletion nusamai-plateau/src/models/iur/uro/transportation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ pub struct RoadType {

#[citygml_data(name = "uro:RailwayTrackAttribute")]
pub struct RailwayTrackAttribute {
#[citygml(geom = b"uro")]
geometries: nusamai_citygml::GeometryRef,

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

Expand Down Expand Up @@ -237,5 +240,25 @@ pub struct TrackAttribute {

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

#[citygml_data(name = "uro:RailwayRouteAttribute")]
pub struct RailwayRouteAttribute {
#[citygml(path = b"uro:operatorType", required)]
pub operator_type: Option<Code>,

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

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

#[citygml(path = b"uro:railwayType", required)]
pub railway_type: Option<Code>,

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

#[citygml(path = b"uro:endStation", required)]
pub end_station: Option<String>,
}
32 changes: 30 additions & 2 deletions nusamai-plateau/src/models/transportation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,39 @@ pub struct Road {

#[citygml_feature(name = "tran:Railway")]
pub struct Railway {
#[citygml(path = b"uro:tranDmAttribute")]
pub tran_dm_attribute: Vec<uro::DmAttributeProperty>, // -> uro:DmAttribute

#[citygml(path = b"tran:class")]
pub class: Option<Code>,

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

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

#[citygml(path = b"tran:trafficArea/tran:TrafficArea")]
traffic_area: Vec<TrafficArea>,
pub traffic_area: Vec<TrafficArea>,

#[citygml(path = b"tran:auxiliaryTrafficArea/tran:AuxiliaryTrafficArea")]
auxiliary_traffic_area: Vec<AuxiliaryTrafficArea>,
pub auxiliary_traffic_area: Vec<AuxiliaryTrafficArea>,

#[citygml(path = b"uro:tranDataQualityAttribute/uro:TransportationDataQualityAttribute")]
pub tran_data_quality_attribute: Option<uro::TransportationDataQualityAttribute>,

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

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

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

#[citygml(path = b"uro:railwayRouteAttribute/uro:RailwayRouteAttribute")]
pub railway_route_attribute: Vec<uro::RailwayRouteAttribute>,

}

#[citygml_feature(name = "tran:Track")]
Expand Down
Loading

0 comments on commit cabd85f

Please sign in to comment.