### Install Package Configuration Source: https://github.com/framstag/libosmscout/blob/master/CMakeLists.txt Installs the generated project and version configuration files to the specified destination. ```cmake install(FILES "${project_config}" "${version_config}" DESTINATION "${config_install_dir}") ``` -------------------------------- ### OSMScoutOpenGL Example with Font Path Source: https://github.com/framstag/libosmscout/blob/master/OSMScoutOpenGL/README.md An example command to run OSMScoutOpenGL, demonstrating the inclusion of a font path argument. ```bash ./OSMScoutOpenGL/OSMScoutOpenGL --font /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf ../../maps/debrecen/ ../stylesheets/standard.oss ../libosmscout/data/icons/14x14/standard/ 800 600 ``` -------------------------------- ### Install Targets Source: https://github.com/framstag/libosmscout/blob/master/PublicTransportMap/CMakeLists.txt Defines installation rules for the PublicTransportMap executable and its related files. ```cmake install(TARGETS PublicTransportMap RUNTIME DESTINATION bin BUNDLE DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Install Stylesheets Source: https://github.com/framstag/libosmscout/blob/master/CMakeLists.txt Installs the stylesheet directory to the share/osmscout destination. ```cmake install(DIRECTORY ${PROJECT_SOURCE_DIR}/stylesheets DESTINATION share/osmscout) ``` -------------------------------- ### Install Import Target Source: https://github.com/framstag/libosmscout/blob/master/Import/CMakeLists.txt Defines installation rules for the Import target on different platforms and configurations. ```cmake install(TARGETS Import RUNTIME DESTINATION bin BUNDLE DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Installing StyleEditor Target Source: https://github.com/framstag/libosmscout/blob/master/StyleEditor/CMakeLists.txt Defines installation rules for the StyleEditor executable, libraries, and archives. ```cmake install(TARGETS StyleEditor RUNTIME DESTINATION bin BUNDLE DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Install Packages with pacman Source: https://github.com/framstag/libosmscout/blob/master/Documentation/README.MSYS2.txt Use the pacman package manager to install necessary libraries for building libosmscout. ```bash pacman -S ``` -------------------------------- ### Install MCPServer Target Source: https://github.com/framstag/libosmscout/blob/master/MCPServer/CMakeLists.txt Defines installation rules for the MCPServer executable and its related files. ```cmake install(TARGETS MCPServer RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) ``` -------------------------------- ### Qt Minimal QApplication for Offscreen Rendering Source: https://github.com/framstag/libosmscout/blob/master/openspec/changes/archive/2026-05-30-draw-map-all/design.md Shows the minimal setup for `QApplication` required for offscreen Qt rendering. A `QPixmap` and `QPainter` are used, and the `QApplication` is destroyed after all backends have rendered. ```cpp #ifdef HAVE_OSMSCOUT_MAP_QT // Qt minimal QApplication // QApplication must be constructed before rendering. // Create with minimal args, no windows shown. // QPixmap + QPainter -> QPixmap::save("PNG") // QApplication destroyed after all backends render. // static QApplication app(argc, argv); // ... Qt rendering code ... // QPixmap pixmap(width, height); // QPainter painter(&pixmap); // ... draw with painter ... // pixmap.save(output_filename, "PNG"); #endif ``` -------------------------------- ### Install Core Features Header Source: https://github.com/framstag/libosmscout/blob/master/libosmscout/CMakeLists.txt Installs the CoreFeatures.h header file to the include/osmscout/lib directory. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/osmscout/lib/CoreFeatures.h DESTINATION include/osmscout/lib) ``` -------------------------------- ### Install DumpData Target Source: https://github.com/framstag/libosmscout/blob/master/DumpData/CMakeLists.txt Defines installation rules for the DumpData executable, libraries, and archives. ```cmake install(TARGETS DumpData RUNTIME DESTINATION bin BUNDLE DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Meson Build for Ninja Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/source.md Sets up a Meson build environment configured for Ninja. This is a common setup for fast, parallel builds. ```bash $ mkdir debug $ meson debug $ cd debug $ ninja ``` -------------------------------- ### Install Required Tools for Srtm2Osm Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/tutorials/Importing.md Installs wget, unzip, mono-runtime, and related libraries, then downloads and extracts Srtm2Osm, and fetches the poly2bb.pl script. ```bash sudo apt-get install wget unzip mono-runtime libmono-system-web-extensions4.0-cil wget http://osm.michis-pla.net/code/Srtm2Osm-1.12.1.0.zip unzip Srtm2Osm-1.12.1.0.zip wget https://svn.openstreetmap.org/applications/utils/osm-extract/polygons/poly2bb.pl chmod +x poly2bb.pl ``` -------------------------------- ### OSMScoutOpenGL Example without Font Path Source: https://github.com/framstag/libosmscout/blob/master/OSMScoutOpenGL/README.md An example command to run OSMScoutOpenGL, omitting the font path argument. ```bash ./OSMScoutOpenGL ../../maps/debrecen/ ../stylesheets/standard.oss ../libosmscout/data/icons/14x14/standard/ 800 600 ``` -------------------------------- ### Set Configuration Install Directory Source: https://github.com/framstag/libosmscout/blob/master/CMakeLists.txt Sets the installation directory for configuration files based on whether the system is UNIX. ```cmake if(UNIX) set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") else() set(config_install_dir CMake) endif() ``` -------------------------------- ### Install Headers for macOS Framework Source: https://github.com/framstag/libosmscout/blob/master/libosmscout/CMakeLists.txt Installs header files into the appropriate subdirectories for a macOS framework build. ```cmake install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/osmscout DESTINATION include FILES_MATCHING PATTERN "*.h" PATTERN "private/Config.h" EXCLUDE) ``` -------------------------------- ### Install OSMScoutOpenGL Target Source: https://github.com/framstag/libosmscout/blob/master/OSMScoutOpenGL/CMakeLists.txt Defines installation rules for the OSMScoutOpenGL executable, specifying runtime, library, and archive destinations. ```cmake install(TARGETS OSMScoutOpenGL RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Install libosmscout JAR to Maven Repository Source: https://github.com/framstag/libosmscout/blob/master/Documentation/README.Java.txt Execute this command in the libosmscout-binding directory to build the libsosmcout.jar and add it to your local Maven repository. ```bash mvn install ``` -------------------------------- ### Configure Online Tile Source (OSM Mapnik) Source: https://github.com/framstag/libosmscout/blob/master/OSMScout2/README.md Example JSON configuration for an online tile provider, specifically the OSM Mapnik source. This configuration is loaded from resources/online-tile-providers.json. ```json [ { "id": "mapnik", "name": "OSM Mapnik", "servers": [ "https://tile.openstreetmap.org/%1/%2/%3.png" ], "maximumZoomLevel": 19, "copyright": "© OpenStreetMap contributors" } ] ``` -------------------------------- ### Complex Styling Rule Example Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/stylesheet.md Demonstrates a complex styling rule for motorways with outline and conditional rendering based on display size. ```text [MAG continent-] { [TYPE highway_motorway] { [SIZE 20m 0.45mm:3px<] { WAY#outline { color: darken(@motorwayColor,0.4); width: 20m; displayWidth: 0.5mm; priority: -1; joinCap: butt; } WAY { color: @motorwayColor; width: 20m; } } [SIZE 20m <0.45mm:3px] WAY { color: lighten(@motorwayColor,0.3); displayWidth: 0.45mm; } } } ``` -------------------------------- ### Create Standalone Toolchain for Android Source: https://github.com/framstag/libosmscout/blob/master/Documentation/Android_Qt.txt This command creates a standalone toolchain for cross-compiling C++ applications for Android. Ensure the toolchain name and install directory are appropriate for your setup. ```bash make-standalone-toolchain.sh \ --verbose \ --toolchain=arm-linux-androideabi-4.8 \ --system=linux-X86_64 \ --install-dir=/home/tim/projects/arm-linux-androideabi-4.8 ``` -------------------------------- ### Build with Meson Source: https://github.com/framstag/libosmscout/blob/master/AGENTS.md Alternative build system configuration using Meson. Sets up and compiles the project. ```bash meson setup build meson compile -C build ``` -------------------------------- ### Configure NavigationSimulation Demo Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt Sets up the NavigationSimulation demo project, including source files, QML files, and dependencies. This demo is conditionally compiled if libosmscout-gpx is available. ```cmake if (${OSMSCOUT_BUILD_GPX}) #---- NavigationSimulation osmscout_demo_project(NAME NavigationSimulation SOURCES src/NavigationSimulation.cpp include/PositionSimulator.h src/PositionSimulator.cpp ../OSMScout2/src/Theme.h ../OSMScout2/src/Theme.cpp src/QtDemoApp.cpp ${RESOURCE_FILES} # qml files in CMake sources make it visible in QtCreator qml/NavigationSimulation.qml INCLUDES ../OSMScout2/src/ TARGET OSMScout::OSMScout OSMScout::Map OSMScout::MapQt OSMScout::ClientQt OSMScout::GPX Qt::Widgets) target_compile_definitions(NavigationSimulation PRIVATE ${QtWidgets_DEFINITIONS}) set_target_properties(NavigationSimulation PROPERTIES UNITY_BUILD OFF) # generated code for qt resources use static variables with the same name if(MSVC) visual_studio_qt_helper("NavigationSimulation") endif() if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt::windeployqt) add_custom_command(TARGET NavigationSimulation POST_BUILD COMMAND set PATH=%PATH%$${qt_install_prefix}/bin COMMAND Qt::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$/$" ) endif() else() message("Skip NavigationSimulation demo, libosmscout-gpx is missing.") endif() ``` -------------------------------- ### Package Java Demos with Maven Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/JavaSWIG.md Navigate to the Java directory and use Maven to package the demo applications. ```bash mvn package ``` -------------------------------- ### Configure RoutingParameters Demo (Qt 5) Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt Sets up the RoutingParameters demo project for Qt 5, specifying source files, QML files, and targets. This demo is skipped if Qt 6 is used, as QML needs porting. ```cmake #---- RoutingParameters if(QT_VERSION_MAJOR EQUAL 5) osmscout_demo_project(NAME RoutingParameters SOURCES ../OSMScout2/src/Theme.h ../OSMScout2/src/Theme.cpp src/RoutingParameters.cpp src/QtDemoApp.cpp ${RESOURCE_FILES} # qml files in CMake sources make it visible in QtCreator qml/RoutingParameters.qml qml/PlaceInput.qml INCLUDES ../OSMScout2/src/ TARGET OSMScout::OSMScout OSMScout::Map OSMScout::MapQt OSMScout::ClientQt Qt::Widgets) target_compile_definitions(RoutingParameters PRIVATE ${QtWidgets_DEFINITIONS}) set_target_properties(RoutingParameters PROPERTIES UNITY_BUILD OFF) # generated code for qt resources use static variables with the same name if(MSVC) visual_studio_qt_helper("RoutingParameters") endif() if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt::windeployqt) add_custom_command(TARGET RoutingParameters POST_BUILD COMMAND set PATH=%PATH%$${qt_install_prefix}/bin COMMAND Qt::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$/$" ) endif() else () message(WARNING "Skip RoutingParameters demo, QML needs to be ported for Qt6 for this demo.") endif() ``` -------------------------------- ### Initialize OSMScoutQt Library Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/qt_qml_api.md Initializes the OSMScoutQt library from C++ before using its QML components. Ensure to release resources using FreeInstance() when done. ```c++ OSMScoutQt::RegisterQmlTypes(); bool success=OSMScoutQt::NewInstance() .WithBasemapLookupDirectory(basemapDir) .WithStyleSheetDirectory(stylesheetDir) .WithStyleSheetFile(stylesheetFileName) .WithIconDirectory(iconDirectory) .WithMapLookupDirectories(mapLookupDirectories) .WithOnlineTileProviders(":/resources/online-tile-providers.json") .WithMapProviders(":/resources/map-providers.json") .Init(); if (!success){ // terminate program, or just report error - something is really bad } // now it is possible to create QML window that is using the library // release resources OSMScoutQt::FreeInstance(); ``` -------------------------------- ### Constructor Initialization List Formatting Source: https://github.com/framstag/libosmscout/blob/master/CODING_STYLE.md Demonstrates the required formatting for constructor initialization lists, with colons aligned and on their own lines. ```cpp TypeInfo::TypeInfo(const std::string& name) : name(name) { // no code } ``` -------------------------------- ### Configure ClientQtThreading Test Source: https://github.com/framstag/libosmscout/blob/master/Tests/CMakeLists.txt Sets up the ClientQtThreading test, which requires libosmscout-client-qt and related Qt targets. It uses qt_wrap_cpp to process header files. ```cmake if(${OSMSCOUT_BUILD_CLIENT_QT} AND TARGET OSMScout::MapQt AND TARGET OSMScout::ClientQt) set(src_files src/ClientQtThreading.cpp) qt_wrap_cpp(src_files include/ClientQtThreading.h) osmscout_test_project(NAME ClientQtThreading SOURCES ${src_files} TARGET OSMScout::Map OSMScout::MapQt OSMScout::ClientQt Qt::Widgets SKIPTEST) else() message("Skip ClientQtThreading test, libosmscout-client-qt is missing.") endif() ``` -------------------------------- ### Configure DrawMapDirectX Demo Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt Sets up the DrawMapDirectX demo project, specifying source files, targets, and linking libraries. For MSVC, it sets the subsystem to WINDOWS. ```cmake #---- DrawMapDirectX if(${OSMSCOUT_BUILD_MAP_DIRECTX}) osmscout_demo_project(NAME DrawMapDirectX SOURCES src/DrawMapDirectX.cpp TARGET OSMScout::OSMScout OSMScout::Map OSMScout::MapDirectX ${Direct2D_LIBRARIES} "Shell32.lib") if(MSVC) set_target_properties(DrawMapDirectX PROPERTIES LINK_FLAGS /SUBSYSTEM:WINDOWS) endif() else() message("Skip DrawMapDirectX demo, libosmscout-map-directx is missing.") endif() ``` -------------------------------- ### Configure ElevationProfileChart Demo Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt Sets up the ElevationProfileChart demo project, specifying source files, QML files, and required targets. It also configures build properties and handles DLL deployment for MSVC. ```cmake set_property(SOURCE qrc_demo.cpp PROPERTY SKIP_AUTOMOC ON) #---- ElevationProfileChart osmscout_demo_project(NAME ElevationProfileChart SOURCES src/ElevationProfileChart.cpp src/QtDemoApp.cpp ${RESOURCE_FILES} # qml files in CMake sources make it visible in QtCreator qml/ElevationProfileChart.qml TARGET OSMScout::OSMScout OSMScout::Map OSMScout::MapQt OSMScout::ClientQt Qt::Widgets) target_compile_definitions(ElevationProfileChart PRIVATE ${QtWidgets_DEFINITIONS}) set_target_properties(ElevationProfileChart PROPERTIES UNITY_BUILD OFF) # generated code for qt resources use static variables with the same name if(MSVC) visual_studio_qt_helper("ElevationProfileChart") endif() if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt::windeployqt) add_custom_command(TARGET ElevationProfileChart POST_BUILD COMMAND set PATH=%PATH%$${qt_install_prefix}/bin COMMAND Qt::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$/$" ) endif() ``` -------------------------------- ### Configure OSMScout Library Project Source: https://github.com/framstag/libosmscout/blob/master/libosmscout-map-directx/CMakeLists.txt Sets up the library project using the 'osmscout_library_project' macro, defining its name, source files, include directories, and dependencies. ```cmake osmscout_library_project( NAME OSMScoutMapDirectX ALIAS MapDirectX OUTPUT_NAME "osmscout_map_directx" SOURCE ${SOURCE_FILES} HEADER ${HEADER_FILES} INCLUDEDIR osmscoutmapdirectx INCLUDES ${Direct2D_INCLUDE_DIRS} TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/include/osmscoutmapdirectx/MapDirectXFeatures.h.cmake TARGET OSMScout::OSMScout OSMScout::Map ${Direct2D_LIBRARIES} Windowscodecs ) ``` -------------------------------- ### Configure QtFileDownloader Test Source: https://github.com/framstag/libosmscout/blob/master/Tests/CMakeLists.txt Sets up the QtFileDownloader test, requiring libosmscout-client-qt and Qt targets. It uses qt_wrap_cpp for header processing. ```cmake if(${OSMSCOUT_BUILD_CLIENT_QT} AND TARGET OSMScout::MapQt AND TARGET OSMScout::ClientQt) set(src_files src/QtFileDownloaderTest.cpp) qt_wrap_cpp(src_files include/DownloaderTest.h) osmscout_test_project(NAME QtFileDownloaderTest SOURCES ${src_files} TARGET OSMScout::Map OSMScout::MapQt OSMScout::ClientQt Qt::Widgets SKIPTEST) else() message("Skip QtFileDownloader test, libosmscout-client-qt is missing.") endif() ``` -------------------------------- ### Conditional Install Qt DLL Source: https://github.com/framstag/libosmscout/blob/master/CMakeLists.txt Conditionally installs the windeployqt directory if OSMSCOUT_INSTALL_QT_DLL is enabled and the Qt6::windeployqt target is found. ```cmake if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt6::windeployqt) install(DIRECTORY "${CMAKE_BINARY_DIR}/windeployqt/" DESTINATION bin) endif() ``` -------------------------------- ### Install BasemapImport Target Source: https://github.com/framstag/libosmscout/blob/master/BasemapImport/CMakeLists.txt Defines installation rules for the BasemapImport target, specifying runtime, bundle, library, and archive destinations. ```cmake install(TARGETS BasemapImport RUNTIME DESTINATION bin BUNDLE DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Run Java Demos with Library Path Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/JavaSWIG.md Execute Java demos, specifying the path to the libosmscout_binding_java shared library using the -Djava.library.path argument. ```bash java -jar \ -Djava.library.path=/home/tim/projects/OSMScout/build/libosmscout-binding \ target/OpenDatabase-1.0-SNAPSHOT-jar-with-dependencies.jar \ ../../maps/nordrhein-westfalen ``` -------------------------------- ### CMake Build with Nonstandard Qt Installation and Libosmscout Options Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/source.md Configures a CMake build for VisualStudio, specifying custom directories for Qt and disabling optional libosmscout features. This is useful for managing custom installations and build configurations. ```bash $ cmake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_VERSION=10.0.##### .. -DCMAKE_INSTALL_PREFIX=.\\output -DOSMSCOUT_BUILD_IMPORT=OFF -DOSMSCOUT_BUILD_DOC_API=OFF -DOSMSCOUT_BUILD_TESTS=OFF -DQTDIR=D:/Tools/Qt/5.9.2/msvc2019 -DCMAKE_PREFIX_PATH=D:/Tools/Qt/5.9.2/msvc2015/lib/cmake ``` -------------------------------- ### Import Process Summary and File Sizes Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/tutorials/Importing.md Displays the summary of the import process, including overall time, resource usage, and the sizes of mandatory and optional generated files. ```text ... Overall 833.727s, RSS 3.6 GiB, VM 7.8 GiB + Summary... Mandatory files: File areaarea.idx: 5.9 MiB File areanode.idx: 3.4 MiB File areas.dat: 189.5 MiB File areaway.idx: 2.7 MiB File bounding.dat: 14 B File intersections.dat: 27.8 MiB File intersections.idx: 8.6 MiB File location.idx: 17.9 MiB File nodes.dat: 11.7 MiB File router.dat: 92.5 MiB File router.idx: 8.6 MiB File router2.dat: 1.2 KiB File types.dat: 24.9 KiB File water.idx: 496.2 KiB File ways.dat: 62.7 MiB => 431.8 MiB Optional files: File areasopt.dat: 1.9 MiB File textloc.dat: 2.4 MiB File textother.dat: 2.5 MiB File textpoi.dat: 1.3 MiB File textregion.dat: 107.6 KiB File waysopt.dat: 2.9 MiB => 11.1 MiB Import OK! ... ``` -------------------------------- ### Configure DrawMapOpenGL Demo Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt Sets up the DrawMapOpenGL demo project, specifying its source file and targets. This demo is compiled if OSMSCOUT_BUILD_MAP_OPENGL is enabled and the 'glfw' target is available. ```cmake #---- DrawMapOpenGL if(${OSMSCOUT_BUILD_MAP_OPENGL} AND TARGET glfw) osmscout_demo_project(NAME DrawMapOpenGL SOURCES src/DrawMapOpenGL.cpp TARGET OSMScout::OSMScout OSMScout::Map OSMScout::MapOpenGLglfw) else() message("Skip DrawMapOpenGL demo, libosmscout-map-opengl or glfw is missing.") endif() ``` -------------------------------- ### CMake Build with Custom Qt5 Installation Prefix on Mac OS X Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/source.md Configures a CMake build on Mac OS X, providing a hint for a non-standard Qt5 installation directory. This ensures CMake can locate Qt5 components. ```bash $ cmake . -DCMAKE_PREFIX_PATH=[QT5_Installation_prefix] ``` -------------------------------- ### CMake Build for VisualStudio with Custom Install Prefix Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/source.md Builds the project using VisualStudio via CMake, specifying a custom installation prefix and system version. It also includes options to disable specific build targets like import, documentation, and tests. ```bash $ mkdir build $ cd build $ cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.10586.0 -DCMAKE_INSTALL_PREFIX=D:\\Mine\\OpenSource\\osmlib $ cmake --build . --config Release --target install ``` -------------------------------- ### Label Placement Example Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/stylesheet.md Illustrates how labels with different position numbers are rendered vertically, with higher numbers appearing further down. ```text The labels will be rendered (centered): Mount Everest Everest 8848m ``` -------------------------------- ### Doxygen Documentation Block Source: https://github.com/framstag/libosmscout/blob/master/CODING_STYLE.md Example of a Doxygen documentation block for a class, including group tagging and inline member documentation. ```cpp /** * \ingroup Geometry * * Anonymous geographic coordinate. */ class OSMSCOUT_API GeoCoord CLASS_FINAL { private: double lat = 0.0; double lon = 0.0; public: /** * Return the latitude value of the coordinate */ double GetLat() const { return lat; } ``` -------------------------------- ### Configure macOS Framework Properties Source: https://github.com/framstag/libosmscout/blob/master/libosmscout-client-qt/CMakeLists.txt Sets properties for building OSMScoutClientQt as a macOS framework, including versioning, identifier, and code signing. ```cmake set_target_properties(OSMScoutClientQt PROPERTIES FRAMEWORK TRUE FRAMEWORK_VERSION C MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework #MACOSX_FRAMEWORK_INFO_PLIST Info.plist PUBLIC_HEADER "${HEADER_FILES}" CODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer" OUTPUT_NAME "OSMScoutClientQt") ``` -------------------------------- ### Public Members in Small Value-Type Classes Source: https://github.com/framstag/libosmscout/blob/master/CODING_STYLE.md Example of a small value-type class where public members are acceptable, with NOLINT comments for specific members. ```cpp class ObjectOSMRef CLASS_FINAL { OSMId id=0; // NOLINT OSMRefType type=osmRefNone; // NOLINT }; ``` -------------------------------- ### Build Java Bindings and C++ Library Source: https://github.com/framstag/libosmscout/blob/master/Documentation/README.Java.txt Run these commands in the libosmscout-binding directory to generate the Java code and the C++ stub library. Ensure SWIG and a JDK are in your system's search path. ```bash ./autogen.sh && ./configure ``` -------------------------------- ### Display Location Information Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/qt_qml_api.md Use LocationInfoModel to get descriptions for map places and display them in a ListView. The setLocation function is called to specify the coordinates. ```qml LocationInfoModel { id: locationInfoModel Component.onCompleted: { locationInfoModel.setLocation(50.08923, 14.49837); } } SilicaListView { id: locationInfoView model: locationInfoModel delegate: Column{ Label { id: entryPoi text: poi visible: poi != "" } Label { id: entryAddress text: address visible: address != "" } } } ``` -------------------------------- ### Configure Performance Test Drivers and Gperftools Source: https://github.com/framstag/libosmscout/blob/master/Tests/CMakeLists.txt Sets up performance test drivers and conditionally links Gperftools if enabled. This is part of the performance testing setup. ```cmake set(HAVE_LIB_OSMSCOUTMAPGDI 1) set(PERFORMANCE_TEST_DRIVERS ${PERFORMANCE_TEST_DRIVERS} dgi) endif() option(PERF_TEST_GPERFTOOLS_USAGE "Enable Gperftools in Performance test" ${GPERFTOOLS_USAGE}) if(${PERF_TEST_GPERFTOOLS_USAGE}) target_include_directories(PerformanceTest PRIVATE ${GPERFTOOLS_INCLUDE_DIRS}) target_link_libraries(PerformanceTest ${GPERFTOOLS_LIBRARIES}) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/PerformanceTestConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/PerformanceTest/config.h) ``` -------------------------------- ### Class Declaration with Special Members and Macros Source: https://github.com/framstag/libosmscout/blob/master/CODING_STYLE.md An example of a class declaration incorporating `CLASS_FINAL`, `OSMSCOUT_API`, defaulted and deleted special member functions, and `noexcept` where appropriate. ```cpp class OSMSCOUT_API FeatureValueBuffer CLASS_FINAL { public: FeatureValueBuffer() = default; FeatureValueBuffer(const FeatureValueBuffer& other); FeatureValueBuffer(FeatureValueBuffer&& other) noexcept; ~FeatureValueBuffer(); FeatureValueBuffer& operator=(const FeatureValueBuffer& other); FeatureValueBuffer& operator=(FeatureValueBuffer&& other) noexcept; private: TypeInfoRef type; uint8_t *featureBits=nullptr; protected: void SetType(const TypeInfoRef& type); }; ``` -------------------------------- ### Create DrawMapAll Demo Project Source: https://github.com/framstag/libosmscout/blob/master/Demos/CMakeLists.txt This snippet creates the DrawMapAll demo project if any map rendering backends are available. It sets compile definitions, links against PNG if needed, and configures platform-specific settings for OSX. ```cmake if(DRAWMAPALL_TARGETS) osmscout_demo_project(NAME DrawMapAll SOURCES ${DRAWMAPALL_SOURCES} TARGET ${DRAWMAPALL_TARGETS}) target_compile_definitions(DrawMapAll PRIVATE ${DRAWMAPALL_DEFS}) if(DRAWMAPALL_NEEDS_PNG) target_link_libraries(DrawMapAll PNG::PNG) endif() if(APPLE AND NOT IOS AND ${OSMSCOUT_BUILD_MAP_IOSX}) target_include_directories(DrawMapAll PRIVATE ${CMAKE_SOURCE_DIR}/libosmscout-map-iOSX/include ${CMAKE_BINARY_DIR}/libosmscout-map-iOSX/include) set_target_properties(DrawMapAll PROPERTIES UNITY_BUILD OFF) find_library(COCOA Cocoa) find_library(APPKIT AppKit) find_library(COREGRAPHICS CoreGraphics) find_library(FOUNDATION Foundation) target_link_libraries(DrawMapAll ${COCOA} ${APPKIT} ${COREGRAPHICS} ${FOUNDATION}) endif() else() message("Skip DrawMapAll demo, no map rendering backends available.") endif() ``` -------------------------------- ### Configure Map Provider Source: https://github.com/framstag/libosmscout/blob/master/OSMScout2/README.md Example JSON configuration for an offline map provider. This configuration is loaded from resources/map-providers.json and specifies server details for downloading map databases. ```json [ { "uri": "https://osmscout.karry.cz", "listUri": "https://osmscout.karry.cz/latest.php?fromVersion=%1&toVersion=%2&locale=%3", "name": "karry.cz" } ] ``` -------------------------------- ### Define Source and Header Files Source: https://github.com/framstag/libosmscout/blob/master/libosmscout-map-qt/CMakeLists.txt Lists the header and source files required for the OSMScoutMapQt library. ```cmake set(HEADER_FILES include/osmscoutmapqt/MapQtImportExport.h include/osmscoutmapqt/MapPainterQt.h include/osmscoutmapqt/SymbolRendererQt.h ) set(SOURCE_FILES src/osmscoutmapqt/MapPainterQt.cpp src/osmscoutmapqt/SymbolRendererQt.cpp ) ``` -------------------------------- ### Define and Get TunnelFeature Name Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/tutorials/TypeFeature.md Implements the GetName method to return the feature's name, 'Tunnel', used in OST files. A constant NAME is defined for this purpose. ```c++ const char* const TunnelFeature::NAME = "Tunnel"; std::string TunnelFeature::GetName() const { return NAME; } ``` -------------------------------- ### Calculate Route Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/documentation/qt_qml_api.md Use RoutingListModel to calculate routes between two points. Specify start and end locations using coordinates and handle route computation completion to display results. ```qml RoutingListModel{ id: route Component.onCompleted: { var from=route.locationEntryFromPosition(50.0920, 14.4936); var to=route.locationEntryFromPosition(49.1949, 16.6345); route.setStartAndTarget(from, to); } onComputingChanged: { if (route.count>0){ console.log("route length: " + route.length + " m"); console.log("route commands: " + route.count); map.addOverlayObject(0,route.routeWay); } } } Map{ id: map } ``` -------------------------------- ### Srtm2Osm Module Processing Log Example Source: https://github.com/framstag/libosmscout/blob/master/webpage/content/tutorials/Importing.md Illustrates the output of the Srtm2Osm module during the import process, showing steps like coordinate generation, sorting, duplicate detection, and index writing. ```text ... + Step #3 - CoordDataGenerator... Module description: Generate coord data file Module requires file 'rawcoords.dat' Module provides debugging file 'coord.dat' - Searching for duplicate coordinates... Searching for coordinates with page id >= 0 % 27.42 (15078926/54994116) % 69.74 (38352393/54994116) Sorting coordinates Detect duplicates Loaded 54994116 coords (54994116/54994116) Found 358622 duplicate cordinates - Storing coordinates... Search for coordinates with page id >= -1844674407370 % 91.30 (50207143/54994116) Sorting coordinates Write coordinates Loaded 54994116 coords (54994116/54994116) - Writing 2855797 index entries to disk... => 66.044s, RSS 2.8 GiB, VM 4.8 GiB ... ``` -------------------------------- ### Configure SunriseSunsetTest Source: https://github.com/framstag/libosmscout/blob/master/Tests/CMakeLists.txt Sets up the SunriseSunsetTest. This test likely verifies calculations related to sunrise and sunset times. ```cmake osmscout_test_project(NAME SunriseSunsetTest SOURCES src/SunriseSunsetTest.cpp) ``` -------------------------------- ### Qt Deployment Command for Windows Source: https://github.com/framstag/libosmscout/blob/master/StyleEditor/CMakeLists.txt Adds a custom command to deploy Qt DLLs on Windows for the StyleEditor target. ```cmake if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt::windeployqt) add_custom_command(TARGET StyleEditor POST_BUILD COMMAND set PATH=%PATH೪$${qt_install_prefix}/bin COMMAND Qt::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$/$" ) ```