From 2998faaf6c3943dd6b99a80eaa7aa44c26ba386f Mon Sep 17 00:00:00 2001 From: HarutakaMatsumoto Date: Tue, 26 Oct 2021 15:05:41 +0900 Subject: [PATCH 1/4] Succeeded load dem --- sources/include/citygml/cityobject.h | 2 ++ sources/src/parser/cityobjectelementparser.cpp | 12 +++++++++--- sources/src/parser/geometryelementparser.cpp | 2 +- test/citygmltest.cpp | 6 ++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sources/include/citygml/cityobject.h b/sources/include/citygml/cityobject.h index dbaeb891..3e9895d0 100644 --- a/sources/include/citygml/cityobject.h +++ b/sources/include/citygml/cityobject.h @@ -39,6 +39,8 @@ namespace citygml { COT_SolitaryVegetationObject = 1ll<< 13, COT_WaterBody = 1ll<< 14, COT_ReliefFeature = 1ll<< 15, + COT_ReliefComponent = 1ll<< 35, + COT_TINRelief = 1ll<< 36, COT_LandUse = 1ll<< 16, COT_Tunnel = 1ll<< 17, COT_Bridge = 1ll<< 18, diff --git a/sources/src/parser/cityobjectelementparser.cpp b/sources/src/parser/cityobjectelementparser.cpp index 78207f17..d3ac4440 100644 --- a/sources/src/parser/cityobjectelementparser.cpp +++ b/sources/src/parser/cityobjectelementparser.cpp @@ -93,6 +93,8 @@ namespace citygml { typeIDTypeMap.insert(HANDLE_TYPE(BLDG, OuterFloorSurface)); typeIDTypeMap.insert(HANDLE_TYPE(GRP, CityObjectGroup)); typeIDTypeMap.insert(HANDLE_TYPE(DEM, ReliefFeature)); + typeIDTypeMap.insert(HANDLE_TYPE(DEM, ReliefComponent)); + typeIDTypeMap.insert(HANDLE_TYPE(DEM, TINRelief)); typeIDTypeMap.insert(HANDLE_TYPE(BLDG, IntBuildingInstallation)); typeIDTypeMapInitialized = true; @@ -280,7 +282,9 @@ namespace citygml { || node == NodeType::GRP_ParentNode || node == NodeType::TRANS_TrafficAreaNode || node == NodeType::TRANS_AuxiliaryTrafficAreaNode - || node == NodeType::WTR_BoundedByNode) { + || node == NodeType::WTR_BoundedByNode + || node == NodeType::DEM_ReliefComponentNode + || node == NodeType::DEM_TINReliefNode) { setParserForNextElement(new CityObjectElementParser(m_documentParser, m_factory, m_logger, [this](CityObject* obj) { m_model->addChildCityObject(obj); })); @@ -298,7 +302,8 @@ namespace citygml { || node == NodeType::TRANS_Lod1MultiSurfaceNode || node == NodeType::WTR_Lod1MultiCurveNode || node == NodeType::WTR_Lod1MultiSurfaceNode - || node == NodeType::WTR_Lod1SolidNode) { + || node == NodeType::WTR_Lod1SolidNode + || node == NodeType::DEM_TinNode) { parseGeometryForLODLevel(1); } else if (node == NodeType::BLDG_Lod2MultiCurveNode @@ -380,7 +385,6 @@ namespace citygml { || node == NodeType::CORE_ExternalReferenceNode || node == NodeType::GML_MultiPointNode || node == NodeType::GRP_GeometryNode - || node == NodeType::DEM_ReliefComponentNode || node == NodeType::GEN_Lod0GeometryNode || node == NodeType::GEN_Lod0ImplicitRepresentationNode || node == NodeType::GEN_Lod0TerrainIntersectionNode @@ -504,6 +508,8 @@ namespace citygml { || node == NodeType::LUSE_Lod3MultiSurfaceNode || node == NodeType::LUSE_Lod4MultiSurfaceNode || node == NodeType::DEM_ReliefComponentNode + || node == NodeType::DEM_TINReliefNode + || node == NodeType::DEM_TinNode || node == NodeType::GEN_Lod0GeometryNode || node == NodeType::GEN_Lod0ImplicitRepresentationNode || node == NodeType::GEN_Lod0TerrainIntersectionNode diff --git a/sources/src/parser/geometryelementparser.cpp b/sources/src/parser/geometryelementparser.cpp index 8c184781..552cb89e 100644 --- a/sources/src/parser/geometryelementparser.cpp +++ b/sources/src/parser/geometryelementparser.cpp @@ -138,7 +138,7 @@ namespace citygml { }; setParserForNextElement(new SequenceParser(m_documentParser, m_logger, patchParserFactory, node)); - + return true; } return GMLObjectElementParser::parseChildElementStartTag(node, attributes); diff --git a/test/citygmltest.cpp b/test/citygmltest.cpp index 6e23399d..13da1265 100644 --- a/test/citygmltest.cpp +++ b/test/citygmltest.cpp @@ -120,9 +120,9 @@ int main( int argc, char **argv ) if ( log ) { std::cout << std::endl << "Objects hierarchy:" << std::endl; -// const citygml::ConstCityObjects& roots = city->getRootCityObjects(); + const citygml::ConstCityObjects& roots = city->getRootCityObjects(); -// for ( unsigned int i = 0; i < roots.size(); i++ ) analyzeObject( roots[ i ], 2 ); + for ( unsigned int i = 0; i < roots.size(); i++ ) analyzeObject( roots[ i ], 2 ); } std::cout << "Done." << std::endl; @@ -132,6 +132,8 @@ int main( int argc, char **argv ) void analyzeObject( const citygml::CityObject* object, unsigned int indent ) { + std::cout + << object->getTypeAsString(); // for ( unsigned int i = 0; i < indent; i++ ) std::cout << " "; // std::cout << "Object " << citygml::getCityObjectsClassName( object->getType() ) << ": " << object->getId() << std::endl; From c8a1ce23cd39d27d831041ecd616efec188476b5 Mon Sep 17 00:00:00 2001 From: HarutakaMatsumoto Date: Tue, 26 Oct 2021 16:09:06 +0900 Subject: [PATCH 2/4] Dealt with variable lod --- sources/src/parser/cityobjectelementparser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/src/parser/cityobjectelementparser.cpp b/sources/src/parser/cityobjectelementparser.cpp index d3ac4440..a3c22d59 100644 --- a/sources/src/parser/cityobjectelementparser.cpp +++ b/sources/src/parser/cityobjectelementparser.cpp @@ -292,6 +292,8 @@ namespace citygml { || node == NodeType::APP_AppearanceMemberNode) { setParserForNextElement(new AppearanceElementParser(m_documentParser, m_factory, m_logger)); + } else if (node == NodeType::DEM_TinNode) { + parseGeometryForLODLevel(std::stoi(m_model->getAttribute("dem:lod"))); } else if (node == NodeType::BLDG_Lod1MultiCurveNode || node == NodeType::BLDG_Lod1MultiSurfaceNode || node == NodeType::BLDG_Lod1SolidNode @@ -302,8 +304,7 @@ namespace citygml { || node == NodeType::TRANS_Lod1MultiSurfaceNode || node == NodeType::WTR_Lod1MultiCurveNode || node == NodeType::WTR_Lod1MultiSurfaceNode - || node == NodeType::WTR_Lod1SolidNode - || node == NodeType::DEM_TinNode) { + || node == NodeType::WTR_Lod1SolidNode) { parseGeometryForLODLevel(1); } else if (node == NodeType::BLDG_Lod2MultiCurveNode From b49b0761306ac8d8c61a7ee890c283a7fdb31300 Mon Sep 17 00:00:00 2001 From: HarutakaMatsumoto Date: Tue, 26 Oct 2021 18:11:24 +0900 Subject: [PATCH 3/4] Implemented all parts except RectifiedGridCoverage class --- sources/include/citygml/cityobject.h | 3 +++ sources/include/citygml/geometry.h | 3 ++- sources/include/parser/nodetypes.h | 4 ++- sources/src/citygml/citygmlfactory.cpp | 2 ++ sources/src/citygml/geometry.cpp | 2 ++ .../src/parser/cityobjectelementparser.cpp | 26 ++++++++++++++++--- sources/src/parser/geometryelementparser.cpp | 1 + sources/src/parser/nodetypes.cpp | 6 +++-- 8 files changed, 40 insertions(+), 7 deletions(-) diff --git a/sources/include/citygml/cityobject.h b/sources/include/citygml/cityobject.h index 3e9895d0..40b388e4 100644 --- a/sources/include/citygml/cityobject.h +++ b/sources/include/citygml/cityobject.h @@ -41,6 +41,9 @@ namespace citygml { COT_ReliefFeature = 1ll<< 15, COT_ReliefComponent = 1ll<< 35, COT_TINRelief = 1ll<< 36, + COT_MassPointRelief = 1ll<< 37, + COT_BreaklineRelief = 1ll<< 38, + COT_RasterRelief = 1ll<< 39, COT_LandUse = 1ll<< 16, COT_Tunnel = 1ll<< 17, COT_Bridge = 1ll<< 18, diff --git a/sources/include/citygml/geometry.h b/sources/include/citygml/geometry.h index 89c77cbc..ddc21723 100644 --- a/sources/include/citygml/geometry.h +++ b/sources/include/citygml/geometry.h @@ -34,7 +34,8 @@ namespace citygml { GT_InteriorWall = 1 << 6, GT_Ceiling = 1 << 7, GT_OuterCeiling = 1 << 8, - GT_OuterFloor = 1 << 9 + GT_OuterFloor = 1 << 9, + GT_Tin = 1 << 10, }; unsigned int getLOD() const; diff --git a/sources/include/parser/nodetypes.h b/sources/include/parser/nodetypes.h index 34611bcc..89bbd2d6 100644 --- a/sources/include/parser/nodetypes.h +++ b/sources/include/parser/nodetypes.h @@ -146,9 +146,11 @@ namespace citygml { NODETYPE( GML, Shell ) NODETYPE( GML, PolyhedralSurface ) NODETYPE( GML, Surface ) - NODETYPE( GML, PolygonPatch) + NODETYPE( GML, PolygonPatch ) NODETYPE( GML, LineString ) + + NODETYPE( GML, RectifiedGridCoverage ) // BLDG NODETYPE( BLDG, Building ) diff --git a/sources/src/citygml/citygmlfactory.cpp b/sources/src/citygml/citygmlfactory.cpp index 840f77b2..1a80e4c8 100644 --- a/sources/src/citygml/citygmlfactory.cpp +++ b/sources/src/citygml/citygmlfactory.cpp @@ -58,6 +58,8 @@ namespace citygml { return Geometry::GeometryType::GT_OuterCeiling; case CityObject::CityObjectsType::COT_OuterFloorSurface: return Geometry::GeometryType::GT_OuterFloor; + case CityObject::CityObjectsType::COT_TINRelief: + return Geometry::GeometryType::GT_Tin; default: return Geometry::GeometryType::GT_Unknown; } diff --git a/sources/src/citygml/geometry.cpp b/sources/src/citygml/geometry.cpp index e3fab3b3..70115ee8 100644 --- a/sources/src/citygml/geometry.cpp +++ b/sources/src/citygml/geometry.cpp @@ -96,6 +96,8 @@ namespace citygml { return "OuterCeiling"; case GeometryType::GT_OuterFloor: return "OuterFloor"; + case GeometryType::GT_Tin: + return "Tin"; default: return "Unknown"; } diff --git a/sources/src/parser/cityobjectelementparser.cpp b/sources/src/parser/cityobjectelementparser.cpp index a3c22d59..48f78a05 100644 --- a/sources/src/parser/cityobjectelementparser.cpp +++ b/sources/src/parser/cityobjectelementparser.cpp @@ -95,6 +95,9 @@ namespace citygml { typeIDTypeMap.insert(HANDLE_TYPE(DEM, ReliefFeature)); typeIDTypeMap.insert(HANDLE_TYPE(DEM, ReliefComponent)); typeIDTypeMap.insert(HANDLE_TYPE(DEM, TINRelief)); + typeIDTypeMap.insert(HANDLE_TYPE(DEM, MassPointRelief)); + typeIDTypeMap.insert(HANDLE_TYPE(DEM, BreaklineRelief)); + typeIDTypeMap.insert(HANDLE_TYPE(DEM, RasterRelief)); typeIDTypeMap.insert(HANDLE_TYPE(BLDG, IntBuildingInstallation)); typeIDTypeMapInitialized = true; @@ -284,7 +287,10 @@ namespace citygml { || node == NodeType::TRANS_AuxiliaryTrafficAreaNode || node == NodeType::WTR_BoundedByNode || node == NodeType::DEM_ReliefComponentNode - || node == NodeType::DEM_TINReliefNode) { + || node == NodeType::DEM_TINReliefNode + || node == NodeType::DEM_MassPointReliefNode + || node == NodeType::DEM_BreaklineReliefNode + || node == NodeType::DEM_RasterReliefNode) { setParserForNextElement(new CityObjectElementParser(m_documentParser, m_factory, m_logger, [this](CityObject* obj) { m_model->addChildCityObject(obj); })); @@ -292,7 +298,13 @@ namespace citygml { || node == NodeType::APP_AppearanceMemberNode) { setParserForNextElement(new AppearanceElementParser(m_documentParser, m_factory, m_logger)); - } else if (node == NodeType::DEM_TinNode) { + } else if (node == NodeType::DEM_ExtentNode + || node == NodeType::DEM_TinNode + || node == NodeType::DEM_ReliefPointsNode + || node == NodeType::DEM_RidgeOrValleyLinesNode + || node == NodeType::DEM_BreaklinesNode + || node == NodeType::DEM_GridNode) { + parseGeometryForLODLevel(std::stoi(m_model->getAttribute("dem:lod"))); } else if (node == NodeType::BLDG_Lod1MultiCurveNode || node == NodeType::BLDG_Lod1MultiSurfaceNode @@ -391,7 +403,8 @@ namespace citygml { || node == NodeType::GEN_Lod0TerrainIntersectionNode || node == NodeType::TRANS_Lod0NetworkNode || node == NodeType::WTR_Lod0MultiCurveNode - || node == NodeType::WTR_Lod0MultiSurfaceNode) { + || node == NodeType::WTR_Lod0MultiSurfaceNode + || node == NodeType::GML_RectifiedGridCoverageNode) { CITYGML_LOG_INFO(m_logger, "Skipping CityObject child element <" << node << "> at " << getDocumentLocation() << " (Currently not supported!)"); setParserForNextElement(new SkipElementParser(m_documentParser, m_logger, node)); return true; @@ -510,7 +523,14 @@ namespace citygml { || node == NodeType::LUSE_Lod4MultiSurfaceNode || node == NodeType::DEM_ReliefComponentNode || node == NodeType::DEM_TINReliefNode + || node == NodeType::DEM_MassPointReliefNode + || node == NodeType::DEM_BreaklineReliefNode + || node == NodeType::DEM_RasterReliefNode || node == NodeType::DEM_TinNode + || node == NodeType::DEM_ReliefPointsNode + || node == NodeType::DEM_RidgeOrValleyLinesNode + || node == NodeType::DEM_BreaklinesNode + || node == NodeType::DEM_GridNode || node == NodeType::GEN_Lod0GeometryNode || node == NodeType::GEN_Lod0ImplicitRepresentationNode || node == NodeType::GEN_Lod0TerrainIntersectionNode diff --git a/sources/src/parser/geometryelementparser.cpp b/sources/src/parser/geometryelementparser.cpp index 552cb89e..04573514 100644 --- a/sources/src/parser/geometryelementparser.cpp +++ b/sources/src/parser/geometryelementparser.cpp @@ -60,6 +60,7 @@ namespace citygml { geometryTypeIDSet.insert(NodeType::GML_PolyhedralSurfaceNode.typeID()); geometryTypeIDSet.insert(NodeType::GML_SurfaceNode.typeID()); geometryTypeIDSet.insert(NodeType::GML_MultiCurveNode.typeID()); + geometryTypeIDSet.insert(NodeType::GML_MultiPointNode.typeID()); geometryTypeIDSetInitialized = true; } diff --git a/sources/src/parser/nodetypes.cpp b/sources/src/parser/nodetypes.cpp index f7c92ebe..21919cd7 100644 --- a/sources/src/parser/nodetypes.cpp +++ b/sources/src/parser/nodetypes.cpp @@ -587,9 +587,11 @@ namespace citygml { DEFINE_NODE( GML, Shell ) DEFINE_NODE( GML, PolyhedralSurface ) DEFINE_NODE( GML, Surface ) - DEFINE_NODE( GML, PolygonPatch) + DEFINE_NODE( GML, PolygonPatch ) - DEFINE_NODE( GML, LineString) + DEFINE_NODE( GML, LineString ) + + DEFINE_NODE( GML, RectifiedGridCoverage ) // BLDG DEFINE_NODE( BLDG, Building ) From a716a9d717198d3ca6d8184027d4a3e298379cb8 Mon Sep 17 00:00:00 2001 From: HarutakaMatsumoto Date: Tue, 26 Oct 2021 19:00:27 +0900 Subject: [PATCH 4/4] Reverted citygmltest.cpp. Fixed DEM_GridNode place --- sources/src/parser/cityobjectelementparser.cpp | 6 +++--- test/citygmltest.cpp | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sources/src/parser/cityobjectelementparser.cpp b/sources/src/parser/cityobjectelementparser.cpp index 48f78a05..1296c027 100644 --- a/sources/src/parser/cityobjectelementparser.cpp +++ b/sources/src/parser/cityobjectelementparser.cpp @@ -290,7 +290,8 @@ namespace citygml { || node == NodeType::DEM_TINReliefNode || node == NodeType::DEM_MassPointReliefNode || node == NodeType::DEM_BreaklineReliefNode - || node == NodeType::DEM_RasterReliefNode) { + || node == NodeType::DEM_RasterReliefNode + || node == NodeType::DEM_GridNode) { setParserForNextElement(new CityObjectElementParser(m_documentParser, m_factory, m_logger, [this](CityObject* obj) { m_model->addChildCityObject(obj); })); @@ -302,8 +303,7 @@ namespace citygml { || node == NodeType::DEM_TinNode || node == NodeType::DEM_ReliefPointsNode || node == NodeType::DEM_RidgeOrValleyLinesNode - || node == NodeType::DEM_BreaklinesNode - || node == NodeType::DEM_GridNode) { + || node == NodeType::DEM_BreaklinesNode) { parseGeometryForLODLevel(std::stoi(m_model->getAttribute("dem:lod"))); } else if (node == NodeType::BLDG_Lod1MultiCurveNode diff --git a/test/citygmltest.cpp b/test/citygmltest.cpp index 13da1265..6e23399d 100644 --- a/test/citygmltest.cpp +++ b/test/citygmltest.cpp @@ -120,9 +120,9 @@ int main( int argc, char **argv ) if ( log ) { std::cout << std::endl << "Objects hierarchy:" << std::endl; - const citygml::ConstCityObjects& roots = city->getRootCityObjects(); +// const citygml::ConstCityObjects& roots = city->getRootCityObjects(); - for ( unsigned int i = 0; i < roots.size(); i++ ) analyzeObject( roots[ i ], 2 ); +// for ( unsigned int i = 0; i < roots.size(); i++ ) analyzeObject( roots[ i ], 2 ); } std::cout << "Done." << std::endl; @@ -132,8 +132,6 @@ int main( int argc, char **argv ) void analyzeObject( const citygml::CityObject* object, unsigned int indent ) { - std::cout - << object->getTypeAsString(); // for ( unsigned int i = 0; i < indent; i++ ) std::cout << " "; // std::cout << "Object " << citygml::getCityObjectsClassName( object->getType() ) << ": " << object->getId() << std::endl;