This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository libcitygml.
commit f848bf182d807261c126f85619ebd0e0fa398df2 Author: Bas Couwenberg <[email protected]> Date: Fri Jan 20 16:32:12 2017 +0100 Imported Upstream version 2.0.4 --- .gitignore | 1 + .travis.yml | 20 ++- CMakeLists.txt | 4 +- osgplugin/README | 22 --- osgplugin/ReaderWriterCityGML.cpp | 14 +- sources/CMakeLists.txt | 39 +++++- sources/include/citygml/appearancemanager.h | 6 +- sources/include/citygml/appearancetarget.h | 10 +- sources/include/citygml/attributesmap.h | 55 ++++++++ sources/include/citygml/citygml.h | 4 +- sources/include/citygml/citygml_api.h.in | 10 +- sources/include/citygml/citygmlfactory.h | 4 +- sources/include/citygml/citygmllogger.h | 26 +++- sources/include/citygml/citymodel.h | 2 +- sources/include/citygml/cityobject.h | 91 ++++++------ sources/include/citygml/enum_type_bitmask.h | 48 +++++++ sources/include/citygml/featureobject.h | 4 +- sources/include/citygml/geometry.h | 10 +- sources/include/citygml/geometrymanager.h | 2 +- sources/include/citygml/implictgeometry.h | 2 +- sources/include/citygml/object.h | 7 +- sources/include/citygml/polygon.h | 24 +++- sources/include/citygml/polygonmanager.h | 2 +- sources/include/citygml/tesselator.h | 6 +- sources/include/citygml/texture.h | 2 +- sources/include/citygml/texturetargetdefinition.h | 4 +- sources/include/parser/appearanceelementparser.h | 4 +- sources/include/parser/citygmldocumentparser.h | 2 +- sources/include/parser/citymodelelementparser.h | 2 +- sources/include/parser/cityobjectelementparser.h | 7 +- sources/include/parser/geometryelementparser.h | 2 +- .../parser/georeferencedtextureelementparser.h | 2 +- .../include/parser/implicitgeometryelementparser.h | 2 +- sources/include/parser/linearringelementparser.h | 2 +- sources/include/parser/linestringelementparser.h | 2 +- sources/include/parser/materialelementparser.h | 2 +- sources/include/parser/nodetypes.h | 2 + sources/include/parser/polygonelementparser.h | 2 +- sources/include/parser/textureelementparser.h | 2 +- sources/src/citygml/appearance.cpp | 2 +- sources/src/citygml/appearancemanager.cpp | 12 +- sources/src/citygml/appearancetarget.cpp | 10 +- sources/src/citygml/attributesmap.cpp | 109 +++++++++++++++ sources/src/citygml/citygmlfactory.cpp | 38 +++--- sources/src/citygml/citymodel.cpp | 8 +- sources/src/citygml/cityobject.cpp | 152 +++++++++++---------- sources/src/citygml/envelope.cpp | 2 +- sources/src/citygml/featureobject.cpp | 4 +- sources/src/citygml/geometry.cpp | 6 +- sources/src/citygml/geometrymanager.cpp | 8 +- sources/src/citygml/georeferencedtexture.cpp | 2 +- sources/src/citygml/implictgeometry.cpp | 4 +- sources/src/citygml/linearring.cpp | 12 +- sources/src/citygml/material.cpp | 2 +- sources/src/citygml/materialtargetdefinition.cpp | 2 +- sources/src/citygml/object.cpp | 14 +- sources/src/citygml/polygon.cpp | 30 ++-- sources/src/citygml/polygonmanager.cpp | 8 +- sources/src/citygml/tesselator.cpp | 5 +- sources/src/citygml/texture.cpp | 4 +- sources/src/citygml/texturecoordinates.cpp | 4 +- sources/src/citygml/texturetargetdefinition.cpp | 4 +- sources/src/citygml/transformmatrix.cpp | 2 +- sources/src/parser/addressparser.cpp | 40 ++++-- sources/src/parser/appearanceelementparser.cpp | 14 +- sources/src/parser/attributes.cpp | 2 +- sources/src/parser/citygmldocumentparser.cpp | 9 +- sources/src/parser/citygmlelementparser.cpp | 4 +- sources/src/parser/citymodelelementparser.cpp | 8 +- sources/src/parser/cityobjectelementparser.cpp | 87 ++++++++++-- sources/src/parser/delayedchoiceelementparser.cpp | 2 +- sources/src/parser/geocoordinatetransformer.cpp | 46 ++++--- sources/src/parser/geometryelementparser.cpp | 8 +- .../parser/georeferencedtextureelementparser.cpp | 6 +- sources/src/parser/gmlfeaturecollectionparser.cpp | 10 +- .../src/parser/implicitgeometryelementparser.cpp | 6 +- sources/src/parser/linearringelementparser.cpp | 6 +- sources/src/parser/linestringelementparser.cpp | 6 +- sources/src/parser/materialelementparser.cpp | 6 +- sources/src/parser/nodetypes.cpp | 6 +- sources/src/parser/parserxercesc.cpp | 41 +++--- sources/src/parser/polygonelementparser.cpp | 6 +- sources/src/parser/sequenceparser.cpp | 2 +- sources/src/parser/textureelementparser.cpp | 12 +- test/citygmltest.cpp | 2 +- 85 files changed, 807 insertions(+), 418 deletions(-) diff --git a/.gitignore b/.gitignore index a70a610..cd1439e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ CMakeLists.txt.user* install build/ buildRelease/ +*.autosave diff --git a/.travis.yml b/.travis.yml index 47781ae..4b87d82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,24 @@ language: cpp +sudo: false compiler: - gcc - clang before_install: - echo $LANG - echo $LC_ALL - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo apt-get update -qq - - sudo apt-get update --fix-missing - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y libxerces-c-dev libxerces-c3.1 libgdal1h libgdal-dev cmake; fi - - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi script: mkdir build && cd build && cmake ../ && make +addons: + apt: + sources: + - ubuntu-toolchain-r-test + - george-edison55-precise-backports + packages: + - libxerces-c-dev + - libxerces-c3.1 + - libgdal1h + - libgdal-dev + - cmake-data + - cmake + - g++-4.8 + - gcc-4.8 diff --git a/CMakeLists.txt b/CMakeLists.txt index d193f0b..c61ae8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) PROJECT ( libcitygml ) set(META_VERSION_MAJOR "2") set(META_VERSION_MINOR "0") -set(META_VERSION_PATCH "0") +set(META_VERSION_PATCH "4") set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}") diff --git a/osgplugin/README b/osgplugin/README deleted file mode 100644 index 9bf6b6a..0000000 --- a/osgplugin/README +++ /dev/null @@ -1,22 +0,0 @@ -libcitygml - Copyright (c) 2010 Joachim Pouderoux, BRGM - -http://code.google.com/p/libcitygml - -To use libcitygml with OpenSceneGraph (min 2.8), here is some instructions: - - Copy FindCityGML.cmake and FindXerces.cmake from libcitygml/CMakeModules - to $(OSG_SRC_DIR)/CMakeModules - - Copy libcitygml/test/osgplugin/* to $(OSG_SRC_DIR)/src/osgPlugins/citygml - - Add the following line to $(OSG_SRC_DIR)/src/osgPlugins/CMakeLists.txt - ADD_SUBDIRECTORY(citygml) - -Use CMake to reconfigure OpenSceneGraph installation. -Generate project and build! - -You can use Open Scene Graph plugin with LibXml2 or Xerces (default), -according to your libcitygml building configuration. -WARNING: no control is done, it is your responsability to select the - corresponding parameters. (i.e. if your build libcitygml with libxml2, - you have to select LibXml2 when configuring the Open Scene Graph plugin. - -Please report any bugs to http://code.google.com/p/libcitygml/issues/list -Thank you. \ No newline at end of file diff --git a/osgplugin/ReaderWriterCityGML.cpp b/osgplugin/ReaderWriterCityGML.cpp index d611ff7..bce2dd1 100644 --- a/osgplugin/ReaderWriterCityGML.cpp +++ b/osgplugin/ReaderWriterCityGML.cpp @@ -48,6 +48,7 @@ class CityGMLOSGPluginLogger : public citygml::CityGMLLogger { public: + virtual void log(LOGLEVEL level, const std::string& message, const char* file, int line) const { std::ostream& stream = getLogStreamFor(level); @@ -63,10 +64,6 @@ public: stream << " " << message << std::endl; } - virtual bool isEnabledFor(LOGLEVEL) const - { - return true; - } private: std::ostream& getLogStreamFor(LOGLEVEL level) const { switch(level) { @@ -398,9 +395,12 @@ void createOsgGeometryFromCityGMLGeometry(const citygml::Geometry& geometry, Cit setMaterial(stateset, p, settings); setTexture(stateset, geom, p, settings); - if (settings._storeGeomIDs) { - geom->addDescription(p.getId()); - } +#if OSG_VERSION_GREATER_OR_EQUAL(3,3,2) + if (settings._storeGeomIDs) { + geom->addDescription(p.getId()); + } +#endif + geometryContainer->addDrawable( geom ); } diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index 1a52087..6597402 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -1,3 +1,4 @@ +include(GenerateExportHeader) SET( target citygml ) ADD_DEFINITIONS( -DCITYGML_LIBRARY ) @@ -14,9 +15,18 @@ ENDIF( LIBCITYGML_DYNAMIC ) configure_file(include/citygml/citygml_api.h.in ${CMAKE_BINARY_DIR}/include/citygml/citygml_api.h) -INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/sources/include ${XERCESC_INCLUDE} ${ICONV_INCLUDE_DIR} ${GLU_INCLUDE_PATH} ${GDAL_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include) +SET(EXPORT_HEADER_FILE_NAME ${PROJECT_BINARY_DIR}/include/citygml/citygml_export.h) + +INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/sources/include + ${XERCESC_INCLUDE} + ${ICONV_INCLUDE_DIR} + ${GLU_INCLUDE_PATH} + ${GDAL_INCLUDE_DIR} + ${CMAKE_BINARY_DIR}/include + ${PROJECT_BINARY_DIR}/include) SET(SOURCES + src/citygml/attributesmap.cpp src/citygml/citymodel.cpp src/citygml/tesselator.cpp src/citygml/object.cpp @@ -73,9 +83,17 @@ SET(SOURCES src/parser/implicitgeometryelementparser.cpp src/parser/addressparser.cpp ) +if(UNIX) + if (APPLE) + set_source_files_properties(src/citygml/tesselator.cpp PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") # for warnings: 'glu*' is deprecated... + endif (APPLE) +endif(UNIX) SET(PUBLIC_HEADER ${CMAKE_BINARY_DIR}/include/citygml/citygml_api.h + ${CMAKE_BINARY_DIR}/include/citygml/citygml_export.h + include/citygml/attributesmap.h + include/citygml/enum_type_bitmask.h include/citygml/citygmllogger.h include/citygml/polygon.h include/citygml/material.h @@ -149,6 +167,11 @@ SET(HEADERS ADD_LIBRARY( ${target} ${LIBCITYGML_USER_DEFINED_DYNAMIC_OR_STATIC} ${SOURCES} ${HEADERS} ) + +generate_export_header(citygml + EXPORT_MACRO_NAME LIBCITYGML_EXPORT + EXPORT_FILE_NAME ${EXPORT_HEADER_FILE_NAME}) + TARGET_LINK_LIBRARIES( ${target} ${XERCESC_LIBRARIES} ${OPENGL_LIBRARIES} ${GDAL_LIBRARY} ) set_target_properties( ${target} PROPERTIES @@ -162,12 +185,24 @@ INSTALL( LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) + + # FIXME: Do not run for OS X framework INSTALL( - FILES ${PUBLIC_HEADER} + FILES + ${PUBLIC_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR} ) +INSTALL( + FILES + ${EXPORT_HEADER_FILE_NAME} + DESTINATION + ${INCLUDE_INSTALL_DIR} +) + + configure_file(citygml.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/citygml.pc) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/citygml.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/sources/include/citygml/appearancemanager.h b/sources/include/citygml/appearancemanager.h index 2820c7e..926f898 100644 --- a/sources/include/citygml/appearancemanager.h +++ b/sources/include/citygml/appearancemanager.h @@ -55,9 +55,9 @@ namespace citygml { protected: - std::unordered_map<std::string, std::shared_ptr<Appearance>> m_appearancesMap; - std::vector<std::shared_ptr<MaterialTargetDefinition>> m_materialTargetDefinitions; - std::vector<std::shared_ptr<TextureTargetDefinition>> m_texTargetDefinitions; + std::unordered_map<std::string, std::shared_ptr<Appearance> > m_appearancesMap; + std::vector<std::shared_ptr<MaterialTargetDefinition> > m_materialTargetDefinitions; + std::vector<std::shared_ptr<TextureTargetDefinition> > m_texTargetDefinitions; std::unordered_set<std::string> m_themes; std::unordered_map<std::string, AppearanceTarget*> m_appearanceTargetsMap; std::shared_ptr<CityGMLLogger> m_logger; diff --git a/sources/include/citygml/appearancetarget.h b/sources/include/citygml/appearancetarget.h index 9a47e54..1269c36 100644 --- a/sources/include/citygml/appearancetarget.h +++ b/sources/include/citygml/appearancetarget.h @@ -22,7 +22,7 @@ namespace citygml { class AppearanceTarget : public citygml::Object { public: - void addTargetDefinition(std::shared_ptr<AppearanceTargetDefinition<Appearance>> targetDef); + void addTargetDefinition(std::shared_ptr<AppearanceTargetDefinition<Appearance> > targetDef); void addTargetDefinition(std::shared_ptr<TextureTargetDefinition> targetDef); void addTargetDefinition(std::shared_ptr<MaterialTargetDefinition> targetDef); @@ -44,11 +44,11 @@ namespace citygml { private: - std::unordered_map<std::string, std::shared_ptr<MaterialTargetDefinition>> m_themeMatMapFront; - std::unordered_map<std::string, std::shared_ptr<MaterialTargetDefinition>> m_themeMatMapBack; + std::unordered_map<std::string, std::shared_ptr<MaterialTargetDefinition> > m_themeMatMapFront; + std::unordered_map<std::string, std::shared_ptr<MaterialTargetDefinition> > m_themeMatMapBack; - std::unordered_map<std::string, std::shared_ptr<TextureTargetDefinition>> m_themeTexMapFront; - std::unordered_map<std::string, std::shared_ptr<TextureTargetDefinition>> m_themeTexMapBack; + std::unordered_map<std::string, std::shared_ptr<TextureTargetDefinition> > m_themeTexMapFront; + std::unordered_map<std::string, std::shared_ptr<TextureTargetDefinition> > m_themeTexMapBack; }; } diff --git a/sources/include/citygml/attributesmap.h b/sources/include/citygml/attributesmap.h new file mode 100644 index 0000000..c8eaa41 --- /dev/null +++ b/sources/include/citygml/attributesmap.h @@ -0,0 +1,55 @@ +#pragma once + +#include <string> +#include <map> + +#include <citygml/citygml_api.h> + +namespace citygml +{ + +/** + * @brief The AttributeType enum represents the data type of an object attribute + */ +enum class AttributeType +{ + String, + Double, + Integer, + Date, + Uri +}; + +/** + * @brief The AttributeValue class stores an attribute value and its data type + */ +class LIBCITYGML_EXPORT AttributeValue +{ +public: + AttributeValue(); + AttributeValue(const char* value); + AttributeValue(const std::string& value, AttributeType type=AttributeType::String); + AttributeValue(double value); + AttributeValue(int value); + + + void setType(AttributeType type); + AttributeType getType() const; + + void setValue(const std::string& value, AttributeType type=AttributeType::String); + void setValue(double value); + void setValue(int value); + + std::string asString() const; + double asDouble(double defaultValue=0.0) const; + int asInteger(int defaultValue=0) const; +private: + AttributeType m_type; + std::string m_value; +}; + +std::ostream& operator<<(std::ostream& os, const AttributeValue& o); + +typedef std::map<std::string, AttributeValue> AttributesMap; + +} // namespace citygml diff --git a/sources/include/citygml/citygml.h b/sources/include/citygml/citygml.h index 7f38105..6f317b1 100644 --- a/sources/include/citygml/citygml.h +++ b/sources/include/citygml/citygml.h @@ -44,7 +44,7 @@ namespace citygml class Material; class AppearanceManager; - typedef unsigned int CityObjectsTypeMask; + typedef EnumClassBitmask<CityObject::CityObjectsType> CityObjectsTypeMask; /////////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ namespace citygml { public: ParserParams() - : objectsMask( CityObject::CityObjectsType::COT_All ) + : objectsMask(CityObject::CityObjectsType::COT_All) , minLOD( 0 ) , maxLOD( 4 ) , optimize( false ) diff --git a/sources/include/citygml/citygml_api.h.in b/sources/include/citygml/citygml_api.h.in index eb84e8f..bfacbca 100644 --- a/sources/include/citygml/citygml_api.h.in +++ b/sources/include/citygml/citygml_api.h.in @@ -9,12 +9,4 @@ (major == LIBCITYGML_VERSION_MAJOR && (minor > LIBCITYGML_VERSION_MINOR || \ (minor == LIBCITYGML_VERSION_MINOR && revision > LIBCITYGML_VERSION_REVISION))) -#if defined( _MSC_VER ) && defined( LIBCITYGML_DYNAMIC ) -# ifdef LIBCITYGML_BUILD -# define LIBCITYGML_EXPORT __declspec( dllexport ) -# else -# define LIBCITYGML_EXPORT __declspec( dllimport ) -# endif -#else -# define LIBCITYGML_EXPORT -#endif +#include <citygml/citygml_export.h> diff --git a/sources/include/citygml/citygmlfactory.h b/sources/include/citygml/citygmlfactory.h index b6c9a44..8bd3357 100644 --- a/sources/include/citygml/citygmlfactory.h +++ b/sources/include/citygml/citygmlfactory.h @@ -1,7 +1,7 @@ #pragma once -#include "citygml/geometry.h" -#include "citygml/cityobject.h" +#include <citygml/geometry.h> +#include <citygml/cityobject.h> #include <memory> diff --git a/sources/include/citygml/citygmllogger.h b/sources/include/citygml/citygmllogger.h index fcbf5c3..59e74da 100644 --- a/sources/include/citygml/citygmllogger.h +++ b/sources/include/citygml/citygmllogger.h @@ -9,20 +9,34 @@ namespace citygml { class LIBCITYGML_EXPORT CityGMLLogger { public: enum class LOGLEVEL { - LL_ERROR, - LL_WARNING, - LL_INFO, - LL_DEBUG, - LL_TRACE + LL_ERROR = 4, + LL_WARNING = 3, + LL_INFO = 2, + LL_DEBUG = 1, + LL_TRACE = 0 }; + CityGMLLogger(LOGLEVEL level = LOGLEVEL::LL_ERROR):m_logLevel(level){} + /** * @brief logs a message. Might be called from different threads. */ virtual void log(LOGLEVEL level, const std::string& message, const char* file=nullptr, int line=-1) const = 0; - virtual bool isEnabledFor(LOGLEVEL level) const = 0; + virtual bool isEnabledFor(LOGLEVEL level) const { + return level >= getLogLevel(); + }; + + virtual LOGLEVEL getLogLevel() const{ + return m_logLevel; + }; + + virtual LOGLEVEL setLogLevel(LOGLEVEL level) { + return m_logLevel = level; + }; + private: + LOGLEVEL m_logLevel; }; /** diff --git a/sources/include/citygml/citymodel.h b/sources/include/citygml/citymodel.h index 16f20ec..760c893 100644 --- a/sources/include/citygml/citymodel.h +++ b/sources/include/citygml/citymodel.h @@ -16,7 +16,7 @@ namespace citygml { class CityObject; class CityGMLFactory; - typedef std::vector<std::unique_ptr<CityObject>> CityObjects; + typedef std::vector<std::unique_ptr<CityObject> > CityObjects; typedef std::vector<const CityObject*> ConstCityObjects; typedef std::map< CityObject::CityObjectsType, std::vector<const CityObject*> > CityObjectsMap; diff --git a/sources/include/citygml/cityobject.h b/sources/include/citygml/cityobject.h index 00f19b0..0b0e01c 100644 --- a/sources/include/citygml/cityobject.h +++ b/sources/include/citygml/cityobject.h @@ -5,7 +5,7 @@ #include <citygml/featureobject.h> #include <citygml/citygml_api.h> - +#include <citygml/enum_type_bitmask.h> class Tesselator; namespace citygml { @@ -22,47 +22,52 @@ namespace citygml { { public: - enum CityObjectsType { - COT_GenericCityObject = 1 << 0, - COT_Building = 1 << 1, - COT_Room = 1 << 2, - COT_BuildingInstallation = 1 << 3, - COT_BuildingFurniture = 1 << 4, - COT_Door = 1 << 5, - COT_Window = 1 << 6, - COT_CityFurniture = 1 << 7, - COT_Track = 1 << 8, - COT_Road = 1 << 9, - COT_Railway = 1 << 10, - COT_Square = 1 << 11, - COT_PlantCover = 1 << 12, - COT_SolitaryVegetationObject = 1 << 13, - COT_WaterBody = 1 << 14, - COT_ReliefFeature = 1 << 15, - COT_LandUse = 1 << 16, - COT_Tunnel = 1 << 17, - COT_Bridge = 1 << 18, - COT_BridgeConstructionElement = 1 << 19, - COT_BridgeInstallation = 1 << 20, - COT_BridgePart = 1 << 21, - COT_BuildingPart = 1 << 22, - - COT_WallSurface = 1 << 23, - COT_RoofSurface = 1 << 24, - COT_GroundSurface = 1 << 25, - COT_ClosureSurface = 1 << 26, - COT_FloorSurface = 1 << 27, - COT_InteriorWallSurface = 1 << 28, - COT_CeilingSurface = 1 << 29, - COT_CityObjectGroup = 1 << 30, + enum class CityObjectsType : uint64_t { + COT_GenericCityObject = 1ll, + COT_Building = 1ll<< 1, + COT_Room = 1ll<< 2, + COT_BuildingInstallation = 1ll<< 3, + COT_BuildingFurniture = 1ll<< 4, + COT_Door = 1ll<< 5, + COT_Window = 1ll<< 6, + COT_CityFurniture = 1ll<< 7, + COT_Track = 1ll<< 8, + COT_Road = 1ll<< 9, + COT_Railway = 1ll<< 10, + COT_Square = 1ll<< 11, + COT_PlantCover = 1ll<< 12, + COT_SolitaryVegetationObject = 1ll<< 13, + COT_WaterBody = 1ll<< 14, + COT_ReliefFeature = 1ll<< 15, + COT_LandUse = 1ll<< 16, + COT_Tunnel = 1ll<< 17, + COT_Bridge = 1ll<< 18, + COT_BridgeConstructionElement = 1ll<< 19, + COT_BridgeInstallation = 1ll<< 20, + COT_BridgePart = 1ll<< 21, + COT_BuildingPart = 1ll<< 22, + + COT_WallSurface = 1ll<< 23, + COT_RoofSurface = 1ll<< 24, + COT_GroundSurface = 1ll<< 25, + COT_ClosureSurface = 1ll<< 26, + COT_FloorSurface = 1ll<< 27, + COT_InteriorWallSurface = 1ll<< 28, + COT_CeilingSurface = 1ll<< 29, + COT_CityObjectGroup = 1ll<< 30, + COT_OuterCeilingSurface = 1ll<< 31, + COT_OuterFloorSurface = 1ll<< 32, + // covers all supertypes of tran::_TransportationObject that are not Track, Road, Railway or Square... // there are to many for to few bits to explicitly enumerate them. However Track, Road, Railway or Square should be used most of the time - COT_TransportationObject = 1 << 31, + COT_TransportationObject = 1ll<< 33, - COT_All = 0xFFFFFFFF + COT_All = 0xFFFFFFFFFFFFFFFFll }; - + + + CityObject( const std::string& id, CityObjectsType type ); // Get the object type @@ -105,9 +110,9 @@ namespace citygml { protected: CityObjectsType m_type; - std::vector<std::unique_ptr<Geometry>> m_geometries; - std::vector<std::unique_ptr<ImplicitGeometry>> m_implicitGeometries; - std::vector<std::unique_ptr<CityObject>> m_children; + std::vector<std::unique_ptr<Geometry> > m_geometries; + std::vector<std::unique_ptr<ImplicitGeometry> > m_implicitGeometries; + std::vector<std::unique_ptr<CityObject> > m_children; std::unique_ptr<Address> m_address; }; @@ -115,4 +120,10 @@ namespace citygml { std::string cityObjectsTypeToString(const CityObject::CityObjectsType& t); CityObject::CityObjectsType cityObjectsTypeFromString(const std::string& s, bool& valid); + + + } + +ENUM_CLASS_BITWISE_OPERATORS_DEFS(citygml::CityObject::CityObjectsType); + diff --git a/sources/include/citygml/enum_type_bitmask.h b/sources/include/citygml/enum_type_bitmask.h new file mode 100644 index 0000000..e823279 --- /dev/null +++ b/sources/include/citygml/enum_type_bitmask.h @@ -0,0 +1,48 @@ +#pragma once + +#include <type_traits> + +template <typename T> +class EnumClassBitmask +{ +private: + T t; + +public: + typedef typename std::underlying_type<T>::type underlying_type; + + /*constexpr*/ EnumClassBitmask() : t(T(0)) {} + /*constexpr*/ EnumClassBitmask(T t) : t(t) {} + /*constexpr*/ explicit EnumClassBitmask(underlying_type t) : t(T(t)) {} + + /*constexpr*/ /*explicit*/ operator bool() const { return bool(t); } + /*constexpr*/ operator T() { return t; } + + /*constexpr*/ EnumClassBitmask operator|(T r) const { return EnumClassBitmask(t | r); } + /*constexpr*/ EnumClassBitmask operator&(T r) const { return EnumClassBitmask(t & r); } + /*constexpr*/ EnumClassBitmask operator^(T r) const { return EnumClassBitmask(t ^ r); } + /*constexpr*/ EnumClassBitmask operator~() const { return EnumClassBitmask(~t); } + + const EnumClassBitmask& operator|=(T r) { t = t | r; return *this; } + const EnumClassBitmask& operator&=(T r) { t = t & r; return *this; } + const EnumClassBitmask& operator^=(T r) { t = t ^ r; return *this; } + + bool operator==(const EnumClassBitmask& r) { return underlying_type(t) == underlying_type(r.t); } + bool operator==(const T& r) { return underlying_type(t) == underlying_type(r); } + + const EnumClassBitmask& setFromUnderlyingType(underlying_type value) { t = T(value); return *this; } +}; + +#define ENUM_CLASS_BITWISE_OPERATORS(type_name) \ +/*constexpr*/ type_name operator|(type_name l, type_name r) { return type_name(std::underlying_type<type_name>::type(l) | std::underlying_type<type_name>::type(r)); } \ +/*constexpr*/ type_name operator&(type_name l, type_name r) { return type_name(std::underlying_type<type_name>::type(l) & std::underlying_type<type_name>::type(r)); } \ +/*constexpr*/ type_name operator^(type_name l, type_name r) { return type_name(std::underlying_type<type_name>::type(l) ^ std::underlying_type<type_name>::type(r)); } \ +/*constexpr*/ type_name operator~(type_name l) { return type_name(~std::underlying_type<type_name>::type(l)); } + +#define ENUM_CLASS_BITWISE_OPERATORS_DEFS(type_name) \ +/*constexpr*/ type_name operator|(type_name l, type_name r); \ +/*constexpr*/ type_name operator&(type_name l, type_name r); \ +/*constexpr*/ type_name operator^(type_name l, type_name r);\ +/*constexpr*/ type_name operator~(type_name l); + + diff --git a/sources/include/citygml/featureobject.h b/sources/include/citygml/featureobject.h index 1a0ca31..35d812d 100644 --- a/sources/include/citygml/featureobject.h +++ b/sources/include/citygml/featureobject.h @@ -2,8 +2,8 @@ #include <memory> -#include "citygml/citygml_api.h" -#include "citygml/object.h" +#include <citygml/object.h> +#include <citygml/envelope.h> namespace citygml { diff --git a/sources/include/citygml/geometry.h b/sources/include/citygml/geometry.h index c8e4b04..bb12435 100644 --- a/sources/include/citygml/geometry.h +++ b/sources/include/citygml/geometry.h @@ -32,7 +32,9 @@ namespace citygml { GT_Closure = 1 << 4, GT_Floor = 1 << 5, GT_InteriorWall = 1 << 6, - GT_Ceiling = 1 << 7 + GT_Ceiling = 1 << 7, + GT_OuterCeiling = 1 << 8, + GT_OuterFloor = 1 << 9 }; unsigned int getLOD() const; @@ -80,10 +82,10 @@ namespace citygml { unsigned int m_lod; - std::vector<std::shared_ptr<Geometry>> m_childGeometries; + std::vector<std::shared_ptr<Geometry> > m_childGeometries; - std::vector<std::shared_ptr<Polygon>> m_polygons; - std::vector<std::shared_ptr<LineString>> m_lineStrings; + std::vector<std::shared_ptr<Polygon> > m_polygons; + std::vector<std::shared_ptr<LineString> > m_lineStrings; }; std::ostream& operator<<( std::ostream& os, const citygml::Geometry& s ); diff --git a/sources/include/citygml/geometrymanager.h b/sources/include/citygml/geometrymanager.h index 297d006..0e29b8c 100644 --- a/sources/include/citygml/geometrymanager.h +++ b/sources/include/citygml/geometrymanager.h @@ -36,7 +36,7 @@ namespace citygml { std::shared_ptr<CityGMLLogger> m_logger; std::vector<GeometryRequest> m_geometryRequests; - std::unordered_map<std::string, std::shared_ptr<Geometry>> m_sharedGeometries; + std::unordered_map<std::string, std::shared_ptr<Geometry> > m_sharedGeometries; }; } diff --git a/sources/include/citygml/implictgeometry.h b/sources/include/citygml/implictgeometry.h index 81ad53f..8fe8282 100644 --- a/sources/include/citygml/implictgeometry.h +++ b/sources/include/citygml/implictgeometry.h @@ -39,7 +39,7 @@ namespace citygml { TransformationMatrix m_matrix; TVec3d m_referencePoint; - std::vector<std::shared_ptr<Geometry>> m_geometries; + std::vector<std::shared_ptr<Geometry> > m_geometries; std::string m_srsName; }; } diff --git a/sources/include/citygml/object.h b/sources/include/citygml/object.h index 964fc30..a8eb302 100644 --- a/sources/include/citygml/object.h +++ b/sources/include/citygml/object.h @@ -1,14 +1,11 @@ #pragma once #include <string> -#include <map> #include <citygml/citygml_api.h> +#include <citygml/attributesmap.h> namespace citygml { - - typedef std::map< std::string, std::string > AttributesMap; - /** * @brief The base object associated with an unique id and a set of attributes (key-value pairs) */ @@ -27,7 +24,7 @@ namespace citygml { virtual ~Object() {} - void setAttribute(const std::string& name, const std::string& value, bool overwrite = true ); + void setAttribute(const std::string& name, const std::string& value, AttributeType type = AttributeType::String, bool overwrite = true ); protected: diff --git a/sources/include/citygml/polygon.h b/sources/include/citygml/polygon.h index 5025b4e..a0167bd 100644 --- a/sources/include/citygml/polygon.h +++ b/sources/include/citygml/polygon.h @@ -84,6 +84,22 @@ namespace citygml { void finish(Tesselator& tesselator , bool optimize, std::shared_ptr<CityGMLLogger> logger); + std::shared_ptr<LinearRing> exteriorRing(){ + return m_exteriorRing; + } + + const std::shared_ptr<LinearRing> exteriorRing() const{ + return m_exteriorRing; + } + + std::vector<std::shared_ptr<LinearRing> >& interiorRings() { + return m_interiorRings; + } + + const std::vector<std::shared_ptr<LinearRing> >& interiorRings() const{ + return m_interiorRings; + } + virtual ~Polygon(); protected: @@ -106,12 +122,12 @@ namespace citygml { TVec3d computeNormal(); std::vector<TVec3d> m_vertices; - std::unordered_map<std::string, std::vector<TVec2f>> m_themeToFrontTexCoordsMap; - std::unordered_map<std::string, std::vector<TVec2f>> m_themeToBackTexCoordsMap; + std::unordered_map<std::string, std::vector<TVec2f> > m_themeToFrontTexCoordsMap; + std::unordered_map<std::string, std::vector<TVec2f> > m_themeToBackTexCoordsMap; std::vector<unsigned int> m_indices; - std::unique_ptr<LinearRing> m_exteriorRing; - std::vector<std::unique_ptr<LinearRing>> m_interiorRings; + std::shared_ptr<LinearRing> m_exteriorRing; + std::vector<std::shared_ptr<LinearRing> > m_interiorRings; bool m_negNormal; bool m_finished; diff --git a/sources/include/citygml/polygonmanager.h b/sources/include/citygml/polygonmanager.h index d920deb..b8a45de 100644 --- a/sources/include/citygml/polygonmanager.h +++ b/sources/include/citygml/polygonmanager.h @@ -36,7 +36,7 @@ namespace citygml { std::shared_ptr<CityGMLLogger> m_logger; std::vector<PolygonRequest> m_polygonRequests; - std::unordered_map<std::string, std::shared_ptr<Polygon>> m_sharedPolygons; + std::unordered_map<std::string, std::shared_ptr<Polygon> > m_sharedPolygons; }; } diff --git a/sources/include/citygml/tesselator.h b/sources/include/citygml/tesselator.h index 86befba..a26ff57 100644 --- a/sources/include/citygml/tesselator.h +++ b/sources/include/citygml/tesselator.h @@ -30,7 +30,7 @@ #include <GL/glu.h> #endif -#include "citygml/vecs.hpp" +#include <citygml/vecs.hpp> #include <vector> #include <list> #include <memory> @@ -59,7 +59,7 @@ public: // Tesselation result access const std::vector<TVec3d> getVertices() const; - const std::vector<std::vector<TVec2f>>& getTexCoords() const { return _texCoordsLists; } + const std::vector<std::vector<TVec2f> >& getTexCoords() const { return _texCoordsLists; } const std::vector<unsigned int>& getIndices() const; private: @@ -75,7 +75,7 @@ private: GLenum _curMode; std::list<TVec3d> _vertices; - std::vector<std::vector<TVec2f>> _texCoordsLists; + std::vector<std::vector<TVec2f> > _texCoordsLists; std::list<unsigned int> _indices; std::vector<unsigned int> _outIndices; diff --git a/sources/include/citygml/texture.h b/sources/include/citygml/texture.h index 6d73d3a..7afe134 100644 --- a/sources/include/citygml/texture.h +++ b/sources/include/citygml/texture.h @@ -42,7 +42,7 @@ namespace citygml { TVec4f getBorderColor() const; void setBorderColor(TVec4f color); - std::string toString() const; + std::string toString() const override; virtual std::shared_ptr<Texture> asTexture() override; virtual std::shared_ptr<const Texture> asTexture() const override; diff --git a/sources/include/citygml/texturetargetdefinition.h b/sources/include/citygml/texturetargetdefinition.h index a9893c7..6bdf5bb 100644 --- a/sources/include/citygml/texturetargetdefinition.h +++ b/sources/include/citygml/texturetargetdefinition.h @@ -46,7 +46,7 @@ namespace citygml { protected: TextureTargetDefinition(const std::string& targetID, std::shared_ptr<Texture> appearance, const std::string& id); - std::vector<std::shared_ptr<TextureCoordinates>> m_coordinatesList; - std::unordered_map<std::string, std::shared_ptr<TextureCoordinates>> m_idTexCoordMap; + std::vector<std::shared_ptr<TextureCoordinates> > m_coordinatesList; + std::unordered_map<std::string, std::shared_ptr<TextureCoordinates> > m_idTexCoordMap; }; } diff --git a/sources/include/parser/appearanceelementparser.h b/sources/include/parser/appearanceelementparser.h index 8cfb1f4..43937f1 100644 --- a/sources/include/parser/appearanceelementparser.h +++ b/sources/include/parser/appearanceelementparser.h @@ -16,7 +16,7 @@ namespace citygml { AppearanceElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: @@ -30,7 +30,7 @@ namespace citygml { virtual Object* getObject() override; private: - std::vector<std::shared_ptr<Appearance>> m_surfaceDataList; + std::vector<std::shared_ptr<Appearance> > m_surfaceDataList; std::shared_ptr<Object> m_appearanceObj; std::string m_theme; }; diff --git a/sources/include/parser/citygmldocumentparser.h b/sources/include/parser/citygmldocumentparser.h index c9f7a24..cb17a13 100644 --- a/sources/include/parser/citygmldocumentparser.h +++ b/sources/include/parser/citygmldocumentparser.h @@ -64,7 +64,7 @@ namespace citygml { bool checkCurrentElementUnownOrUnexpected_start(const std::string& name); bool checkCurrentElementUnownOrUnexpected_end(const std::string& name); - std::stack<std::shared_ptr<ElementParser>> m_parserStack; + std::stack<std::shared_ptr<ElementParser> > m_parserStack; /** * @brief The currently active parser (the one on which startElement or endElement was called last) diff --git a/sources/include/parser/citymodelelementparser.h b/sources/include/parser/citymodelelementparser.h index eb16c39..94eb4b1 100644 --- a/sources/include/parser/citymodelelementparser.h +++ b/sources/include/parser/citymodelelementparser.h @@ -13,7 +13,7 @@ namespace citygml { CityModelElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(CityModel*)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: diff --git a/sources/include/parser/cityobjectelementparser.h b/sources/include/parser/cityobjectelementparser.h index d149aa8..ff1df25 100644 --- a/sources/include/parser/cityobjectelementparser.h +++ b/sources/include/parser/cityobjectelementparser.h @@ -7,7 +7,7 @@ #include <unordered_set> #include <mutex> -#include "citygml/cityobject.h" +#include <citygml/cityobject.h> namespace citygml { @@ -16,7 +16,7 @@ namespace citygml { CityObjectElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(CityObject*)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: @@ -32,10 +32,12 @@ namespace citygml { private: static void initializeTypeIDTypeMap(); static void initializeAttributesSet(); + static AttributeType getAttributeType(const NodeType::XMLNode& node); CityObject* m_model; std::function<void(CityObject*)> m_callback; std::string m_lastAttributeName; + AttributeType m_lastAttributeType; // The nodes that are valid CityObjects static std::mutex initializedTypeIDMutex; @@ -44,6 +46,7 @@ namespace citygml { static std::mutex initializedAttributeSetMutex; static std::unordered_set<int> attributesSet; + static std::unordered_map<int, AttributeType> attributeTypeMap; static bool attributesSetInitialized; void parseGeometryForLODLevel(int lod); diff --git a/sources/include/parser/geometryelementparser.h b/sources/include/parser/geometryelementparser.h index 5b8d871..3a107c6 100644 --- a/sources/include/parser/geometryelementparser.h +++ b/sources/include/parser/geometryelementparser.h @@ -16,7 +16,7 @@ namespace citygml { int lodLevel, CityObject::CityObjectsType parentType, std::function<void(Geometry*)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: // CityGMLElementParser interface diff --git a/sources/include/parser/georeferencedtextureelementparser.h b/sources/include/parser/georeferencedtextureelementparser.h index 5eee158..eef6154 100644 --- a/sources/include/parser/georeferencedtextureelementparser.h +++ b/sources/include/parser/georeferencedtextureelementparser.h @@ -14,7 +14,7 @@ namespace citygml { GeoReferencedTextureElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(std::shared_ptr<GeoreferencedTexture>)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: diff --git a/sources/include/parser/implicitgeometryelementparser.h b/sources/include/parser/implicitgeometryelementparser.h index 06dfc04..d3a62c6 100644 --- a/sources/include/parser/implicitgeometryelementparser.h +++ b/sources/include/parser/implicitgeometryelementparser.h @@ -16,7 +16,7 @@ namespace citygml { int lodLevel, CityObject::CityObjectsType parentType, std::function<void(ImplicitGeometry*)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: // CityGMLElementParser interface diff --git a/sources/include/parser/linearringelementparser.h b/sources/include/parser/linearringelementparser.h index c9413f0..bfa03f3 100644 --- a/sources/include/parser/linearringelementparser.h +++ b/sources/include/parser/linearringelementparser.h @@ -13,7 +13,7 @@ namespace citygml { LinearRingElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, bool interior, std::function<void(LinearRing*)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: // CityGMLElementParser interface diff --git a/sources/include/parser/linestringelementparser.h b/sources/include/parser/linestringelementparser.h index c21643e..d3d8a83 100644 --- a/sources/include/parser/linestringelementparser.h +++ b/sources/include/parser/linestringelementparser.h @@ -14,7 +14,7 @@ namespace citygml { LineStringElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(std::shared_ptr<LineString>)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: // CityGMLElementParser interface diff --git a/sources/include/parser/materialelementparser.h b/sources/include/parser/materialelementparser.h index 90e0e9c..f08504a 100644 --- a/sources/include/parser/materialelementparser.h +++ b/sources/include/parser/materialelementparser.h @@ -15,7 +15,7 @@ namespace citygml { MaterialElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(std::shared_ptr<Material>)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; bool handlesElement(const NodeType::XMLNode &node) const override; protected: diff --git a/sources/include/parser/nodetypes.h b/sources/include/parser/nodetypes.h index df85a5e..c78d04d 100644 --- a/sources/include/parser/nodetypes.h +++ b/sources/include/parser/nodetypes.h @@ -206,6 +206,8 @@ namespace citygml { NODETYPE( BLDG, FloorSurface ) NODETYPE( BLDG, InteriorWallSurface ) NODETYPE( BLDG, CeilingSurface ) + NODETYPE( BLDG, OuterCeilingSurface ) + NODETYPE( BLDG, OuterFloorSurface ) NODETYPE( BLDG, BuildingFurniture ) NODETYPE( BLDG, CityFurniture ) diff --git a/sources/include/parser/polygonelementparser.h b/sources/include/parser/polygonelementparser.h index 315df87..794fc2c 100644 --- a/sources/include/parser/polygonelementparser.h +++ b/sources/include/parser/polygonelementparser.h @@ -14,7 +14,7 @@ namespace citygml { PolygonElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(std::shared_ptr<Polygon>)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: // CityGMLElementParser interface diff --git a/sources/include/parser/textureelementparser.h b/sources/include/parser/textureelementparser.h index 4fdd560..c5725d0 100644 --- a/sources/include/parser/textureelementparser.h +++ b/sources/include/parser/textureelementparser.h @@ -17,7 +17,7 @@ namespace citygml { TextureElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void(std::shared_ptr<Texture>)> callback); // ElementParser interface - virtual std::string elementParserName() const; + virtual std::string elementParserName() const override; virtual bool handlesElement(const NodeType::XMLNode &node) const override; protected: diff --git a/sources/src/citygml/appearance.cpp b/sources/src/citygml/appearance.cpp index 4e7ffb8..7412d6f 100644 --- a/sources/src/citygml/appearance.cpp +++ b/sources/src/citygml/appearance.cpp @@ -1,4 +1,4 @@ -#include "citygml/appearance.h" +#include <citygml/appearance.h> #include <algorithm> diff --git a/sources/src/citygml/appearancemanager.cpp b/sources/src/citygml/appearancemanager.cpp index d2e36d2..93821d7 100644 --- a/sources/src/citygml/appearancemanager.cpp +++ b/sources/src/citygml/appearancemanager.cpp @@ -1,9 +1,9 @@ -#include "citygml/appearancemanager.h" -#include "citygml/appearance.h" -#include "citygml/appearancetarget.h" -#include "citygml/citygmllogger.h" -#include "citygml/materialtargetdefinition.h" -#include "citygml/texturetargetdefinition.h" +#include <citygml/appearancemanager.h> +#include <citygml/appearance.h> +#include <citygml/appearancetarget.h> +#include <citygml/citygmllogger.h> +#include <citygml/materialtargetdefinition.h> +#include <citygml/texturetargetdefinition.h> namespace citygml { diff --git a/sources/src/citygml/appearancetarget.cpp b/sources/src/citygml/appearancetarget.cpp index 047de91..4f6e7d2 100644 --- a/sources/src/citygml/appearancetarget.cpp +++ b/sources/src/citygml/appearancetarget.cpp @@ -1,8 +1,8 @@ -#include "citygml/appearancetarget.h" -#include "citygml/texturetargetdefinition.h" -#include "citygml/materialtargetdefinition.h" -#include "citygml/appearancetargetdefinition.h" -#include "citygml/appearance.h" +#include <citygml/appearancetarget.h> +#include <citygml/texturetargetdefinition.h> +#include <citygml/materialtargetdefinition.h> +#include <citygml/appearancetargetdefinition.h> +#include <citygml/appearance.h> #include <unordered_set> #include <algorithm> diff --git a/sources/src/citygml/attributesmap.cpp b/sources/src/citygml/attributesmap.cpp new file mode 100644 index 0000000..e9a7d40 --- /dev/null +++ b/sources/src/citygml/attributesmap.cpp @@ -0,0 +1,109 @@ +#include <citygml/attributesmap.h> + +#include <sstream> + +namespace citygml { + +AttributeValue::AttributeValue() + : m_type(AttributeType::String) +{ +} + +AttributeValue::AttributeValue(const char* value) + : m_type(AttributeType::String) + , m_value(value) +{ + +} + +AttributeValue::AttributeValue(const std::string& value, AttributeType type) + : m_type(type) + , m_value(value) +{ + +} + +AttributeValue::AttributeValue(double value) +{ + setValue(value); +} + +AttributeValue::AttributeValue(int value) +{ + setValue(value); +} + +void AttributeValue::setType(AttributeType type) +{ + m_type = type; +} + +AttributeType AttributeValue::getType() const +{ + return m_type; +} + +void AttributeValue::setValue(const std::string& value, AttributeType type) +{ + m_type = type; + m_value = value; +} + +void AttributeValue::setValue(double value) +{ + m_type = AttributeType::Double; + + std::stringstream sstream; + sstream << value; + m_value = sstream.str(); +} + +void AttributeValue::setValue(int value) +{ + m_type = AttributeType::Integer; + + std::stringstream sstream; + sstream << value; + m_value = sstream.str(); +} + +std::string AttributeValue::asString() const +{ + return m_value; +} + +double AttributeValue::asDouble(double defaultValue) const +{ + double value = defaultValue; + + if (m_type == AttributeType::Double) + { + std::stringstream sstream; + sstream << m_value; + sstream >> value; + } + + return value; +} + +int AttributeValue::asInteger(int defaultValue) const +{ + int value = defaultValue; + + if (m_type == AttributeType::Integer) + { + std::stringstream sstream; + sstream << m_value; + sstream >> value; + } + + return value; +} + +std::ostream& operator<<(std::ostream& os, const AttributeValue& o) +{ + os << o.asString(); + return os; +} + +} // namespace citygml diff --git a/sources/src/citygml/citygmlfactory.cpp b/sources/src/citygml/citygmlfactory.cpp index 739f43d..ba85d1e 100644 --- a/sources/src/citygml/citygmlfactory.cpp +++ b/sources/src/citygml/citygmlfactory.cpp @@ -1,20 +1,20 @@ -#include "citygml/citygmlfactory.h" -#include "citygml/appearancemanager.h" -#include "citygml/polygonmanager.h" -#include "citygml/geometrymanager.h" -#include "citygml/cityobject.h" -#include "citygml/appearancetarget.h" -#include "citygml/polygon.h" -#include "citygml/linestring.h" -#include "citygml/implictgeometry.h" -#include "citygml/texture.h" -#include "citygml/georeferencedtexture.h" -#include "citygml/material.h" -#include "citygml/materialtargetdefinition.h" -#include "citygml/texturetargetdefinition.h" -#include "citygml/citymodel.h" -#include "citygml/implictgeometry.h" -#include "citygml/citygmllogger.h" +#include <citygml/cityobject.h> +#include <citygml/citygmlfactory.h> +#include <citygml/appearancemanager.h> +#include <citygml/polygonmanager.h> +#include <citygml/geometrymanager.h> +#include <citygml/appearancetarget.h> +#include <citygml/polygon.h> +#include <citygml/linestring.h> +#include <citygml/implictgeometry.h> +#include <citygml/texture.h> +#include <citygml/georeferencedtexture.h> +#include <citygml/material.h> +#include <citygml/materialtargetdefinition.h> +#include <citygml/texturetargetdefinition.h> +#include <citygml/citymodel.h> +#include <citygml/implictgeometry.h> +#include <citygml/citygmllogger.h> namespace citygml { @@ -54,6 +54,10 @@ namespace citygml { return Geometry::GeometryType::GT_InteriorWall; case CityObject::CityObjectsType::COT_CeilingSurface: return Geometry::GeometryType::GT_Ceiling; + case CityObject::CityObjectsType::COT_OuterCeilingSurface: + return Geometry::GeometryType::GT_OuterCeiling; + case CityObject::CityObjectsType::COT_OuterFloorSurface: + return Geometry::GeometryType::GT_OuterFloor; default: return Geometry::GeometryType::GT_Unknown; } diff --git a/sources/src/citygml/citymodel.cpp b/sources/src/citygml/citymodel.cpp index eab81ce..9f411dd 100644 --- a/sources/src/citygml/citymodel.cpp +++ b/sources/src/citygml/citymodel.cpp @@ -17,10 +17,10 @@ * GNU Lesser General Public License for more details. */ -#include "citygml/citymodel.h" -#include "citygml/appearancemanager.h" -#include "citygml/appearance.h" -#include "citygml/citygmllogger.h" +#include <citygml/citymodel.h> +#include <citygml/appearancemanager.h> +#include <citygml/appearance.h> +#include <citygml/citygmllogger.h> #include <float.h> #include <string.h> diff --git a/sources/src/citygml/cityobject.cpp b/sources/src/citygml/cityobject.cpp index 5c9bdee..a3b1473 100644 --- a/sources/src/citygml/cityobject.cpp +++ b/sources/src/citygml/cityobject.cpp @@ -1,14 +1,16 @@ -#include "citygml/cityobject.h" -#include "citygml/geometry.h" -#include "citygml/implictgeometry.h" -#include "citygml/appearancemanager.h" -#include "citygml/citygml.h" -#include "citygml/citygmllogger.h" -#include "citygml/address.h" +#include <citygml/cityobject.h> +#include <citygml/geometry.h> +#include <citygml/implictgeometry.h> +#include <citygml/appearancemanager.h> +#include <citygml/citygml.h> +#include <citygml/citygmllogger.h> +#include <citygml/address.h> #include <unordered_map> #include <algorithm> +ENUM_CLASS_BITWISE_OPERATORS(citygml::CityObject::CityObjectsType); + namespace citygml { CityObject::CityObject(const std::string& id, CityObject::CityObjectsType type) : FeatureObject( id ), m_type( type ) @@ -119,14 +121,14 @@ namespace citygml { std::ostream& operator<<( std::ostream& os, const CityObject& o ) { - os << o.getType() << ": " << o.getId() << std::endl; + os << static_cast<uint64_t>(o.getType()) << ": " << o.getId() << std::endl; os << " Envelope: " << o.getEnvelope() << std::endl; AttributesMap::const_iterator it = o.getAttributes().begin(); while ( it != o.getAttributes().end() ) { os << " + " << it->first << ": " << it->second << std::endl; - it++; + ++it; } for (unsigned int i = 0; i < o.getGeometriesCount(); i++) { @@ -141,67 +143,71 @@ namespace citygml { std::string cityObjectsTypeToString(const CityObject::CityObjectsType& t) { switch (t) { - case CityObject::COT_GenericCityObject: + case CityObject::CityObjectsType::COT_GenericCityObject: return "GenericCityObject"; - case CityObject::COT_Building: + case CityObject::CityObjectsType::COT_Building: return "Building"; - case CityObject::COT_Room: + case CityObject::CityObjectsType::COT_Room: return "Room"; - case CityObject::COT_BuildingInstallation: + case CityObject::CityObjectsType::COT_BuildingInstallation: return "BuildingInstallation"; - case CityObject::COT_BuildingFurniture: + case CityObject::CityObjectsType::COT_BuildingFurniture: return "BuildingFurniture"; - case CityObject::COT_Door: + case CityObject::CityObjectsType::COT_Door: return "Door"; - case CityObject::COT_Window: + case CityObject::CityObjectsType::COT_Window: return "Window"; - case CityObject::COT_CityFurniture: + case CityObject::CityObjectsType::COT_CityFurniture: return "CityFurniture"; - case CityObject::COT_Track: + case CityObject::CityObjectsType::COT_Track: return "Track"; - case CityObject::COT_Road: + case CityObject::CityObjectsType::COT_Road: return "Road"; - case CityObject::COT_Railway: + case CityObject::CityObjectsType::COT_Railway: return "Railway"; - case CityObject::COT_Square: + case CityObject::CityObjectsType::COT_Square: return "Square"; - case CityObject::COT_PlantCover: + case CityObject::CityObjectsType::COT_PlantCover: return "PlantCover"; - case CityObject::COT_SolitaryVegetationObject: + case CityObject::CityObjectsType::COT_SolitaryVegetationObject: return "SolitaryVegetationObject"; - case CityObject::COT_WaterBody: + case CityObject::CityObjectsType::COT_WaterBody: return "WaterBody"; - case CityObject::COT_ReliefFeature: + case CityObject::CityObjectsType::COT_ReliefFeature: return "ReliefFeature"; - case CityObject::COT_LandUse: + case CityObject::CityObjectsType::COT_LandUse: return "LandUse"; - case CityObject::COT_Tunnel: + case CityObject::CityObjectsType::COT_Tunnel: return "Tunnel"; - case CityObject::COT_Bridge: + case CityObject::CityObjectsType::COT_Bridge: return "Bridge"; - case CityObject::COT_BridgeConstructionElement: + case CityObject::CityObjectsType::COT_BridgeConstructionElement: return "BridgeConstructionElement"; - case CityObject::COT_BridgeInstallation: + case CityObject::CityObjectsType::COT_BridgeInstallation: return "BridgeInstallation"; - case CityObject::COT_BridgePart: + case CityObject::CityObjectsType::COT_BridgePart: return "BridgePart"; - case CityObject::COT_BuildingPart: + case CityObject::CityObjectsType::COT_BuildingPart: return "BuildingPart"; - case CityObject::COT_WallSurface: + case CityObject::CityObjectsType::COT_WallSurface: return "WallSurface"; - case CityObject::COT_RoofSurface: + case CityObject::CityObjectsType::COT_RoofSurface: return "RoofSurface"; - case CityObject::COT_GroundSurface: + case CityObject::CityObjectsType::COT_GroundSurface: return "GroundSurface"; - case CityObject::COT_ClosureSurface: + case CityObject::CityObjectsType::COT_ClosureSurface: return "ClosureSurface"; - case CityObject::COT_FloorSurface: + case CityObject::CityObjectsType::COT_FloorSurface: return "FloorSurface"; - case CityObject::COT_InteriorWallSurface: + case CityObject::CityObjectsType::COT_InteriorWallSurface: return "InteriorWallSurface"; - case CityObject::COT_CeilingSurface: + case CityObject::CityObjectsType::COT_CeilingSurface: return "CeilingSurface"; - case CityObject::COT_TransportationObject: + case CityObject::CityObjectsType::COT_OuterCeilingSurface: + return "OuterCeilingSurface"; + case CityObject::CityObjectsType::COT_OuterFloorSurface: + return "OuterFloorSurface"; + case CityObject::CityObjectsType::COT_TransportationObject: return "TransportationObject"; default: return "Unknown"; @@ -215,37 +221,39 @@ namespace citygml { } std::unordered_map<std::string, CityObject::CityObjectsType> stringTypeMap = { - {cityObjectsTypeToLowerString(CityObject::COT_GenericCityObject), CityObject::COT_GenericCityObject}, - {cityObjectsTypeToLowerString(CityObject::COT_Building), CityObject::COT_Building}, - {cityObjectsTypeToLowerString(CityObject::COT_Room), CityObject::COT_Room}, - {cityObjectsTypeToLowerString(CityObject::COT_BuildingInstallation), CityObject::COT_BuildingInstallation}, - {cityObjectsTypeToLowerString(CityObject::COT_BuildingFurniture), CityObject::COT_BuildingFurniture}, - {cityObjectsTypeToLowerString(CityObject::COT_Door), CityObject::COT_Door}, - {cityObjectsTypeToLowerString(CityObject::COT_Window), CityObject::COT_Window}, - {cityObjectsTypeToLowerString(CityObject::COT_CityFurniture), CityObject::COT_CityFurniture}, - {cityObjectsTypeToLowerString(CityObject::COT_Track), CityObject::COT_Track}, - {cityObjectsTypeToLowerString(CityObject::COT_Road), CityObject::COT_Road}, - {cityObjectsTypeToLowerString(CityObject::COT_Railway), CityObject::COT_Railway}, - {cityObjectsTypeToLowerString(CityObject::COT_Square), CityObject::COT_Square}, - {cityObjectsTypeToLowerString(CityObject::COT_PlantCover), CityObject::COT_PlantCover}, - {cityObjectsTypeToLowerString(CityObject::COT_SolitaryVegetationObject), CityObject::COT_SolitaryVegetationObject}, - {cityObjectsTypeToLowerString(CityObject::COT_WaterBody), CityObject::COT_WaterBody}, - {cityObjectsTypeToLowerString(CityObject::COT_ReliefFeature), CityObject::COT_ReliefFeature}, - {cityObjectsTypeToLowerString(CityObject::COT_LandUse), CityObject::COT_LandUse}, - {cityObjectsTypeToLowerString(CityObject::COT_Tunnel), CityObject::COT_Tunnel}, - {cityObjectsTypeToLowerString(CityObject::COT_Bridge), CityObject::COT_Bridge}, - {cityObjectsTypeToLowerString(CityObject::COT_BridgeConstructionElement), CityObject::COT_BridgeConstructionElement}, - {cityObjectsTypeToLowerString(CityObject::COT_BridgeInstallation), CityObject::COT_BridgeInstallation}, - {cityObjectsTypeToLowerString(CityObject::COT_BridgePart), CityObject::COT_BridgePart}, - {cityObjectsTypeToLowerString(CityObject::COT_BuildingPart), CityObject::COT_BuildingPart}, - {cityObjectsTypeToLowerString(CityObject::COT_WallSurface), CityObject::COT_WallSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_RoofSurface), CityObject::COT_RoofSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_GroundSurface), CityObject::COT_GroundSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_ClosureSurface), CityObject::COT_ClosureSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_FloorSurface), CityObject::COT_FloorSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_InteriorWallSurface), CityObject::COT_InteriorWallSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_CeilingSurface), CityObject::COT_CeilingSurface}, - {cityObjectsTypeToLowerString(CityObject::COT_TransportationObject), CityObject::COT_TransportationObject} + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_GenericCityObject), CityObject::CityObjectsType::COT_GenericCityObject}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Building), CityObject::CityObjectsType::COT_Building}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Room), CityObject::CityObjectsType::COT_Room}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BuildingInstallation), CityObject::CityObjectsType::COT_BuildingInstallation}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BuildingFurniture), CityObject::CityObjectsType::COT_BuildingFurniture}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Door), CityObject::CityObjectsType::COT_Door}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Window), CityObject::CityObjectsType::COT_Window}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_CityFurniture), CityObject::CityObjectsType::COT_CityFurniture}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Track), CityObject::CityObjectsType::COT_Track}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Road), CityObject::CityObjectsType::COT_Road}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Railway), CityObject::CityObjectsType::COT_Railway}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Square), CityObject::CityObjectsType::COT_Square}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_PlantCover), CityObject::CityObjectsType::COT_PlantCover}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_SolitaryVegetationObject), CityObject::CityObjectsType::COT_SolitaryVegetationObject}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_WaterBody), CityObject::CityObjectsType::COT_WaterBody}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_ReliefFeature), CityObject::CityObjectsType::COT_ReliefFeature}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_LandUse), CityObject::CityObjectsType::COT_LandUse}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Tunnel), CityObject::CityObjectsType::COT_Tunnel}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_Bridge), CityObject::CityObjectsType::COT_Bridge}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BridgeConstructionElement), CityObject::CityObjectsType::COT_BridgeConstructionElement}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BridgeInstallation), CityObject::CityObjectsType::COT_BridgeInstallation}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BridgePart), CityObject::CityObjectsType::COT_BridgePart}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_BuildingPart), CityObject::CityObjectsType::COT_BuildingPart}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_WallSurface), CityObject::CityObjectsType::COT_WallSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_RoofSurface), CityObject::CityObjectsType::COT_RoofSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_GroundSurface), CityObject::CityObjectsType::COT_GroundSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_ClosureSurface), CityObject::CityObjectsType::COT_ClosureSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_FloorSurface), CityObject::CityObjectsType::COT_FloorSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_InteriorWallSurface), CityObject::CityObjectsType::COT_InteriorWallSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_CeilingSurface), CityObject::CityObjectsType::COT_CeilingSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_OuterCeilingSurface), CityObject::CityObjectsType::COT_OuterCeilingSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_OuterFloorSurface), CityObject::CityObjectsType::COT_OuterFloorSurface}, + {cityObjectsTypeToLowerString(CityObject::CityObjectsType::COT_TransportationObject), CityObject::CityObjectsType::COT_TransportationObject} }; CityObject::CityObjectsType cityObjectsTypeFromString(const std::string& s, bool& valid) @@ -260,7 +268,7 @@ namespace citygml { return it->second; } - return CityObject::COT_All; + return CityObject::CityObjectsType::COT_All; } } diff --git a/sources/src/citygml/envelope.cpp b/sources/src/citygml/envelope.cpp index f0e9275..b8c6de3 100644 --- a/sources/src/citygml/envelope.cpp +++ b/sources/src/citygml/envelope.cpp @@ -1,4 +1,4 @@ -#include "citygml/envelope.h" +#include <citygml/envelope.h> #include <numeric> #include <cmath> diff --git a/sources/src/citygml/featureobject.cpp b/sources/src/citygml/featureobject.cpp index 5765604..d548b2d 100644 --- a/sources/src/citygml/featureobject.cpp +++ b/sources/src/citygml/featureobject.cpp @@ -1,6 +1,6 @@ -#include "citygml/featureobject.h" +#include <citygml/featureobject.h> -#include "citygml/envelope.h" +#include <citygml/envelope.h> namespace citygml { diff --git a/sources/src/citygml/geometry.cpp b/sources/src/citygml/geometry.cpp index 1118c07..e35609b 100644 --- a/sources/src/citygml/geometry.cpp +++ b/sources/src/citygml/geometry.cpp @@ -1,4 +1,4 @@ -#include "citygml/geometry.h" +#include <citygml/geometry.h> #include <citygml/polygon.h> #include <citygml/appearancemanager.h> @@ -92,6 +92,10 @@ namespace citygml { return "InteriorWall"; case GeometryType::GT_Ceiling: return "Ceiling"; + case GeometryType::GT_OuterCeiling: + return "OuterCeiling"; + case GeometryType::GT_OuterFloor: + return "OuterFloor"; default: return "Unknown"; } diff --git a/sources/src/citygml/geometrymanager.cpp b/sources/src/citygml/geometrymanager.cpp index 1bdfbb6..63eaebe 100644 --- a/sources/src/citygml/geometrymanager.cpp +++ b/sources/src/citygml/geometrymanager.cpp @@ -1,8 +1,8 @@ -#include "citygml/geometrymanager.h" +#include <citygml/geometrymanager.h> -#include "citygml/geometry.h" -#include "citygml/implictgeometry.h" -#include "citygml/citygmllogger.h" +#include <citygml/geometry.h> +#include <citygml/implictgeometry.h> +#include <citygml/citygmllogger.h> namespace citygml { diff --git a/sources/src/citygml/georeferencedtexture.cpp b/sources/src/citygml/georeferencedtexture.cpp index be8aba0..389e1a8 100644 --- a/sources/src/citygml/georeferencedtexture.cpp +++ b/sources/src/citygml/georeferencedtexture.cpp @@ -1,4 +1,4 @@ -#include "citygml/georeferencedtexture.h" +#include <citygml/georeferencedtexture.h> namespace citygml { diff --git a/sources/src/citygml/implictgeometry.cpp b/sources/src/citygml/implictgeometry.cpp index 32b576f..1bc1b4c 100644 --- a/sources/src/citygml/implictgeometry.cpp +++ b/sources/src/citygml/implictgeometry.cpp @@ -1,5 +1,5 @@ -#include "citygml/implictgeometry.h" -#include "citygml/geometry.h" +#include <citygml/implictgeometry.h> +#include <citygml/geometry.h> namespace citygml { diff --git a/sources/src/citygml/linearring.cpp b/sources/src/citygml/linearring.cpp index 8a77db5..a91d299 100644 --- a/sources/src/citygml/linearring.cpp +++ b/sources/src/citygml/linearring.cpp @@ -1,8 +1,8 @@ -#include "citygml/linearring.h" -#include "citygml/texturecoordinates.h" -#include "citygml/texture.h" -#include "citygml/texturetargetdefinition.h" -#include "citygml/citygmllogger.h" +#include <citygml/linearring.h> +#include <citygml/texturecoordinates.h> +#include <citygml/texture.h> +#include <citygml/texturetargetdefinition.h> +#include <citygml/citygmllogger.h> #include <float.h> #include <assert.h> @@ -66,7 +66,7 @@ namespace citygml { { // Currently TextureCoordinates sharing via xlink is not supported (every TextureTargetDefinition is the // sole owner of its TextureCoordinate objects... if this ever changes use an unordered_set for the texture coordinates - std::vector<std::shared_ptr<TextureCoordinates>> coordinatesList; + std::vector<std::shared_ptr<TextureCoordinates> > coordinatesList; bool textureCoordinatesVerticesMismatch = false; diff --git a/sources/src/citygml/material.cpp b/sources/src/citygml/material.cpp index 976f72e..689edbf 100644 --- a/sources/src/citygml/material.cpp +++ b/sources/src/citygml/material.cpp @@ -1,4 +1,4 @@ -#include "citygml/material.h" +#include <citygml/material.h> namespace citygml { diff --git a/sources/src/citygml/materialtargetdefinition.cpp b/sources/src/citygml/materialtargetdefinition.cpp index 24399e0..667379c 100644 --- a/sources/src/citygml/materialtargetdefinition.cpp +++ b/sources/src/citygml/materialtargetdefinition.cpp @@ -1,4 +1,4 @@ -#include "citygml/materialtargetdefinition.h" +#include <citygml/materialtargetdefinition.h> namespace citygml { diff --git a/sources/src/citygml/object.cpp b/sources/src/citygml/object.cpp index f147481..702ae35 100644 --- a/sources/src/citygml/object.cpp +++ b/sources/src/citygml/object.cpp @@ -1,4 +1,4 @@ -#include "citygml/object.h" +#include <citygml/object.h> #include <sstream> #include <iostream> @@ -22,27 +22,27 @@ namespace citygml { std::string Object::getAttribute(const std::string& name) const { - std::map< std::string, std::string >::const_iterator elt = m_attributes.find( name ); - return elt != m_attributes.end() ? elt->second : ""; + AttributesMap::const_iterator elt = m_attributes.find( name ); + return elt != m_attributes.end() ? elt->second.asString() : ""; } - const AttributesMap&Object::getAttributes() const + const AttributesMap& Object::getAttributes() const { return m_attributes; } - AttributesMap&Object::getAttributes() + AttributesMap& Object::getAttributes() { return m_attributes; } - void Object::setAttribute(const std::string& name, const std::string& value, bool overwrite) + void Object::setAttribute(const std::string& name, const std::string& value, AttributeType type, bool overwrite) { if ( !overwrite ) { if ( m_attributes.count(name) > 1 ) return; } - m_attributes[ name ] = value; + m_attributes[ name ] = AttributeValue(value, type); } std::ostream& operator<<( std::ostream& os, const Object& o ) diff --git a/sources/src/citygml/polygon.cpp b/sources/src/citygml/polygon.cpp index a31962a..9dcc755 100644 --- a/sources/src/citygml/polygon.cpp +++ b/sources/src/citygml/polygon.cpp @@ -1,11 +1,11 @@ -#include "citygml/polygon.h" -#include "citygml/appearance.h" -#include "citygml/texture.h" -#include "citygml/texturecoordinates.h" -#include "citygml/tesselator.h" -#include "citygml/citygmllogger.h" -#include "citygml/texturetargetdefinition.h" -#include "citygml/materialtargetdefinition.h" +#include <citygml/polygon.h> +#include <citygml/appearance.h> +#include <citygml/texture.h> +#include <citygml/texturecoordinates.h> +#include <citygml/tesselator.h> +#include <citygml/citygmllogger.h> +#include <citygml/texturetargetdefinition.h> +#include <citygml/materialtargetdefinition.h> #include <algorithm> #include <stdexcept> @@ -134,7 +134,7 @@ namespace citygml { m_exteriorRing->removeDuplicateVertices( texTargetDefinitions, logger ); } - for ( std::unique_ptr<LinearRing>& ring : m_interiorRings ) + for ( auto& ring : m_interiorRings ) { ring->removeDuplicateVertices( texTargetDefinitions, logger ); } @@ -157,8 +157,8 @@ namespace citygml { return coords->getCoords(); } - std::vector<std::vector<TVec2f>> Polygon::getTexCoordListsForRing(const LinearRing& ring, const std::vector<std::string>& themesFront, const std::vector<std::string>& themesBack) { - std::vector<std::vector<TVec2f>> texCoordsLists; + std::vector<std::vector<TVec2f> > Polygon::getTexCoordListsForRing(const LinearRing& ring, const std::vector<std::string>& themesFront, const std::vector<std::string>& themesBack) { + std::vector<std::vector<TVec2f> > texCoordsLists; for (const std::string& theme : themesFront) { texCoordsLists.push_back(getTexCoordsForRingAndTheme(ring, theme, true)); @@ -186,7 +186,7 @@ namespace citygml { m_exteriorRing->forgetVertices(); } - for ( std::unique_ptr<LinearRing>& ring : m_interiorRings ) + for ( auto& ring : m_interiorRings ) { tesselator.addContour( ring->getVertices(), getTexCoordListsForRing(*ring, themesFront, themesBack) ); ring->forgetVertices(); @@ -200,7 +200,7 @@ namespace citygml { return; } - const std::vector<std::vector<TVec2f>>& texCoordLists = tesselator.getTexCoords(); + const std::vector<std::vector<TVec2f> >& texCoordLists = tesselator.getTexCoords(); for (size_t i = 0; i < themesFront.size(); i++) { assert(texCoordLists.at(i).size() == m_vertices.size()); @@ -256,10 +256,10 @@ namespace citygml { } if ( ring->isExterior() ) { - m_exteriorRing = std::unique_ptr<LinearRing>(ring); + m_exteriorRing = std::shared_ptr<LinearRing>(ring); } else { - m_interiorRings.push_back( std::unique_ptr<LinearRing>(ring) ); + m_interiorRings.push_back( std::shared_ptr<LinearRing>(ring) ); } } diff --git a/sources/src/citygml/polygonmanager.cpp b/sources/src/citygml/polygonmanager.cpp index 5340c1f..78a51b2 100644 --- a/sources/src/citygml/polygonmanager.cpp +++ b/sources/src/citygml/polygonmanager.cpp @@ -1,8 +1,8 @@ -#include "citygml/polygonmanager.h" +#include <citygml/polygonmanager.h> -#include "citygml/polygon.h" -#include "citygml/citygmllogger.h" -#include "citygml/geometry.h" +#include <citygml/polygon.h> +#include <citygml/citygmllogger.h> +#include <citygml/geometry.h> namespace citygml { diff --git a/sources/src/citygml/tesselator.cpp b/sources/src/citygml/tesselator.cpp index 7b85bc8..757f737 100644 --- a/sources/src/citygml/tesselator.cpp +++ b/sources/src/citygml/tesselator.cpp @@ -22,7 +22,7 @@ #define NOMINMAX #endif -#include "citygml/tesselator.h" +#include <citygml/tesselator.h> #ifndef WIN32 # include <stdint.h> #endif @@ -32,6 +32,7 @@ #include <iostream> #include <assert.h> +#include <algorithm> Tesselator::Tesselator(std::shared_ptr<citygml::CityGMLLogger> logger ) { @@ -79,7 +80,7 @@ const std::vector<unsigned int>& Tesselator::getIndices() const return _outIndices; } -void Tesselator::addContour(const std::vector<TVec3d>& pts, std::vector<std::vector<TVec2f>> textureCoordinatesLists ) +void Tesselator::addContour(const std::vector<TVec3d>& pts, std::vector<std::vector<TVec2f> > textureCoordinatesLists ) { unsigned int len = pts.size(); if ( len < 3 ) return; diff --git a/sources/src/citygml/texture.cpp b/sources/src/citygml/texture.cpp index 42b7dd8..428743b 100644 --- a/sources/src/citygml/texture.cpp +++ b/sources/src/citygml/texture.cpp @@ -1,5 +1,5 @@ -#include "citygml/texture.h" -#include "citygml/utils.h" +#include <citygml/texture.h> +#include <citygml/utils.h> namespace citygml { diff --git a/sources/src/citygml/texturecoordinates.cpp b/sources/src/citygml/texturecoordinates.cpp index dea3397..472af15 100644 --- a/sources/src/citygml/texturecoordinates.cpp +++ b/sources/src/citygml/texturecoordinates.cpp @@ -1,5 +1,5 @@ -#include "citygml/texturecoordinates.h" -#include "citygml/linearring.h" +#include <citygml/texturecoordinates.h> +#include <citygml/linearring.h> namespace citygml { diff --git a/sources/src/citygml/texturetargetdefinition.cpp b/sources/src/citygml/texturetargetdefinition.cpp index 6b74ef5..c0a2971 100644 --- a/sources/src/citygml/texturetargetdefinition.cpp +++ b/sources/src/citygml/texturetargetdefinition.cpp @@ -1,5 +1,5 @@ -#include "citygml/texturetargetdefinition.h" -#include "citygml/texturecoordinates.h" +#include <citygml/texturetargetdefinition.h> +#include <citygml/texturecoordinates.h> namespace citygml { diff --git a/sources/src/citygml/transformmatrix.cpp b/sources/src/citygml/transformmatrix.cpp index 85d2afa..16b1c53 100644 --- a/sources/src/citygml/transformmatrix.cpp +++ b/sources/src/citygml/transformmatrix.cpp @@ -1,4 +1,4 @@ -#include "citygml/transformmatrix.h" +#include <citygml/transformmatrix.h> namespace citygml { diff --git a/sources/src/parser/addressparser.cpp b/sources/src/parser/addressparser.cpp index f6f1162..3e5084a 100644 --- a/sources/src/parser/addressparser.cpp +++ b/sources/src/parser/addressparser.cpp @@ -10,6 +10,30 @@ #include <functional> namespace citygml { + void setCountry(Address* address, std::string const &country) + { + address->setCountry(country); + } + + void setLocality(Address* address, std::string const &locality) + { + address->setLocality(locality); + } + + void setThoroughfareName(Address* address, std::string const &thoroughfareName) + { + address->setThoroughfareName(thoroughfareName); + } + + void setThoroughfareNumber(Address *address, std::string const &thoroughfareNumber) + { + address->setThoroughfareNumber(thoroughfareNumber); + } + + void setPostalCode(Address* address, std::string const &postalCode) + { + address->setPostalCode(postalCode); + } namespace { @@ -20,7 +44,7 @@ namespace citygml { auto k_rootElements = std::unordered_set<NodeType::XMLNode>(); auto k_subElements = std::unordered_set<NodeType::XMLNode>(); - auto k_dataElements = std::unordered_map<NodeType::XMLNode, std::function<void(Address*, const std::string&)>>(); + auto k_dataElements = std::unordered_map<NodeType::XMLNode, std::function<void(Address*, const std::string&)> >(); std::mutex g_nodeSetMutex; bool g_nodeSetsInitialized = false; @@ -43,13 +67,11 @@ namespace citygml { NodeType::XAL_ThoroughfareNode }; - k_dataElements = { - { NodeType::XAL_CountryNameNode, &Address::setCountry }, - { NodeType::XAL_LocalityNameNode, &Address::setLocality }, - { NodeType::XAL_ThoroughfareNameNode, &Address::setThoroughfareName }, - { NodeType::XAL_ThoroughfareNumberNode, &Address::setThoroughfareNumber }, - { NodeType::XAL_PostalCodeNumberNode, &Address::setPostalCode } - }; + k_dataElements[NodeType::XAL_CountryNameNode] = &setCountry; + k_dataElements[NodeType::XAL_LocalityNameNode] = &setLocality; + k_dataElements[NodeType::XAL_ThoroughfareNameNode] = &setThoroughfareName; + k_dataElements[NodeType::XAL_ThoroughfareNumberNode] = &setThoroughfareNumber; + k_dataElements[NodeType::XAL_PostalCodeNumberNode] = &setPostalCode; g_nodeSetsInitialized = true; } @@ -82,7 +104,7 @@ namespace citygml { throw std::runtime_error("Unexpected start tag found."); } - m_address = make_unique<Address>(attributes.getCityGMLIDAttribute()); + m_address = citygml::make_unique<Address>(attributes.getCityGMLIDAttribute()); return true; } diff --git a/sources/src/parser/appearanceelementparser.cpp b/sources/src/parser/appearanceelementparser.cpp index 2f6456c..1ae9195 100644 --- a/sources/src/parser/appearanceelementparser.cpp +++ b/sources/src/parser/appearanceelementparser.cpp @@ -12,13 +12,13 @@ #include "parser/georeferencedtextureelementparser.h" #include "parser/skipelementparser.h" -#include "citygml/appearance.h" -#include "citygml/texture.h" -#include "citygml/material.h" -#include "citygml/georeferencedtexture.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" -#include "citygml/object.h" +#include <citygml/appearance.h> +#include <citygml/texture.h> +#include <citygml/material.h> +#include <citygml/georeferencedtexture.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> +#include <citygml/object.h> #include <stdexcept> diff --git a/sources/src/parser/attributes.cpp b/sources/src/parser/attributes.cpp index d5b1af1..132f884 100644 --- a/sources/src/parser/attributes.cpp +++ b/sources/src/parser/attributes.cpp @@ -2,7 +2,7 @@ #include "parser/parserutils.hpp" #include "parser/documentlocation.h" -#include "citygml/citygmllogger.h" +#include <citygml/citygmllogger.h> #include "sstream" diff --git a/sources/src/parser/citygmldocumentparser.cpp b/sources/src/parser/citygmldocumentparser.cpp index a792d39..3a25d98 100644 --- a/sources/src/parser/citygmldocumentparser.cpp +++ b/sources/src/parser/citygmldocumentparser.cpp @@ -5,10 +5,10 @@ #include "parser/citymodelelementparser.h" #include "parser/geocoordinatetransformer.h" -#include "citygml/citygmllogger.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citymodel.h" -#include "citygml/tesselator.h" +#include <citygml/citygmllogger.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citymodel.h> +#include <citygml/tesselator.h> #include <stdexcept> @@ -133,6 +133,7 @@ namespace citygml { CITYGML_LOG_INFO(m_logger, "Finished coordinates transformation ."); } catch (const std::runtime_error& e) { CITYGML_LOG_ERROR(m_logger, "Coordinate transformation aborted: " << e.what()); + throw e; } } diff --git a/sources/src/parser/citygmlelementparser.cpp b/sources/src/parser/citygmlelementparser.cpp index 16e93d7..5a30c86 100644 --- a/sources/src/parser/citygmlelementparser.cpp +++ b/sources/src/parser/citygmlelementparser.cpp @@ -1,7 +1,7 @@ #include "parser/citygmlelementparser.h" -#include "citygml/utils.h" -#include "citygml/citygmllogger.h" +#include <citygml/utils.h> +#include <citygml/citygmllogger.h> #include "parser/citygmldocumentparser.h" #include "parser/documentlocation.h" diff --git a/sources/src/parser/citymodelelementparser.cpp b/sources/src/parser/citymodelelementparser.cpp index 9d2b135..915dd91 100644 --- a/sources/src/parser/citymodelelementparser.cpp +++ b/sources/src/parser/citymodelelementparser.cpp @@ -6,10 +6,10 @@ #include "parser/cityobjectelementparser.h" #include "parser/appearanceelementparser.h" -#include "citygml/citymodel.h" -#include "citygml/citygmllogger.h" -#include "citygml/citygmlfactory.h" -#include "citygml/cityobject.h" +#include <citygml/citymodel.h> +#include <citygml/citygmllogger.h> +#include <citygml/citygmlfactory.h> +#include <citygml/cityobject.h> #include <stdexcept> diff --git a/sources/src/parser/cityobjectelementparser.cpp b/sources/src/parser/cityobjectelementparser.cpp index 4c7ec16..dd43786 100644 --- a/sources/src/parser/cityobjectelementparser.cpp +++ b/sources/src/parser/cityobjectelementparser.cpp @@ -11,9 +11,9 @@ #include "parser/linestringelementparser.h" #include "parser/addressparser.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" -#include "citygml/address.h" +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> +#include <citygml/address.h> #include <stdexcept> #include <iostream> @@ -25,16 +25,18 @@ namespace citygml { std::unordered_map<int, CityObject::CityObjectsType> CityObjectElementParser::typeIDTypeMap = std::unordered_map<int, CityObject::CityObjectsType>(); std::unordered_set<int> CityObjectElementParser::attributesSet = std::unordered_set<int>(); + std::unordered_map<int, AttributeType> CityObjectElementParser::attributeTypeMap; std::mutex CityObjectElementParser::initializedTypeIDMutex; std::mutex CityObjectElementParser::initializedAttributeSetMutex; - #define HANDLE_TYPE( prefix, elementName ) std::pair<int, CityObject::CityObjectsType>(NodeType::prefix ## _ ## elementName ## Node.typeID(), CityObject::COT_ ## elementName) + #define HANDLE_TYPE( prefix, elementName ) std::pair<int, CityObject::CityObjectsType>(NodeType::prefix ## _ ## elementName ## Node.typeID(), CityObject::CityObjectsType::COT_## elementName) #define HANDLE_GROUP_TYPE( prefix, elementName, enumtype ) std::pair<int, CityObject::CityObjectsType>(NodeType::prefix ## _ ## elementName ## Node.typeID(), enumtype) #define HANDLE_ATTR( prefix, elementName ) NodeType::prefix ## _ ## elementName ## Node.typeID() CityObjectElementParser::CityObjectElementParser(CityGMLDocumentParser& documentParser, CityGMLFactory& factory, std::shared_ptr<CityGMLLogger> logger, std::function<void (CityObject*)> callback) : GMLFeatureCollectionElementParser(documentParser, factory, logger) + , m_lastAttributeType(AttributeType::String) { m_callback = callback; } @@ -71,9 +73,9 @@ namespace citygml { typeIDTypeMap.insert(HANDLE_TYPE(VEG, PlantCover)); typeIDTypeMap.insert(HANDLE_TYPE(VEG, SolitaryVegetationObject)); typeIDTypeMap.insert(HANDLE_TYPE(WTR, WaterBody)); - typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterSurface, CityObject::COT_WaterBody)); - typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterGroundSurface, CityObject::COT_WaterBody)); - typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterClosureSurface, CityObject::COT_WaterBody)); + typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterSurface, CityObject::CityObjectsType::COT_WaterBody)); + typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterGroundSurface, CityObject::CityObjectsType::COT_WaterBody)); + typeIDTypeMap.insert(HANDLE_GROUP_TYPE(WTR, WaterClosureSurface, CityObject::CityObjectsType::COT_WaterBody)); typeIDTypeMap.insert(HANDLE_TYPE(LUSE, LandUse)); typeIDTypeMap.insert(HANDLE_TYPE(SUB, Tunnel)); typeIDTypeMap.insert(HANDLE_TYPE(BRID, Bridge)); @@ -87,6 +89,8 @@ namespace citygml { typeIDTypeMap.insert(HANDLE_TYPE(BLDG, FloorSurface)); typeIDTypeMap.insert(HANDLE_TYPE(BLDG, InteriorWallSurface)); typeIDTypeMap.insert(HANDLE_TYPE(BLDG, CeilingSurface)); + typeIDTypeMap.insert(HANDLE_TYPE(BLDG, OuterCeilingSurface)); + typeIDTypeMap.insert(HANDLE_TYPE(BLDG, OuterFloorSurface)); typeIDTypeMap.insert(HANDLE_TYPE(GRP, CityObjectGroup)); typeIDTypeMap.insert(HANDLE_TYPE(DEM, ReliefFeature)); @@ -143,11 +147,71 @@ namespace citygml { attributesSet.insert(HANDLE_ATTR(WTR, Usage)); attributesSet.insert(HANDLE_ATTR(WTR, WaterLevel)); + + attributeTypeMap[HANDLE_ATTR(CORE, CreationDate)] = AttributeType::Date; + attributeTypeMap[HANDLE_ATTR(CORE, TerminationDate)] = AttributeType::Date; + attributeTypeMap[HANDLE_ATTR(BLDG, Type)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(BLDG, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(BLDG, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(BLDG, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(BLDG, YearOfConstruction)] = AttributeType::Date; + attributeTypeMap[HANDLE_ATTR(BLDG, YearOfDemolition)] = AttributeType::Date; + attributeTypeMap[HANDLE_ATTR(BLDG, StoreyHeightsAboveGround)] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(BLDG, StoreyHeightsBelowGround)] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(BLDG, StoreysBelowGround)] = AttributeType::Integer; + attributeTypeMap[HANDLE_ATTR(BLDG, StoreysAboveGround)] = AttributeType::Integer; + attributeTypeMap[HANDLE_ATTR(BLDG, MeasuredHeight)] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(BLDG, RoofType)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(VEG, Class )] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(VEG, Function )] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(VEG, AverageHeight )] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(VEG, Species )] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(VEG, Height )] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(VEG, TrunkDiameter )] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(VEG, CrownDiameter )] = AttributeType::Double; + attributeTypeMap[HANDLE_ATTR(FRN, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(FRN, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GRP, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GRP, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GRP, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GEN, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GEN, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(GEN, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(LUSE, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(LUSE, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(LUSE, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(DEM, Lod)] = AttributeType::Integer; + attributeTypeMap[HANDLE_ATTR(TRANS, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(TRANS, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(TRANS, SurfaceMaterial)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(WTR, Class)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(WTR, Function)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(WTR, Usage)] = AttributeType::String; + attributeTypeMap[HANDLE_ATTR(WTR, WaterLevel)] = AttributeType::Double; + attributesSetInitialized = true; } } } + AttributeType CityObjectElementParser::getAttributeType(const NodeType::XMLNode& node) + { + if (node == NodeType::GEN_StringAttributeNode) { + return AttributeType::String; + } else if (node == NodeType::GEN_DoubleAttributeNode) { + return AttributeType::Double; + } else if (node == NodeType::GEN_IntAttributeNode) { + return AttributeType::Integer; + } else if (node == NodeType::GEN_DateAttributeNode) { + return AttributeType::Date; + } else if (node == NodeType::GEN_UriAttributeNode) { + return AttributeType::Uri; + } else { + // fallback to string for other types + return AttributeType::String; + } + } + bool CityObjectElementParser::handlesElement(const NodeType::XMLNode& node) const { initializeTypeIDTypeMap(); @@ -193,7 +257,7 @@ namespace citygml { || node == NodeType::GEN_UriAttributeNode) { m_lastAttributeName = attributes.getAttribute("name"); - + m_lastAttributeType = getAttributeType(node); } else if (attributesSet.count(node.typeID()) > 0 || node == NodeType::GEN_ValueNode) { return true; @@ -349,12 +413,13 @@ namespace citygml { || node == NodeType::GEN_UriAttributeNode) { m_lastAttributeName = ""; - return true; + m_lastAttributeType = AttributeType::String; + return true; } else if (node == NodeType::GEN_ValueNode) { if (!m_lastAttributeName.empty()) { - m_model->setAttribute(m_lastAttributeName, characters); + m_model->setAttribute(m_lastAttributeName, characters, m_lastAttributeType); } else { CITYGML_LOG_WARN(m_logger, "Found value node (" << NodeType::GEN_ValueNode << ") outside attribute node... ignore."); } @@ -362,7 +427,7 @@ namespace citygml { return true; } else if (attributesSet.count(node.typeID()) > 0) { if (!characters.empty()) { - m_model->setAttribute(node.name(), characters); + m_model->setAttribute(node.name(), characters, attributeTypeMap.at(node.typeID())); } return true; } else if (node == NodeType::BLDG_BoundedByNode diff --git a/sources/src/parser/delayedchoiceelementparser.cpp b/sources/src/parser/delayedchoiceelementparser.cpp index ebba494..ad18a18 100644 --- a/sources/src/parser/delayedchoiceelementparser.cpp +++ b/sources/src/parser/delayedchoiceelementparser.cpp @@ -3,7 +3,7 @@ #include "parser/documentlocation.h" #include "parser/citygmldocumentparser.h" -#include "citygml/citygmllogger.h" +#include <citygml/citygmllogger.h> #include <sstream> #include <stdexcept> diff --git a/sources/src/parser/geocoordinatetransformer.cpp b/sources/src/parser/geocoordinatetransformer.cpp index abff46e..dfce731 100644 --- a/sources/src/parser/geocoordinatetransformer.cpp +++ b/sources/src/parser/geocoordinatetransformer.cpp @@ -1,14 +1,14 @@ #include "parser/geocoordinatetransformer.h" -#include "citygml/citygmllogger.h" -#include "citygml/citymodel.h" -#include "citygml/cityobject.h" -#include "citygml/implictgeometry.h" -#include "citygml/geometry.h" -#include "citygml/polygon.h" -#include "citygml/linestring.h" -#include "citygml/vecs.hpp" -#include "citygml/envelope.h" +#include <citygml/citygmllogger.h> +#include <citygml/citymodel.h> +#include <citygml/cityobject.h> +#include <citygml/implictgeometry.h> +#include <citygml/geometry.h> +#include <citygml/polygon.h> +#include <citygml/linestring.h> +#include <citygml/vecs.hpp> +#include <citygml/envelope.h> #ifdef USE_GDAL #include "ogrsf_frmts.h" @@ -19,12 +19,11 @@ class GeoTransform { public: GeoTransform( const std::string& destURN, std::shared_ptr<citygml::CityGMLLogger> logger ) + : m_destSRSURN(destURN) + , m_sourceURN("") + , m_transformation(nullptr) + , m_logger(logger) { - m_logger = logger; - m_transformation = nullptr; - m_destSRSURN = destURN; - m_sourceURN = ""; - OGRErr err = m_destSRS.SetFromUserInput(destURN.c_str()); if (err != OGRERR_NONE) { @@ -33,13 +32,13 @@ public: } } - GeoTransform(const GeoTransform& other) { - m_logger = other.m_logger; - m_destSRSURN = other.m_destSRSURN; - m_destSRS = other.m_destSRS; - m_sourceURN = ""; - - m_transformation = nullptr; + GeoTransform(const GeoTransform& other) + : m_destSRS(other.m_destSRS) + , m_destSRSURN(other.m_destSRSURN) + , m_sourceURN("") + , m_transformation(nullptr) + , m_logger(other.m_logger) + { } ~GeoTransform() @@ -290,6 +289,11 @@ class GeoTransform { namespace citygml { + GeoCoordinateTransformer::GeoCoordinateTransformer(const std::string& destSRS, std::shared_ptr<CityGMLLogger> logger) + { + m_destinationSRS = destSRS; + m_logger = logger; + } void GeoCoordinateTransformer::transformToDestinationSRS(CityModel* model) { CITYGML_LOG_WARN(m_logger, "Coordinate transformation to " << m_destinationSRS << " requested, but libcitygml was build without GDAL. The coordinates will not be transformed."); diff --git a/sources/src/parser/geometryelementparser.cpp b/sources/src/parser/geometryelementparser.cpp index e5b78bd..d6f2f57 100644 --- a/sources/src/parser/geometryelementparser.cpp +++ b/sources/src/parser/geometryelementparser.cpp @@ -9,10 +9,10 @@ #include "parser/delayedchoiceelementparser.h" #include "parser/sequenceparser.h" -#include "citygml/geometry.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" -#include "citygml/polygon.h" +#include <citygml/geometry.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> +#include <citygml/polygon.h> #include <mutex> diff --git a/sources/src/parser/georeferencedtextureelementparser.cpp b/sources/src/parser/georeferencedtextureelementparser.cpp index 6520ab5..32f5b06 100644 --- a/sources/src/parser/georeferencedtextureelementparser.cpp +++ b/sources/src/parser/georeferencedtextureelementparser.cpp @@ -7,9 +7,9 @@ #include "parser/documentlocation.h" #include "parser/skipelementparser.h" -#include "citygml/georeferencedtexture.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/georeferencedtexture.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <stdexcept> diff --git a/sources/src/parser/gmlfeaturecollectionparser.cpp b/sources/src/parser/gmlfeaturecollectionparser.cpp index 472e50f..7c529d9 100644 --- a/sources/src/parser/gmlfeaturecollectionparser.cpp +++ b/sources/src/parser/gmlfeaturecollectionparser.cpp @@ -4,11 +4,11 @@ #include "parser/parserutils.hpp" #include "parser/nodetypes.h" -#include "citygml/citygmllogger.h" -#include "citygml/envelope.h" -#include "citygml/object.h" -#include "citygml/vecs.hpp" -#include "citygml/featureobject.h" +#include <citygml/citygmllogger.h> +#include <citygml/envelope.h> +#include <citygml/object.h> +#include <citygml/vecs.hpp> +#include <citygml/featureobject.h> #include <stdexcept> diff --git a/sources/src/parser/implicitgeometryelementparser.cpp b/sources/src/parser/implicitgeometryelementparser.cpp index 91fd904..a71be09 100644 --- a/sources/src/parser/implicitgeometryelementparser.cpp +++ b/sources/src/parser/implicitgeometryelementparser.cpp @@ -12,9 +12,9 @@ #include "parser/polygonelementparser.h" #include "parser/delayedchoiceelementparser.h" -#include "citygml/implictgeometry.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/implictgeometry.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <stdexcept> diff --git a/sources/src/parser/linearringelementparser.cpp b/sources/src/parser/linearringelementparser.cpp index 25d60c0..ad07381 100644 --- a/sources/src/parser/linearringelementparser.cpp +++ b/sources/src/parser/linearringelementparser.cpp @@ -7,9 +7,9 @@ #include "parser/documentlocation.h" #include "parser/parserutils.hpp" -#include "citygml/linearring.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/linearring.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <stdexcept> diff --git a/sources/src/parser/linestringelementparser.cpp b/sources/src/parser/linestringelementparser.cpp index 6cb6fb9..3aebf21 100644 --- a/sources/src/parser/linestringelementparser.cpp +++ b/sources/src/parser/linestringelementparser.cpp @@ -7,9 +7,9 @@ #include "parser/documentlocation.h" #include "parser/parserutils.hpp" -#include "citygml/linestring.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/linestring.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <mutex> #include <stdexcept> diff --git a/sources/src/parser/materialelementparser.cpp b/sources/src/parser/materialelementparser.cpp index 228534d..9c7d411 100644 --- a/sources/src/parser/materialelementparser.cpp +++ b/sources/src/parser/materialelementparser.cpp @@ -8,9 +8,9 @@ #include "parser/parserutils.hpp" #include "parser/skipelementparser.h" -#include "citygml/material.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/material.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <stdexcept> diff --git a/sources/src/parser/nodetypes.cpp b/sources/src/parser/nodetypes.cpp index 8b75cf4..247933b 100644 --- a/sources/src/parser/nodetypes.cpp +++ b/sources/src/parser/nodetypes.cpp @@ -1,5 +1,5 @@ #include "parser/nodetypes.h" -#include "citygml/utils.h" +#include <citygml/utils.h> namespace citygml { @@ -263,6 +263,8 @@ namespace citygml { INITIALIZE_NODE( BLDG, FloorSurface ) INITIALIZE_NODE( BLDG, InteriorWallSurface ) INITIALIZE_NODE( BLDG, CeilingSurface ) + INITIALIZE_NODE( BLDG, OuterCeilingSurface ) + INITIALIZE_NODE( BLDG, OuterFloorSurface ) INITIALIZE_NODE( BLDG, BuildingFurniture ) INITIALIZE_NODE( BLDG, RoofType) @@ -640,6 +642,8 @@ namespace citygml { DEFINE_NODE( BLDG, FloorSurface ) DEFINE_NODE( BLDG, InteriorWallSurface ) DEFINE_NODE( BLDG, CeilingSurface ) + DEFINE_NODE( BLDG, OuterCeilingSurface ) + DEFINE_NODE( BLDG, OuterFloorSurface ) DEFINE_NODE( BLDG, BuildingFurniture ) DEFINE_NODE( BLDG, RoofType) diff --git a/sources/src/parser/parserxercesc.cpp b/sources/src/parser/parserxercesc.cpp index 1ee2649..2d3dd6f 100644 --- a/sources/src/parser/parserxercesc.cpp +++ b/sources/src/parser/parserxercesc.cpp @@ -14,14 +14,15 @@ * GNU Lesser General Public License for more details. */ -#include "citygml/citygml.h" +#include <citygml/citygml.h> +#include <citygml/citygmllogger.h> #include <fstream> #include <string> #include <memory> #include <mutex> -#include "citygml/citygmllogger.h" +#include <citygml/citygml_api.h> #include "parser/citygmldocumentparser.h" #include "parser/documentlocation.h" #include "parser/attributes.h" @@ -62,9 +63,11 @@ std::shared_ptr<XMLCh> toXercesString(const std::string& str) { class DocumentLocationXercesAdapter : public citygml::DocumentLocation { public: - DocumentLocationXercesAdapter(const std::string& fileName) { - m_locator = nullptr; - m_fileName = fileName; + explicit DocumentLocationXercesAdapter(const std::string& fileName) + : m_locator(nullptr) + , m_fileName(fileName) + { + } void setLocator(const xercesc::Locator* locator) { @@ -140,12 +143,12 @@ public: CityGMLDocumentParser::endDocument(); } - virtual void setDocumentLocator(const xercesc::Locator* const locator) { + virtual void setDocumentLocator(const xercesc::Locator* const locator) override { m_documentLocation.setLocator(locator); } // CityGMLDocumentParser interface - virtual const citygml::DocumentLocation& getDocumentLocation() const { + virtual const citygml::DocumentLocation& getDocumentLocation() const override { return m_documentLocation; } protected: @@ -157,7 +160,7 @@ protected: class StdBinInputStream : public xercesc::BinInputStream { public: - StdBinInputStream( std::istream& stream ) : BinInputStream(), m_stream( stream ) {} + explicit StdBinInputStream( std::istream& stream ) : BinInputStream(), m_stream( stream ) {} virtual ~StdBinInputStream() {} @@ -180,7 +183,7 @@ private: class StdBinInputSource : public xercesc::InputSource { public: - StdBinInputSource( std::istream& stream ) : m_stream( stream ) {} + explicit StdBinInputSource( std::istream& stream ) : m_stream( stream ) {} virtual xercesc::BinInputStream* makeStream() const { @@ -200,6 +203,11 @@ namespace citygml class StdLogger : public CityGMLLogger { public: + + StdLogger(LOGLEVEL level = LOGLEVEL::LL_ERROR):CityGMLLogger(level){ + + }; + virtual void log(LOGLEVEL level, const std::string& message, const char* file, int line) const { std::ostream& stream = level == LOGLEVEL::LL_ERROR ? std::cerr : std::cout; @@ -231,12 +239,7 @@ namespace citygml } stream << " " << message << std::endl; - } - - virtual bool isEnabledFor(LOGLEVEL) const - { - return true; - } + } }; std::mutex xerces_init_mutex; @@ -258,7 +261,7 @@ namespace citygml xerces_init_mutex.unlock(); } catch (const xercesc::XMLException& e) { - CITYGML_LOG_ERROR(logger, "Could not initialize xercesc XMLPlatformUtils, a XML Exception occured : " << toStdString(e.getMessage())); + CITYGML_LOG_ERROR(logger, "Could not initialize xercesc XMLPlatformUtils, a XML Exception occurred : " << toStdString(e.getMessage())); return false; } @@ -286,15 +289,15 @@ namespace citygml } catch ( const xercesc::XMLException& e ) { - CITYGML_LOG_ERROR(logger, "XML Exception occured: " << toStdString(e.getMessage())); + CITYGML_LOG_ERROR(logger, "XML Exception occurred: " << toStdString(e.getMessage())); } catch ( const xercesc::SAXParseException& e ) { - CITYGML_LOG_ERROR(logger, "SAXParser Exception occured: " << toStdString(e.getMessage())); + CITYGML_LOG_ERROR(logger, "SAXParser Exception occurred: " << toStdString(e.getMessage())); } catch ( const std::exception& e ) { - CITYGML_LOG_ERROR(logger, "Unexpected Exception occured: " << e.what()); + CITYGML_LOG_ERROR(logger, "Unexpected Exception occurred: " << e.what()); } #endif diff --git a/sources/src/parser/polygonelementparser.cpp b/sources/src/parser/polygonelementparser.cpp index 9adb1ec..7e6637e 100644 --- a/sources/src/parser/polygonelementparser.cpp +++ b/sources/src/parser/polygonelementparser.cpp @@ -7,9 +7,9 @@ #include "parser/documentlocation.h" #include "parser/linearringelementparser.h" -#include "citygml/polygon.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" +#include <citygml/polygon.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> #include <mutex> #include <stdexcept> diff --git a/sources/src/parser/sequenceparser.cpp b/sources/src/parser/sequenceparser.cpp index e732918..b68b1f5 100644 --- a/sources/src/parser/sequenceparser.cpp +++ b/sources/src/parser/sequenceparser.cpp @@ -1,6 +1,6 @@ #include "parser/sequenceparser.h" -#include "citygml/citygmllogger.h" +#include <citygml/citygmllogger.h> #include "parser/documentlocation.h" #include "parser/citygmldocumentparser.h" diff --git a/sources/src/parser/textureelementparser.cpp b/sources/src/parser/textureelementparser.cpp index f1100a6..67861fe 100644 --- a/sources/src/parser/textureelementparser.cpp +++ b/sources/src/parser/textureelementparser.cpp @@ -8,12 +8,12 @@ #include "parser/parserutils.hpp" #include "parser/skipelementparser.h" -#include "citygml/cityobject.h" -#include "citygml/citygmlfactory.h" -#include "citygml/citygmllogger.h" -#include "citygml/texture.h" -#include "citygml/texturetargetdefinition.h" -#include "citygml/texturecoordinates.h" +#include <citygml/cityobject.h> +#include <citygml/citygmlfactory.h> +#include <citygml/citygmllogger.h> +#include <citygml/texture.h> +#include <citygml/texturetargetdefinition.h> +#include <citygml/texturecoordinates.h> #include <stdexcept> diff --git a/test/citygmltest.cpp b/test/citygmltest.cpp index 9ccf60f..0765b20 100644 --- a/test/citygmltest.cpp +++ b/test/citygmltest.cpp @@ -113,7 +113,7 @@ 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 ); } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libcitygml.git _______________________________________________ Pkg-grass-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

