Skip to content

Commit

Permalink
Handle geometry type for LOD0 Footprint / roof edge
Browse files Browse the repository at this point in the history
  • Loading branch information
topheg committed Oct 28, 2022
1 parent ca78b02 commit da4e587
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions sources/include/parser/cityobjectelementparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace citygml {
static bool attributesSetInitialized;

void parseGeometryForLODLevel(int lod);
void parseGeometryForLODLevel(int lod, CityObject::CityObjectsType parentType);
void parseImplicitGeometryForLODLevel(int lod);
void parseGeometryPropertyElementForLODLevel(int lod, const std::string& id);
};
Expand Down
21 changes: 15 additions & 6 deletions sources/src/parser/cityobjectelementparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,17 @@ namespace citygml {
|| node == NodeType::DEM_BreaklinesNode) {

parseGeometryForLODLevel(std::stoi(m_model->getAttribute("dem:lod")));
} else if (node == NodeType::BLDG_Lod0FootPrintNode
|| node == NodeType::BLDG_Lod0RoofEdgeNode
|| node == NodeType::GEN_Lod0TerrainIntersectionNode
} else if (node == NodeType::GEN_Lod0TerrainIntersectionNode
|| node == NodeType::WTR_Lod0MultiCurveNode
|| node == NodeType::WTR_Lod0MultiSurfaceNode) {

parseGeometryForLODLevel(0);
} else if (node == NodeType::BLDG_Lod0FootPrintNode) {
// for Lod0 footprint, we must explicitly set the City Object Type, because the parent type is "Building", and it doesn't allow to discriminate between the ground and roof surface
parseGeometryForLODLevel(0, CityObject::CityObjectsType::COT_GroundSurface);
} else if (node == NodeType::BLDG_Lod0RoofEdgeNode) {
// for Lod0 roof edge, we must explicitly set the City Object Type, because the parent type is "Building", and it doesn't allow to discriminate between the ground and roof surface
parseGeometryForLODLevel(0, CityObject::CityObjectsType::COT_RoofSurface);
} else if (node == NodeType::BLDG_Lod1MultiCurveNode
|| node == NodeType::BLDG_Lod1MultiSurfaceNode
|| node == NodeType::BLDG_Lod1SolidNode
Expand Down Expand Up @@ -588,13 +592,18 @@ namespace citygml {
{
return m_model;
}

void CityObjectElementParser::parseGeometryForLODLevel(int lod)
void CityObjectElementParser::parseGeometryForLODLevel(int lod, CityObject::CityObjectsType parentType)
{
setParserForNextElement(new GeometryElementParser(m_documentParser, m_factory, m_logger, lod, m_model->getType(), [this](Geometry* geom) {
setParserForNextElement(new GeometryElementParser(m_documentParser, m_factory, m_logger, lod, parentType, [this](Geometry* geom) {
m_model->addGeometry(geom);
}));
}

void CityObjectElementParser::parseGeometryForLODLevel(int lod)
{
parseGeometryForLODLevel(lod, m_model->getType());
}

void CityObjectElementParser::parseImplicitGeometryForLODLevel(int lod)
{
Expand Down

0 comments on commit da4e587

Please sign in to comment.