Skip to content

Commit

Permalink
Fix: DisasterRiskAttributeProperty for backward compatibility (#547)
Browse files Browse the repository at this point in the history
## Description(変更内容)

#524 の修正

### 詳細

PLATEAU 4.0において `uro:BuildingHighTideRiskAttribute`(建築物で使用) と
`uro:HighTideRiskAttribute` (その他の地物で使用)が1つの `uro:HighTideRiskAttribute`
に統一されたため #524 で対応したが、後方互換性のために `uro:BuildingHighTideRiskAttribute`
要素も拾うような対処はしていなかった。対応する。
  • Loading branch information
ciscorn authored May 29, 2024
1 parent 1cd36a8 commit 720b2f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 95 deletions.
96 changes: 1 addition & 95 deletions nusamai-plateau/src/models/iur/uro/building.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use nusamai_citygml::{
citygml_data, citygml_property, CityGmlElement, Code, Date, GYear, Length, Measure,
};
use nusamai_citygml::{citygml_data, CityGmlElement, Code, Date, GYear, Length, Measure};

#[citygml_data(name = "uro:BuildingIDAttribute")]
pub struct BuildingIDAttribute {
Expand Down Expand Up @@ -137,98 +135,6 @@ pub struct BuildingDetailAttribute {
pub survey_year: Option<GYear>,
}

#[citygml_property(name = "uro:BuildingDisasterRiskAttributeProperty")]
pub enum BuildingDisasterRiskAttributeProperty {
#[citygml(path = b"uro:BuildingHighTideRiskAttribute")]
BuildingHighTideRiskAttribute(BuildingHighTideRiskAttribute),
#[citygml(path = b"uro:BuildingInlandFloodingRiskAttribute")]
BuildingInlandFloodingRiskAttribute(BuildingInlandFloodingRiskAttribute),
#[citygml(path = b"uro:BuildingLandSlideRiskAttribute")]
BuildingLandSlideRiskAttribute(BuildingLandSlideRiskAttribute),
#[citygml(path = b"uro:BuildingRiverFloodingRiskAttribute")]
BuildingRiverFloodingRiskAttribute(BuildingRiverFloodingRiskAttribute),
#[citygml(path = b"uro:BuildingTsunamiRiskAttribute")]
BuildingTsunamiRiskAttribute(BuildingTsunamiRiskAttribute),
}

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

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

#[citygml(path = b"uro:rankOrg")]
pub rank_org: Option<Code>,

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

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

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

#[citygml(path = b"uro:rankOrg")]
pub rank_org: Option<Code>,

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

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

#[citygml(path = b"uro:areaType", required)]
pub area_type: Option<Code>,
}

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

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

#[citygml(path = b"uro:rankOrg")]
pub rank_org: Option<Code>,

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

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

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

#[citygml(path = b"uro:rankOrg")]
pub rank_org: Option<Code>,

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

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

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

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

#[citygml_data(name = "uro:RealEstateIDAttribute")]
pub struct RealEstateIDAttribute {
#[citygml(path = b"uro:realEstateIDOfBuilding", required)]
Expand Down
5 changes: 5 additions & 0 deletions nusamai-plateau/src/models/iur/uro/disaster_risk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ use nusamai_citygml::{citygml_data, citygml_property, CityGmlElement, Code, Leng

#[citygml_property(name = "uro:DisasterRiskAttributeProperty")]
pub enum DisasterRiskAttributeProperty {
#[citygml(path = b"uro:BuildingHighTideRiskAttribute")] // for backward compatibility
#[citygml(path = b"uro:HighTideRiskAttribute")]
HighTideRiskAttribute(HighTideRiskAttribute),
#[citygml(path = b"uro:BuildingInlandFloodingRiskAttribute")] // for backward compatibility
#[citygml(path = b"uro:InlandFloodingRiskAttribute")]
InlandFloodingRiskAttribute(InlandFloodingRiskAttribute),
#[citygml(path = b"uro:BuildingLandSlideRiskAttribute")] // for backward compatibility
#[citygml(path = b"uro:LandSlideRiskAttribute")]
LandSlideRiskAttribute(LandSlideRiskAttribute),
#[citygml(path = b"uro:ReservoirFloodingRiskAttribute")]
ReservoirFloodingRiskAttribute(ReservoirFloodingRiskAttribute),
#[citygml(path = b"uro:BuildingRiverFloodingRiskAttribute")] // for backward compatibility
#[citygml(path = b"uro:RiverFloodingRiskAttribute")]
RiverFloodingRiskAttribute(RiverFloodingRiskAttribute),
#[citygml(path = b"uro:BuildingTsunamiRiskAttribute")] // for backward compatibility
#[citygml(path = b"uro:TsunamiRiskAttribute")]
TsunamiRiskAttribute(TsunamiRiskAttribute),
}
Expand Down

0 comments on commit 720b2f0

Please sign in to comment.