[Git][debian-gis-team/libcitygml][upstream] New upstream version 2.5.2

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Fri Jan 5 05:29:19 GMT 2024



Bas Couwenberg pushed to branch upstream at Debian GIS Project / libcitygml


Commits:
1fab3967 by Bas Couwenberg at 2024-01-05T06:16:01+01:00
New upstream version 2.5.2
- - - - -


15 changed files:

- + .github/workflows/cmake-multi-platform.yml
- CMakeLists.txt
- + CTestTestfile.cmake
- osgplugin/ReaderWriterCityGML.cpp
- sources/include/citygml/appearancetarget.h
- sources/include/citygml/citygml.h
- sources/include/parser/nodetypes.h
- sources/src/citygml/appearancetarget.cpp
- sources/src/parser/citygmldocumentparser.cpp
- sources/src/parser/externalreferenceparser.cpp
- sources/src/parser/geometryelementparser.cpp
- sources/src/parser/nodetypes.cpp
- sources/src/parser/parserxercesc.cpp
- test/CMakeLists.txt
- test/citygmltest.cpp


Changes:

=====================================
.github/workflows/cmake-multi-platform.yml
=====================================
@@ -0,0 +1,78 @@
+# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
+# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
+name: CMake on multiple platforms
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+
+    strategy:
+      # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
+      fail-fast: false
+
+      # Set up a matrix to run the following 3 configurations:
+      # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
+      # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
+      # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
+      #
+      # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
+      matrix:
+        os: [ubuntu-latest]
+        build_type: [Release]
+        c_compiler: [gcc, clang]
+        include:
+          - os: ubuntu-latest
+            c_compiler: gcc
+            cpp_compiler: g++
+          - os: ubuntu-latest
+            c_compiler: clang
+            cpp_compiler: clang++
+        exclude:
+          - os: windows-latest
+            c_compiler: gcc
+          - os: windows-latest
+            c_compiler: clang
+          - os: ubuntu-latest
+            c_compiler: cl
+          
+
+    steps:
+    - uses: actions/checkout at v3
+
+    - name: Install Packages for Ubuntu      
+      run:  sudo apt-get update && sudo apt-get install -y --fix-missing libxerces-c-dev libxerces-c3.2 libgdal30 libgdal-dev libopenscenegraph-dev     
+    - name: Set reusable strings
+      # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
+      id: strings
+      shell: bash
+      run: |
+        echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
+    
+    - name: Configure CMake
+      # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
+      # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
+      run: >
+        cmake -B ${{ steps.strings.outputs.build-output-dir }}
+        -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
+        -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
+        -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
+        -DLIBCITYGML_TESTS=true
+        -DLIBCITYGML_OSGPLUGIN=true
+        -DLIBCITYGML_USE_OPENGL=true        
+        -S ${{ github.workspace }}
+
+    - name: Build
+      # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
+      run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
+
+    - name: Test
+      working-directory: ${{ steps.strings.outputs.build-output-dir }}
+      # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
+      # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
+      run: ctest --build-config ${{ matrix.build_type }}


=====================================
CMakeLists.txt
=====================================
@@ -1,10 +1,10 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0 FATAL_ERROR)
 
 PROJECT ( libcitygml )
 
 set(META_VERSION_MAJOR       "2")
-set(META_VERSION_MINOR       "4")
-set(META_VERSION_PATCH       "1")
+set(META_VERSION_MINOR       "5")
+set(META_VERSION_PATCH       "2")
 
 set(META_VERSION             "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}")
 
@@ -150,6 +150,7 @@ ENDIF(LIBCITYGML_OSGPLUGIN)
 # test
 OPTION(LIBCITYGML_TESTS "Set to ON to build libcitygml tests programs." ON)
 IF   (LIBCITYGML_TESTS)
+  enable_testing()
   ADD_SUBDIRECTORY( test )
 ENDIF(LIBCITYGML_TESTS)
 
@@ -220,3 +221,5 @@ IF(UNIX AND NOT APPLE)
       include(CPack)
   endif()
 ENDIF()
+
+


=====================================
CTestTestfile.cmake
=====================================
@@ -0,0 +1,5 @@
+
+
+add_test(berlin_open_data_sample_data.citygml COMMAND bin/citygmltest ../data/berlin_open_data_sample_data.citygml)
+add_test(b1_lod2_s.gml COMMAND bin/citygmltest ../data/b1_lod2_s.gml)
+add_test(FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml COMMAND bin/citygmltest ../data/FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml)
\ No newline at end of file


=====================================
osgplugin/ReaderWriterCityGML.cpp
=====================================
@@ -41,6 +41,7 @@
 #include <citygml/polygon.h>
 #include <citygml/material.h>
 #include <citygml/texture.h>
+#include <citygml/tesselator.h>
 #include <citygml/citygmllogger.h>
 
 #include <algorithm>
@@ -189,8 +190,8 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCityGML::readNode( const std::string
     std::streambuf* cerrsb = std::cerr.rdbuf( osg::notify(osg::NOTICE).rdbuf() );
 
     osg::notify(osg::NOTICE) << "Parsing CityGML file " << fileName << "..." << std::endl;
-
-    std::shared_ptr<const citygml::CityModel> city = citygml::load( fileName, settings._params, m_logger );
+    std::unique_ptr<TesselatorBase> tesselator = std::unique_ptr<TesselatorBase>(new Tesselator(nullptr));
+    std::shared_ptr<const citygml::CityModel> city = citygml::load( fileName, settings._params, std::move(tesselator), m_logger );
 
     ReadResult rr = readCity( city, settings );
 
@@ -221,8 +222,8 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCityGML::readNode( std::istream& fin
     std::streambuf* cerrsb = std::cerr.rdbuf( osg::notify(osg::NOTICE).rdbuf() );
 
     osg::notify(osg::NOTICE) << "Parsing CityGML stream..." << std::endl;
-
-    std::shared_ptr<const citygml::CityModel> city = citygml::load( fin, settings._params );
+    std::unique_ptr<TesselatorBase> tesselator = std::unique_ptr<TesselatorBase>(new Tesselator(nullptr));
+    std::shared_ptr<const citygml::CityModel> city = citygml::load( fin, settings._params, std::move(tesselator), m_logger);
 
     ReadResult rr = readCity( city, settings );
 


=====================================
sources/include/citygml/appearancetarget.h
=====================================
@@ -36,6 +36,7 @@ namespace citygml {
 
         std::vector<TextureTargetDefinition*> getTextureTargetDefinitions();
 
+        std::vector<std::string> getAllMaterialThemes(bool front) const;
         std::vector<std::string> getAllTextureThemes(bool front) const;
 
     protected:


=====================================
sources/include/citygml/citygml.h
=====================================
@@ -67,11 +67,11 @@ namespace citygml
             , minLOD( 0 )
             , maxLOD( 4 )
             , optimize( false )
-            , tesselate( true )
             , pruneEmptyObjects( false )
+            , tesselate( true )
+            , keepVertices ( false )
             , destSRS( "" )
             , srcSRS( "" )
-            , keepVertices ( false )
         { }
 
     public:


=====================================
sources/include/parser/nodetypes.h
=====================================
@@ -132,6 +132,7 @@ namespace citygml {
         NODETYPE( GML, MultiCurve )
         NODETYPE( GML, MultiSurface )
         NODETYPE( GML, MultiSolid )
+        NODETYPE( GML, MultiGeometry )
 
         NODETYPE( GML, CompositeCurve )
         NODETYPE( GML, CompositeSurface )


=====================================
sources/src/citygml/appearancetarget.cpp
=====================================
@@ -108,6 +108,16 @@ namespace citygml {
         return std::vector<TextureTargetDefinition*>(texTargetDefs.begin(), texTargetDefs.end());
     }
 
+    std::vector<std::string> AppearanceTarget::getAllMaterialThemes(bool front) const
+    {
+        auto& map = front ? m_themeMatMapFront : m_themeMatMapBack;
+        std::vector<std::string> themes;
+        for (const auto& pair : map) {
+            themes.push_back(pair.first);
+        }
+        return themes;
+    }
+
     std::vector<std::string> AppearanceTarget::getAllTextureThemes(bool front) const
     {
         auto& map = front ? m_themeTexMapFront : m_themeTexMapBack;


=====================================
sources/src/parser/citygmldocumentparser.cpp
=====================================
@@ -1,4 +1,5 @@
 #include "parser/citygmldocumentparser.h"
+#include "parser/delayedchoiceelementparser.h"
 #include "parser/documentlocation.h"
 #include "parser/nodetypes.h"
 #include "parser/elementparser.h"
@@ -99,6 +100,15 @@ namespace citygml {
 
         m_activeParser = m_parserStack.top();
         CITYGML_LOG_TRACE(m_logger, "Invoke " << m_activeParser->elementParserName() << "::endElement for <" << node << "> at " << getDocumentLocation());
+        
+        if(std::dynamic_pointer_cast<DelayedChoiceElementParser>(m_activeParser) != nullptr) {
+            // We try to close a DelayedChoiceElementParser:
+            // this means no node has been found that contains any of the delayed choice nodes
+            // This is not directly an error: this needs to be treated as an empty node
+            CITYGML_LOG_DEBUG(m_logger, "End tag found while the active parser is a DelayedChoiceElementParser. This probably means the node is empty. The close node is: <" << node << "> at " << getDocumentLocation());
+            removeCurrentElementParser(m_activeParser.get());
+            m_activeParser = m_parserStack.top();
+        }
         if (!m_activeParser->endElement(node, characters)) {
             CITYGML_LOG_ERROR(m_logger, "Active parser " << m_activeParser->elementParserName() << " reports end tag <" << node << "> at " << getDocumentLocation() << " as "
                               << "unknown, but it seems as if the corresponding start tag was not reported as unknown. Please check the parser implementation."


=====================================
sources/src/parser/externalreferenceparser.cpp
=====================================
@@ -17,7 +17,7 @@ namespace citygml {
     }
 
     bool ExternalReferenceParser::handlesElement(NodeType::XMLNode const& node) const {
-        return node.typeID() == NodeType::CORE_ExternalReferenceNode.typeID();
+        return (node.typeID() == NodeType::CORE_ExternalReferenceNode.typeID() || node.typeID() == NodeType::CORE_InformationSystemNode.typeID());
     }
 
     bool ExternalReferenceParser::parseElementStartTag(NodeType::XMLNode const& node, Attributes & attributes) {


=====================================
sources/src/parser/geometryelementparser.cpp
=====================================
@@ -61,6 +61,7 @@ namespace citygml {
                 geometryTypeIDSet.insert(NodeType::GML_SurfaceNode.typeID());
 				geometryTypeIDSet.insert(NodeType::GML_MultiCurveNode.typeID());
                 geometryTypeIDSet.insert(NodeType::GML_MultiPointNode.typeID());
+                geometryTypeIDSet.insert(NodeType::GML_MultiGeometryNode.typeID());
                 geometryTypeIDSetInitialized = true;
 
             }


=====================================
sources/src/parser/nodetypes.cpp
=====================================
@@ -202,6 +202,7 @@ namespace citygml {
                 INITIALIZE_NODE( GML, MultiCurve )
                 INITIALIZE_NODE( GML, MultiSurface )
                 INITIALIZE_NODE( GML, MultiSolid )
+                INITIALIZE_NODE( GML, MultiGeometry )
 
                 INITIALIZE_NODE( GML, CompositeCurve )
                 INITIALIZE_NODE( GML, CompositeSurface )
@@ -577,6 +578,7 @@ namespace citygml {
     DEFINE_NODE( GML, MultiCurve )
     DEFINE_NODE( GML, MultiSurface )
     DEFINE_NODE( GML, MultiSolid )
+    DEFINE_NODE( GML, MultiGeometry )
 
     DEFINE_NODE( GML, CompositeCurve )
     DEFINE_NODE( GML, CompositeSurface )


=====================================
sources/src/parser/parserxercesc.cpp
=====================================
@@ -65,10 +65,10 @@ std::shared_ptr<XMLCh> toXercesString(const std::string& str) {
 class DocumentLocationXercesAdapter : public citygml::DocumentLocation {
 public:
     explicit DocumentLocationXercesAdapter(const std::string& fileName)
-		: m_locator(nullptr)
-		, m_fileName(fileName)
-	{
-        
+        : m_locator(nullptr)
+        , m_fileName(fileName)
+    {
+
     }
 
     void setLocator(const xercesc::Locator* locator) {
@@ -124,6 +124,8 @@ public:
     // ContentHandler interface
     virtual void startElement(const XMLCh* const, const XMLCh* const, const XMLCh* const qname, const xercesc::Attributes& attrs) override {
         AttributesXercesAdapter attributes(attrs, m_documentLocation, m_logger);
+        // We need to empty m_lastcharacters here, because if a tag is empty, characters(...) will never be called and this variable will contain wrong values
+        m_lastcharacters = "";
         CityGMLDocumentParser::startElement(toStdString(qname), attributes);
     }
 
@@ -133,7 +135,7 @@ public:
     }
 
     virtual void characters(const XMLCh* const chars, const XMLSize_t) override {
-        m_lastcharacters = toStdString(chars);
+        m_lastcharacters += toStdString(chars);
     }
 
     virtual void startDocument() override {
@@ -240,7 +242,7 @@ namespace citygml
             }
 
             stream << " " << message << std::endl;
-        }     
+        }
     };
 
     std::mutex xerces_init_mutex;


=====================================
test/CMakeLists.txt
=====================================
@@ -31,3 +31,8 @@ if(NOT DEFINED BIN_INSTALL_DIR)
 endif(NOT DEFINED BIN_INSTALL_DIR)
 
 install(TARGETS citygmltest RUNTIME DESTINATION ${BIN_INSTALL_DIR})
+
+
+add_test(NAME berlin_open_data_sample_data COMMAND citygmltest ../../data/berlin_open_data_sample_data.citygml)
+add_test(NAME b1_lod2_s COMMAND citygmltest ../../data/b1_lod2_s.gml)
+add_test(NAME FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1 COMMAND citygmltest ../../data/FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml)
\ No newline at end of file


=====================================
test/citygmltest.cpp
=====================================
@@ -22,6 +22,7 @@
 #include <citygml/citymodel.h>
 #include <citygml/cityobject.h>
 #include <citygml/geometry.h>
+#include <citygml/implictgeometry.h>
 
 #ifdef LIBCITYGML_USE_OPENGL
 #include <citygml/tesselator.h>
@@ -171,6 +172,17 @@ void printGeometry( const citygml::Geometry& geometry, unsigned int indent )
   }
 }
 
+
+void printImplicitGeometry( const citygml::ImplicitGeometry& implicitGeometry, unsigned int indent ) 
+{
+    printIndent(indent);
+    std::cout << "Reference point " << implicitGeometry.getReferencePoint() << std::endl;
+    for ( unsigned int i = 0; i < implicitGeometry.getGeometriesCount(); i++ ) 
+    {
+        printGeometry( implicitGeometry.getGeometry(i), indent+1 );
+    }
+}
+
 void analyzeObject( const citygml::CityObject& object, unsigned int indent )
 {
    printIndent(indent);
@@ -181,6 +193,10 @@ void analyzeObject( const citygml::CityObject& object, unsigned int indent )
    {
        printGeometry( object.getGeometry(i), indent+1 );
    }
+   for ( unsigned int i = 0; i < object.getImplicitGeometryCount(); i++ ) 
+   {
+       printImplicitGeometry( object.getImplicitGeometry(i), indent+1 );
+   }
 
    for ( unsigned int i = 0; i < object.getChildCityObjectsCount(); i++ )
        analyzeObject( object.getChildCityObject(i), indent+1 );



View it on GitLab: https://salsa.debian.org/debian-gis-team/libcitygml/-/commit/1fab39679004337e03341ed0eb6585981eebf471

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/libcitygml/-/commit/1fab39679004337e03341ed0eb6585981eebf471
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240105/0bd6afd6/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list